From 931c4669be646a04025424eec94f93c29e4fbd54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 21 Mar 2014 14:21:58 -0300 Subject: [PATCH] Use the wrapper_mappings option --- app/views/examples/_basic_example_sf.html.erb | 17 ++++++++++------- app/views/examples/_horizontal_form_sf.html.erb | 17 ++++++++++------- app/views/examples/_inline_form_sf.html.erb | 6 ++++-- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/app/views/examples/_basic_example_sf.html.erb b/app/views/examples/_basic_example_sf.html.erb index 691ca933..a27314ff 100644 --- a/app/views/examples/_basic_example_sf.html.erb +++ b/app/views/examples/_basic_example_sf.html.erb @@ -1,19 +1,22 @@ -<%= simple_form_for :article do |f| %> +<%= simple_form_for :article, wrapper_mappings: { + check_boxes: :vertical_radio_button, + radio_buttons: :vertical_radio_button, + file: :vertical_file_input, + boolean: :vertical_check_box +} do |f| %> <%= f.input :my_email, as: :string, label: 'Email Address' %> <%= f.input :my_password, as: :password, label: 'Password' %> - <%= f.input :my_file, as: :file, label: 'File input', wrapper: :vertical_file_input %> + <%= f.input :my_file, as: :file, label: 'File input' %> - <%= f.input :my_checkbox, as: :boolean, label: 'Check me out', :wrapper => :vertical_check_box %> + <%= f.input :my_checkbox, as: :boolean, label: 'Check me out' %> <%= f.input :my_checkboxes, as: :check_boxes, label: 'This is a checkbox', - collection: ["Option one is this and that—be sure to include why it's great", "Option two can be something else and selecting it will deselect option one"], - wrapper: :vertical_radio_button %> + collection: ["Option one is this and that—be sure to include why it's great", "Option two can be something else and selecting it will deselect option one"] %> <%= f.input :my_radio_buttons, as: :radio_buttons, label: 'This is a radio button', - collection: ["Option one is this and that—be sure to include why it's great", "Option two can be something else and selecting it will deselect option one"], - wrapper: :vertical_radio_button %> + collection: ["Option one is this and that—be sure to include why it's great", "Option two can be something else and selecting it will deselect option one"] %> <%= f.button :submit %> <% end %> diff --git a/app/views/examples/_horizontal_form_sf.html.erb b/app/views/examples/_horizontal_form_sf.html.erb index 9ece9286..42de23a5 100644 --- a/app/views/examples/_horizontal_form_sf.html.erb +++ b/app/views/examples/_horizontal_form_sf.html.erb @@ -1,19 +1,22 @@ -<%= simple_form_for :article, wrapper: :bootstrap_horizontal, html: { class: 'form-horizontal' } do |f| %> +<%= simple_form_for :article, html: { class: 'form-horizontal' }, wrapper: :bootstrap_horizontal, wrapper_mappings: { + check_boxes: :horizontal_radio_button, + radio_buttons: :horizontal_radio_button, + file: :horizontal_file_input, + boolean: :horizontal_check_box +} do |f| %> <%= f.input :my_email, as: :string, label: 'Email' %> <%= f.input :my_password, as: :password, label: 'Password' %> - <%= f.input :my_file, as: :file, label: 'File input', wrapper: :horizontal_file_input %> + <%= f.input :my_file, as: :file, label: 'File input' %> - <%= f.input :my_checkbox, as: :boolean, label: 'Remember me', :wrapper => :horizontal_check_box %> + <%= f.input :my_checkbox, as: :boolean, label: 'Remember me' %> <%= f.input :my_checkboxes, as: :check_boxes, label: 'A couple of checkboxes', - collection: ["Option one is this and that—be sure to include why it's great", "Option two can be something else and selecting it will deselect option one"], - wrapper: :horizontal_radio_button %> + collection: ["Option one is this and that—be sure to include why it's great", "Option two can be something else and selecting it will deselect option one"] %> <%= f.input :my_radio_buttons, as: :radio_buttons, label: 'A couple of radio button', - collection: ["Option one is this and that—be sure to include why it's great", "Option two can be something else and selecting it will deselect option one"], - wrapper: :horizontal_radio_button %> + collection: ["Option one is this and that—be sure to include why it's great", "Option two can be something else and selecting it will deselect option one"] %> <%= f.button :submit %> <% end %> diff --git a/app/views/examples/_inline_form_sf.html.erb b/app/views/examples/_inline_form_sf.html.erb index a51037fb..c5b42e4b 100644 --- a/app/views/examples/_inline_form_sf.html.erb +++ b/app/views/examples/_inline_form_sf.html.erb @@ -1,9 +1,11 @@ -<%= simple_form_for :article, defaults: { label: false }, html: { class: 'form-inline' } do |f| %> +<%= simple_form_for :article, defaults: { label: false }, html: { class: 'form-inline' }, wrapper_mappings: { + boolean: :vertical_check_box +} do |f| %> <%= f.input :email, as: :string, placeholder: 'Email Address' %> <%= f.input :password, as: :password, placeholder: 'Password' %> - <%= f.input :checkbox, as: :boolean, inline_label: 'Remember me', :wrapper => :vertical_check_box %> + <%= f.input :checkbox, as: :boolean, inline_label: 'Remember me' %> <%= f.button :submit %> <% end %>