Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision cced2d9f

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID cced2d9f2e54131bd8eb8001adb9d1bdd9415810
  • Vorgänger f766dfb7
  • Nachfolger 69a5907e

Refactoring

Unterschiede anzeigen:

SL/Controller/RequirementSpecTextBlock.pm
4 4

  
5 5
use parent qw(SL::Controller::Base);
6 6

  
7
use Carp;
7 8
use Time::HiRes ();
8 9

  
9 10
use SL::ClientJS;
......
68 69
    $self->js->html('#column-content', $html);
69 70
  }
70 71

  
71
  $self->text_block(SL::DB::RequirementSpecTextBlock->new(
72
    requirement_spec_id => $::form->{requirement_spec_id},
73
    output_position     => $::form->{output_position},
74
  ));
75

  
76
  my $id_base = join('_', 'new_text_block', Time::HiRes::gettimeofday(), int rand 1000000000000);
77
  my $html    = $self->render('requirement_spec_text_block/_form', { output => 0 }, id_base => $id_base, insert_after => $::form->{id});
72
  $self->add_new_text_block_form(output_position => $new_where, insert_after_id => $::form->{id});
78 73

  
79
  $self->invalidate_version
80
     ->action($::form->{id} ? 'insertAfter' : 'appendTo', $html, '#text-block-' . ($::form->{id} || 'list'))
81
     ->focus('#' . $id_base . '_title')
82
     ->render($self);
74
  $self->invalidate_version->render($self);
83 75
}
84 76

  
85 77
sub action_ajax_edit {
......
329 321
  return $self->js->html('#requirement_spec_version', $html);
330 322
}
331 323

  
324
sub add_new_text_block_form {
325
  my ($self, %params) = @_;
326

  
327
  croak "Missing parameter output_position" unless defined($params{output_position}) && ($params{output_position} ne '');
328

  
329
  $self->text_block(SL::DB::RequirementSpecTextBlock->new(
330
    requirement_spec_id => $::form->{requirement_spec_id},
331
    output_position     => $params{output_position},
332
  ));
333

  
334
  my $id_base = join('_', 'new_text_block', Time::HiRes::gettimeofday(), int rand 1000000000000);
335
  my $html    = $self->render('requirement_spec_text_block/_form', { output => 0 }, id_base => $id_base, insert_after => $params{insert_after_id});
336

  
337
  $self->js
338
     ->action($params{insert_after_id} ? 'insertAfter' : 'appendTo', $html, '#text-block-' . ($params{insert_after_id} || 'list'))
339
     ->focus('#' . $id_base . '_title');
340
}
341

  
332 342
1;

Auch abrufbar als: Unified diff