From 95c80e5e483f47741ff90a05468aef7585bd2160 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 24 Mar 2017 16:05:25 +0100 Subject: [PATCH] =?utf8?q?ActionBar:=20Verwendung=20bei=20=C2=BBSystem?= =?utf8?q?=C2=AB=20=E2=86=92=20=C2=BBVorlagen=C2=AB=20=E2=86=92=20*?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/amtemplates.pl | 38 +++++++++++++++++++++-- locale/de/all | 3 +- templates/webpages/am/edit_templates.html | 18 +---------- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/bin/mozilla/amtemplates.pl b/bin/mozilla/amtemplates.pl index c5a49820a..0917769f3 100644 --- a/bin/mozilla/amtemplates.pl +++ b/bin/mozilla/amtemplates.pl @@ -37,6 +37,7 @@ use File::Find; use SL::DB::Default; use SL::AM; use SL::Form; +use SL::Locale::String qw(t8); use Data::Dumper; @@ -278,17 +279,50 @@ sub display_template_form { $options{"CAN_EDIT"} = $form->{"edit"}; if (!$form->{edit}) { - $options{"content"} = "\n\n" if (!$options{"content"}); - $options{"SHOW_SECOND_EDIT_BUTTON"} = $options{"lines"} > 25; + $options{"content"} = "\n\n" if (!$options{"content"}); } } $options{"HIDDEN"} = [ map(+{ "name" => $_, "value" => $form->{$_} }, @hidden) ]; + setup_amtemplates_display_form_action_bar( + mode => $form->{edit} ? 'edit' : 'show', + template_selected => $options{SHOW_CONTENT}, + ); + $form->header; print($form->parse_html_template("am/edit_templates", \%options)); $main::lxdebug->leave_sub(); } +sub setup_amtemplates_display_form_action_bar { + my %params = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Edit'), + submit => [ '#form', { action => 'edit_template' } ], + accesskey => 'enter', + only_if => $params{mode} eq 'show', + disabled => !$params{template_selected} ? t8('No template has been selected yet.') : undef, + ], + + action => [ + t8('Save'), + submit => [ '#form', { action => 'save_template' } ], + accesskey => 'enter', + only_if => $params{mode} eq 'edit', + ], + + action => [ + t8('Abort'), + call => [ 'kivi.history_back' ], + only_if => $params{mode} eq 'edit', + ], + ); + } +} + 1; diff --git a/locale/de/all b/locale/de/all index 2625fc495..0896c9091 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1900,6 +1900,7 @@ $self->{texts} = { 'No start date given, setting to #1' => 'Kein Startdatum gegeben, setze Startdatum auf #1', 'No such job #1 in the database.' => 'Hintergrund-Job #1 existiert nicht mehr.', 'No summary account' => 'Kein Sammelkonto', + 'No template has been selected yet.' => 'Es wurde noch keine Vorlage ausgewählt.', 'No template was found.' => 'Es wurde keine Vorlage gefunden.', 'No text blocks have been created for this position.' => 'Für diese Position wurden noch keine Textblöcke angelegt.', 'No text has been entered yet.' => 'Es wurde noch kein Text eingegeben.', @@ -3794,7 +3795,6 @@ $self->{texts} = { 'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.', 'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.', 'request_quotation' => 'Angebotsanforderung', - 'reset' => 'zurücksetzen', 'return_material' => 'Materialrückgabe', 'rfq_list' => 'anfragenliste', 'running' => 'läuft', @@ -3823,7 +3823,6 @@ $self->{texts} = { 'start upload' => 'Hochladen beginnt', 'stock' => 'Einlagerung', 'stock_br' => 'Eingel.', - 'submit' => 'abschicken', 'succeeded' => 'erfolgreich', 'sum' => 'Summe', 'tax_chartaccno' => 'Automatikkonto', diff --git a/templates/webpages/am/edit_templates.html b/templates/webpages/am/edit_templates.html index ff6ece22b..3b18ce0e0 100644 --- a/templates/webpages/am/edit_templates.html +++ b/templates/webpages/am/edit_templates.html @@ -7,7 +7,7 @@

[[% 'Help Template Variables' | $T8 %]]

[% END %] -
+ [% FOREACH var = HIDDEN %][% END %] @@ -43,8 +43,6 @@
[% END %] - - [% IF SHOW_CONTENT %]

[% IF CAN_EDIT %][% 'Edit file' | $T8 %][% ELSE %][% 'Display file' | $T8 %][% END %] [% HTML.escape(display_filename) %] @@ -53,24 +51,10 @@ [% IF CAN_EDIT %]

-

- - - -

- [% ELSE %] - - -

-

[% HTML.escape(content) %]

- [% IF SHOW_SECOND_EDIT_BUTTON %] -

- [% END %] - [% END %] [% END %] -- 2.20.1