added localization to core widgets
[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';
7
8
9
10 after fragment widget {
11   arg 'method' => $_{viewport}->method;
12 };
13
14 implements fragment ok_button_fragment {
15   if (grep { $_ eq 'ok' } $_{viewport}->accept_events) {
16     arg 'event_id' => event_id 'ok';
17     arg 'label' => localized $_{viewport}->ok_label;
18     render 'ok_button';
19   }
20 };
21
22 implements fragment apply_button_fragment {
23   if (grep { $_ eq 'apply' } $_{viewport}->accept_events) {
24     arg 'event_id' => event_id 'apply';
25     arg 'label' => localized $_{viewport}->apply_label;
26     render 'apply_button';
27   }
28 };
29
30 implements fragment cancel_button_fragment {
31   if (grep { $_ eq 'close' } $_{viewport}->accept_events) {
32     arg 'event_id' => event_id 'close';
33     arg 'label' => localized $_{viewport}->close_label;
34     render 'cancel_button';
35   }
36 };
37
38 __PACKAGE__->meta->make_immutable;
39
40
41 1;
42
43 __END__;
44
45 =head1 NAME
46
47 Reaction::UI::Widget::Action
48
49 =head1 DESCRIPTION
50
51 =head1 FRAGMENTS
52
53 =head2 ok_button_fragment
54
55 =head2 apply_button_fragment
56
57 =head2 cancel_button_fragment
58
59 =head1 AUTHORS
60
61 See L<Reaction::Class> for authors.
62
63 =head1 LICENSE
64
65 See L<Reaction::Class> for the license.
66
67 =cut
68