From 6f90b1ba5d1301194ad12591a000794acd89449b Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 11 Jan 2017 11:33:17 +0100 Subject: [PATCH] ActionBar: Verwendung im Pflichtenheft-Controller --- SL/Controller/RequirementSpec.pm | 21 +++++++++++++++++++ .../webpages/requirement_spec/_form.html | 6 +----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/SL/Controller/RequirementSpec.pm b/SL/Controller/RequirementSpec.pm index 6d9c57b95..9fd3cf328 100644 --- a/SL/Controller/RequirementSpec.pm +++ b/SL/Controller/RequirementSpec.pm @@ -66,6 +66,8 @@ sub action_new { $self->requirement_spec->$_($self->copy_source->$_) for qw(type_id status_id customer_id title hourly_rate is_template) } + $self->_setup_form_action_bar; + $self->render('requirement_spec/new', title => $self->requirement_spec->is_template ? t8('Create a new requirement spec template') : t8('Create a new requirement spec')); } @@ -682,4 +684,23 @@ sub init_html_template { return !!$template; } +sub _setup_form_action_bar { + my ($self) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Save'), + submit => [ '#basic_settings_form', { action => 'RequirementSpec/' . ($self->requirement_spec->id ? 'update' : 'create') } ], + accesskey => 'enter', + ], + + link => [ + t8('Abort'), + link => $self->url_for(action => 'list', is_template => $self->requirement_spec->is_template), + ], + ); + } +} + 1; diff --git a/templates/webpages/requirement_spec/_form.html b/templates/webpages/requirement_spec/_form.html index a89a99b28..ea73e4df8 100644 --- a/templates/webpages/requirement_spec/_form.html +++ b/templates/webpages/requirement_spec/_form.html @@ -68,11 +68,7 @@ [%- END %]

-[% IF submit_as == 'post' %] - [% L.hidden_tag("action", "RequirementSpec/dispatch", id=id_prefix _ '_action') %] - [% L.submit_tag("action_" _ (SELF.requirement_spec.id ? "update" : "create"), LxERP.t8('Save'), id=id_prefix _ '_action_update') %] - [% LxERP.t8('Abort') %] -[% ELSE %] +[% IF submit_as != 'post' %] [% L.ajax_submit_tag("controller.pl?action=RequirementSpec/update", "#" _ id_prefix, LxERP.t8("Save"), id=id_prefix _ '_submit') %]