From: Moritz Bunkus Date: Tue, 31 Jan 2017 14:29:53 +0000 (+0100) Subject: ActionBar: Verwendung bei »Steuerzonen« X-Git-Tag: release-3.5.4~1269 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=8631a825ebe02f537dae531fd5ec712a12c53f0f;p=kivitendo-erp.git ActionBar: Verwendung bei »Steuerzonen« --- diff --git a/SL/Controller/Taxzones.pm b/SL/Controller/Taxzones.pm index 1594b9b37..e0125695c 100644 --- a/SL/Controller/Taxzones.pm +++ b/SL/Controller/Taxzones.pm @@ -27,6 +27,7 @@ sub action_list { my $taxzones = SL::DB::Manager::TaxZone->get_all_sorted(); + $self->setup_list_action_bar; $self->render('taxzones/list', title => t8('List of tax zones'), TAXZONES => $taxzones); @@ -42,6 +43,7 @@ sub action_new { sub show_form { my ($self, %params) = @_; + $self->setup_show_form_action_bar; $self->render('taxzones/form', %params, BUCHUNGSGRUPPEN => SL::DB::Manager::Buchungsgruppe->get_all_sorted); } @@ -179,4 +181,52 @@ sub create_or_update { sub init_defaults { SL::DB::Default->get }; +# +# helpers +# + +sub setup_show_form_action_bar { + my ($self) = @_; + + my $is_new = !$self->config->id; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Save'), + submit => [ '#form', { action => 'Taxzones/' . ($is_new ? 'create' : 'update') } ], + checks => [ 'kivi.validate_form' ], + accesskey => 'enter', + ], + + action => [ + t8('Delete'), + submit => [ '#form', { action => 'Taxzones/delete' } ], + confirm => t8('Do you really want to delete this object?'), + disabled => $is_new ? t8('This object has not been saved yet.') + : !$self->config->orphaned ? t8('The object is in use and cannot be deleted.') + : undef, + ], + + link => [ + t8('Abort'), + link => $self->url_for(action => 'list'), + ], + ); + } +} + +sub setup_list_action_bar { + my ($self) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + link => [ + t8('Add'), + link => $self->url_for(action => 'new'), + ], + ); + } +} + 1; diff --git a/templates/webpages/taxzones/form.html b/templates/webpages/taxzones/form.html index d6153788c..9cddd46e9 100644 --- a/templates/webpages/taxzones/form.html +++ b/templates/webpages/taxzones/form.html @@ -1,13 +1,13 @@ [%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]

[% HTML.escape(title) %]

[% SET style="width: 400px" %] -
+ [%- L.hidden_tag("id", SELF.config.id) %] - + [%- FOREACH bg = BUCHUNGSGRUPPEN %] @@ -34,28 +34,4 @@
[% 'Description' | $T8 %][%- L.input_tag("config.description", SELF.config.description) %][%- L.input_tag("config.description", SELF.config.description, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]
[% LxERP.t8('Obsolete') %]: [% L.checkbox_tag('config.obsolete', checked = SELF.config.obsolete, for_submit=1) %] - -

- [% L.hidden_tag("action", "Taxzones/dispatch") %] - [% L.submit_tag("action_" _ (SELF.config.id ? "update" : "create"), LxERP.t8('Save'), onclick="return check_prerequisites();") %] - [%- IF SELF.config.id AND SELF.config.orphaned %] - [% L.submit_tag("action_delete", LxERP.t8('Delete'), confirm=LxERP.t8('Are you sure?')) %] - [%- END %] - [%- LxERP.t8("Cancel") %] -

- -
- -
diff --git a/templates/webpages/taxzones/list.html b/templates/webpages/taxzones/list.html index 46c1a0ba1..793f88c87 100644 --- a/templates/webpages/taxzones/list.html +++ b/templates/webpages/taxzones/list.html @@ -22,11 +22,4 @@

-
- [% L.sortable_element('#taxzone_list tbody', url=SELF.url_for(action='reorder'), with='tzone_id') %] - -

- [%- 'Add' | $T8 %] -

-