Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fb1cb898

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID fb1cb898c1317c3d976ec511e21d5bd419837dca
  • Vorgänger bb3360db
  • Nachfolger 3fbb0b9b

Pflichtenhefttextblöcke: HTML nutzen

Unterschiede anzeigen:

SL/Controller/RequirementSpec.pm
267 267

  
268 268
  $::auth->assert('sales_quotation_edit');
269 269
  $::request->{layout}->use_stylesheet("${_}.css") for qw(jquery.contextMenu requirement_spec);
270
  $::request->{layout}->use_javascript("${_}.js")  for qw(jquery.jstree jquery/jquery.contextMenu jquery/jquery.hotkeys requirement_spec);
270
  $::request->{layout}->use_javascript("${_}.js")  for qw(jquery.jstree jquery/jquery.contextMenu jquery/jquery.hotkeys requirement_spec ckeditor/ckeditor ckeditor/adapters/jquery);
271 271
  $self->init_visible_section;
272 272

  
273 273
  return 1;
SL/Controller/RequirementSpecTextBlock.pm
85 85
     ->insertAfter($html, '#text-block-' . $self->text_block->id)
86 86
     ->jstree->select_node('#tree', '#tb-' . $self->text_block->id)
87 87
     ->focus('#edit_text_block_' . $self->text_block->id . '_title')
88
     ->reinit_widgets
88 89
     ->render($self);
89 90
}
90 91

  
......
456 457

  
457 458
  $self->js
458 459
     ->action($params{insert_after_id} ? 'insertAfter' : 'appendTo', $html, '#text-block-' . ($params{insert_after_id} || 'list'))
460
     ->reinit_widgets
459 461
     ->focus('#' . $id_base . '_title');
460 462
}
461 463

  
SL/DB/RequirementSpecTextBlock.pm
11 11
use SL::DB::MetaSetup::RequirementSpecTextBlock;
12 12
use SL::DB::Manager::RequirementSpecTextBlock;
13 13
use SL::DB::Helper::ActsAsList;
14
use SL::DB::Helper::AttrHTML;
14 15
use SL::Locale::String;
15 16

  
16 17
__PACKAGE__->meta->add_relationship(
......
24 25
__PACKAGE__->meta->initialize;
25 26

  
26 27
__PACKAGE__->configure_acts_as_list(group_by => [qw(requirement_spec_id output_position)]);
28
__PACKAGE__->attr_html('text');
27 29

  
28 30
__PACKAGE__->before_save(\  &_before_save_invalidate_requirement_spec_version);
29 31
__PACKAGE__->before_delete(\&_before_delete_invalidate_requirement_spec_version);
......
69 71
sub content_excerpt {
70 72
  my ($self) = @_;
71 73

  
72
  return Common::truncate($self->text // '', at => 200);
74
  return Common::truncate($self->text_as_stripped_html // '', at => 200);
73 75
}
74 76

  
75 77
1;
templates/webpages/requirement_spec_text_block/_form.html
36 36

  
37 37
  <tr>
38 38
   <th align="right" valign="top">[%- LxERP.t8("Description") %]:</th>
39
   <td valign="top">[% L.textarea_tag(id_base _ '.text', SELF.text_block.text, style = style, rows = 10) %]</td>
39
   <td valign="top">[% 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') %]</td>
40 40
  </tr>
41 41
 </table>
42 42

  
......
72 72
          || confirm('[%- LxERP.t8("Do you want to overwrite your current title?") %]')))
73 73
    title_ctrl.val(pt.title);
74 74

  
75
  if ((pt.text || '') != '') {
76
    var text_ctrl = $('#[% id_base %]_text');
77
    var text      = text_ctrl.val() || '';
78
    if (text != '')
79
      text += "\n\n";
80

  
81
    text_ctrl.val(text + pt.text);
82
  }
75
  if ((pt.text || '') != '')
76
    $('#[% id_base %]_text').ckeditorGet().insertHtml(pt.text);
83 77

  
84 78
  return false;
85 79
}
templates/webpages/requirement_spec_text_block/_text_block.html
8 8
  </div>
9 9
 [% ELSE %]
10 10
  <div class="requirement-spec-text-block-text">
11
   [% L.simple_format(text_block.text) %]
11
   [% text_block.text_as_restricted_html %]
12 12
  </div>
13 13
 [% END %]
14 14

  

Auch abrufbar als: Unified diff