Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b28b0afc

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID b28b0afc6b991b5050ea39f66fd1870ca27f400f
  • Vorgänger 3bbe01f7
  • Nachfolger 20220c4d

Pflichtenhefttextblöcke: AJAX-Calls für erweitertes Menü gefixt

Unterschiede anzeigen:

SL/Controller/RequirementSpecTextBlock.pm
45 45

  
46 46
  # $::lxdebug->message(0, "cur $current_where new $new_where");
47 47

  
48
  $self->show_list(output_position => $new_where, id => $::form->{clicked_id}) if ($new_where != ($current_where // -1));
48
  $self->show_list(output_position => $new_where, id => $::form->{clicked_id}, set_type => 1) if ($new_where != ($current_where // -1));
49 49

  
50 50
  $self->render($self->js);
51 51
}
......
322 322

  
323 323
sub show_list {
324 324
  my $self   = shift;
325
  my %params = Params::Validate::validate(@_, { output_position => 1, id => 0, requirement_spec_id => 0, });
325
  my %params = Params::Validate::validate(@_, { output_position => 1, id => 0, requirement_spec_id => 0, set_type => 0, });
326 326

  
327 327
  $params{requirement_spec_id} ||= $::form->{requirement_spec_id};
328 328
  croak "Unknown requirement_spec_id" if !$params{requirement_spec_id};
......
332 332

  
333 333
  $self->js->html('#column-content', $html);
334 334

  
335
  if ($params{id}) {
336
    $self->js
337
     ->val('#current_content_type', 'text-blocks-' . (0 == $params{output_position} ? 'front' : 'back'))
338
     ->val('#current_content_id',   $params{id});
339
  }
335
  $self->js->val('#current_content_type', 'text-blocks-' . (0 == $params{output_position} ? 'front' : 'back')) if $params{id} || $params{set_type};
336
  $self->js->val('#current_content_id',   $params{id})                                                         if $params{id};
340 337

  
341 338
  return $self->set_function_blocks_tab_menu_class(class => 'text-block-context-menu');
342 339
}
js/requirement_spec.js
107 107
// -------------------------------------------------------------------------
108 108

  
109 109
ns.find_text_block_id = function(clicked_elt) {
110
  // console.log("id: " + $(clicked_elt).attr('id'));
111 110
  var id = $(clicked_elt).attr('id');
111
  // console.log("id: " + id);
112 112
  if (/^text-block-\d+$/.test(id)) {
113 113
    // console.log("find_text_block_id: case 1: " + id.substr(11));
114 114
    return id.substr(11) * 1;
......
126 126
    return id.substr(3) * 1;
127 127
  }
128 128

  
129
  // console.log("find_text_block_id: case undef");
129
  // console.log("find_text_block_id: case undef, id: " + id);
130 130
  return undefined;
131 131
};
132 132

  
......
135 135
  if (output_position)
136 136
    return output_position;
137 137

  
138
  var type = $(clicked_elt).closest('#tb-back,#tb-front').data('type');
138
  var type = $(clicked_elt).closest('#tb-back,#tb-front').data('type') || $('#current_content_type').val();
139 139
  if (/^text-blocks-(front|back)/.test(type))
140 140
    return type == "text-blocks-front" ? 0 : 1;
141 141

  

Auch abrufbar als: Unified diff