Pflichtenheftkostenschätzung: "Abbrechen" ohne AJAX-Call nur in JS
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 31 Jul 2013 14:34:11 +0000 (16:34 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:09:08 +0000 (13:09 +0200)
SL/Controller/RequirementSpec.pm
js/requirement_spec.js
templates/webpages/requirement_spec/_edit_time_and_cost_estimate.html

index 75453fb..2a64136 100644 (file)
@@ -109,23 +109,14 @@ sub action_ajax_show_time_and_cost_estimate {
   $self->render('requirement_spec/_show_time_and_cost_estimate', { layout => 0 });
 }
 
-sub action_ajax_cancel_time_and_cost_estimate {
-  my ($self) = @_;
-
-  my $html   = $self->render('requirement_spec/_show_time_and_cost_estimate', { output => 0 });
-
-  $self->js
-   ->replaceWith('#time_cost_estimate', $html)
-   ->render($self);
-}
-
 sub action_ajax_edit_time_and_cost_estimate {
   my ($self) = @_;
 
   my $html   = $self->render('requirement_spec/_edit_time_and_cost_estimate', { output => 0 });
 
   $self->js
-   ->replaceWith('#time_cost_estimate', $html)
+   ->hide('#time_cost_estimate')
+   ->after('#time_cost_estimate', $html)
    ->on('#time_cost_estimate INPUT[type=text]', 'keydown', 'kivi.requirement_spec.time_cost_estimate_input_key_down')
    ->render($self);
 }
index b465ce0..d2a5052 100644 (file)
@@ -326,8 +326,13 @@ ns.standard_basic_settings_ajax_call = function(key, opt) {
 // -------------------------------------------------------------------------
 
 ns.standard_time_cost_estimate_ajax_call = function(key, opt) {
-  if ((key == 'cancel') && !confirm(kivi.t8('Do you really want to cancel?')))
+  if (key == 'cancel') {
+    if (confirm(kivi.t8('Do you really want to cancel?'))) {
+      $('#time_cost_estimate').show();
+      $('#time_cost_estimate_form_container').remove();
+    }
     return true;
+  }
 
   var data = "action=RequirementSpec/ajax_" + key + "_time_and_cost_estimate&";
 
index 1bd8092..a18efc0 100644 (file)
@@ -1,7 +1,7 @@
 [%- USE LxERP -%][%- USE L -%][%- USE HTML -%][%- USE P -%]
 [%- DEFAULT id_prefix = 'time_and_cost_estimate_form' %]
 
-<div id="time_cost_estimate" class="edit-time-cost-estimate-context-menu">
+<div id="time_cost_estimate_form_container" class="edit-time-cost-estimate-context-menu">
  [%- IF !SELF.requirement_spec.sections.size %]
   <p>[%- LxERP.t8("Neither sections nor function blocks have been created yet.") %]</p>