Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1f592a0f

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID 1f592a0f4f88893b5c2cb29b2d10e2d07b444ac0
  • Vorgänger e2cad7d4
  • Nachfolger 3250f2ee

Pflichtenhefte: Auflisten von Abschnitten

Unterschiede anzeigen:

SL/Controller/RequirementSpecItem.pm
14 14

  
15 15
use Rose::Object::MakeMethods::Generic
16 16
(
17
 scalar => [ qw(requirement_spec item) ],
17
  scalar => [ qw(requirement_spec item visible_item visible_section) ],
18 18
);
19 19

  
20 20
# __PACKAGE__->run_before('load_requirement_spec');
......
24 24
# actions
25 25
#
26 26

  
27
sub action_ajax_list {
28
  my ($self) = @_;
29

  
30
  my $js = SL::ClientJS->new;
31

  
32
  if (!$::form->{clicked_id}) {
33
    # Clicked on "sections" in the tree. Do nothing.
34
    return $self->render($js);
35
  }
36

  
37
  $self->init_visible_section($::form->{current_content_id}, $::form->{current_content_type});
38
  $self->item(SL::DB::RequirementSpecItem->new(id => $::form->{clicked_id})->load->get_section);
39

  
40
  if (!$self->visible_section || ($self->visible_section->id != $self->item->id)) {
41
    my $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $self->item);
42
    $js->html('#column-content', $html)
43
       ->val('#current_content_type', $self->item->get_type)
44
       ->val('#current_content_id', $self->item->id);
45
  }
46

  
47
  $self->render($js);
48
}
49

  
27 50
sub action_new {
28 51
  my ($self) = @_;
29 52

  
......
108 131
  return join "\n", (split m/\n/, $@)[0..4];
109 132
}
110 133

  
134
sub init_visible_section {
135
  my ($self, $content_id, $content_type) = @_;
136

  
137
  return undef unless $content_id;
138
  return undef unless $content_type =~ m/section|function-block/;
139

  
140
  $self->visible_item(SL::DB::RequirementSpecItem->new(id => $content_id)->load);
141
  return $self->visible_section($self->visible_item->get_section);
142
}
143

  
111 144
1;

Auch abrufbar als: Unified diff