aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/form_tag_helper.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix select_tag so that is doesn't change options when include_blank is setYounes SERRAJ2019-05-221-1/+2
|
* url -> URL where apt except inside actionpack/Sharang Dashputre2019-04-011-1/+1
|
* Add `Style/RedundantFreeze` to remove redudant `.freeze`Yasuo Honda2018-09-291-4/+4
| | | | | | | | | | | | | | | | | | | | | Since Rails 6.0 will support Ruby 2.4.1 or higher `# frozen_string_literal: true` magic comment is enough to make string object frozen. This magic comment is enabled by `Style/FrozenStringLiteralComment` cop. * Exclude these files not to auto correct false positive `Regexp#freeze` - 'actionpack/lib/action_dispatch/journey/router/utils.rb' - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb' It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333 Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed. * Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required - 'actionpack/test/controller/test_case_test.rb' - 'activemodel/test/cases/type/string_test.rb' - 'activesupport/lib/active_support/core_ext/string/strip.rb' - 'activesupport/test/core_ext/string_ext_test.rb' - 'railties/test/generators/actions_test.rb'
* Inclusive Language in Documentation Examples [ci skip]Cassidy Kobewka2018-04-151-2/+2
|
* Pass the skip_pipeline option in image_submit_tagAndrew White2018-03-141-1/+2
| | | | Fixes #32248.
* Don't enforce UTF-8 by defaultAndrew White2018-02-271-1/+3
| | | | | | With the disabling of TLS 1.0 by most major websites, continuing to run IE8 or lower becomes increasingly difficult so default to not enforcing UTF-8 encoding as it's not relevant to other browsers.
* Fix output of `select_tag` with `include_blank: true` [ci skip]yuuji.yaginuma2017-11-081-1/+1
| | | | | Since #24923, if use `select_tag` with `include_blank: true`, an empty label is added.
* [Action View] require_relative => requireAkira Matsuda2017-10-211-1/+1
| | | | This basically reverts c4d1a4efeec6f0b5b58222993aa0bec85a19b6a8
* Fix radio_button_tag commentMasato Oba2017-10-081-1/+1
| | | | | Colons, periods, etc. can also be included in id. The sanitize_to_id method does not remove them.
* Use tt in doc for ActionView [ci skip]Yoshiyuki Hirano2017-08-271-1/+1
|
* Fix broken doc layout for action_view [ci skip]Yoshiyuki Hirano2017-08-271-1/+1
|
* Remove alt generation from image_submit_tagRafael Mendonça França2017-08-231-6/+6
|
* Remove duplicated convert_direct_upload_option_to_urlRafael Mendonça França2017-08-031-1/+4
| | | | FormHelper includes FormTagHelper so we don't need to define two methods
* Make sure Action View doesn't break with Active StorageRafael Mendonça França2017-08-031-1/+1
| | | | | When Active Storage is not loaded and direct_upload is used on file_field_tag we should not raise an exception.
* Move the direct_upload: true convenience option from the activestorage ↵David Heinemeier Hansson2017-07-311-1/+5
| | | | helper into actionview
* Use frozen string literal in actionview/Kir Shatrov2017-07-241-0/+2
|
* [Action View] require => require_relativeAkira Matsuda2017-07-011-1/+1
|
* Default embed_authenticity_token_in_remote_forms to nil.Kasper Timm Hansen2017-04-161-1/+1
| | | | | | | Effectively treat nil values as "auto", e.g. whatever a form helper chooses to interpret it as. But treat an explicitly assigned false value as disabling.
* Prevent duplicate data-disable-with attributesTyler Hunt2017-01-031-14/+18
| | | | | | When using the hash form of the data option, prevent duplicate data-disable-with attributes from appearing in the submit tag due to both string and symbol forms of the hash key being present.
* Add missing spaces to button_tag api doc [ci skip] (#27369)Andreas Maierhofer2016-12-151-1/+1
|
* Fix Remaining Case-In-Assignment Statement FormattingAlex Kitchens2016-09-061-16/+17
| | | | | | | | | Recently, the Rails team made an effort to keep the source code consistent, using Ruboco (bb1ecdcc677bf6e68e0252505509c089619b5b90 and below). Some of the case statements were missed. This changes the case statements' formatting and is consistent with changes in 810dff7c9fa9b2a38eb1560ce0378d760529ee6b and db63406cb007ab3756d2a96d2e0b5d4e777f8231.
* applies remaining conventions across the projectXavier Noria2016-08-061-14/+14
|
* applies new string literal convention in actionview/libXavier Noria2016-08-061-15/+15
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Change datetime to datetime-local helper tagHerminio Torres2016-06-211-16/+3
| | | | | | | | | | | A change was made in the helper that renders the `datetime`, being now by default `datetime-local` and creating an alias of `datetime-local` for `datetime`, `datetime` tag and it passes to be an abstract class for all other tags that inherit from him. As a new specification of the HTML 5 the text field type `datetime` will no longer exist and will pass a `datetime-local`. Ref: https://html.spec.whatwg.org/multipage/forms.html#local-date-and-time-state-(type=datetime-local)
* Confirm with the specification when generating emtpy option for select with ↵Vipul A M2016-05-211-1/+3
| | | | | | | | | | | | `include_blank: true` option. We now generate option with empty label, example: `<select id="places" name="places"><option value="" label=" "></option></select>` for include_blank: true. This is only done, if content is missing on the option, and we providing the value from this option. Fixes #24816
* Deprecate `datetime_field` and `datetime_field_tag` helpers.Wojciech Wnętrzak2016-03-311-0/+4
| | | | | Datetime input type was removed from HTML specification. One can use `datetime_local_field` and `datetime_local_field_tag` instead.
* We are calling `to_s` in the method so we can call downcase nowRafael Mendonça França2016-02-221-3/+3
|
* html_safe is not supposed to be public API for AV. This change removes usage ↵Vipul A M2016-01-201-6/+6
| | | | | | of html_safe in favour of raw() in AV helpers. Also changed usage of html_safe to make use of raw() instead so that the intended behaviour is verified with raw()
* add option for per-form CSRF tokensBen Toews2016-01-041-2/+8
|
* fix TypeError when using submit_tag with Symbol valueyuuji.yaginuma2015-12-241-1/+1
|
* [ci skip] Change 'an URL' to 'a URL' as URL doesn't have a vowel soundtanmay30112015-10-061-1/+1
|
* Fix - Prevent adding of `data-disable-with` option twice in html.Akshay Vishnoi2015-09-181-1/+1
| | | | | | | | | | | | | | | | | | Earlier when `data-disable-with` option is added direclty as in options then ```ruby submit_tag("Save", { "data-disable-with" => "Processing..." }) # => <input type="submit" name="commit" value="Save" data-disable-with="Processing..." data-disable-with="Processing..." /> ``` Now when `data-disable-with` option is added direclty as in options then ```ruby submit_tag("Save", { "data-disable-with" => "Processing..." }) # => <input type="submit" name="commit" value="Save" data-disable-with="Processing..." /> ```
* Make disable_with default in submit_tagJustin Schiff2015-08-111-9/+23
| | | | | | | | | | | | | | Prevents double submission by making disable_with the default. Default disable_with option will only be applied if user has not specified her/his own disable_with option, whether that is in the `data-disable-with` string form or the `:data => { :disable_with => "Saving..." }` hash form. disable_with will default to the value attribute. A configuration option was added to opt out of this functionality if the user so desires. `config.action_view.automatically_disable_submit_tag = false`
* Cut string allocations in content_tag_stringschneems2015-07-291-4/+4
| | | | | | content_tag's first argument is will generate a string with an html tag so `:a` will generate: `<a></a>`. When this happens, the symbol is implicitly `to_s`-d so a new string is allocated. We can get around that by using a frozen string instead which This change buys us 74,236 bytes of memory and 1,855 fewer objects per request.
* Add missing spec and documentation for button_tag helperAkshay Vishnoi2015-05-241-2/+15
|
* [ci skip] Add `,`yui-knk2015-04-081-1/+1
|
* Corrects the API to method select_tagLeandro Nunes2015-02-201-2/+1
| | | | The 'selected' option is not doing what it should do. The expected behavior is to pass the value selected by default for the options_from_collection_for_select method
* fix typo in number_field_tag documentation [ci skip]yuuji.yaginuma2015-01-191-2/+2
|
* Fix select_tag generating tag when set to false.Guo Xiang Tan2014-11-211-1/+3
| | | | Fixes https://github.com/rails/rails/issues/17701.
* Use new hash syntaxRafael Mendonça França2014-10-251-2/+3
|
* :scissors:Rafael Mendonça França2014-10-251-2/+1
|
* Merge pull request #17064 from frenkel/fix_select_tag_include_blankRafael Mendonça França2014-10-251-2/+8
|\ | | | | Use include_blank value as option label
| * Use include_blank value as option labelFrank Groeneveld2014-10-171-2/+8
| | | | | | | | Update select_tag to reflect documentation and behave the same as form builder select. If the value of include_blank is not boolean true, use that value as the option label.
* | Fix how file_ and password_field_tag edit optionsclaudiob2014-10-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes the behavior of `file_field_tag` and `password_field_tag` when invoked with a hash of options. These two helpers are different from all the other ones in that they modify the options hash passed as a parameter, whereas all the other helpers duplicate it before updating it. The result is that *bad things* can happen if the user re-uses the same hash. For instance, users who write the following code to display a file field followed by a text field (both with the same class): ```rhtml <% options = {class: 'important'} %> <%= file_field_tag 'Upload', options %> <%= text_field_tag 'Name', options %> ``` would instead see **two file fields!** ```html <input class="important" id="Upload" name="Upload" type="file"> <input class="important" id="Name" name="Name" type="file" value="value"> ``` This PR replaces `update` with `merge` in the code of the two helpers, fixing the issue above. The included test verifies the change, since it passes after this PR, but fails before with the following error: ``` Expected: <input type="text" name="title" id="title" value="Hello!" class="important" /> Actual: <input type="password" name="title" id="title" value="Hello!" class="important" /> ```
* | Remove duplicate stringify_keys in text_field_tagclaudiob2014-10-151-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All the methods that invoke `text_field_tag` (such as `hidden_field_tag`) and all the methods that invoke `number_field_tag` (that is `range_field_tag`) do not need to call `stringify_keys` on their `options` parameter since the `text_field_tag` method [is already doing it internally](https://github.com/claudiob/rails/blob/4159134524f4c78d008eef9d9a17f73a3172dcc8/actionview/lib/action_view/helpers/form_tag_helper.rb#L182): ```ruby def text_field_tag(name, value = nil, options = {}) tag :input, { "type" => "text", "name" => name, "id" => sanitize_to_id(name), "value" => value }.update(options.stringify_keys) end ``` and `number_field_tag` is [already doing it internally](https://github.com/claudiob/rails/blob/e3207bdbba55f3806441f22b175557579bc0b051/actionview/lib/action_view/helpers/form_tag_helper.rb#L780) as well: ```ruby def number_field_tag(name, value = nil, options = {}) options = options.stringify_keys ... end [Note #1: My code uses `merge` to respect the existing behavior of duplicating the `options` hash before updating its keys, see https://github.com/rails/rails/pull/17096#issuecomment-57223827] [Note #2: My code uses symbols instead of strings (e.g.: `:hidden`) to look forward to future version of Ruby/Raiks (GC symbols); the result of the method, however, is the same, because the symbols are stringified inside `text_field_tag`] [Note #3: I had previously created a similar PR #17096 but decided to split it into multiple PRs given the feedback received in the comments]
* | Use #tr instead of #gsub where possibleAlex Weidmann2014-10-021-1/+1
|/
* Remove erroneous form_tag option docsT.J. Schuck2014-08-221-1/+0
| | | | | | | This is true of the first param (url_for_options), not of the second options param which is being documented here. [ci skip]
* Clarify that unknown keys will become HTML attrsT.J. Schuck2014-08-221-0/+1
| | | | | | Docs for all the other form tag helpers in this file already clarify this. [ci skip]
* [ci skip] correct output for asset_helper methodsKuldeep Aggarwal2014-06-161-5/+5
| | | | see cc255d3
* Merge pull request #15693 from pdg137/enforce_utf8Matthew Draper2014-06-141-1/+4
|\ | | | | | | In actionview, eliminate calls to tag that use html_safe parameter values.