From: Moritz Bunkus Date: Wed, 13 Mar 2013 10:12:08 +0000 (+0100) Subject: Pflichtenhefte: Textblöcke, Abschnitte und Funktionsblöcke markieren können X-Git-Tag: release-3.2.0beta~467^2~216 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=90f4ba5dc6212592754cdddd082640103ee15884;p=kivitendo-erp.git Pflichtenhefte: Textblöcke, Abschnitte und Funktionsblöcke markieren können --- 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 000000000..dd6d527d6 Binary files /dev/null and b/image/flag-red.png differ 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 %]