Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prepend_field() and append_field() to Shakan. #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

GeJ
Copy link

@GeJ GeJ commented Apr 26, 2017

These two methods add fields at the beginning and the end of the fields list respectively.

While here, add some sugar for hidden and textarea fields in H:S::Fields.pm

Geraud CONTINSOUZAS added 2 commits April 26, 2017 13:48
These two methods add fields at the beginning and the end of the fields
list using Mouse's traits feature.

The idea behind these two methods is to be able to easily add fields
without manually unpacking the 'fields' attribute. Something like :

    my $user_form = $form_factory->get_user_form();

    get '/user/new' => sub {
        my ($self, $c) = @_;
        $user_form->prepend_field(Textfield(name => 'user_name'));
        ...
    };

    get '/user/edit/:user_id' => sub {
        my ($self, $c) = @_;
        $user_form->append_field(
          Hiddenfield(name => 'user_name', value => $c->args->{user_id})
        );
        ...
    };
@coveralls
Copy link

coveralls commented Apr 26, 2017

Coverage Status

Coverage decreased (-63.5%) to 36.508% when pulling 17657ff on GeJ:easy_add_fields into 745ee02 on Songmu:master.

@coveralls
Copy link

coveralls commented Apr 26, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 7f1265a on GeJ:easy_add_fields into 745ee02 on Songmu:master.

@GeJ
Copy link
Author

GeJ commented Apr 26, 2017

While here, cpanfile requires Mouse at 0.90 which was released in 2011. Do you think it would be acceptable to require a newer version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants