From e8b07984052b974e46a84a2a4a8a4d3fd10e797a Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 31 Jul 2013 16:28:55 +0200 Subject: [PATCH] Pflichtenheft-Grundeinstellungen erst read/only anzeigen, nicht direkt als Maske --- SL/Controller/RequirementSpec.pm | 20 +++++++-- js/locale/de.js | 1 + js/requirement_spec.js | 36 +++++++++++++++ locale/de/all | 2 + .../webpages/requirement_spec/_form.html | 2 +- .../_show_basic_settings.html | 44 +++++++++++++++++++ templates/webpages/requirement_spec/show.html | 2 +- 7 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 templates/webpages/requirement_spec/_show_basic_settings.html diff --git a/SL/Controller/RequirementSpec.pm b/SL/Controller/RequirementSpec.pm index 58a037475..75453fbcd 100644 --- a/SL/Controller/RequirementSpec.pm +++ b/SL/Controller/RequirementSpec.pm @@ -86,10 +86,21 @@ sub action_new { $self->render('requirement_spec/new', title => $self->requirement_spec->is_template ? t8('Create a new requirement spec template') : t8('Create a new requirement spec')); } +sub action_ajax_show_basic_settings { + my ($self) = @_; + + $self->render('requirement_spec/_show_basic_settings', { layout => 0 }); +} + sub action_ajax_edit { my ($self) = @_; - $self->render('requirement_spec/_form', { layout => 0 }, submit_as => 'ajax'); + my $html = $self->render('requirement_spec/_form', { output => 0 }, submit_as => 'ajax'); + + $self->js + ->hide('#basic_settings') + ->after('#basic_settings', $html) + ->render($self); } sub action_ajax_show_time_and_cost_estimate { @@ -346,9 +357,12 @@ sub create_or_update { my $info = $self->requirement_spec->is_template ? t8('The requirement spec template has been saved.') : t8('The requirement spec has been saved.'); if ($::request->is_ajax) { - my $html = $self->render('requirement_spec/_header', { output => 0 }); + my $header_html = $self->render('requirement_spec/_header', { output => 0 }); + my $basics_html = $self->render('requirement_spec/_show_basic_settings', { output => 0 }); return $self->invalidate_version - ->replaceWith('#requirement-spec-header', $html) + ->replaceWith('#requirement-spec-header', $header_html) + ->replaceWith('#basic_settings', $basics_html) + ->remove('#basic_settings_form') ->flash('info', $info) ->render($self); } diff --git a/js/locale/de.js b/js/locale/de.js index b425c1936..012cc8f43 100644 --- a/js/locale/de.js +++ b/js/locale/de.js @@ -44,6 +44,7 @@ namespace("kivi").setupLocale({ "The name must only consist of letters, numbers and underscores and start with a letter.":"Der Name darf nur aus Buchstaben (keine Umlaute), Ziffern und Unterstrichen bestehen und muss mit einem Buchstaben beginnen.", "The option field is empty.":"Das Optionsfeld ist leer.", "The selected database is still configured for client \"#1\". If you delete the database that client will stop working until you re-configure it. Do you still want to delete the database?":"Die auswählte Datenbank ist noch für Mandant \"#1\" konfiguriert. Wenn Sie die Datenbank löschen, wird der Mandanten nicht mehr funktionieren, bis er anders konfiguriert wurde. Wollen Sie die Datenbank trotzdem löschen?", +"There is one or more sections for which no part has been assigned yet; therefore creating the new record is not possible yet.":"Es gibt einen oder mehrere Abschnitte ohne Artikelzuweisung; daher kann der neue Beleg noch nicht erstellt werden.", "Time/cost estimate actions":"Aktionen für Kosten-/Zeitabschätzung", "Toggle marker":"Markierung umschalten", "Update":"Erneuern", diff --git a/js/requirement_spec.js b/js/requirement_spec.js index 4f2074927..b465ce094 100644 --- a/js/requirement_spec.js +++ b/js/requirement_spec.js @@ -302,6 +302,25 @@ ns.paste_selected_template = function(template_id) { return true; }; +// ------------------------------------------------------------------------- +// ---------------------------- basic settings ----------------------------- +// ------------------------------------------------------------------------- +ns.standard_basic_settings_ajax_call = function(key, opt) { + if (key == 'cancel') { + if (confirm(kivi.t8('Do you really want to cancel?'))) { + $('#basic_settings').show(); + $('#basic_settings_form').remove(); + } + return true; + } + + var data = 'action=RequirementSpec/ajax_' + key + '&id=' + encodeURIComponent($('#requirement_spec_id').val()); + + $.post("controller.pl", data, kivi.eval_json_result); + + return true; +}; + // ------------------------------------------------------------------------- // -------------------------- time/cost estimate --------------------------- // ------------------------------------------------------------------------- @@ -525,6 +544,23 @@ ns.create_context_menus = function(is_template) { }, general_actions) }); + $.contextMenu({ + selector: '.basic-settings-context-menu', + items: $.extend({ + heading: { name: kivi.t8('Basic settings actions'), className: 'context-menu-heading' } + , edit: { name: kivi.t8('Edit'), icon: "edit", callback: kivi.requirement_spec.standard_basic_settings_ajax_call } + }, general_actions) + }); + + $.contextMenu({ + selector: '.edit-basic-settings-context-menu', + items: $.extend({ + heading: { name: kivi.t8('Basic settings actions'), className: 'context-menu-heading' } + , save: { name: kivi.t8('Save'), icon: "save", callback: kivi.requirement_spec.standard_basic_settings_ajax_call } + , cancel: { name: kivi.t8('Cancel'), icon: "close", callback: kivi.requirement_spec.standard_basic_settings_ajax_call } + }, general_actions) + }); + $.contextMenu({ selector: '.time-cost-estimate-context-menu', items: $.extend({ diff --git a/locale/de/all b/locale/de/all index 8e8669d81..3500c610d 100755 --- a/locale/de/all +++ b/locale/de/all @@ -313,6 +313,8 @@ $self->{texts} = { 'Bank transfers via SEPA' => 'Überweisungen via SEPA', 'Base unit' => 'Basiseinheit', 'Basic Data' => 'Basisdaten', + 'Basic Settings for the Requirement Spec' => 'Grundeinstellungen des Pflichtenheftes', + 'Basic Settings for the Requirement Spec Template' => 'Grundeinstellungen der Pflichtenheftvorlage', 'Basic settings' => 'Grundeinstellungen', 'Batch Printing' => 'Druck', 'Bcc' => 'Bcc', diff --git a/templates/webpages/requirement_spec/_form.html b/templates/webpages/requirement_spec/_form.html index 326026345..dd760ed5d 100644 --- a/templates/webpages/requirement_spec/_form.html +++ b/templates/webpages/requirement_spec/_form.html @@ -2,7 +2,7 @@ [%- DEFAULT id_prefix = 'basic_settings_form' submit_as = 'post' %] -
+ [% L.hidden_tag("id", SELF.requirement_spec.id, id=id_prefix _ '_id') %] [% L.hidden_tag("requirement_spec.is_template", SELF.requirement_spec.is_template, id=id_prefix _ '_is_template') %] diff --git a/templates/webpages/requirement_spec/_show_basic_settings.html b/templates/webpages/requirement_spec/_show_basic_settings.html new file mode 100644 index 000000000..cdd80f151 --- /dev/null +++ b/templates/webpages/requirement_spec/_show_basic_settings.html @@ -0,0 +1,44 @@ +[%- USE HTML -%][%- USE LxERP -%] +
+ + + + + + + + + + +[%- UNLESS SELF.requirement_spec.is_template %] + + + + + + + + + + + + + + + + + + + + + +[%- END %] + +
+ [% IF SELF.requirement_spec.is_template %] + [% LxERP.t8("Basic Settings for the Requirement Spec Template") %] + [% ELSE %] + [% LxERP.t8("Basic Settings for the Requirement Spec") %] + [% END %] +
[% LxERP.t8("Title") %]:[% HTML.escape(SELF.requirement_spec.title) %]
[% LxERP.t8("Requirement Spec Type") %]:[% HTML.escape(SELF.requirement_spec.type.description) %]
[% LxERP.t8("Requirement Spec Status") %]:[% HTML.escape(SELF.requirement_spec.status.description) %]
[% LxERP.t8("Customer") %]:[% HTML.escape(SELF.requirement_spec.customer.name) %]
[% LxERP.t8("Hourly Rate") %]:[% HTML.escape(SELF.requirement_spec.hourly_rate_as_number) %]
+
diff --git a/templates/webpages/requirement_spec/show.html b/templates/webpages/requirement_spec/show.html index 9a173a5aa..38711c14d 100644 --- a/templates/webpages/requirement_spec/show.html +++ b/templates/webpages/requirement_spec/show.html @@ -9,7 +9,7 @@