From 90f4ba5dc6212592754cdddd082640103ee15884 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 13 Mar 2013 11:12:08 +0100 Subject: [PATCH] =?utf8?q?Pflichtenhefte:=20Textbl=C3=B6cke,=20Abschnitte?= =?utf8?q?=20und=20Funktionsbl=C3=B6cke=20markieren=20k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/RequirementSpecItem.pm | 15 +++- SL/Controller/RequirementSpecTextBlock.pm | 15 +++- SL/Presenter/RequirementSpecItem.pm | 4 +- SL/Presenter/RequirementSpecTextBlock.pm | 5 +- css/requirement_spec.css | 84 ++++++++++++++++++ image/flag-red.png | Bin 0 -> 1656 bytes locale/de/all | 1 + templates/webpages/requirement_spec/show.html | 8 +- .../_function_block.html | 4 +- .../_function_block_content_top.html | 2 +- .../requirement_spec_item/_section.html | 2 +- .../_sub_function_block.html | 4 +- .../_text_block.html | 2 +- 13 files changed, 134 insertions(+), 12 deletions(-) create mode 100644 image/flag-red.png diff --git a/SL/Controller/RequirementSpecItem.pm b/SL/Controller/RequirementSpecItem.pm index c2f470aba..b1709ce09 100644 --- a/SL/Controller/RequirementSpecItem.pm +++ b/SL/Controller/RequirementSpecItem.pm @@ -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 # diff --git a/SL/Controller/RequirementSpecTextBlock.pm b/SL/Controller/RequirementSpecTextBlock.pm index 7d339a873..eaf8b6fdc 100644 --- a/SL/Controller/RequirementSpecTextBlock.pm +++ b/SL/Controller/RequirementSpecTextBlock.pm @@ -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) = @_; diff --git a/SL/Presenter/RequirementSpecItem.pm b/SL/Presenter/RequirementSpecItem.pm index b7f377e2c..f1c30bb50 100644 --- a/SL/Presenter/RequirementSpecItem.pm +++ b/SL/Presenter/RequirementSpecItem.pm @@ -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, }; } diff --git a/SL/Presenter/RequirementSpecTextBlock.pm b/SL/Presenter/RequirementSpecTextBlock.pm index dc045ff31..c0b983a7c 100644 --- a/SL/Presenter/RequirementSpecTextBlock.pm +++ b/SL/Presenter/RequirementSpecTextBlock.pm @@ -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 }, }; } diff --git a/css/requirement_spec.css b/css/requirement_spec.css index 761b191aa..f198a45fc 100644 --- a/css/requirement_spec.css +++ b/css/requirement_spec.css @@ -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 index 0000000000000000000000000000000000000000..dd6d527d6cfe4e10d796cb0310ecb0e731c13838 GIT binary patch literal 1656 zcmV-;28a2HP)r09Qy!^#3BK!cEr`V8vZ?DwP72>HUdOdMTJI%;tp~QQbVSj;>GBaf+-hFvh zrYKW{S6)4p+nd{q-)>&zo8g;*N0)vMG*n>$Fx30^kN1xQ3_Bw;cpVkzsqj?X*%czS zYPM=_Hs+n>mGDZUKQ7C%uC%V4Wp`32@)P+1ly0@pwaS&vM7OV<@ib-$QJnFgEgnS!( z8xB8gO%1*kd`s2YzAZdIJYS(|@0Ba$ikQOgiM4}k2g85qxura)JeYL6$=AEiyDlod zG8)W~EjvPi;jH7cv}bAN0o7C8Q{9BUx16e@>I@rXi^zrKLWGn>{MG!`#(4*?i>`{U zBGeKj9g&WpH)q?UYNBco>b6w`DS{B{IikF$yoX-*8P#d(G!)Ulwp>-NGGCWutFzTz z{a@=n_jvAE>@>8$QP3y=_(^oA<4^~D3g;?bRKKVOFz8K_rb+XFGHQexF&vV~NC(ov zJV3{P%zykg?NE_8MjV4Sw`>Yj1}aTgI!?uMVmZbwSC(e)XFQZPd>gZ>7l3V{L`o7 z6XFvPYFwS1lbnNYw-j$MZ7?Bp#aEfGO#fBetydH%3YzYoP>VHUP0S}{*d;^pZjv|OT!IW4w*;hnFpNYc5pl1rtEz(OE61-(9uM9TX$RZ z=5V$oL6U%W*T#fchgd(YINcTZFz(^`R-Gb=N}@Jv�EwFRP~>zrV`zz!0BNuuzqX zPv8?EKD>UW*Gw+}P`<5=sEq*Fx3zPqbBGYTYh3lN`XRSvCenxW8AUl#UNSGaPP>KT z+wg7jJhDQj7fvrsIk)GM%MOT^_m|!nz6yD+((B z`ks~#mk&d+HdqoM3Bb1OECm|33K1~KA?j$zC z$MS{Cfn|LVFN>Eo?YwHfU9?>^{^~Oi*LK%-+@U4b`HAxrxbt2z&~TQ-fQ5ZuSc2`d zfd^*)8K2jS92YqP`2Q(&m%5Wb+Mly;wQtqSabGMD3lv_%c46DG?Eu6NL_g7wEg%fj zN~VgHGyJ^jBrsdi~32px< zdp^U^MoXlz!v~r2?z637%Dv2#vzw{4GgB)KQ(}TCUdR+%2n;L#HpgZOSkdP9Fb!gl zZUM=35s#^NBvWb!d%~qm-HtOAviBX@ml06XN&Ur%Q^SaoXuB>(^bB6?I< zbW?9;ba!ELWdHzp+AA+F*UQYyE>2D?NY%?PN(TTo*alb-Q_5Tb0000}ps literal 0 HcmV?d00001 diff --git a/locale/de/all b/locale/de/all index a3528d95a..e3be4f307 100755 --- a/locale/de/all +++ b/locale/de/all @@ -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)', diff --git a/templates/webpages/requirement_spec/show.html b/templates/webpages/requirement_spec/show.html index 655fe6577..e4846f51b 100644 --- a/templates/webpages/requirement_spec/show.html +++ b/templates/webpages/requirement_spec/show.html @@ -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 } } diff --git a/templates/webpages/requirement_spec_item/_function_block.html b/templates/webpages/requirement_spec_item/_function_block.html index 038ff2368..4105838e8 100644 --- a/templates/webpages/requirement_spec_item/_function_block.html +++ b/templates/webpages/requirement_spec_item/_function_block.html @@ -1,7 +1,7 @@ [%- USE HTML -%][%- USE LxERP -%][%- USE P -%][%- USE L -%] -
+
-
+
[% INCLUDE 'requirement_spec_item/_function_block_content_top.html' id_prefix='' %] diff --git a/templates/webpages/requirement_spec_item/_function_block_content_top.html b/templates/webpages/requirement_spec_item/_function_block_content_top.html index c52e177b4..8c9e49805 100644 --- a/templates/webpages/requirement_spec_item/_function_block_content_top.html +++ b/templates/webpages/requirement_spec_item/_function_block_content_top.html @@ -1,4 +1,4 @@ [%- USE HTML -%][%- USE L -%]
- [%- HTML.escape(requirement_spec_item.fb_number) -%] <[% requirement_spec_item.id %]> +
[%- HTML.escape(requirement_spec_item.fb_number) -%] <[% requirement_spec_item.id %]>
[%- L.simple_format(requirement_spec_item.description) -%]
diff --git a/templates/webpages/requirement_spec_item/_section.html b/templates/webpages/requirement_spec_item/_section.html index bc6aed015..8e7699d86 100644 --- a/templates/webpages/requirement_spec_item/_section.html +++ b/templates/webpages/requirement_spec_item/_section.html @@ -1,5 +1,5 @@ [%- USE HTML -%][%- USE LxERP -%][%- USE L -%] -
+
[%- INCLUDE 'requirement_spec_item/_section_header.html' %]
diff --git a/templates/webpages/requirement_spec_item/_sub_function_block.html b/templates/webpages/requirement_spec_item/_sub_function_block.html index 576d2376d..95f23ebe5 100644 --- a/templates/webpages/requirement_spec_item/_sub_function_block.html +++ b/templates/webpages/requirement_spec_item/_sub_function_block.html @@ -1,7 +1,7 @@ [%- USE HTML -%][%- USE LxERP -%][%- USE P -%] -
+
-
+
[% INCLUDE 'requirement_spec_item/_function_block_content_top.html' id_prefix='sub-' %] [% INCLUDE 'requirement_spec_item/_function_block_content_bottom.html' id_prefix='sub-' %]
diff --git a/templates/webpages/requirement_spec_text_block/_text_block.html b/templates/webpages/requirement_spec_text_block/_text_block.html index 6028289bb..6d456bfa8 100644 --- a/templates/webpages/requirement_spec_text_block/_text_block.html +++ b/templates/webpages/requirement_spec_text_block/_text_block.html @@ -1,5 +1,5 @@ [%- USE HTML -%][%- USE L -%][%- USE LxERP -%] -
+

[% IF !text_block.title %][%- LxERP.t8("No title yet") %][% END %][%- HTML.escape(text_block.title) %]

[% IF !text_block.text %] -- 2.20.1