Skip to content

Commit

Permalink
remove button_to again
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 2, 2015
1 parent f010e09 commit 1251d41
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 58 deletions.
1 change: 0 additions & 1 deletion Changes
@@ -1,6 +1,5 @@

6.06 2015-04-02
- Added button_to helper to Mojolicious::Plugin::TagHelpers.
- Added "chat.pl" to example scripts.

6.05 2015-03-24
Expand Down
33 changes: 3 additions & 30 deletions lib/Mojolicious/Plugin/TagHelpers.pm
Expand Up @@ -15,9 +15,9 @@ sub register {
}

my @helpers = (
qw(button_to csrf_field form_for hidden_field javascript label_for),
qw(link_to password_field select_field stylesheet submit_button),
qw(tag_with_error text_area)
qw(csrf_field form_for hidden_field javascript label_for link_to),
qw(password_field select_field stylesheet submit_button tag_with_error),
qw(text_area)
);
$app->helper($_ => __PACKAGE__->can("_$_")) for @helpers;

Expand All @@ -34,11 +34,6 @@ sub register {
$app->helper($_ => sub { shift; _tag(@_) }) for qw(t tag);
}

sub _button_to {
my ($c, $text) = (shift, shift);
return $c->helpers->form_for(@_, sub { _submit_button($c, $text) });
}

sub _csrf_field {
my $c = shift;
return _hidden_field($c, csrf_token => $c->helpers->csrf_token, @_);
Expand Down Expand Up @@ -256,28 +251,6 @@ by default.
L<Mojolicious::Plugin::TagHelpers> implements the following helpers.
=head2 button_to
%= button_to 'Test' => 'some_get_route'
%= button_to 'Test' => some_get_route => {id => 23} => (class => 'menu')
%= button_to 'Test' => 'http://example.com/test' => (class => 'menu')
%= button_to 'Remove' => 'some_delete_route'
Generate portable C<form> tag with L</"form_for"> containing a single button.
<form action="/path/to/get/route">
<input type="submit" value="Test">
</form>
<form action="/path/to/get/route/23" class="menu">
<input type="submit" value="Test">
</form>
<form action="http://example.com/test" class="menu">
<input type="submit" value="Test">
</form>
<form action="/path/to/delete/route?_method=DELETE" method="POST">
<input type="submit" value="Remove">
</form>
=head2 check_box
%= check_box employed => 1
Expand Down
27 changes: 0 additions & 27 deletions t/mojolicious/tag_helper_lite_app.t
Expand Up @@ -16,8 +16,6 @@ get 'tags_with_error';

any [qw(GET POST)] => 'links';

get '/buttons';

get 'script';

get 'style';
Expand Down Expand Up @@ -107,24 +105,6 @@ $t->post_ok('/links')->status_is(200)->content_is(<<'EOF');
<a href="/form/23" title="Foo">Foo</a>
EOF

# Buttons
$t->get_ok('/buttons')->status_is(200)
->content_is('<form action="/links">'
. '<input type="submit" value="First test">'
. "</form>\n"
. '<form action="/links.txt">'
. '<input type="submit" value="Second">'
. "</form>\n"
. '<form action="/" class="menu">'
. '<input type="submit" value="Third">'
. "</form>\n"
. '<form action="http://example.com">'
. '<input type="submit" value="Fourth">'
. "</form>\n"
. '<form action="/selection?_method=PUT" method="POST">'
. '<input type="submit" value="Fifth">'
. "</form>\n");

# Scripts
$t->get_ok('/script')->status_is(200)->content_is(<<EOF);
<script src="/script.js"></script>
Expand Down Expand Up @@ -529,13 +509,6 @@ __DATA__
<%= link_to Foo => 'form', {test => 23}, title => 'Foo' %>
<%= link_to form => {test => 23} => (title => 'Foo') => begin %>Foo<% end %>
@@ buttons.html.ep
%= button_to 'First test' => 'links'
%= button_to 'Second' => 'links' => {format => 'txt'}
%= button_to 'Third' => '/' => (class => 'menu')
%= button_to 'Fourth' => 'http://example.com'
%= button_to 'Fifth' => 'selection'
@@ script.html.ep
<%= javascript '/script.js' %>
<%= javascript begin %>
Expand Down

0 comments on commit 1251d41

Please sign in to comment.