From: Moritz Bunkus Date: Thu, 18 Jul 2013 13:54:51 +0000 (+0200) Subject: Pflichtenhefttextblöcke: AJAX-Calls für erweitertes Menü gefixt X-Git-Tag: release-3.2.0beta~467^2~105 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=b28b0afc6b991b5050ea39f66fd1870ca27f400f;p=kivitendo-erp.git Pflichtenhefttextblöcke: AJAX-Calls für erweitertes Menü gefixt --- diff --git a/SL/Controller/RequirementSpecTextBlock.pm b/SL/Controller/RequirementSpecTextBlock.pm index 7faf16d66..7d224f6e2 100644 --- a/SL/Controller/RequirementSpecTextBlock.pm +++ b/SL/Controller/RequirementSpecTextBlock.pm @@ -45,7 +45,7 @@ sub action_ajax_list { # $::lxdebug->message(0, "cur $current_where new $new_where"); - $self->show_list(output_position => $new_where, id => $::form->{clicked_id}) if ($new_where != ($current_where // -1)); + $self->show_list(output_position => $new_where, id => $::form->{clicked_id}, set_type => 1) if ($new_where != ($current_where // -1)); $self->render($self->js); } @@ -322,7 +322,7 @@ sub add_new_text_block_form { sub show_list { my $self = shift; - my %params = Params::Validate::validate(@_, { output_position => 1, id => 0, requirement_spec_id => 0, }); + my %params = Params::Validate::validate(@_, { output_position => 1, id => 0, requirement_spec_id => 0, set_type => 0, }); $params{requirement_spec_id} ||= $::form->{requirement_spec_id}; croak "Unknown requirement_spec_id" if !$params{requirement_spec_id}; @@ -332,11 +332,8 @@ sub show_list { $self->js->html('#column-content', $html); - if ($params{id}) { - $self->js - ->val('#current_content_type', 'text-blocks-' . (0 == $params{output_position} ? 'front' : 'back')) - ->val('#current_content_id', $params{id}); - } + $self->js->val('#current_content_type', 'text-blocks-' . (0 == $params{output_position} ? 'front' : 'back')) if $params{id} || $params{set_type}; + $self->js->val('#current_content_id', $params{id}) if $params{id}; return $self->set_function_blocks_tab_menu_class(class => 'text-block-context-menu'); } diff --git a/js/requirement_spec.js b/js/requirement_spec.js index 160240df4..61babb806 100644 --- a/js/requirement_spec.js +++ b/js/requirement_spec.js @@ -107,8 +107,8 @@ ns.tree_node_clicked = function(event) { // ------------------------------------------------------------------------- ns.find_text_block_id = function(clicked_elt) { - // console.log("id: " + $(clicked_elt).attr('id')); var id = $(clicked_elt).attr('id'); + // console.log("id: " + id); if (/^text-block-\d+$/.test(id)) { // console.log("find_text_block_id: case 1: " + id.substr(11)); return id.substr(11) * 1; @@ -126,7 +126,7 @@ ns.find_text_block_id = function(clicked_elt) { return id.substr(3) * 1; } - // console.log("find_text_block_id: case undef"); + // console.log("find_text_block_id: case undef, id: " + id); return undefined; }; @@ -135,7 +135,7 @@ ns.find_text_block_output_position = function(clicked_elt) { if (output_position) return output_position; - var type = $(clicked_elt).closest('#tb-back,#tb-front').data('type'); + var type = $(clicked_elt).closest('#tb-back,#tb-front').data('type') || $('#current_content_type').val(); if (/^text-blocks-(front|back)/.test(type)) return type == "text-blocks-front" ? 0 : 1;