| Reaction documentation | Contained in the Reaction distribution. |
Reaction::UI::ViewPort::Action::Role::OK - Integrate OK, Apply and Close events
package MyApp::UI::ViewPort::SomeAction; use Reaction::Class; use namespace::clean -except => 'meta'; extends 'Reaction::UI::ViewPort::Object::Mutable'; with 'Reaction::UI::ViewPort::Action::Role::OK'; ... 1;
This role integrates an ok event and inherits a
close
and an apply
event into the consuming viewport.
Defaults to ok. String is built by _build_ok_label.
Calls apply, and then close if successful.
Extends accept_events in Reaction::UI::ViewPort::Action::Role::Close with the
event ok if an on_close_callback
was provided.
Returns the string representing the label for the OK action. Defaults to ok.
See Reaction::Class for authors.
See Reaction::Class for the license.
| Reaction documentation | Contained in the Reaction distribution. |
package Reaction::UI::ViewPort::Action::Role::OK; use Reaction::Role; use MooseX::Types::Moose qw/Str/; with 'Reaction::UI::ViewPort::Action::Role::Close'; has ok_label => (is => 'rw', isa => Str, lazy_build => 1); sub _build_ok_label { 'ok' } sub ok { my $self = shift; $self->close(@_) if $self->apply(@_); } around accept_events => sub { my $orig = shift; my $self = shift; ( ($self->has_on_close_callback ? ('ok') : ()), $self->$orig(@_) ); }; 1; __END__