Revision 7e8a6c25
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Controller/Employee.pm | ||
---|---|---|
5 | 5 |
|
6 | 6 |
use SL::DB::Employee; |
7 | 7 |
use SL::Helper::Flash; |
8 |
use SL::Locale::String qw(t8); |
|
8 | 9 |
|
9 | 10 |
__PACKAGE__->run_before('check_auth'); |
10 | 11 |
__PACKAGE__->run_before('load_all'); |
... | ... | |
23 | 24 |
my ($self, %params) = @_; |
24 | 25 |
|
25 | 26 |
if ($self->{employee}) { |
27 |
$self->setup_edit_action_bar; |
|
26 | 28 |
$self->render('employee/edit', title => $::locale->text('Edit Employee #1', $self->{employee}->safe_name)); |
27 | 29 |
} else { |
28 |
flash('error', $::locale->text('Could not load employee')); |
|
30 |
flash_later('error', $::locale->text('Could not load employee'));
|
|
29 | 31 |
$self->redirect_to(action => 'list'); |
30 | 32 |
} |
31 | 33 |
} |
... | ... | |
35 | 37 |
|
36 | 38 |
$self->{employee}->save; |
37 | 39 |
|
38 |
flash('info', $::locale->text('Employee #1 saved!')); |
|
40 |
flash('info', $::locale->text('Employee #1 saved!', $self->{employee}->safe_name));
|
|
39 | 41 |
|
40 | 42 |
$self->redirect_to(action => 'edit', 'employee.id' => $self->{employee}->id); |
41 | 43 |
} |
... | ... | |
63 | 65 |
return 1; |
64 | 66 |
} |
65 | 67 |
|
68 |
sub setup_edit_action_bar { |
|
69 |
my ($self) = @_; |
|
70 |
|
|
71 |
for my $bar ($::request->layout->get('actionbar')) { |
|
72 |
$bar->add( |
|
73 |
action => [ |
|
74 |
t8('Save'), |
|
75 |
submit => [ '#form', { action => 'Employee/save' } ], |
|
76 |
accesskey => 'enter', |
|
77 |
], |
|
78 |
|
|
79 |
'separator', |
|
80 |
|
|
81 |
link => [ |
|
82 |
t8('Abort'), |
|
83 |
link => $self->url_for(action => 'list'), |
|
84 |
], |
|
85 |
); |
|
86 |
} |
|
87 |
} |
|
66 | 88 |
|
67 | 89 |
######################## behaviour ########################## |
68 | 90 |
|
Auch abrufbar als: Unified diff
ActionBar: Verwendung bei »System« → »Benutzer«