Pflichtenhefte: Textblöcke, Abschnitte und Funktionsblöcke markieren können
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 13 Mar 2013 10:12:08 +0000 (11:12 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:02:28 +0000 (13:02 +0200)
13 files changed:
SL/Controller/RequirementSpecItem.pm
SL/Controller/RequirementSpecTextBlock.pm
SL/Presenter/RequirementSpecItem.pm
SL/Presenter/RequirementSpecTextBlock.pm
css/requirement_spec.css
image/flag-red.png [new file with mode: 0644]
locale/de/all
templates/webpages/requirement_spec/show.html
templates/webpages/requirement_spec_item/_function_block.html
templates/webpages/requirement_spec_item/_function_block_content_top.html
templates/webpages/requirement_spec_item/_section.html
templates/webpages/requirement_spec_item/_sub_function_block.html
templates/webpages/requirement_spec_text_block/_text_block.html

index c2f470a..b1709ce 100644 (file)
@@ -23,7 +23,7 @@ use Rose::Object::MakeMethods::Generic
   'scalar --get_set_init' => [ qw(complexities risks) ],
 );
 
-__PACKAGE__->run_before('load_requirement_spec_item', only => [ qw(dragged_and_dropped ajax_update ajax_edit ajax_delete) ]);
+__PACKAGE__->run_before('load_requirement_spec_item', only => [ qw(dragged_and_dropped ajax_update ajax_edit ajax_delete ajax_flag) ]);
 __PACKAGE__->run_before('init_visible_section');
 
 #
@@ -322,6 +322,19 @@ sub action_ajax_delete {
      ->render($self);
 }
 
+sub action_ajax_flag {
+  my ($self) = @_;
+
+  $self->item->update_attributes(is_flagged => !$self->item->is_flagged);
+
+  my $is_visible = $self->visible_section && ($self->visible_section->id == $self->item->get_section->id);
+
+  SL::ClientJS->new
+   ->action_if($is_visible, 'toggleClass', '#' . $self->item->get_type . '-' . $self->item->id, 'flagged')
+   ->toggleClass('#fb-' . $self->item->id, 'flagged')
+   ->render($self);
+}
+
 #
 # filters
 #
index 7d339a8..eaf8b6f 100644 (file)
@@ -19,7 +19,7 @@ use Rose::Object::MakeMethods::Generic
   'scalar --get_set_init' => [ qw(predefined_texts) ],
 );
 
-__PACKAGE__->run_before('load_requirement_spec_text_block', only => [qw(ajax_edit ajax_update ajax_delete dragged_and_dropped)]);
+__PACKAGE__->run_before('load_requirement_spec_text_block', only => [qw(ajax_edit ajax_update ajax_delete ajax_flag dragged_and_dropped)]);
 
 #
 # actions
@@ -172,6 +172,19 @@ sub action_ajax_delete {
      ->render($self);
 }
 
