Pflichtenheftabschnitte/-funktionsblöcke: HTML nutzen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 13 Jan 2014 12:40:05 +0000 (13:40 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:12:25 +0000 (13:12 +0200)
12 files changed:
SL/Controller/RequirementSpecItem.pm
SL/DB/RequirementSpecItem.pm
SL/Presenter/RequirementSpecItem.pm
templates/webpages/requirement_spec/_edit_time_and_cost_estimate_item.html
templates/webpages/requirement_spec/_show_time_and_cost_estimate_item.html
templates/webpages/requirement_spec_item/_function_block_content_top.html
templates/webpages/requirement_spec_item/_function_block_form.html
templates/webpages/requirement_spec_item/_section_form.html
templates/webpages/requirement_spec_item/_section_header.html
templates/webpages/requirement_spec_order/_assignment_form.html
templates/webpages/requirement_spec_order/list.html
templates/webpages/requirement_spec_order/update.html

index ffdf56e..9b8f643 100644 (file)
@@ -155,6 +155,7 @@ sub action_ajax_add_section {
     ->hide('#column-content > *')
     ->appendTo($html, '#column-content')
     ->focus('#new_section_title')
+    ->reinit_widgets
     ->render($self);
 }
 
@@ -241,9 +242,10 @@ sub action_ajax_edit {
       ->remove("#edit_section_form")
       ->insertAfter($html, '#section-header-' . $self->item->id)
       ->jstree->select_node('#tree', '#fb-' . $self->item->id)
-      ->focus("#edit_section_title")
       ->val('#current_content_type', 'section')
       ->val('#current_content_id',   $self->item->id)
+      ->reinit_widgets
+      ->focus("#edit_section_title")
       ->render($self);
     return;
   }
@@ -262,9 +264,10 @@ sub action_ajax_edit {
     ->insertAfter($html, $content_top_id)
     ->run('kivi.requirement_spec.init_function_block_keypress_events', "${id_base}_form")
     ->jstree->select_node('#tree', '#fb-' . $self->item->id)
-    ->focus("#${id_base}_description")
     ->val('#current_content_type', $self->item->item_type)
     ->val('#current_content_id', $self->item->id)
+    ->reinit_widgets
+    ->focus("#${id_base}_description")
     ->render($self);
 }
 
@@ -559,7 +562,7 @@ sub select_node {
 
 sub create_dependency_item {
   my $self = shift;
-  [ $_[0]->id, $self->presenter->truncate(join(' ', grep { $_ } ($_[1], $_[0]->fb_number, $_[0]->description))) ];
+  [ $_[0]->id, $self->presenter->truncate(join(' ', grep { $_ } ($_[1], $_[0]->fb_number, $_[0]->description_as_stripped_html))) ];
 }
 
 sub create_dependencies {
@@ -611,6 +614,7 @@ sub add_new_item_form {
     ->action($params{insert_position}, $html, $params{display_reference})
     ->action_if($self->item->item_type eq 'sub-function-block', 'show', '#sub-function-block-container-' . $self->item->parent_id)
     ->run('kivi.requirement_spec.init_function_block_keypress_events', "${id_base}_form")
+    ->reinit_widgets
     ->focus("#${id_base}_description");
 }
 
index 433e844..0e35ff9 100644 (file)
@@ -12,6 +12,7 @@ use SL::DB::MetaSetup::RequirementSpecItem;
 use SL::DB::Manager::RequirementSpecItem;
 use SL::DB::Helper::ActsAsList;
 use SL::DB::Helper::AttrDuration;
+use SL::DB::Helper::AttrHTML;
 use SL::DB::Default;
 use SL::Locale::String;
 use SL::PrefixedNumber;
@@ -40,6 +41,7 @@ __PACKAGE__->meta->initialize;
 
 __PACKAGE__->configure_acts_as_list(group_by => [qw(requirement_spec_id parent_id)]);
 __PACKAGE__->attr_duration(qw(time_estimation));
+__PACKAGE__->attr_html('description');
 
 __PACKAGE__->before_save(\&_before_save_create_fb_number);
 __PACKAGE__->before_save(\&_before_save_invalidate_requirement_spec_version);
@@ -128,7 +130,7 @@ sub child_type {
 sub content_excerpt {
   my ($self) = @_;
 
-  return Common::truncate($self->description // '', at => 200);
+  return Common::truncate($self->description_as_stripped_html // '', at => 200);
 }
 
 
index 357f8c5..faafd26 100644 (file)
@@ -12,7 +12,7 @@ use Carp;
 sub requirement_spec_item_tree_node_title {
   my ($self, $item) = @_;
 
-  return join(' ', map { $_ || '' } ($item->fb_number, $self->truncate($item->parent_id ? $item->description : $item->title, at => 30)));
+  return join(' ', map { $_ || '' } ($item->fb_number, $self->truncate($item->parent_id ? $item->description_as_stripped_html : $item->title, at => 30)));
 }
 
 sub requirement_spec_item_jstree_data {
index 593de9a..111dc49 100644 (file)
@@ -3,7 +3,7 @@
  [% L.hidden_tag("requirement_spec_items[+].id", item.id, id = id_prefix _ '_item_id') %]
 
  <td style="padding-left: [%- level * 50 -%]px">
-  [%- P.simple_format(item.fb_number _ ": " _ item.description) -%]
+  [%- item.fb_number _ ": " _ item.description_as_restricted_html -%]
  </td>
  <td>
   [%- L.select_tag('requirement_spec_items[].complexity_id', SELF.complexities, id=id_prefix _ '_complexity_id_' _ item.id, title_key='description', default=item.complexity_id, style="width: 100%") %]<br>
index 897d50f..c3d21e3 100644 (file)
@@ -1,7 +1,7 @@
 [%- USE HTML -%][%- USE LxERP -%][%- USE P -%]
 <tr class="listrow">
  <td style="padding-left: [%- level * 50 -%]px">
-  [%- P.simple_format(item.fb_number _ ": " _ item.description) -%]
+  [%- item.fb_number _ ": " _ item.description_as_restricted_html -%]
  </td>
  <td>[%- HTML.escape(item.complexity.description) -%]</td>
  <td>[%- HTML.escape(item.risk.description) -%]</td>
index bf34168..ac6d31f 100644 (file)
@@ -1,4 +1,4 @@
 [%- USE HTML -%][%- USE L -%]<div id="[% id_prefix %]function-block-content-top-[% requirement_spec_item.id %]">
  <div class="function-block-number">[%- HTML.escape(requirement_spec_item.fb_number) -%]</div>
- [%- L.simple_format(requirement_spec_item.description) -%]
+ [%- requirement_spec_item.description_as_restricted_html -%]
 </div>
index dbe5952..8b227e0 100644 (file)
@@ -28,7 +28,7 @@
 [%- ELSE -%]
     [%- LxERP.t8("Add sub function block") %]
 [%- END -%]:<br>
-    [% L.textarea_tag(id_base _ '.description', SELF.item.description, rows=8, style="width: 100%") %]
+    [% L.textarea_tag(id_base _ '.description_as_restricted_html', SELF.item.description_as_restricted_html, id=id_base _ '_description', rows=8, style="width: 100%", class='texteditor') %]
    </div>
 
    <div style="margin-top: 10px">
index c5ee157..9f65c9a 100644 (file)
@@ -27,7 +27,7 @@
 
  <p>
   [%- LxERP.t8("Description") %]:<br>
-  [% L.textarea_tag(id_base _ '.description', SELF.item.description, rows=8, cols=80, style=style) %]
+  [% L.textarea_tag(id_base _ '.description_as_restricted_html', SELF.item.description_as_restricted_html, id=id_base _ '_description', rows=8, cols=80, style=style, class='texteditor') %]
  </p>
 
  <p>
index ab70d99..4df9892 100644 (file)
@@ -13,7 +13,7 @@
 <div class="section-description" id="section-description">
  <div class="section-description-heading">[%- LxERP.t8("Preamble") %]</div>
  [% IF requirement_spec_item.description %]
-  [%- L.simple_format(requirement_spec_item.description) -%]
+  [%- requirement_spec_item.description_as_restricted_html -%]
  [%- ELSE %]
   <span class="dimmed-text">[%- LxERP.t8("No text has been entered yet.") %]</span>
  [%- END %]
index 28cc667..9990c55 100644 (file)
@@ -40,7 +40,7 @@
     [% L.hidden_tag("sections[+].id", section.id, no_id=1) %]
     <td>[% HTML.escape(section.fb_number) %]</td>
     <td>[% HTML.escape(section.title) %]</td>
-    <td>[% HTML.escape(P.truncate(section.description)) %]</td>
+    <td>[% HTML.escape(P.truncate(section.description_as_stripped_html)) %]</td>
     <td>[% P.part_picker('sections[].order_part_id', section.order_part_id, convertible_unit=SELF.h_unit_name, id='quotations_and_orders_sections_order_pard_id_' _ loop.count, style=style) %]</td>
    </tr>
    [% END %]
index 775ce18..b4bef1d 100644 (file)
@@ -23,7 +23,7 @@
     <tr class="listrow">
      <td>[% HTML.escape(section.fb_number) %]</td>
      <td>[% HTML.escape(section.title) %]</td>
-     <td>[% HTML.escape(P.truncate(section.description)) %]</td>
+     <td>[% HTML.escape(P.truncate(section.description_as_stripped_html)) %]</td>
      <td>
       [% IF section.order_part %]
        [% HTML.escape(section.order_part.partnumber) %] [% HTML.escape(section.order_part.description) %]
index 2230bd2..13b3798 100644 (file)
@@ -31,7 +31,7 @@
     <tr class="listrow">
      [% L.hidden_tag("orderitems[+].id", item.item.id, no_id=1) %]
      <td>[% HTML.escape(item.item.part.partnumber) %]</td>
-     <td>[% HTML.escape(item.item.description) %]</td>
+     <td>[% HTML.escape(item.item.description_as_stripped_html) %]</td>
      <td align="right">[% LxERP.format_amount(item.item.qty * 1) %] [% HTML.escape(item.item.unit) %]</td>
      <td align="right">[% LxERP.format_amount(item.item.qty * 1) %] [% HTML.escape(item.item.unit) %]</td>
      <td>[% L.select_tag('orderitems[].section_id', sections, default=item.section.id, title_sub=\make_section_title, style=style, no_id=1, with_empty=1, empty_title=LxERP.t8('Do not modify this position')) %]</td>