From: Moritz Bunkus Date: Fri, 24 Mar 2017 14:08:27 +0000 (+0100) Subject: ActionBar: Verwendung bei »System« → »Benutzer« X-Git-Tag: release-3.5.4~1166 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7e8a6c2552eb60b2c788dcd02d0566b26f9a3458;p=kivitendo-erp.git ActionBar: Verwendung bei »System« → »Benutzer« --- diff --git a/SL/Controller/Employee.pm b/SL/Controller/Employee.pm index 265d1db3c..679227202 100644 --- a/SL/Controller/Employee.pm +++ b/SL/Controller/Employee.pm @@ -5,6 +5,7 @@ use parent qw(SL::Controller::Base); use SL::DB::Employee; use SL::Helper::Flash; +use SL::Locale::String qw(t8); __PACKAGE__->run_before('check_auth'); __PACKAGE__->run_before('load_all'); @@ -23,9 +24,10 @@ sub action_edit { my ($self, %params) = @_; if ($self->{employee}) { + $self->setup_edit_action_bar; $self->render('employee/edit', title => $::locale->text('Edit Employee #1', $self->{employee}->safe_name)); } else { - flash('error', $::locale->text('Could not load employee')); + flash_later('error', $::locale->text('Could not load employee')); $self->redirect_to(action => 'list'); } } @@ -35,7 +37,7 @@ sub action_save { $self->{employee}->save; - flash('info', $::locale->text('Employee #1 saved!')); + flash('info', $::locale->text('Employee #1 saved!', $self->{employee}->safe_name)); $self->redirect_to(action => 'edit', 'employee.id' => $self->{employee}->id); } @@ -63,6 +65,26 @@ sub assign_from_form { return 1; } +sub setup_edit_action_bar { + my ($self) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Save'), + submit => [ '#form', { action => 'Employee/save' } ], + accesskey => 'enter', + ], + + 'separator', + + link => [ + t8('Abort'), + link => $self->url_for(action => 'list'), + ], + ); + } +} ######################## behaviour ########################## diff --git a/templates/webpages/employee/_form.html b/templates/webpages/employee/_form.html deleted file mode 100644 index 841cdc5b2..000000000 --- a/templates/webpages/employee/_form.html +++ /dev/null @@ -1,29 +0,0 @@ -[%- USE HTML %] -[%- USE LxERP %] -[%- USE T8 %] -[%- USE L %] - -
- - - - - - - - - - - - - - -
[% 'Login of User' | $T8 %]:[% employee.login | html %]
[% 'Name' | $T8 %]:[% employee.name | html %]
[% 'Deleted' | $T8 %]: [% L.radio_button_tag('employee.deleted', value=1, checked=employee.deleted, label=LxERP.t8('Yes')) %] - [% L.radio_button_tag('employee.deleted', value=0, checked=!employee.deleted, label=LxERP.t8('No')) %] -
- -[%- L.hidden_tag('employee.id', employee.id) %] -[%- L.hidden_tag('action', 'Employee/dispatch') %] -[%- L.submit_tag('action_save', LxERP.t8('Save')) %] -
- diff --git a/templates/webpages/employee/edit.html b/templates/webpages/employee/edit.html index d4b3ed894..63e6f5c28 100644 --- a/templates/webpages/employee/edit.html +++ b/templates/webpages/employee/edit.html @@ -1,9 +1,25 @@ -

[% title | html %]

+[%- USE LxERP -%][%- USE L -%][%- USE T8 -%]

[% title | html %]

-[% PROCESS 'common/flash.html' %] +[% PROCESS "common/flash.html" %] -[% PROCESS 'employee/_form.html' employee=SELF.employee %] +
-
+ + + + + + + + + + + + + +
[% "Login of User" | $T8 %]:[% SELF.employee.login | html %]
[% "Name" | $T8 %]:[% SELF.employee.name | html %]
[% "Deleted" | $T8 %]: [% L.radio_button_tag("SELF.employee.deleted", value=1, checked=SELF.employee.deleted, label=LxERP.t8("Yes")) %] + [% L.radio_button_tag("SELF.employee.deleted", value=0, checked=!SELF.employee.deleted, label=LxERP.t8("No")) %] +
-[% PROCESS 'employee/_list.html' %] + [%- L.hidden_tag("employee.id", SELF.employee.id) %] +