X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FRequirementSpecTextBlock.pm;h=02a27a537037f68f8457c406fa8f67d1972646d5;hb=aaa2cd9291719d6a8f327606fc5aeeeb172b7ecb;hp=b5d83104413e091e186e0e08d40bd04d763a0b29;hpb=402ad79b07e541bf996b3f5f463d3a9ac4705a01;p=kivitendo-erp.git diff --git a/SL/Controller/RequirementSpecTextBlock.pm b/SL/Controller/RequirementSpecTextBlock.pm index b5d831044..02a27a537 100644 --- a/SL/Controller/RequirementSpecTextBlock.pm +++ b/SL/Controller/RequirementSpecTextBlock.pm @@ -18,6 +18,8 @@ use SL::DB::RequirementSpecTextBlock; use SL::Helper::Flash; use SL::Locale::String; +use constant SORTABLE_PICTURE_LIST => 'kivi.requirement_spec.make_text_block_picture_lists_sortable'; + use Rose::Object::MakeMethods::Generic ( scalar => [ qw(text_block) ], @@ -48,7 +50,9 @@ sub action_ajax_list { $self->show_list(output_position => $new_where, id => $::form->{clicked_id}, set_type => 1) if ($new_where != ($current_where // -1)); - $self->render($self->js); + $self->js + ->run(SORTABLE_PICTURE_LIST()) + ->render($self); } sub action_ajax_add { @@ -102,9 +106,11 @@ sub action_ajax_create { $self->invalidate_version ->hide('#text-block-list-empty') ->replaceWith('#' . $::form->{form_prefix} . '_form', $html) + ->run(SORTABLE_PICTURE_LIST()) ->jstree->create_node('#tree', $insert_after ? ('#tb-' . $insert_after, 'after') : ('#tb-' . ($attributes->{output_position} == 0 ? 'front' : 'back'), 'last'), $node) ->jstree->select_node('#tree', '#tb-' . $self->text_block->id); $self->add_new_text_block_form(output_position => $self->text_block->output_position, insert_after_id => $self->text_block->id, requirement_spec_id => $self->text_block->requirement_spec_id) + ->reinit_widgets ->render($self); } @@ -128,7 +134,11 @@ sub action_ajax_update { $self->invalidate_version ->remove('#' . $prefix . '_form') ->replaceWith('#text-block-' . $self->text_block->id, $html) + ->run(SORTABLE_PICTURE_LIST()) ->jstree->rename_node('#tree', '#tb-' . $self->text_block->id, $self->text_block->title) + ->prop('#tb-' . $self->text_block->id . ' a', 'title', $self->text_block->content_excerpt) + ->addClass('#tb-' . $self->text_block->id . ' a', 'tooltip') + ->reinit_widgets ->render($self); } @@ -221,7 +231,9 @@ sub action_dragged_and_dropped { } } - $self->js->render($self); + $self->js + ->run(SORTABLE_PICTURE_LIST()) + ->render($self); } sub action_ajax_copy { @@ -261,6 +273,7 @@ sub action_ajax_paste { my $node = $self->presenter->requirement_spec_text_block_jstree_data($self->text_block); $self->invalidate_version + ->run(SORTABLE_PICTURE_LIST()) ->jstree->create_node('#tree', $::form->{id} ? ('#tb-' . $::form->{id}, 'after') : ("#tb-${front_back}", 'last'), $node) ->render($self); } @@ -372,6 +385,14 @@ sub action_ajax_paste_picture { $self->paste_picture($copied); } +sub action_reorder_pictures { + my ($self) = @_; + + SL::DB::RequirementSpecPicture->reorder_list(@{ $::form->{picture_id} || [] }); + + $self->render(\'', { type => 'json' }); +} + # # filters #