Pflichtenheftitems & Textblöcke: Selektion bei Popupmenü durch Markierung links anzeigen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 13 Mar 2013 17:45:51 +0000 (18:45 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:02:29 +0000 (13:02 +0200)
css/requirement_spec.css
js/requirement_spec.js

index f198a45..d5edd4b 100644 (file)
@@ -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;
+}
index ac96fc2..39beb0d 100644 (file)
@@ -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:                   "---------"