From a202449b1b075b708ec4c68e0be1faf02ce2d031 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 13 Mar 2013 18:45:51 +0100 Subject: [PATCH] =?utf8?q?Pflichtenheftitems=20&=20Textbl=C3=B6cke:=20Sele?= =?utf8?q?ktion=20bei=20Popupmen=C3=BC=20durch=20Markierung=20links=20anze?= =?utf8?q?igen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- css/requirement_spec.css | 73 +++++++++++++++++++++------------------- js/requirement_spec.js | 53 +++++++++++++++++++++++++++-- 2 files changed, 89 insertions(+), 37 deletions(-) diff --git a/css/requirement_spec.css b/css/requirement_spec.css index f198a45fc..d5edd4bee 100644 --- a/css/requirement_spec.css +++ b/css/requirement_spec.css @@ -50,8 +50,9 @@ table.rs_input_field input, table.rs_input_field select { /* Sections & function blocks */ /* ------------------------------------------------------------ */ -.function-block { - border-bottom: 1px solid #bbb; +.section { + border-left: 0; + margin-left: 0; } .section-description-heading { @@ -65,21 +66,10 @@ table.rs_input_field input, table.rs_input_field select { margin-bottom: 15px; } -.sub-function-block { - border-bottom: 1px solid #ccc; - background-color: #fff; -} - -.sub-function-block-container { - margin: 10px 0px 10px 20px; - border: 1px solid #ccc; -} - -.sub-function-block-header { - padding: 5px; - font-weight: bold; - color: #fff; - background: #ccc; +.function-block { + border-bottom: 1px solid #bbb; + border-left: 0; + margin-left: 0; } .function-block-form { @@ -95,37 +85,45 @@ table.rs_input_field input, table.rs_input_field select { padding: 5px; } -/* Flagged sections, function blocks, text blocks */ +.sub-function-block { + background-color: #fff; + border-bottom: 1px solid #ccc; + border-left: 0; + margin-left: 0; +} -.section.flagged .section-description { - background-color: #feece3; - border: 1px solid #fe5f14; +.sub-function-block-container { + margin: 10px 0px 10px 20px; + border: 1px solid #ccc; } -.section.flagged .section-description > .section-description-heading { - background-color: #fe5f14; +.sub-function-block-header { + padding: 5px; + font-weight: bold; color: #fff; + background: #ccc; } +/* Flagged sections, function blocks, text blocks */ -.function-block.flagged { +.section.flagged .section-description, +.function-block.flagged, +.sub-function-block.flagged { background-color: #feece3; - border: 1px solid #fe5f14; } -.function-block.flagged > .function-block-content > div > .function-block-number { +.section.flagged .section-description > .section-description-heading, +.function-block.flagged > .function-block-content > div > .function-block-number, +.sub-function-block.flagged > .sub-function-block-content > div > .function-block-number { background-color: #fe5f14; color: #fff; } -.sub-function-block.flagged { - background-color: #feece3; - border: 1px solid #fe5f14; -} +/* Selected sections, function blocks, text blocks */ -.sub-function-block.flagged > .sub-function-block-content > div > .function-block-number { - background-color: #fe5f14; - color: #fff; +.section.selected, .function-block.selected, .sub-function-block.selected { + margin-left: -3px; + border-left: 3px solid #cbb120; } /* ------------------------------------------------------------ */ @@ -133,6 +131,8 @@ table.rs_input_field input, table.rs_input_field select { /* ------------------------------------------------------------ */ .requirement-spec-text-block { + border-left: 0; + margin-left: 3px; margin-top: 10px; } @@ -142,10 +142,15 @@ table.rs_input_field input, table.rs_input_field select { .requirement-spec-text-block.flagged { background-color: #feece3; - border: 1px solid #fe5f14; + /* border: 1px solid #fe5f14; */ } .requirement-spec-text-block.flagged > h2 { background-color: #fe5f14; color: #fff; } + +.requirement-spec-text-block.selected { + border-left: 3px solid #cbb120; + margin-left: 0; +} diff --git a/js/requirement_spec.js b/js/requirement_spec.js index ac96fc2ad..39beb0d87 100644 --- a/js/requirement_spec.js +++ b/js/requirement_spec.js @@ -237,10 +237,50 @@ function ask_delete_item(key, opt) { return true; } +function handle_text_block_popup_menu_markings(opt, add) { + var id = find_text_block_id(opt.$trigger); + if (id) + $('#text-block-' + id).toggleClass('selected', add); + return true; +} + +function requirement_spec_text_block_popup_menu_shown(opt) { + return handle_text_block_popup_menu_markings(opt, true); +} + +function requirement_spec_text_block_popup_menu_hidden(opt) { + return handle_text_block_popup_menu_markings(opt, false); +} + + +function handle_item_popup_menu_markings(opt, add) { + var id = find_item_id(opt.$trigger); + if (id) + $('#section-' + id + ',#function-block-' + id + ',#sub-function-block-' + id).toggleClass('selected', add); + return true; +} + +function requirement_spec_item_popup_menu_shown(opt) { + return handle_item_popup_menu_markings(opt, true); +} + +function requirement_spec_item_popup_menu_hidden(opt) { + return handle_item_popup_menu_markings(opt, false); +} + function create_requirement_spec_context_menus() { + var events = { + show: requirement_spec_text_block_popup_menu_shown, + hide: requirement_spec_text_block_popup_menu_hidden + }; + $.contextMenu({ selector: '.text-block-context-menu', - items: { + events: { + show: requirement_spec_text_block_popup_menu_shown + , hide: requirement_spec_text_block_popup_menu_hidden + }, + 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 } @@ -254,9 +294,15 @@ function create_requirement_spec_context_menus() { } }); + var events = { + show: requirement_spec_item_popup_menu_shown, + hide: requirement_spec_item_popup_menu_hidden + }; + $.contextMenu({ selector: '.section-context-menu', - items: { + events: events, + 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: "---------" @@ -274,7 +320,8 @@ function create_requirement_spec_context_menus() { $.contextMenu({ selector: '.function-block-context-menu,.sub-function-block-context-menu', - items: { + events: events, + 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: "---------" -- 2.20.1