aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/form_tag_helper.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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.
| * In actionview, eliminate calls to tag that use html_safe parameter values. ↵Paul Grayson2014-06-131-2/+4
|/ | | | This is generally unnecessary, since tag handles string quoting, except in one case (utf8_enforcer_tag) where we want to specify the encoding ourselves.
* document include_blank's usage with a string [ci skip]Greg Molnar2014-06-051-1/+4
|
* call `capture` fewer times from `form_for`Aaron Patterson2014-06-021-3/+2
|
* update docs to include html id for select_tagOmar Ismail2014-05-231-2/+2
|
* Form_tag_helper grammar fix [skip ci]Jon Atack2014-05-021-1/+1
|
* Add documentation to select_tag for :selected optionRizwan Reza2014-04-301-1/+5
|
* [ci skip] Added example for number_field_tag methodZENATI YASSINE2014-04-191-0/+28
|
* [ci skip] Added example for date_field_tag methodZENATI YASSINE2014-04-191-0/+13
|
* [ci skip] Added example for email_field_tag methodZENATI YASSINE2014-04-191-0/+13
|
* Merge pull request #14738 from tilsammans/pull/11407Rafael Mendonça França2014-04-171-3/+5
|\ | | | | | | | | | | | | Remove wrapping div with inline styles for hidden form fields. Conflicts: actionview/CHANGELOG.md
| * Remove wrapping div with inline styles for hidden form fields.Joost Baaij2014-04-141-3/+5
| | | | | | | | | | | | We are dropping HTML 4.01 and XHTML strict compliance since input tags directly inside a form are valid HTML5, and the absense of inline styles help in validating for Content Security Policy.
* | [ci skip] Added examples for url_field_tag methodZENATI YASSINE2014-04-161-0/+13
| |
* | [ci skip] Added examples for telephone_field_tag methodZENATI YASSINE2014-04-161-0/+13
| |
* | [ci skip] Added examples for search_field_tag methodZENATI YASSINE2014-04-161-0/+13
| |
* | [ci skip] Added examples for color_field_tag methodZENATI YASSINE2014-04-161-0/+13
|/
* Use 1.9 style hash on docs [ci skip]Carlos Antonio da Silva2014-03-041-1/+1
|
* Simplify handling of defaults/options in button_tagCarlos Antonio da Silva2014-03-041-4/+1
| | | | | | | | | There's no need to rely on Active Support's Hash#reverse_merge for simple cases with default values, since we can just merge from the default rather than reverse merge from the options. This also avoids the creation of one extra hash object by moving to a Hash#merge! call.
* remove private method and rewrite into more precise notationSergey Prikhodko2014-03-041-12/+12
|
* rollback to private methodSergey Prikhodko2014-03-031-5/+9
|
* cleanup and move extracted method right into the helperSergey Prikhodko2014-03-031-9/+5
|