From b5ae29de03cc64c8dc0448fd1b40d8ba69944236 Mon Sep 17 00:00:00 2001 From: Akshay Vishnoi Date: Wed, 20 May 2015 02:14:51 +0530 Subject: Add missing spec and documentation for button_tag helper --- actionview/lib/action_view/helpers/form_tag_helper.rb | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 1f76f40138..896020bc15 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -448,8 +448,9 @@ module ActionView # resetbutton or a generic button which can be used in # JavaScript, for example. You can use the button tag as a regular # submit tag but it isn't supported in legacy browsers. However, - # the button tag allows richer labels such as images and emphasis, - # so this helper will also accept a block. + # the button tag does allow for richer labels such as images and emphasis, + # so this helper will also accept a block. By default, it will create + # a button tag with type `submit`, if type is not given. # # ==== Options # * :data - This option can be used to add custom data attributes. @@ -472,6 +473,15 @@ module ActionView # button_tag # # => # + # button_tag 'Reset', type: 'reset' + # # => + # + # button_tag 'Button', type: 'button' + # # => + # + # button_tag 'Reset', type: 'reset', disabled: true + # # => + # # button_tag(type: 'button') do # content_tag(:strong, 'Ask me!') # end @@ -479,6 +489,9 @@ module ActionView # # Ask me! # # # + # button_tag "Save", data: { confirm: "Are you sure?" } + # # => + # # button_tag "Checkout", data: { disable_with: "Please wait..." } # # => # -- cgit v1.2.3