aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/form_helper.rb
Commit message (Collapse)AuthorAgeFilesLines
* Ruby 2.7 warning: creating a Proc without a blockutilum2019-02-131-2/+2
| | | | | | | | | | | | | | | | As of [Revision 66772]( https://bugs.ruby-lang.org/projects/ruby-trunk/repository/trunk/revisions/66772) `Proc.new` without giving a block emits `warning: tried to create Proc object without a block`. This commit fixes cases where Rails test suit tickles this warning. See CI logs: https://travis-ci.org/rails/rails/jobs/487205819#L1161-L1190 https://travis-ci.org/rails/rails/jobs/487205821#L1154-1159 https://travis-ci.org/rails/rails/jobs/487205821#L1160-L1169 https://travis-ci.org/rails/rails/jobs/487205821#L1189 https://travis-ci.org/rails/rails/jobs/487254404#L1307-L1416 https://travis-ci.org/rails/rails/jobs/487254405#L1174-L1191
* Generate doc of methods provided by form builders [ci skip]yuuji.yaginuma2018-12-261-0/+221
| | | | | | | | Because method arguments are different in the methods provided by form helpers and form builders, I think these are necessary to prevent confusion. Fixes #34787
* Added maxlength example to text_field documentationRaghu Kamat2018-10-251-0/+3
| | | | | | | | | | | The usage of maxlength in the text_field helper adds a size attribute to the generated text_field input with the same value as the maxlength. This implicit addition of size attribute by the method gives a false impression that it may be bug. By adding the implementation of the maxlength to the api docs, we explicitly tell the reader referring the api doc that addition of size along with maxlength is the expected behaviour. [ci skip]
* Add `:namespace` option to the api docs of `form_with` [ci skip]bogdanvlviv2018-08-271-0/+3
|
* Fix leaking special form_with attributes into html attributesYurii Cherniavskyi2018-07-201-0/+1
| | | | | Special form_with attributes `skip_default_ids` and `allow_method_names_outside_object` attributes are leaking into html attributes of option select tag helpers.
* passing splat keyword arguments as a single Hashutilum2018-04-041-1/+1
| | | | Ruby 2.6.0 warns about this.
* Fix `new_framework_defaults_6_0.rb`bogdanvlviv2018-02-271-2/+2
| | | | | | | | | `default_enforce_utf8` belongs to `config.action_view` Update info about `:skip_enforcing_utf8` since we can change default behavior via `config.action_controller.default_enforce_utf8` Related to #32125
* Merge pull request #32125 from rails/switch-to-not-enforcing-utf8-by-defaultAndrew White2018-02-271-2/+2
|\ | | | | Don't enforce UTF-8 by default
| * Don't enforce UTF-8 by defaultAndrew White2018-02-271-2/+2
| | | | | | | | | | | | 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.
* | add :nodoc: to ActionView::Helpers::FormBuilder#emitted_hidden_id?Marcelo Perini Veloso2018-02-271-1/+1
|/
* Change translation key of submit_tag from module_name_class_name to ↵Rui Onodera2018-02-271-1/+6
| | | | | | | | | | module_name/class_name Currently submit_tag value translation does not support i18n key style locale key. It confuses me a bit because many other components support i18n key style locale key. I added i18n key style locale key support to submit tag.
* Fix typo in API document FormHelper#fieldskami-zh2018-01-251-4/+3
| | | | | - Fix typo - Adjust output example to other example's format
* Fix typos, update documentationJames Lovejoy2018-01-111-3/+3
| | | | [ci skip]
* Make form_with_generates_ids default value to be falseRafael Mendonça França2017-11-271-1/+1
| | | | | This will keep the behavior of an application with the defaults of a 4.2 or 5.0 application behaving the same when upgrading to 5.2.
* Make sure that form_with_generates_ids only affects form_withRafael Mendonça França2017-11-251-1/+4
|
* Change `form_with` to generates ids by defaultnpezza932017-11-251-24/+3
| | | | | | | | | | When `form_with` was introduced we disabled the automatic generation of ids that was enabled in `form_for`. This usually is not an good idea since labels don't work when the input doesn't have an id and it made harder to test with Capybara. You can still disable the automatic generation of ids setting `config.action_view.form_with_generates_ids` to `false.`
* [Action View] require_relative => requireAkira Matsuda2017-10-211-6/+6
| | | | This basically reverts c4d1a4efeec6f0b5b58222993aa0bec85a19b6a8
* Fix broken doc layout for action_view [ci skip]Yoshiyuki Hirano2017-08-271-1/+1
|
* [ci skip] form_with in the getting started guide.Kasper Timm Hansen2017-08-211-0/+30
| | | | Add back a bit about a resource oriented style of routing.
* Add code formatting and minor grammar clarificationsT.J. Schuck2017-08-091-10/+10
| | | [ci skip]
* Fix broken RDoc formattingT.J. Schuck2017-08-091-1/+1
| | | | | The `@` ivar format doesn’t work with RDoc's `+` code formatting; needs `<tt>`. [ci skip]
* Remove duplicated convert_direct_upload_option_to_urlRafael Mendonça França2017-08-031-6/+0
| | | | FormHelper includes FormTagHelper so we don't need to define two methods
* Refactor convert_direct_upload_option_to_urlRafael Mendonça França2017-08-031-3/+4
| | | | Also make sure file_field doesn't mutate the original options passed in.
* Add requireDavid Heinemeier Hansson2017-08-011-0/+1
|
* 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-6/+6
|
* Use mattr_accessor default: option throughout the projectGenadi Samokovarov2017-06-031-4/+2
|
* Add option for class_attribute default (#29270)David Heinemeier Hansson2017-05-291-8/+9
| | | | | | | | | | | | * Allow a default value to be declared for class_attribute * Convert to using class_attribute default rather than explicit setter * Removed instance_accessor option by mistake * False is a valid default value * Documentation
* Add `form_with_generates_remote_forms` config.Kasper Timm Hansen2017-04-161-1/+3
| | | | | | | Allows users to not have remote forms by default, since there's more JS harness, e.g. bundling rails-ujs, otherwise. Also don't skip creating defaults file anymore. Sprockets isn't the only new config.
* Default embed_authenticity_token_in_remote_forms to nil.Kasper Timm Hansen2017-04-161-6/+8
| | | | | | | 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.
* Fix module name [ci skip]yuuji.yaginuma2017-04-151-10/+10
| | | | Replace `FormOptionHelper` to `FormOptionsHelper`.
* Close form_for tag in FormHelper API docsAlex Muller2017-04-131-2/+2
|
* do not mutate `object_name` of class in `fields_for`yuuji.yaginuma2016-12-271-1/+2
| | | | | | Since it affects the entire form, should not mutate `object_name` of class. Fixes #26931
* fields: support attributes not on model.Kasper Timm Hansen2016-12-181-0/+2
| | | | Ensure the support works like form_with.
* [ci skip] fields don't output ids by default anymore.Kasper Timm Hansen2016-12-181-2/+2
|
* form_with: allow methods outside the model.Kasper Timm Hansen2016-12-181-1/+13
| | | | | | | | Has the handy effect of making the initial examples in the form_with docs work too. Had to do some finagling such that form_with's without a scope didn't wrap their names in braces ala `[title]`.
* [ci skip] Replace remote with local in form_with doc.Kasper Timm Hansen2016-12-181-1/+1
| | | | Remote is gone, long live local.
* Make attributes output in html opt-in.Kasper Timm Hansen2016-12-181-1/+1
| | | | | | | | | | By using `except` any option provided to `form_with` would become an html attribute unless explicitly opted out. This proved annoying when adding new internal keys in the options hash and seeing them pop up in the html output. Prevent this by inverting the `except` to `slice` out the keys we want to allow becoming html attributes, like id and class.
* Avoid invalid attribute on local forms generated by `form_with`George Claghorn2016-12-151-4/+0
| | | | | | | | | | | | | Fixes that the following ERB template would result in invalid HTML output: <%= form_with model: Post.new, local: true do |form| %> <% end %> Specifically, the resulting form tag would have a spurious `remote` attribute: <form remote="false" ...>
* form_with/fields: Don't output ids by defaultKasper Timm Hansen2016-12-131-3/+28
| | | | | | | | | | | Continuing 67f81cc where we decided not to output ids by default in the new form helpers. Went with @dhh's suggestion of just requiring ids on fields being labelled: https://github.com/rails/rails/issues/25197#issuecomment-231797117 Seems okay enough.
* Fix warning: method redefined; discarding old fieldsRyuta Kamizono2016-11-251-1/+1
| | | | Follow up to #26976.
* form_helper typo fix [ci skip]ota42y2016-11-221-1/+1
|
* Add form_with to unify form_tag/form_for. (#26976)Kasper Timm Hansen2016-11-211-2/+341
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add form_with to unify form_tag/form_for. `form_tag` and `form_for` serve very similar use cases. This PR unifies that usage such that `form_with` can output just the opening form tag akin to `form_tag` and can just work with a url, for instance. `form_with` by default doesn't attach class or id to the form — removing them on fields is moved out to a default revisiting PR later. Ported over old tests where applicable to ensure maximum coverage, but left some commented out because they don't yet apply (e.g. `fields_for` later being replaced by `fields`). [ Kasper Timm Hansen & Marek Kirejczyk ] * Add fields DSL method. Strips `_for` and requires models passed as a keyword argument. * Document form_with. Graft the `form_for` docs: rewrite, revise and expand where needed. Also test that a `format` isn't used when an explicit URL is passed. * Enable remote by default. Brand new world! Forms submit via XHRs by default, woah. * Invert `include_id` to `skip_id`. `skip_id: true` reads better than `include_id: false` (since the `include_id` default is true). * Invert `remote` to `local`. Since forms are remote by default, the option name makes more sense as `local: true`. * Invert `enforce_utf8` to `skip_enforcing_utf8`. * Refer to the brand spanking new rails-ujs. Soon to be bundled in Rails proper, so jquery-ujs is out. * Make `form_with` a bit more composed. The flow is still not quite what it should be because the legacy methods and these new ones pull at opposite ends. Lots of options have been renamed, so now the new pieces don't fit in so well. I'll try to work on this in later commits after this PR (it's likely there's a much better way to structure this whole part of Action View).
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-2/+2
|
* fixes remaining RuboCop issues [Vipul A M, Xavier Noria]Xavier Noria2016-09-011-1/+1
|
* fix document for radio_buttonshingo-nakanishi2016-09-011-1/+2
| | | | add `# Let's say that @user.receive_newsletter returns "no":` for `def radio_button(object_name, method, tag_value, options = {})`. fix `# Let's say that @user.category returns "no":` to `# Let's say that @user.receive_newsletter returns "no":`
* revises more Lint/EndAlignment offensesXavier Noria2016-08-081-9/+9
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-2/+2
|
* applies new string literal convention in actionview/libXavier Noria2016-08-061-13/+13
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.