+sub action_ajax_flag {
+  my ($self) = @_;
+
+  $self->text_block->update_attributes(is_flagged => !$self->text_block->is_flagged);
+
+  my $current_where = $self->output_position_from_id($::form->{current_content_id}, $::form->{current_content_type});
+
+  SL::ClientJS->new
+   ->action_if($current_where == $self->text_block->output_position, 'toggleClass', '#text-block-' . $self->text_block->id, 'flagged')
+   ->toggleClass('#tb-' . $self->text_block->id, 'flagged')
+   ->render($self);
+}
+
 sub action_dragged_and_dropped {
   my ($self)       = @_;
 
index b7f377e..f1c30bb 100644 (file)
@@ -20,11 +20,13 @@ sub requirement_spec_item_jstree_data {
 
   my @children = map { $self->requirement_spec_item_jstree_data($_, %params) } @{ $item->sorted_children };
   my $type     = !$item->parent_id ? 'section' : 'function-block';
+  my $class    = $type . '-context-menu';
+  $class      .= ' flagged' if $item->is_flagged;
 
   return {
     data     => $self->requirement_spec_item_tree_node_title($item),
     metadata => { id =>         $item->id, type => $type },
-    attr     => { id => "fb-" . $item->id, href => $params{href} || '#', class => $type . '-context-menu' },
+    attr     => { id => "fb-" . $item->id, href => $params{href} || '#', class => $class },
     children => \@children,
   };
 }
index dc045ff..c0b983a 100644 (file)
@@ -14,10 +14,13 @@ use SL::JSON;
 sub requirement_spec_text_block_jstree_data {
   my ($self, $text_block, %params) = @_;
 
+  my $class  = 'text-block-context-menu';
+  $class    .= ' flagged' if $text_block->is_flagged;
+
   return {
     data     => $text_block->title || '',
     metadata => { id =>         $text_block->id, type => 'text-block' },
-    attr     => { id => "tb-" . $text_block->id, href => $params{href} || '#', class => 'text-block-context-menu' },
+    attr     => { id => "tb-" . $text_block->id, href => $params{href} || '#', class => $class },
   };
 }
 
index 761b191..f198a45 100644 (file)
@@ -1,3 +1,7 @@
+/* ------------------------------------------------------------ */
+/* General page layout */
+/* ------------------------------------------------------------ */
+
 input.rs_input_field, select.rs_input_field,
 table.rs_input_field input, table.rs_input_field select {
   width: 300px;
@@ -26,6 +30,26 @@ table.rs_input_field input, table.rs_input_field select {
   color: #bbb;
 }
 
+/* ------------------------------------------------------------ */
+/* Special things that apply to the tree */
+/* ------------------------------------------------------------ */
+
+#tree li.flagged > a > ins {
+ background-image: url("../image/flag-red.png") !important;
+ background-position: 0;
+}
+
+/* ------------------------------------------------------------ */
+/* Special things that apply to the context menu */
+/* ------------------------------------------------------------ */
+
+.context-menu-item.icon-flag { background-image: url("../image/flag-red.png"); }
+
+
+/* ------------------------------------------------------------ */
+/* Sections & function blocks */
+/* ------------------------------------------------------------ */
+
 .function-block {
   border-bottom: 1px solid #bbb;
 }
@@ -43,6 +67,7 @@ table.rs_input_field input, table.rs_input_field select {
 
 .sub-function-block {
   border-bottom: 1px solid #ccc;
+  background-color: #fff;
 }
 
 .sub-function-block-container {
@@ -62,6 +87,65 @@ table.rs_input_field input, table.rs_input_field select {
   border: 1px solid rgb(0, 100, 0);
 }
 
+.function-block-number {
+  font-weight: bold;
+}
+
 .function-block-form > div {
   padding: 5px;
 }
+
+/* Flagged sections, function blocks, text blocks */
+
+.section.flagged .section-description {
+  background-color: #feece3;
+  border: 1px solid #fe5f14;
+}
+
+.section.flagged .section-description > .section-description-heading {
+  background-color: #fe5f14;
+  color: #fff;
+}
+
+
+.function-block.flagged {
+  background-color: #feece3;
+  border: 1px solid #fe5f14;
+}
+
+.function-block.flagged > .function-block-content > div > .function-block-number {
+  background-color: #fe5f14;
+  color: #fff;
+}
+
+.sub-function-block.flagged {
+  background-color: #feece3;
+  border: 1px solid #fe5f14;
+}
+
+.sub-function-block.flagged > .sub-function-block-content > div > .function-block-number {
+  background-color: #fe5f14;
+  color: #fff;
+}
+
+/* ------------------------------------------------------------ */
+/* Text blocks */
+/* ------------------------------------------------------------ */
+
+.requirement-spec-text-block {
+  margin-top: 10px;
+}
+
+.requirement-spec-text-block > h2 {
+  margin-top: 0px;
+}
+
+.requirement-spec-text-block.flagged {
+  background-color: #feece3;
+  border: 1px solid #fe5f14;
+}
+
+.requirement-spec-text-block.flagged > h2 {
+  background-color: #fe5f14;
+  color: #fff;
+}
diff --git a/image/flag-red.png b/image/flag-red.png
new file mode 100644 (file)
index 0000000..dd6d527
Binary files /dev/null and b/image/flag-red.png differ
index a3528d9..e3be4f3 100755 (executable)
@@ -2463,6 +2463,7 @@ $self->{texts} = {
   'To Date'                     => 'Bis',
   'To continue please change the taxkey 0 to another value.' => 'Um fortzufahren, ändern Sie bitte den Steuerschlüssel 0 auf einen anderen Wert.',
   'To user login'               => 'Zum Benutzerlogin',
+  'Toggle marker'               => 'Markierung umschalten',
   'Top'                         => 'Oben',
   'Top (CSS)'                   => 'Oben (mit CSS)',
   'Top (Javascript)'            => 'Oben (mit Javascript)',
index 655fe65..e4846f5 100644 (file)
@@ -115,6 +115,8 @@ $(function(){
       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 }
     }
@@ -129,7 +131,9 @@ $(function(){
       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:               "---------",
+      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 }
     }
@@ -144,6 +148,8 @@ $(function(){
       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 }
     }
index 038ff23..4105838 100644 (file)
@@ -1,7 +1,7 @@
 [%- USE HTML -%][%- USE LxERP -%][%- USE P -%][%- USE L -%]
-<div id="function-block-[% requirement_spec_item.id %]" class="function-block">
+<div id="function-block-[% requirement_spec_item.id %]" class="function-block[%- IF requirement_spec_item.is_flagged -%] flagged[%- END -%]">
 
- <div id="function-block-content-[%- requirement_spec_item.id -%]" class="function-block-content[%- IF requirement_spec_item.flagged -%] flagged[%- END -%] function-block-context-menu">
+ <div id="function-block-content-[%- requirement_spec_item.id -%]" class="function-block-content function-block-context-menu">
 
   [% INCLUDE 'requirement_spec_item/_function_block_content_top.html' id_prefix='' %]
 
index c52e177..8c9e498 100644 (file)
@@ -1,4 +1,4 @@
 [%- USE HTML -%][%- USE L -%]<div id="[% id_prefix %]function-block-content-top-[% requirement_spec_item.id %]">
- <b>[%- HTML.escape(requirement_spec_item.fb_number) -%]</b> &lt;[% requirement_spec_item.id %]&gt;
+ <div class="function-block-number">[%- HTML.escape(requirement_spec_item.fb_number) -%] &lt;[% requirement_spec_item.id %]&gt;</div>
  [%- L.simple_format(requirement_spec_item.description) -%]
 </div>
index bc6aed0..8e7699d 100644 (file)
@@ -1,5 +1,5 @@
 [%- USE HTML -%][%- USE LxERP -%][%- USE L -%]
-<div id="full-section-content">
+<div id="section-[% requirement_spec_item.id %]" class="section[%- IF requirement_spec_item.is_flagged -%]flagged[%- END -%]">
  <div class="section-context-menu" id="section-header-[% requirement_spec_item.id %]">
   [%- INCLUDE 'requirement_spec_item/_section_header.html' %]
  </div>
index 576d237..95f23eb 100644 (file)
@@ -1,7 +1,7 @@
 [%- USE HTML -%][%- USE LxERP -%][%- USE P -%]
-<div id="sub-function-block-[% requirement_spec_item.id %]" class="sub-function-block">
+<div id="sub-function-block-[% requirement_spec_item.id %]" class="sub-function-block[%- IF requirement_spec_item.is_flagged -%] flagged[%- END -%]">
 
- <div id="sub-function-block-content-[%- requirement_spec_item.id -%]" class="sub-function-block-content[%- IF requirement_spec_item.flagged -%] flagged[%- END -%] sub-function-block-context-menu">
+ <div id="sub-function-block-content-[%- requirement_spec_item.id -%]" class="sub-function-block-content sub-function-block-context-menu">
   [% INCLUDE 'requirement_spec_item/_function_block_content_top.html' id_prefix='sub-' %]
   [% INCLUDE 'requirement_spec_item/_function_block_content_bottom.html' id_prefix='sub-' %]
  </div>
index 6028289..6d456bf 100644 (file)
@@ -1,5 +1,5 @@
 [%- USE HTML -%][%- USE L -%][%- USE LxERP -%]
-<div id="text-block-[% HTML.escape(text_block.id) %]" class="requirement-spec-text-block text-block-context-menu">
+<div id="text-block-[% HTML.escape(text_block.id) %]" class="requirement-spec-text-block text-block-context-menu[% IF text_block.is_flagged %] flagged[% END %]">
  <h2 class="requirement-spec-text-block-title">[% IF !text_block.title %]<span class="dimmed-text">[%- LxERP.t8("No title yet") %]</span>[% END %][%- HTML.escape(text_block.title) %]</h2>
 
  [% IF !text_block.text %]