From: Moritz Bunkus Date: Mon, 13 Jan 2014 10:54:49 +0000 (+0100) Subject: Pflichtenhefttextblöcke: HTML nutzen X-Git-Tag: release-3.2.0beta~467^2~51 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=fb1cb898c1317c3d976ec511e21d5bd419837dca;p=kivitendo-erp.git Pflichtenhefttextblöcke: HTML nutzen --- diff --git a/SL/Controller/RequirementSpec.pm b/SL/Controller/RequirementSpec.pm index 3fa13c0f5..b36d9b9ea 100644 --- a/SL/Controller/RequirementSpec.pm +++ b/SL/Controller/RequirementSpec.pm @@ -267,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 jquery/jquery.hotkeys 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; diff --git a/SL/Controller/RequirementSpecTextBlock.pm b/SL/Controller/RequirementSpecTextBlock.pm index 02a27a537..737f748e8 100644 --- a/SL/Controller/RequirementSpecTextBlock.pm +++ b/SL/Controller/RequirementSpecTextBlock.pm @@ -85,6 +85,7 @@ sub action_ajax_edit { ->insertAfter($html, '#text-block-' . $self->text_block->id) ->jstree->select_node('#tree', '#tb-' . $self->text_block->id) ->focus('#edit_text_block_' . $self->text_block->id . '_title') + ->reinit_widgets ->render($self); } @@ -456,6 +457,7 @@ sub add_new_text_block_form { $self->js ->action($params{insert_after_id} ? 'insertAfter' : 'appendTo', $html, '#text-block-' . ($params{insert_after_id} || 'list')) + ->reinit_widgets ->focus('#' . $id_base . '_title'); } diff --git a/SL/DB/RequirementSpecTextBlock.pm b/SL/DB/RequirementSpecTextBlock.pm index 9c59731ec..6ee48c552 100644 --- a/SL/DB/RequirementSpecTextBlock.pm +++ b/SL/DB/RequirementSpecTextBlock.pm @@ -11,6 +11,7 @@ use SL::Common (); use SL::DB::MetaSetup::RequirementSpecTextBlock; use SL::DB::Manager::RequirementSpecTextBlock; use SL::DB::Helper::ActsAsList; +use SL::DB::Helper::AttrHTML; use SL::Locale::String; __PACKAGE__->meta->add_relationship( @@ -24,6 +25,7 @@ __PACKAGE__->meta->add_relationship( __PACKAGE__->meta->initialize; __PACKAGE__->configure_acts_as_list(group_by => [qw(requirement_spec_id output_position)]); +__PACKAGE__->attr_html('text'); __PACKAGE__->before_save(\ &_before_save_invalidate_requirement_spec_version); __PACKAGE__->before_delete(\&_before_delete_invalidate_requirement_spec_version); @@ -69,7 +71,7 @@ sub pictures_sorted { sub content_excerpt { my ($self) = @_; - return Common::truncate($self->text // '', at => 200); + return Common::truncate($self->text_as_stripped_html // '', at => 200); } 1; diff --git a/templates/webpages/requirement_spec_text_block/_form.html b/templates/webpages/requirement_spec_text_block/_form.html index 425a5842c..897647880 100644 --- a/templates/webpages/requirement_spec_text_block/_form.html +++ b/templates/webpages/requirement_spec_text_block/_form.html @@ -36,7 +36,7 @@ [%- LxERP.t8("Description") %]: - [% L.textarea_tag(id_base _ '.text', SELF.text_block.text, style = style, rows = 10) %] + [% L.textarea_tag(id_base _ '.text_as_restricted_html', SELF.text_block.text_as_restricted_html, id = id_base _ '_text', style = style _ '; height: 200px', class='texteditor') %] @@ -72,14 +72,8 @@ function insert_selected_predefined_text() { || confirm('[%- LxERP.t8("Do you want to overwrite your current title?") %]'))) title_ctrl.val(pt.title); - if ((pt.text || '') != '') { - var text_ctrl = $('#[% id_base %]_text'); - var text = text_ctrl.val() || ''; - if (text != '') - text += "\n\n"; - - text_ctrl.val(text + pt.text); - } + if ((pt.text || '') != '') + $('#[% id_base %]_text').ckeditorGet().insertHtml(pt.text); return false; } diff --git a/templates/webpages/requirement_spec_text_block/_text_block.html b/templates/webpages/requirement_spec_text_block/_text_block.html index 860b83da5..16cddcf07 100644 --- a/templates/webpages/requirement_spec_text_block/_text_block.html +++ b/templates/webpages/requirement_spec_text_block/_text_block.html @@ -8,7 +8,7 @@ [% ELSE %]
- [% L.simple_format(text_block.text) %] + [% text_block.text_as_restricted_html %]
[% END %]