1 package Reaction::UI::ViewPort::Action::Role::OK;
4 use MooseX::Types::Moose qw/Str/;
5 with 'Reaction::UI::ViewPort::Action::Role::Close';
7 has ok_label => (is => 'rw', isa => Str, lazy_build => 1);
9 sub _build_ok_label { 'ok' }
13 $self->close(@_) if $self->apply(@_);
16 around accept_events => sub {
19 ( ($self->has_on_close_callback ? ('ok') : ()), $self->$orig(@_) );
28 Reaction::UI::ViewPort::Action::Role::OK - Integrate OK, Apply and Close events
32 package MyApp::UI::ViewPort::SomeAction;
35 use namespace::clean -except => 'meta';
37 extends 'Reaction::UI::ViewPort::Object::Mutable';
38 with 'Reaction::UI::ViewPort::Action::Role::OK';
45 This role integrates an C<ok> event and inherits a
46 L<close|Reaction::UI::ViewPort::Action::Role::Close/close>
47 and an L<apply|Reaction::UI::ViewPort::Action::Role::Apply/apply>
48 event into the consuming viewport.
54 Defaults to C<ok>. String is built by L</_build_ok_label>.
60 Calls C<apply>, and then C<close> if successful.
64 Extends L<Reaction::UI::ViewPort::Action::Role::Close/accept_events> with the
65 event C<ok> if an L<on_close_callback|Reaction::UI::ViewPort::Action::Role::Close/on_close_callback>
68 =head1 INTERNAL METHODS
70 =head2 _build_ok_label
72 Returns the string representing the label for the OK action. Defaults to C<ok>.
76 L<Reaction::UI::ViewPort::Action::Role::Apply>
78 L<Reaction::UI::ViewPort::Action::Role::Close>
82 See L<Reaction::Class> for authors.
86 See L<Reaction::Class> for the license.