Refactoring: SL::Template: Parameterübergabe als Hash, nicht positionsabhängig
[kivitendo-erp.git] / templates / webpages / requirement_spec_text_block / _form.html
index 8a8a6d3..8976478 100644 (file)
 
   <tr>
    <th align="right" valign="top">[%- LxERP.t8("Description") %]:</th>
-   <td valign="top">[% L.textarea_tag(id_base _ '.text', SELF.text_block.text, style = style, rows = 10) %]</td>
+   <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>
   </tr>
  </table>
 
  <p>
   [%- L.ajax_submit_tag('controller.pl?action=RequirementSpecTextBlock/ajax_' _ (SELF.text_block.id ? 'update' : 'create'), '#' _ id_base _ '_form', LxERP.t8('Save')) %]
-  <a href="#" onclick="cancel_edit_text_block_form('[% id_base %]')">[%- LxERP.t8("Cancel") %]</a>
+  <a href="#" onclick="kivi.requirement_spec.cancel_edit_text_block_form('[% id_base %]')">[%- LxERP.t8("Cancel") %]</a>
  </p>
 
 [%- IF SELF.predefined_texts.size %]
@@ -67,19 +67,13 @@ function insert_selected_predefined_text() {
 
   var title_ctrl = $('#[% id_base %]_title');
 
-  if (   ((title_ctrl.val() || '') != '')
-      && ((pt.title         || '') != '')
-      && confirm('[%- LxERP.t8("Do you want to overwrite your current title?") %]'))
+  if (   ((pt.title         || '') != '')
+      && (   ((title_ctrl.val() || '') == '')
+          || 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;
 }