]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Controller/RequirementSpec.pm
Pflichtenhefttextblöcke: HTML nutzen
[mfinanz.git] / SL / Controller / RequirementSpec.pm
index 9727d589799ad55bd1c0635b950bab65c7524e16..b36d9b9ea9bc869239c13c05d67bcf022baed42e 100644 (file)
@@ -120,11 +120,14 @@ sub action_ajax_edit_time_and_cost_estimate {
   my ($self) = @_;
 
   my $html   = $self->render('requirement_spec/_edit_time_and_cost_estimate', { output => 0 });
+  my $first  = ($self->requirement_spec->sections_sorted || [])->[0];
+  $first     = ($first->children_sorted || [])->[0] if $first;
 
   $self->js
    ->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')
+   ->action_if($first && $first->id, 'focus', '#time_and_cost_estimate_form_complexity_id_' . $first->id)
    ->render($self);
 }
 
@@ -146,9 +149,12 @@ sub action_ajax_save_time_and_cost_estimate {
 
   $self->requirement_spec(SL::DB::RequirementSpec->new(id => $self->requirement_spec->id)->load);
 
-  my $html = $self->render('requirement_spec/_show_time_and_cost_estimate', { output => 0 });
-  $self->js->replaceWith('#time_cost_estimate', $html)
-           ->remove('#time_cost_estimate_form_container');
+  my $html = $self->render('requirement_spec/_show_time_and_cost_estimate', { output => 0 }, initially_hidden => !!$::form->{keep_open});
+  $self->js->replaceWith('#time_cost_estimate', $html);
+
+  return $self->js->render($self) if $::form->{keep_open};
+
+  $self->js->remove('#time_cost_estimate_form_container');
 
   if ($self->visible_section) {
     $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $self->visible_section);
@@ -261,7 +267,7 @@ sub setup {
 
   $::auth->assert('sales_quotation_edit');
   $::request->{layout}->use_stylesheet("${_}.css") for qw(jquery.contextMenu requirement_spec);
-  $::request->{layout}->use_javascript("${_}.js") for qw(jquery.jstree jquery/jquery.contextMenu requirement_spec);
+  $::request->{layout}->use_javascript("${_}.js")  for qw(jquery.jstree jquery/jquery.contextMenu jquery/jquery.hotkeys requirement_spec ckeditor/ckeditor ckeditor/adapters/jquery);
   $self->init_visible_section;
 
   return 1;
@@ -348,7 +354,7 @@ sub create_or_update {
     }
   })) {
     $::lxdebug->message(LXDebug::WARN(), "Error: " . $db->error);
-    @errors = ($::locale->text('Saving failed. Error message from the database: #1'), $db->error);
+    @errors = ($::locale->text('Saving failed. Error message from the database: #1', $db->error));
     return $self->js->error(@errors)->render($self) if $::request->is_ajax;
 
     $self->requirement_spec->id(undef) if $is_new;