container support built into fields and an example of usage in ComponentUI
[catagits/Reaction.git] / lib / Reaction / UI / Widget / Action.pm
1 package Reaction::UI::Widget::Action;
2
3 use Reaction::UI::WidgetClass;
4
5 use namespace::clean -except => [ qw(meta) ];
6 extends 'Reaction::UI::Widget::Object::Mutable';
7
8 after fragment widget {
9   arg 'method' => $_{viewport}->method;
10 };
11
12 implements fragment ok_button_fragment {
13   if (grep { $_ eq 'ok' } $_{viewport}->accept_events) {
14     arg 'event_id' => event_id 'ok';
15     arg 'label' => localized $_{viewport}->ok_label;
16     render 'ok_button';
17   }
18 };
19
20 implements fragment apply_button_fragment {
21   if (grep { $_ eq 'apply' } $_{viewport}->accept_events) {
22     arg 'event_id' => event_id 'apply';
23     arg 'label' => localized $_{viewport}->apply_label;
24     render 'apply_button';
25   }
26 };
27
28 implements fragment cancel_button_fragment {
29   if (grep { $_ eq 'close' } $_{viewport}->accept_events) {
30     arg 'event_id' => event_id 'close';
31     arg 'label' => localized $_{viewport}->close_label;
32     render 'cancel_button';
33   }
34 };
35
36 __PACKAGE__->meta->make_immutable;
37
38
39 1;
40
41 __END__;
42
43 =head1 NAME
44
45 Reaction::UI::Widget::Action
46
47 =head1 DESCRIPTION
48
49 =head1 FRAGMENTS
50
51 =head2 ok_button_fragment
52
53 =head2 apply_button_fragment
54
55 =head2 cancel_button_fragment
56
57 =head1 AUTHORS
58
59 See L<Reaction::Class> for authors.
60
61 =head1 LICENSE
62
63 See L<Reaction::Class> for the license.
64
65 =cut
66