Revision 13b0468f
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/Controller/RequirementSpec.pm | ||
---|---|---|
24 | 24 |
use Rose::Object::MakeMethods::Generic |
25 | 25 |
( |
26 | 26 |
scalar => [ qw(requirement_spec_item customers types statuses db_args flat_filter is_template visible_item visible_section) ], |
27 |
'scalar --get_set_init' => [ qw(requirement_spec complexities risks projects copy_source) ], |
|
27 |
'scalar --get_set_init' => [ qw(requirement_spec complexities risks projects copy_source js) ],
|
|
28 | 28 |
); |
29 | 29 |
|
30 | 30 |
__PACKAGE__->run_before('setup'); |
... | ... | |
101 | 101 |
|
102 | 102 |
my $html = $self->render('requirement_spec/_show_time_and_cost_estimate', { output => 0 }); |
103 | 103 |
|
104 |
SL::ClientJS->new
|
|
105 |
->replaceWith('#time_cost_estimate', $html)
|
|
106 |
->render($self);
|
|
104 |
$self->js
|
|
105 |
->replaceWith('#time_cost_estimate', $html) |
|
106 |
->render($self); |
|
107 | 107 |
} |
108 | 108 |
|
109 | 109 |
sub action_ajax_edit_time_and_cost_estimate { |
... | ... | |
111 | 111 |
|
112 | 112 |
my $html = $self->render('requirement_spec/_edit_time_and_cost_estimate', { output => 0 }); |
113 | 113 |
|
114 |
SL::ClientJS->new
|
|
115 |
->replaceWith('#time_cost_estimate', $html)
|
|
116 |
->render($self);
|
|
114 |
$self->js
|
|
115 |
->replaceWith('#time_cost_estimate', $html) |
|
116 |
->render($self); |
|
117 | 117 |
} |
118 | 118 |
|
119 | 119 |
sub action_ajax_save_time_and_cost_estimate { |
... | ... | |
133 | 133 |
}); |
134 | 134 |
|
135 | 135 |
my $html = $self->render('requirement_spec/_show_time_and_cost_estimate', { output => 0 }); |
136 |
my $js = SL::ClientJS->new->replaceWith('#time_cost_estimate', $html);
|
|
136 |
$self->js->replaceWith('#time_cost_estimate', $html);
|
|
137 | 137 |
|
138 | 138 |
if ($self->visible_section) { |
139 | 139 |
$html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $self->visible_section); |
140 |
$js->html('#column-content', $html); |
|
140 |
$self->js->html('#column-content', $html);
|
|
141 | 141 |
} |
142 | 142 |
|
143 |
$js->render($self); |
|
143 |
$self->js->render($self);
|
|
144 | 144 |
} |
145 | 145 |
|
146 | 146 |
sub action_show { |
... | ... | |
225 | 225 |
$self->copy_source(SL::DB::RequirementSpec->new(id => $::form->{copy_source_id})->load) if $::form->{copy_source_id}; |
226 | 226 |
} |
227 | 227 |
|
228 |
sub init_js { |
|
229 |
my ($self) = @_; |
|
230 |
$self->js(SL::ClientJS->new); |
|
231 |
} |
|
232 |
|
|
228 | 233 |
sub load_select_options { |
229 | 234 |
my ($self) = @_; |
230 | 235 |
|
... | ... | |
251 | 256 |
my @errors = $self->requirement_spec->validate; |
252 | 257 |
|
253 | 258 |
if (@errors) { |
254 |
return SL::ClientJS->new->error(@errors)->render($self) if $::request->is_ajax;
|
|
259 |
return $self->js->error(@errors)->render($self) if $::request->is_ajax;
|
|
255 | 260 |
|
256 | 261 |
flash('error', @errors); |
257 | 262 |
$self->render('requirement_spec/new', title => $title); |
... | ... | |
268 | 273 |
})) { |
269 | 274 |
$::lxdebug->message(LXDebug::WARN(), "Error: " . $db->error); |
270 | 275 |
@errors = ($::locale->text('Saving failed. Error message from the database: #1'), $db->error); |
271 |
return SL::ClientJS->new->error(@errors)->render($self) if $::request->is_ajax;
|
|
276 |
return $self->js->error(@errors)->render($self) if $::request->is_ajax;
|
|
272 | 277 |
|
273 | 278 |
$self->requirement_spec->id(undef) if $is_new; |
274 | 279 |
flash('error', @errors); |
... | ... | |
277 | 282 |
|
278 | 283 |
if ($::request->is_ajax) { |
279 | 284 |
my $html = $self->render('requirement_spec/_header', { output => 0 }); |
280 |
return SL::ClientJS->new
|
|
285 |
return $self->js
|
|
281 | 286 |
->replaceWith('#requirement-spec-header', $html) |
282 | 287 |
->flash('info', t8('The requirement spec has been saved.')) |
283 | 288 |
->render($self); |
Auch abrufbar als: Unified diff
Refactoring