From: Moritz Bunkus Date: Wed, 13 Mar 2013 14:56:29 +0000 (+0100) Subject: Pflichtenhefte: Statischen JavaScript-Code nach js/requirement_spec.js verschieben X-Git-Tag: release-3.2.0beta~467^2~213 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a9cc182f3613fd21a698c9f40b8c5908d92c9da5;p=kivitendo-erp.git Pflichtenhefte: Statischen JavaScript-Code nach js/requirement_spec.js verschieben --- diff --git a/js/locale/de.js b/js/locale/de.js index 3fbe53804..d1f1ef816 100644 --- a/js/locale/de.js +++ b/js/locale/de.js @@ -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" }); diff --git a/js/requirement_spec.js b/js/requirement_spec.js index c84dc79f3..cec409777 100644 --- a/js/requirement_spec.js +++ b/js/requirement_spec.js @@ -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 } + } + }); +} diff --git a/templates/webpages/requirement_spec/show.html b/templates/webpages/requirement_spec/show.html index 5a92d0fbe..f3e75e721 100644 --- a/templates/webpages/requirement_spec/show.html +++ b/templates/webpages/requirement_spec/show.html @@ -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(); }); -->