Revision dcef8eb0
Von Moritz Bunkus vor mehr als 7 Jahren hinzugefügt
SL/Controller/Project.pm | ||
---|---|---|
51 | 51 |
include_prefix => 'l_', |
52 | 52 |
include_value => 'Y'); |
53 | 53 |
|
54 |
$self->setup_search_action_bar; |
|
55 |
|
|
54 | 56 |
$self->render('project/search', %params); |
55 | 57 |
} |
56 | 58 |
|
57 | 59 |
sub action_list { |
58 | 60 |
my ($self) = @_; |
59 | 61 |
|
62 |
$self->setup_search_action_bar; |
|
63 |
|
|
60 | 64 |
$self->make_filter_summary; |
61 | 65 |
|
62 | 66 |
$self->prepare_report; |
63 | 67 |
|
64 |
$self->report_generator_list_objects(report => $self->{report}, objects => $self->models->get); |
|
68 |
$self->report_generator_list_objects(report => $self->{report}, objects => $self->models->get, action_bar => 1);
|
|
65 | 69 |
} |
66 | 70 |
|
67 | 71 |
sub action_new { |
... | ... | |
69 | 73 |
|
70 | 74 |
$self->project(SL::DB::Project->new); |
71 | 75 |
$self->display_form(title => $::locale->text('Create a new project'), |
72 |
callback => $::form->{callback} || $self->url_for(action => 'new'));
|
|
76 |
callback => $::form->{callback} || $self->url_for(action => 'list'));
|
|
73 | 77 |
} |
74 | 78 |
|
75 | 79 |
sub action_edit { |
76 | 80 |
my ($self) = @_; |
77 | 81 |
|
78 | 82 |
$self->display_form(title => $::locale->text('Edit project #1', $self->project->projectnumber), |
79 |
callback => $::form->{callback} || $self->url_for(action => 'edit', id => $self->project->id));
|
|
83 |
callback => $::form->{callback} || $self->url_for(action => 'list'));
|
|
80 | 84 |
} |
81 | 85 |
|
82 | 86 |
sub action_create { |
... | ... | |
232 | 236 |
|
233 | 237 |
CVar->render_inputs(variables => $params{CUSTOM_VARIABLES}) if @{ $params{CUSTOM_VARIABLES} }; |
234 | 238 |
|
239 |
$self->setup_edit_action_bar(callback => $params{callback}); |
|
240 |
|
|
235 | 241 |
$self->render('project/form', %params); |
236 | 242 |
} |
237 | 243 |
|
... | ... | |
372 | 378 |
|
373 | 379 |
$self->{filter_summary} = join ', ', @filter_strings; |
374 | 380 |
} |
381 |
|
|
382 |
sub setup_edit_action_bar { |
|
383 |
my ($self, %params) = @_; |
|
384 |
|
|
385 |
my $is_new = !$self->project->id; |
|
386 |
|
|
387 |
for my $bar ($::request->layout->get('actionbar')) { |
|
388 |
$bar->add( |
|
389 |
combobox => [ |
|
390 |
action => [ |
|
391 |
t8('Save'), |
|
392 |
submit => [ '#form', { action => 'Project/' . ($is_new ? 'create' : 'update') } ], |
|
393 |
accesskey => 'enter', |
|
394 |
], |
|
395 |
action => [ |
|
396 |
t8('Save as new'), |
|
397 |
submit => [ '#form', { action => 'Project/create' }], |
|
398 |
disabled => $is_new ? t8('The object has not been saved yet.') : undef, |
|
399 |
], |
|
400 |
], # end of combobox "Save" |
|
401 |
|
|
402 |
action => [ |
|
403 |
t8('Delete'), |
|
404 |
submit => [ '#form', { action => 'Project/destroy' } ], |
|
405 |
confirm => $::locale->text('Do you really want to delete this object?'), |
|
406 |
disabled => $is_new ? t8('This object has not been saved yet.') |
|
407 |
: $self->project->is_used ? t8('This object has already been used.') |
|
408 |
: undef, |
|
409 |
], |
|
410 |
|
|
411 |
link => [ |
|
412 |
t8('Abort'), |
|
413 |
link => $params{callback} || $self->url_for(action => 'list'), |
|
414 |
], |
|
415 |
); |
|
416 |
} |
|
417 |
} |
|
418 |
|
|
419 |
sub setup_search_action_bar { |
|
420 |
my ($self, %params) = @_; |
|
421 |
|
|
422 |
for my $bar ($::request->layout->get('actionbar')) { |
|
423 |
$bar->add( |
|
424 |
action => [ |
|
425 |
t8('Search'), |
|
426 |
submit => [ '#search_form', { action => 'Project/list' } ], |
|
427 |
accesskey => 'enter', |
|
428 |
], |
|
429 |
link => [ |
|
430 |
t8('Add Project'), |
|
431 |
link => $self->url_for(action => 'new'), |
|
432 |
], |
|
433 |
); |
|
434 |
} |
|
435 |
} |
|
436 |
|
|
375 | 437 |
1; |
Auch abrufbar als: Unified diff
ActionBar: Project-Controller umgestellt