Revision a34bdbf7
Von Moritz Bunkus vor etwa 7 Jahren hinzugefügt
SL/Controller/SimpleSystemSetting.pm | ||
---|---|---|
250 | 250 |
sub action_list { |
251 | 251 |
my ($self) = @_; |
252 | 252 |
|
253 |
$self->setup_list_action_bar; |
|
253 | 254 |
$self->render('simple_system_setting/list', title => $self->config->{titles}->{list}); |
254 | 255 |
} |
255 | 256 |
|
... | ... | |
377 | 378 |
|
378 | 379 |
my $sub_form_template = SL::System::Process->exe_dir . '/templates/webpages/simple_system_setting/_' . $self->type . '_form.html'; |
379 | 380 |
|
381 |
$self->setup_render_form_action_bar; |
|
380 | 382 |
$self->render( |
381 | 383 |
'simple_system_setting/form', |
382 | 384 |
%params, |
... | ... | |
409 | 411 |
$self->{dateformats} = [ qw(mm/dd/yy dd/mm/yy dd.mm.yy yyyy-mm-dd) ]; |
410 | 412 |
} |
411 | 413 |
|
414 |
# |
|
415 |
# action bar |
|
416 |
# |
|
417 |
|
|
418 |
sub setup_list_action_bar { |
|
419 |
my ($self, %params) = @_; |
|
420 |
|
|
421 |
for my $bar ($::request->layout->get('actionbar')) { |
|
422 |
$bar->add( |
|
423 |
link => [ |
|
424 |
t8('Add'), |
|
425 |
link => $self->url_for(action => 'new', type => $self->type), |
|
426 |
], |
|
427 |
); |
|
428 |
} |
|
429 |
} |
|
430 |
|
|
431 |
sub setup_render_form_action_bar { |
|
432 |
my ($self) = @_; |
|
433 |
|
|
434 |
my $is_new = !$self->object->id; |
|
435 |
my $can_be_deleted = !$is_new |
|
436 |
&& (!$self->object->can("orphaned") || $self->object->orphaned) |
|
437 |
&& (!$self->object->can("can_be_deleted") || $self->object->can_be_deleted); |
|
438 |
|
|
439 |
for my $bar ($::request->layout->get('actionbar')) { |
|
440 |
$bar->add( |
|
441 |
action => [ |
|
442 |
t8('Save'), |
|
443 |
submit => [ '#form', { action => 'SimpleSystemSetting/' . ($is_new ? 'create' : 'update') } ], |
|
444 |
checks => [ 'kivi.validate_form' ], |
|
445 |
accesskey => 'enter', |
|
446 |
], |
|
447 |
|
|
448 |
action => [ |
|
449 |
t8('Delete'), |
|
450 |
submit => [ '#form', { action => 'SimpleSystemSetting/delete' } ], |
|
451 |
confirm => t8('Do you really want to delete this object?'), |
|
452 |
disabled => $is_new ? t8('This object has not been saved yet.') |
|
453 |
: !$can_be_deleted ? t8('The object is in use and cannot be deleted.') |
|
454 |
: undef, |
|
455 |
], |
|
456 |
|
|
457 |
link => [ |
|
458 |
t8('Abort'), |
|
459 |
link => $self->list_url, |
|
460 |
], |
|
461 |
); |
|
462 |
} |
|
463 |
} |
|
464 |
|
|
412 | 465 |
1; |
413 | 466 |
|
414 | 467 |
__END__ |
Auch abrufbar als: Unified diff
ActionBar: Verwendung im »SimpleSystemSetting«-Controller