Pflichtenhefte: Statischen JavaScript-Code nach js/requirement_spec.js verschieben
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 13 Mar 2013 14:56:29 +0000 (15:56 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:02:28 +0000 (13:02 +0200)
js/locale/de.js
js/requirement_spec.js
templates/webpages/requirement_spec/show.html

index 3fbe538..d1f1ef8 100644 (file)
@@ -1,5 +1,9 @@
 namespace("kivi").setupLocale({
+"Add function block":"Funktionsblock hinzufügen",
 "Add linked record":"Verknüpften Beleg hinzufügen",
+"Add section":"Abschnitt hinzufügen",
+"Add sub function block":"Unterfunktionsblock hinzufügen",
+"Add text block":"Textblock erfassen",
 "Are you sure?":"Sind Sie sicher?",
 "Database Connection Test":"Test der Datenbankverbindung",
 "Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?":"Soll die Kontonummer \"#1\" zu \"#2\" und den Name \"#3\" zu \"#4\" geändert werden?",
@@ -11,4 +15,11 @@ namespace("kivi").setupLocale({
 "The name must only consist of letters, numbers and underscores and start with a letter.":"Der Name darf nur aus Buchstaben (keine Umlaute), Ziffern und Unterstrichen bestehen und muss mit einem Buchstaben beginnen.",
 "The option field is empty.":"Das Optionsfeld ist leer.",
 "The selected database is still configured for client \"#1\". If you delete the database that client will stop working until you re-configure it. Do you still want to delete the database?":"Die auswählte Datenbank ist noch für Mandant \"#1\" konfiguriert. Wenn Sie die Datenbank löschen, wird der Mandanten nicht mehr funktionieren, bis er anders konfiguriert wurde. Wollen Sie die Datenbank trotzdem löschen?"
+"Copy":"Kopieren",
+"Delete":"Löschen",
+"Delete text block":"Textblock löschen",
+"Edit":"Bearbeiten",
+"Edit text block":"Textblock bearbeiten",
+"Paste":"Einfügen",
+"Toggle marker":"Markierung umschalten"
 });
index c84dc79..cec4097 100644 (file)
@@ -178,6 +178,12 @@ function cancel_edit_text_block_form(id_base) {
     $('#text-block-' + id).show();
 }
 
+function ask_delete_text_block(key, opt) {
+  if (confirm(kivi.t8("Are you sure?")))
+    standard_text_block_ajax_call(key, opt);
+  return true;
+}
+
 // --------------------------------------------------------------------------------
 // ------------------------------ sections and items ------------------------------
 // --------------------------------------------------------------------------------
@@ -248,3 +254,63 @@ function cancel_edit_item_form(form_id_base, options) {
   if (options.to_hide_if_empty && (1 == $(options.to_hide_if_empty).children().size()))
     $(options.to_hide_if_empty).hide();
 }
+
+function ask_delete_item(key, opt) {
+  if (confirm(kivi.t8("Are you sure?")))
+    standard_item_ajax_call(key, opt);
+  return true;
+}
+
+function create_requirement_spec_context_menus() {
+  $.contextMenu({
+    selector: '.text-block-context-menu',
+    items: {
+        add:    { name: kivi.t8('Add text block'),    icon: "add",    callback: standard_text_block_ajax_call }
+      , edit:   { name: kivi.t8('Edit text block'),   icon: "edit",   callback: standard_text_block_ajax_call, disabled: disable_edit_text_block_commands }
+      , delete: { name: kivi.t8('Delete text block'), icon: "delete", callback: ask_delete_text_block,         disabled: disable_edit_text_block_commands }
+      , sep1:   "---------"
+      , flag:   { name: kivi.t8('Toggle marker'),     icon: "flag",   callback: standard_text_block_ajax_call, disabled: disable_edit_text_block_commands }
+      , sep2:   "---------"
+      , copy:   { name: kivi.t8('Copy'),              icon: "copy",                                            disabled: function() { return true; } }
+      , paste:  { name: kivi.t8('Paste'),             icon: "paste",                                           disabled: function() { return true; } }
+      // , copy:   { name: kivi.t8('Copy'),              icon: "copy",                                            disabled: disable_edit_text_block_commands }
+      // , paste:  { name: kivi.t8('Paste'),             icon: "paste",                                           disabled: disable_edit_text_block_commands }
+    }
+  });
+
+  $.contextMenu({
+    selector: '.section-context-menu',
+    items: {
+        add_section:        { name: kivi.t8('Add section'),        icon: "add",    callback: standard_item_ajax_call }
+      , add_function_block: { name: kivi.t8('Add function block'), icon: "add",    callback: standard_item_ajax_call, disabled: disable_add_function_block_command }
+      , sep1:               "---------"
+      , edit:               { name: kivi.t8('Edit'),               icon: "edit",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
+      , delete:             { name: kivi.t8('Delete'),             icon: "delete", callback: ask_delete_item,         disabled: disable_edit_item_commands }
+      , sep2:               "---------"
+      , flag:               { name: kivi.t8('Toggle marker'),      icon: "flag",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
+      , sep3:               "---------"
+      , copy:               { name: kivi.t8('Copy'),               icon: "copy",                                      disabled: function() { return true; } }
+      , paste:              { name: kivi.t8('Paste'),              icon: "paste",                                     disabled: function() { return true; } }
+      // , copy:               { name: kivi.t8('Copy'),               icon: "copy",                                      disabled: disable_edit_item_commands }
+      // , paste:              { name: kivi.t8('Paste'),              icon: "paste",                                     disabled: disable_edit_item_commands }
+    }
+  });
+
+  $.contextMenu({
+    selector: '.function-block-context-menu,.sub-function-block-context-menu',
+    items: {
+        add_function_block:     { name: kivi.t8('Add function block'),     icon: "add",    callback: standard_item_ajax_call }
+      , add_sub_function_block: { name: kivi.t8('Add sub function block'), icon: "add",    callback: standard_item_ajax_call }
+      , sep1:                   "---------"
+      , edit:                   { name: kivi.t8('Edit'),                   icon: "edit",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
+      , delete:                 { name: kivi.t8('Delete'),                 icon: "delete", callback: ask_delete_item,         disabled: disable_edit_item_commands }
+      , sep2:                   "---------"
+      , flag:                   { name: kivi.t8('Toggle marker'),          icon: "flag",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands }
+      , sep3:                   "---------"
+      , copy:                   { name: kivi.t8('Copy'),                   icon: "copy",                                      disabled: function() { return true; } }
+      , paste:                  { name: kivi.t8('Paste'),                  icon: "paste",                                     disabled: function() { return true; } }
+      // , copy:                   { name: kivi.t8('Copy'),                   icon: "copy",                                      disabled: disable_edit_item_commands }
+      // , paste:                  { name: kivi.t8('Paste'),                  icon: "paste",                                     disabled: disable_edit_item_commands }
+    }
+  });
+}
index 5a92d0f..f3e75e7 100644 (file)
@@ -99,67 +99,8 @@ $(function() {
 [% IF SELF.requirement_spec_item %]
   $.jstree._reference("#tree").select_node('#fb-[% SELF.requirement_spec_item.id %]', true);
 [% END %]
-});
-
-function ask_delete_text_block(key, opt) {
-  if (confirm("[% LxERP.t8("Are you sure?") %]"))
-    standard_text_block_ajax_call(key, opt);
-  return true;
-}
-
-function ask_delete_item(key, opt) {
-  if (confirm("[% LxERP.t8("Are you sure?") %]"))
-    standard_item_ajax_call(key, opt);
-  return true;
-}
-
-$(function(){
-  $.contextMenu({
-    selector: '.text-block-context-menu',
-    items: {
-      add:    { name: "[% LxERP.t8('Add text block') %]",    icon: "add",    callback: standard_text_block_ajax_call },
-      edit:   { name: "[% LxERP.t8('Edit text block') %]",   icon: "edit",   callback: standard_text_block_ajax_call, disabled: disable_edit_text_block_commands },
-      delete: { name: "[% LxERP.t8('Delete text block') %]", icon: "delete", callback: ask_delete_text_block,         disabled: disable_edit_text_block_commands },
-      sep1:   "---------",
-      flag:   { name: "[% LxERP.t8('Toggle marker') %]",     icon: "flag",  callback: standard_text_block_ajax_call, disabled: disable_edit_text_block_commands },
-      sep2:   "---------",
-      copy:   { name: "[% LxERP.t8('Copy') %]",              icon: "copy",  disabled: disable_edit_text_block_commands },
-      paste:  { name: "[% LxERP.t8('Paste') %]",             icon: "paste", disabled: disable_edit_text_block_commands }
-    }
-  });
-
-
-  $.contextMenu({
-    selector: '.section-context-menu',
-    items: {
-      add_section:        { name: "[% LxERP.t8('Add section') %]",        icon: "add",    callback: standard_item_ajax_call },
-      add_function_block: { name: "[% LxERP.t8('Add function block') %]", icon: "add",    callback: standard_item_ajax_call, disabled: disable_add_function_block_command },
-      sep1:               "---------",
-      edit:               { name: "[% LxERP.t8('Edit') %]",               icon: "edit",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands },
-      delete:             { name: "[% LxERP.t8('Delete') %]",             icon: "delete", callback: ask_delete_item,         disabled: disable_edit_item_commands },
-      sep2:                   "---------",
-      flag:               { name: "[% LxERP.t8('Toggle marker') %]", icon: "flag", callback: standard_item_ajax_call, disabled: disable_edit_item_commands },
-      sep3:               "---------",
-      copy:               { name: "[% LxERP.t8('Copy') %]",               icon: "copy",  disabled: disable_edit_item_commands },
-      paste:              { name: "[% LxERP.t8('Paste') %]",              icon: "paste", disabled: disable_edit_item_commands }
-    }
-  });
 
-  $.contextMenu({
-    selector: '.function-block-context-menu,.sub-function-block-context-menu',
-    items: {
-      add_function_block:     { name: "[% LxERP.t8('Add function block') %]",     icon: "add", callback: standard_item_ajax_call },
-      add_sub_function_block: { name: "[% LxERP.t8('Add sub function block') %]", icon: "add", callback: standard_item_ajax_call },
-      sep1:                   "---------",
-      edit:                   { name: "[% LxERP.t8('Edit') %]",   icon: "edit",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands },
-      delete:                 { name: "[% LxERP.t8('Delete') %]", icon: "delete", callback: ask_delete_item,         disabled: disable_edit_item_commands },
-      sep2:                   "---------",
-      flag:                   { name: "[% LxERP.t8('Toggle marker') %]", icon: "flag", callback: standard_item_ajax_call, disabled: disable_edit_item_commands },
-      sep3:                   "---------",
-      copy:                   { name: "[% LxERP.t8('Copy') %]",  icon: "copy",  disabled: disable_edit_item_commands },
-      paste:                  { name: "[% LxERP.t8('Paste') %]", icon: "paste", disabled: disable_edit_item_commands }
-    }
-  });
+  create_requirement_spec_context_menus();
 });
 
   -->