From: Moritz Bunkus Date: Tue, 21 Mar 2017 14:37:01 +0000 (+0100) Subject: ActionBar: Verwendung bei »System« → »Lieferbedingungen« X-Git-Tag: release-3.5.4~1188 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=20e24a4a3afcdcf95348bd01f43f7e43550ffd7c;p=kivitendo-erp.git ActionBar: Verwendung bei »System« → »Lieferbedingungen« --- diff --git a/SL/Controller/DeliveryTerm.pm b/SL/Controller/DeliveryTerm.pm index 4810d2141..47392d947 100644 --- a/SL/Controller/DeliveryTerm.pm +++ b/SL/Controller/DeliveryTerm.pm @@ -7,6 +7,7 @@ use parent qw(SL::Controller::Base); use SL::DB::DeliveryTerm; use SL::DB::Language; use SL::Helper::Flash; +use SL::Locale::String qw(t8); use Rose::Object::MakeMethods::Generic ( @@ -25,6 +26,7 @@ __PACKAGE__->run_before('load_languages', only => [ qw(new list edit create sub action_list { my ($self) = @_; + $self->setup_list_action_bar; $self->render('delivery_term/list', title => $::locale->text('Delivery terms'), DELIVERY_TERMS => SL::DB::Manager::DeliveryTerm->get_all_sorted); @@ -34,11 +36,13 @@ sub action_new { my ($self) = @_; $self->{delivery_term} = SL::DB::DeliveryTerm->new; + $self->setup_form_action_bar; $self->render('delivery_term/form', title => $::locale->text('Create a new delivery term')); } sub action_edit { my ($self) = @_; + $self->setup_form_action_bar; $self->render('delivery_term/form', title => $::locale->text('Edit delivery term')); } @@ -120,4 +124,48 @@ sub load_languages { $self->{languages} = SL::DB::Manager::Language->get_all_sorted; } +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'), + ], + ); + } +} + +sub setup_form_action_bar { + my ($self) = @_; + + my $is_new = !$self->delivery_term->id; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Save'), + submit => [ '#form', { action => 'DeliveryTerm/' . ($is_new ? 'create' : 'update') } ], + checks => [ 'kivi.validate_form' ], + accesskey => 'enter', + ], + + action => [ + t8('Delete'), + submit => [ '#form', { action => 'DeliveryTerm/destroy' } ], + confirm => t8('Do you really want to delete this object?'), + disabled => $is_new ? t8('This object has not been saved yet.') : undef, + ], + + 'separator', + + link => [ + t8('Abort'), + link => $self->url_for(action => 'list'), + ], + ); + } +} + 1; diff --git a/locale/de/all b/locale/de/all index 3f576a50e..196936461 100755 --- a/locale/de/all +++ b/locale/de/all @@ -300,7 +300,6 @@ $self->{texts} = { 'Ar aging on %s' => 'Offene Forderungen zum %s', 'Are you sure to generate cb/ob transactions?' => 'Sollen die EB/SB Buchungen wirklich erzeugt werden?', 'Are you sure you want to delete Invoice Number' => 'Soll die Rechnung mit folgender Nummer wirklich gelöscht werden:', - 'Are you sure you want to delete this delivery term?' => 'Wollen Sie diese Lieferbedingungen wirklich löschen?', 'Are you sure you want to delete this letter?' => 'Sind Sie sicher, dass Sie diesen Brief löschen wollen?', 'Are you sure you want to remove the marked entries from the queue?' => 'Sind Sie sicher, dass die markierten Einträge von der Warteschlange gelöscht werden sollen?', 'Are you sure you want to update the prices' => 'Sind Sie sicher, dass Sie die Preise aktualisieren wollen?', @@ -712,7 +711,6 @@ $self->{texts} = { 'Create invoice?' => 'Rechnung erstellen?', 'Create new' => 'Neu erfassen', 'Create new client #1' => 'Neuen Mandanten #1 anlegen', - 'Create new delivery term' => 'Neue Lieferbedingungen anlegen', 'Create new quotation or order' => 'Neues Angebot oder neuen Auftrag anlegen', 'Create new quotation/order' => 'Neues Angebot/neuen Auftrag anlegen', 'Create new qutoation/order' => 'Neues Angebot/neuen Auftrag anlegen', diff --git a/templates/webpages/delivery_term/form.html b/templates/webpages/delivery_term/form.html index 1aa2f5239..3049617c2 100755 --- a/templates/webpages/delivery_term/form.html +++ b/templates/webpages/delivery_term/form.html @@ -1,7 +1,7 @@ -[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %] +[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %][%- USE P -%]

[% FORM.title %]

-
+ [%- INCLUDE 'common/flash.html' %] @@ -9,14 +9,14 @@ [%- 'Description' | $T8 %] - + [% P.input_tag("delivery_term.description", SELF.delivery_term.description, size="60", "data-validate"="required", "data-title"=LxERP.t8("Description")) %] [%- 'Long Description' | $T8 %] - + [% P.input_tag("delivery_term.description_long", SELF.delivery_term.description_long, size="60", "data-validate"="required", "data-title"=LxERP.t8("Long Description")) %] @@ -28,17 +28,7 @@ [%- END %] + -

- - - - [%- IF SELF.delivery_term.id %] - - [%- END %] - [%- 'Abort' | $T8 %] -

- + [% P.hidden_tag("id", SELF.delivery_term.id) %]
- diff --git a/templates/webpages/delivery_term/list.html b/templates/webpages/delivery_term/list.html index 517d91272..6877e921d 100644 --- a/templates/webpages/delivery_term/list.html +++ b/templates/webpages/delivery_term/list.html @@ -3,7 +3,7 @@ [%- INCLUDE 'common/flash.html' %] -
+ [% IF !DELIVERY_TERMS.size %]

[%- 'No delivery term has been created yet.' | $T8 %] @@ -34,11 +34,6 @@ [%- END %] - -

- [%- 'Create new delivery term' | $T8 %] -

[% L.sortable_element('#delivery_term_list tbody', url => 'controller.pl?action=DeliveryTerm/reorder', with => 'delivery_term_id') %] -