| 1 | package Galileo::Plugin::Modal; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use Mojo::Base 'Mojolicious::Plugin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | sub register { | ||||||||||
| 6 | 3 | ▶ | my ($plugin, $app) = @_; | ||||||||
|
Subroutine
register: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 7 | |||||||||||
| 8 | 3 | push @{$app->renderer->classes}, __PACKAGE__; | |||||||||
| 9 | |||||||||||
| 10 | $app->helper( modal => sub { | ||||||||||
| 11 | 37 | ▶ | my ($self, $id, $body) = @_; | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||
| 12 | 37 | ▶ | $body = $body->() if ref $body; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | 37 | return $self->render_to_string( | |||||||||
| 14 | template => 'galileo_modal', | ||||||||||
| 15 | 'galileo.modal.id' => $id, | ||||||||||
| 16 | 'galileo.modal.body' => $body, | ||||||||||
| 17 | ); | ||||||||||
| 18 | 3 | }); | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 3 | 1; | |||||||||
| 22 | |||||||||||
| 23 | __DATA__ | ||||||||||
| 24 | |||||||||||
| 25 | @@ galileo_modal.html.ep | ||||||||||
| 26 | <div class="modal hide fade" id="<%= stash 'galileo.modal.id' %>"> | ||||||||||
| 27 | <div class="modal-header"> | ||||||||||
| 28 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||||||||||
| 29 | <h3>Confirm Action</h3> | ||||||||||
| 30 | </div> | ||||||||||
| 31 | <div class="modal-body"> | ||||||||||
| 32 | <p><%= stash 'galileo.modal.body' %></p> | ||||||||||
| 33 | </div> | ||||||||||
| 34 | <div class="modal-footer"> | ||||||||||
| 35 | <a href="#" class="btn" data-dismiss="modal">Close</a> | ||||||||||
| 36 | <a href="#" class="btn btn-primary" data-dismiss="modal">Confirm</a> | ||||||||||
| 37 | </div> | ||||||||||
| 38 | </div> | ||||||||||