| 1 | package Strehler::FormFu::Element::SubmitBlock; | ||
| 2 | $Strehler::FormFu::Element::SubmitBlock::VERSION = '1.6.8'; | ||
| 3 | use strict; | ||
| 4 | use Moose; | ||
| 5 | |||
| 6 | extends 'HTML::FormFu::Element::Fieldset'; | ||
| 7 | |||
| 8 | after BUILD => sub { | ||
| 9 | my $self = shift; | ||
| 10 | my $root_path = __FILE__; | ||
| 11 | $root_path =~ s/FormFu\/Element\/SubmitBlock\.pm//; | ||
| 12 | $self->load_config_file($root_path . "forms/admin/elements/submit_block.yml"); | ||
| 13 | $self->name("save"); | ||
| 14 | return; | ||
| 15 | }; | ||
| 16 | |||
| 17 | =encoding utf8 | ||
| 18 | |||
| 19 | =head1 NAME | ||
| 20 | |||
| 21 | Strehler::FormFu::Element::SubmitBlock - FormFu Element for Strehler submit buttons. | ||
| 22 | |||
| 23 | =head1 DESCRIPTION | ||
| 24 | |||
| 25 | Standard Strehler implementation consider two submit buttons: one that redirect to list at the end of the work (Submit) and one that keep you on the edit page after saving the content (Submit and Continue). All the business logic for that is encapsulated in this FormFu element. | ||
| 26 | |||
| 27 | Keep in mind that a simple Submit button created in a stardard way will still work, but always with the behaviour of the Submit button of the SubmitBlock. It's mandatory that the submit button (or the block that contains it) has name "save". | ||
| 28 | |||
| 29 | =head1 SYNOPSIS | ||
| 30 | |||
| 31 | In article form: | ||
| 32 | |||
| 33 | - type: "+Strehler::FormFu::Element::SubmitBlock" | ||
| 34 | |||
| 35 | No parameters, no labels. | ||
| 36 | |||
| 37 | =head1 GENERATED HTML | ||
| 38 | |||
| 39 | <fieldset> | ||
| 40 | <button value="submit-go" type="submit" name="strehl-action" class="btn btn-primary span3"> | ||
| 41 | Submit | ||
| 42 | </button> | ||
| 43 | <button value="submit-continue" type="submit" name="strehl-action" class="btn btn-info span3"> | ||
| 44 | Submit and Continue | ||
| 45 | </button> | ||
| 46 | </fieldset> | ||
| 47 | |||
| 48 | =head1 YAML CONFIGURATION | ||
| 49 | |||
| 50 | For the complete configuration see in the package: forms/admin/elements/submit_block.yml | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | 1; |