aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/form_helper_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Fix broken alignments caused by auto-correct commit 411ccbdRyuta Kamizono2016-08-101-3/+6
| | | | Hash syntax auto-correcting breaks alignments. 411ccbdab2608c62aabdb320d52cb02d446bb39c
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-54/+54
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-10/+4
|
* modernizes hash syntax in actionviewXavier Noria2016-08-061-4/+4
|
* applies new string literal convention in actionview/testXavier Noria2016-08-061-162/+162
| | | | | 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-80/+18
| | | | | | | | | | | 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)
* Revert "Merge pull request #17973 from maurogeorge/file_field_hidden_field"eileencodes2016-06-211-20/+5
| | | | | | | | | | | | | The reason we are reverting this commit is because it created breaking changes for file upload gems. For more information see discussion here: https://github.com/rails/rails/issues/17947#issuecomment-225154294 This reverts commit c455817804e4df64c46c17a0cdec0e5a1ca5ba2e, reversing changes made to 8b3cd74b8a09ef85a43d7631bb062a9ec7f57227. Conflicts: actionview/CHANGELOG.md actionview/lib/action_view/helpers/form_helper.rb
* Deprecate `datetime_field` and `datetime_field_tag` helpers.Wojciech Wnętrzak2016-03-311-8/+24
| | | | | Datetime input type was removed from HTML specification. One can use `datetime_local_field` and `datetime_local_field_tag` instead.
* Revert "Merge pull request #22764 from ↵Rafael Mendonça França2016-03-051-21/+3
| | | | | | | | | | stevenspiel/titleize_model_name_for_default_submit_button_value" This reverts commit 4158974c60d817c9bc1e2aecb342161295f2ac0d, reversing changes made to 3d590add45b7ff1de972d99b076cb504d5208935. Reason: This break i18n in some languages. See https://github.com/rails/rails/issues/791#issuecomment-192724640
* html_safe is not supposed to be public API for AV. This change removes usage ↵Vipul A M2016-01-201-2/+2
| | | | | | 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()
* Merge pull request #22764 from ↵Rafael França2016-01-041-3/+21
|\ | | | | | | | | stevenspiel/titleize_model_name_for_default_submit_button_value titleize the model name on default submit buttons
| * downcase default submit button value's model nameSteven Spiel2016-01-011-3/+21
| |
* | Fix collection_radio_buttons' hidden_field name and make it appear before ↵Santiago Pastorino2015-12-311-18/+18
|/ | | | | | the radios Fixes #22773
* Fix week_field returning invalid valueChristoph2015-11-101-4/+10
| | | | | | | According to the W3 spec[1] the value should use a 1-based index and not a 0-based index for the week number. [1]: http://www.w3.org/TR/html-markup/datatypes.html#form.data.week
* Merge pull request #22116 from gsamokovarov/fix-form-for-block-testYves Senn2015-10-291-2/+3
|\ | | | | Fix a faulty form_for test
| * Fix a faulty form_for testGenadi Samokovarov2015-10-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stumbled upon this one while trying to deprecate the String/Symbol passing to `form_for`. This test passed on an accident, because the signature of `form_for` currently accepts 2 positional arguments and a block. Calling it with the wrong number of arguments caused: ```ruby (byebug) form_for(:post, @post, html: { id: 'create-post' }) *** ArgumentError Exception: wrong number of arguments (3 for 1..2) ``` This made the test pass, because it was still an `ArgumentError`. :-)
* | Merge pull request #21431 from ojab/masterRafael Mendonça França2015-09-261-0/+21
|\ \ | | | | | | Handle nested fields_for by adding indexes to record_name
| * | Handle nested fields_for by adding indexes to record_nameojab2015-08-301-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of the form with nested fields_for, i. e. <%= form_for :foos, url: root_path do |f| %> <% @foos.each do |foo| %> <%= f.fields_for 'foo[]', foo do |f2| %> <%= f2.text_field :id %> <% foo.bars.each do |bar| %> <%= f2.fields_for 'bar[]', bar do |b| %> <%= b.text_field :id %> <% end %> <% end %> <% end %> <% end %> <%= f.submit %> <% end %> rails doesn't add index for 'foo' in the inner fields_for block, so field names in the outer fields_for looks like "foos[foo][#{foo_index}][id]" and in the inner "foos[foo[]][bar][#{bar_index}][id]". Submitting of such form leads to an error like: >ActionController::BadRequest (Invalid request parameters: expected Array >(got Rack::QueryParser::Params) for param `foo'): This commit adds indexes for the foos in the inner blocks, so field names become "foos[foo][#{foo_index}][bar][#{bar_index}][id]" and submitting of such form works fine as expected. Fixes #15332
* | | Add a hidden field on the collection_radio_buttonsMauro George2015-09-241-4/+9
| |/ |/| | | | | | | This will avoid a error be raised when the only input on the form is the `collection_radio_buttons`.
* | :hocho: TyposAkira Matsuda2015-09-211-1/+1
|/
* Removed Mocha from ActionView part 1Ronak Jangir2015-08-241-26/+29
|
* Make disable_with default in submit_tagJustin Schiff2015-08-111-9/+9
| | | | | | | | | | | | | | 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`
* Override default form builder for a controllerKevin McPhillips2015-04-131-0/+24
|
* Accept lambda as child_index option in #fields_for methodKarol Galanciak2015-04-051-0/+17
|
* Fixed undefined method `i18n_key' for nil:NilClass for labels in non AR form_forMiklos Fazekas2015-02-061-0/+12
| | | | | Refactoring at #18647 broke using non active record objects in form_for. This patch restores the original behaviour where we only compute i18 key when object.respond_to?(:to_model)
* Add tests to make sure label and placeholder respect to_modelRafael Mendonça França2015-02-051-0/+42
|
* Eliminate a ruby warning in a test in Action ViewYuki Nishijima2015-01-171-1/+5
| | | | | | | This eliminates the warning below: actionview/test/template/form_helper_test.rb:913: warning: method redefined; discarding old id_came_from_user? actionview/test/template/form_helper_test.rb:104: warning: previous definition of id_came_from_user? was here
* Only use the `_before_type_cast` in the form when from user inputSean Griffin2015-01-141-0/+17
| | | | | | While we don't want to change the form input when validations fail, blindly using `_before_type_cast` will cause the input to display the wrong data for any type which does additional work on database values.
* Add tests with an explanation of why we're using `_before_type_cast`Sean Griffin2015-01-141-3/+4
| | | | | | | If you entered incorrect input into a form (particularly with a numericality validation), we should not replace what you typed in with `0`, since clicking submit a second time would essentially be the same as erroneously accepting the junk input as 0.
* Revert "Don't use the `_before_type_cast` version of attributes in the form"Sean Griffin2015-01-141-1/+1
| | | | This reverts commit 787e22bb491bd8c36db1e9734261c4ce02c5c5fd.
* Don't use the `_before_type_cast` version of attributes in the formSean Griffin2015-01-141-1/+1
| | | | | | | | | | | We should never be ignoring valuable information that the types may need to give us. The reason that it originally used `_before_type_cast` is unclear, but appears to date back long enough that the reasons may not be relevant today. There is only one test that asserts that it uses the before type cast version, but it gives no context as to why and uses a mock which does not simulate the real world. Fixes #18523.
* Merge pull request #17973 from maurogeorge/file_field_hidden_fieldRafael Mendonça França2015-01-021-5/+20
|\ | | | | | | Generate a hidden_tag when using a file_field
| * Add a hidden_field on the file_fieldMauro George2015-01-021-5/+20
|/ | | | | This will avoid a error be raised when the only input on the form is the `file_field`.
* Fix options overwritten by superJose Añasco2014-12-091-0/+5
|
* Add `:enforce_utf8` option to form_forclaudiob2014-11-201-3/+33
| | | | | | | | | Since 06388b0 `form_tag` accepts the option `enforce_utf8` which, when set to false, prevents the hidden "UTF8 enforcer" field from appearing in the output. This commit implements the same behavior for `form_for`. Stems from https://github.com/rails/rails/pull/17685#issuecomment-63871395
* Improve test of private properties of objects in form tagsRafael Mendonça França2014-10-311-28/+9
|
* Use public_send for form tagsagius2014-10-311-0/+27
|
* Honor public/private in ActionView::Helpers::Tags::Base#valueTobias Pfeiffer2014-10-311-0/+6
| | | | | * use public_send instead of send to avoid calling private methods in form helpers
* remove un-needed sortschneems2014-10-071-8/+7
| | | | | | HTML doesn't care what order the elements are rendered in, so why should we? Updates tests to use proper `assert_dom_equal` instead of `assert_equal` /cc @jeremy
* Merge pull request #16488 from agrobbin/form-label-builderJeremy Kemper2014-08-251-0/+9
|\ | | | | Provide a builder for form labels to customize wrapping around I18n content
| * provide a builder for form labels to customize wrapping around I18n contentAlex Robbin2014-08-201-0/+9
| |
* | just use the placeholder tag value if it is passed as a StringAlex Robbin2014-08-221-4/+19
| |
* | add I18n support for `:placeholder` HTML option is passed to form fieldsAlex Robbin2014-08-221-0/+168
| |
* | Revert "Add I18n support for `:placeholder` HTML option is passed to form ↵Jeremy Kemper2014-08-211-168/+0
|/ | | | fields"
* add I18n support for `:placeholder` HTML option is passed to form fieldsAlex Robbin2014-08-121-0/+168
|
* adding missing test for text area value before type castEugene Gilburg2014-07-191-0/+7
|
* Add String support for min/max attributes on DatetimeFieldTodd Bealmear2014-06-301-0/+64
|
* Merge pull request #15715 from ↵Yves Senn2014-06-141-2/+4
|\ | | | | | | | | | | zuhao/refactor_actionview_cleanup_I18n_translations Clean up I18n stored translations after test.