package Galileo::Plugin::Modal; use Mojo::Base 'Mojolicious::Plugin'; sub register { my ($plugin, $app) = @_; push @{$app->renderer->classes}, __PACKAGE__; $app->helper( modal => sub { my ($self, $id, $body) = @_; $body = $body->() if ref $body; return $self->render_to_string( template => 'galileo_modal', 'galileo.modal.id' => $id, 'galileo.modal.body' => $body, ); }); } 1; __DATA__ @@ galileo_modal.html.ep