Commit | Line | Data |
114916fc |
1 | package Reaction::UI::ViewPort::Action::Role::OK; |
2 | |
3 | use Reaction::Role; |
4 | use MooseX::Types::Moose qw/Str/; |
5 | with 'Reaction::UI::ViewPort::Action::Role::Close'; |
6 | |
7 | has ok_label => (is => 'rw', isa => 'Str', lazy_build => 1); |
8 | |
9 | sub _build_ok_label { 'ok' } |
10 | |
11 | sub ok { |
12 | my $self = shift; |
13 | $self->close(@_) if $self->apply(@_); |
14 | } |
15 | |
16 | around accept_events => sub { |
17 | my $orig = shift; |
18 | my $self = shift; |
1d6ef3dc |
19 | ( ($self->has_on_close_callback ? ('ok') : ()), $self->$orig(@_) ); |
114916fc |
20 | }; |
21 | |
22 | 1; |