From 7cf2912f062f5836d8fa772325411ab1e04715f2 Mon Sep 17 00:00:00 2001 From: Thiago Pinto Date: Thu, 6 Dec 2012 02:05:10 -0500 Subject: correct bad jquery syntax --- actionpack/lib/action_view/helpers/form_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 17386a57b8..ce51585b87 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -775,8 +775,8 @@ module ActionView # text_field(:post, :title, class: "create_input") # # => # - # text_field(:session, :user, onchange: "if $('session[user]').value == 'admin' { alert('Your login can not be admin!'); }") - # # => + # text_field(:session, :user, onchange: "if $('#session_user').value == 'admin' { alert('Your login can not be admin!'); }") + # # => # # text_field(:snippet, :code, size: 20, class: 'code_input') # # => -- cgit v1.2.3 From 4aced1f0730896128e9b8d68f9cacc00328b31ec Mon Sep 17 00:00:00 2001 From: Thiago Pinto Date: Thu, 6 Dec 2012 02:13:33 -0500 Subject: adding example for f.file_input --- actionpack/lib/action_view/helpers/form_helper.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index ce51585b87..be62cf70c6 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -834,6 +834,9 @@ module ActionView # file_field(:user, :avatar) # # => # + # file_field(:post, :image, :multiple => true) + # # => + # # file_field(:post, :attached, accept: 'text/html') # # => # -- cgit v1.2.3 From 15f26631062ae7258e0ebd1ef128a88f59def760 Mon Sep 17 00:00:00 2001 From: Thiago Pinto Date: Thu, 6 Dec 2012 02:21:15 -0500 Subject: adding example for f.file_input --- actionpack/lib/action_view/helpers/form_helper.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index be62cf70c6..92b88752d4 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -840,6 +840,9 @@ module ActionView # file_field(:post, :attached, accept: 'text/html') # # => # + # file_field(:post, :image, accept: 'image/png,image/gif,image/jpeg') + # # => + # # file_field(:attachment, :file, class: 'file_input') # # => def file_field(object_name, method, options = {}) -- cgit v1.2.3 From d2fb5f2ae6bfe636505d0003fd2c760f4df8151a Mon Sep 17 00:00:00 2001 From: Thiago Pinto Date: Thu, 6 Dec 2012 02:33:43 -0500 Subject: complementary options guidelines for f.file_field and file_field_tag --- actionpack/lib/action_view/helpers/form_helper.rb | 6 ++++++ actionpack/lib/action_view/helpers/form_tag_helper.rb | 2 ++ 2 files changed, 8 insertions(+) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 92b88752d4..5710d1fc02 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -830,6 +830,12 @@ module ActionView # # Using this method inside a +form_for+ block will set the enclosing form's encoding to multipart/form-data. # + # ==== Options + # * Creates standard HTML attributes for the tag. + # * :disabled - If set to true, the user will not be able to use this input. + # * :multiple - If set to true, *in most updated browsers* the user will be allowed to select multiple files. + # * :accept - If set to one or multiple mime-types, the user will be suggested a filter when choosing a file. You still need to set up model validations. + # # ==== Examples # file_field(:user, :avatar) # # => diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index e298751062..ff83ef3ca1 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -233,6 +233,8 @@ module ActionView # ==== Options # * Creates standard HTML attributes for the tag. # * :disabled - If set to true, the user will not be able to use this input. + # * :multiple - If set to true, *in most updated browsers* the user will be allowed to select multiple files. + # * :accept - If set to one or multiple mime-types, the user will be suggested a filter when choosing a file. You still need to set up model validations. # # ==== Examples # file_field_tag 'attachment' -- cgit v1.2.3 From ba2d867b2961b5ef72aad353c2d647b04654cbe3 Mon Sep 17 00:00:00 2001 From: Thiago Pinto Date: Thu, 6 Dec 2012 02:52:40 -0500 Subject: API reader should look elsewhere for helper instructions --- actionpack/lib/action_view/helpers/form_helper.rb | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 5710d1fc02..f0abb79bd0 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -1226,6 +1226,10 @@ module ActionView RUBY_EVAL end + # Instructions for this +method+ can be found in this documentation. + # For reusability and delegation reasons, various +methods+ have equal names. + # Please, look up the next +method+ with this name + # def fields_for(record_name, record_object = nil, fields_options = {}, &block) fields_options, record_object = record_object, nil if record_object.is_a?(Hash) && record_object.extractable_options? fields_options[:builder] ||= options[:builder] @@ -1255,23 +1259,43 @@ module ActionView @template.fields_for(record_name, record_object, fields_options, &block) end + # Instructions for this +method+ can be found in this documentation. + # For reusability and delegation reasons, various +methods+ have equal names. + # Please, look up the next +method+ with this name + # def label(method, text = nil, options = {}, &block) @template.label(@object_name, method, text, objectify_options(options), &block) end + # Instructions for this +method+ can be found in this documentation. + # For reusability and delegation reasons, various +methods+ have equal names. + # Please, look up the next +method+ with this name + # def check_box(method, options = {}, checked_value = "1", unchecked_value = "0") @template.check_box(@object_name, method, objectify_options(options), checked_value, unchecked_value) end + # Instructions for this +method+ can be found in this documentation. + # For reusability and delegation reasons, various +methods+ have equal names. + # Please, look up the next +method+ with this name + # def radio_button(method, tag_value, options = {}) @template.radio_button(@object_name, method, tag_value, objectify_options(options)) end + # Instructions for this +method+ can be found in this documentation. + # For reusability and delegation reasons, various +methods+ have equal names. + # Please, look up the next +method+ with this name + # def hidden_field(method, options = {}) @emitted_hidden_id = true if method == :id @template.hidden_field(@object_name, method, objectify_options(options)) end + # Instructions for this +method+ can be found in this documentation. + # For reusability and delegation reasons, various +methods+ have equal names. + # Please, look up the next +method+ with this name + # def file_field(method, options = {}) self.multipart = true @template.file_field(@object_name, method, objectify_options(options)) -- cgit v1.2.3