Revision ccf94c5d
Von Sven Schöling vor fast 8 Jahren hinzugefügt
SL/Layout/ActionBar.pm | ||
---|---|---|
1 |
package SL::Layout::ActionBar; |
|
2 |
|
|
3 |
use strict; |
|
4 |
use parent qw(SL::Layout::Base); |
|
5 |
|
|
6 |
use constant HTML_CLASS => 'layout-actionbar'; |
|
7 |
|
|
8 |
use Rose::Object::MakeMethods::Generic ( |
|
9 |
'scalar --get_set_init' => [ qw(actions) ], |
|
10 |
); |
|
11 |
|
|
12 |
|
|
13 |
###### Layout overrides |
|
14 |
|
|
15 |
sub pre_content { |
|
16 |
$::request->presenter->html_tag('div', '', class => HTML_CLASS); |
|
17 |
} |
|
18 |
|
|
19 |
sub inline_javascript { |
|
20 |
# data for bar |
|
21 |
} |
|
22 |
|
|
23 |
sub javascripts { |
|
24 |
|
|
25 |
} |
|
26 |
|
|
27 |
###### interface |
|
28 |
|
|
29 |
sub add_actions { |
|
30 |
my ($self, @actions) = @_; |
|
31 |
push @{ $self->actions }, @actions; |
|
32 |
} |
|
33 |
|
|
34 |
sub init_actions { |
|
35 |
[] |
|
36 |
} |
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
1; |
|
42 |
|
|
43 |
__END__ |
|
44 |
|
|
45 |
=encoding utf-8 |
|
46 |
|
|
47 |
=head1 NAME |
|
48 |
|
|
49 |
SL::Layout::ActionBar - Unified action buttons for controllers |
|
50 |
|
|
51 |
=head1 CONCEPT |
|
52 |
|
|
53 |
This is a layout block that does a unified action bar for any controller who |
|
54 |
wants to use it. It's designed to be rendered above the content and to be |
|
55 |
fixed when scrolling. |
|
56 |
|
|
57 |
While it can be used as a generic widget container, it's designed to be able to |
|
58 |
provide commonly used functionality as a short cut. These shortcuts include: |
|
59 |
|
|
60 |
=over 4 |
|
61 |
|
|
62 |
=item * |
|
63 |
|
|
64 |
Calling a controller with parameters |
|
65 |
|
|
66 |
=item * |
|
67 |
|
|
68 |
Submitting a form with added parameters |
|
69 |
|
|
70 |
=item * |
|
71 |
|
|
72 |
Arrangement utility |
|
73 |
|
|
74 |
=back |
|
75 |
|
|
76 |
|
|
77 |
=head1 METHODS |
|
78 |
|
|
79 |
=over 4 |
|
80 |
|
|
81 |
=item C<add_actions LIST> |
|
82 |
|
|
83 |
Dispatches each each argument to C<add_action> |
|
84 |
|
|
85 |
=item C<add_action> |
|
86 |
|
|
87 |
|
|
88 |
=item C<add_separator> |
|
89 |
|
|
90 |
=item C<add_ |
|
91 |
|
|
92 |
=head1 ACCESS FROM CODE |
|
93 |
|
|
94 |
This is accessable through |
|
95 |
|
|
96 |
$::request->layout->actionbar |
|
97 |
|
|
98 |
=head1 DOM MODEL |
|
99 |
|
|
100 |
The entire block is rendered into a div with the class 'layout-actionbar'. |
|
101 |
|
|
102 |
=head1 ACTION WIDGETS |
|
103 |
|
|
104 |
Each individual action must be an instance of C<SL::Layout::ActionBar::Action>. |
|
105 |
|
|
106 |
=head1 BUGS |
|
107 |
|
|
108 |
none yet. :) |
|
109 |
|
|
110 |
=head1 AUTHOR |
|
111 |
|
|
112 |
Sven Schoeling E<lt>s.schoeling@linet-services.deE<gt> |
|
113 |
|
|
114 |
=cut |
Auch abrufbar als: Unified diff
Actionbar Layout mock