| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
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()
|
|\
| |
| |
| |
| | |
stevenspiel/titleize_model_name_for_default_submit_button_value
titleize the model name on default submit buttons
|
| | |
|
|/
|
|
|
|
| |
the radios
Fixes #22773
|
|
|
|
|
|
|
| |
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
|
|\
| |
| | |
Fix a faulty form_for test
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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`. :-)
|
|\ \
| | |
| | | |
Handle nested fields_for by adding indexes to record_name
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| |/
|/|
| |
| |
| | |
This will avoid a error be raised when the only input on the form is the
`collection_radio_buttons`.
|
|/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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`
|
| |
|
| |
|
|
|
|
|
| |
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)
|
| |
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This reverts commit 787e22bb491bd8c36db1e9734261c4ce02c5c5fd.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| |
| | |
Generate a hidden_tag when using a file_field
|
|/
|
|
|
| |
This will avoid a error be raised when the only input on the form is the
`file_field`.
|
| |
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
|
|
|
|
| |
* use public_send instead of send to avoid calling private
methods in form helpers
|
|
|
|
|
|
| |
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
|
|\
| |
| | |
Provide a builder for form labels to customize wrapping around I18n content
|
| | |
|
| | |
|
| | |
|
|/
|
|
| |
fields"
|
| |
|
| |
|
| |
|
|\
| |
| |
| |
| |
| | |
zuhao/refactor_actionview_cleanup_I18n_translations
Clean up I18n stored translations after test.
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, only the object and method name from the label tag were
used when looking up the translation for a label. If a value is
given for the label, this ought to be additionally used. The
following:
# form.html.erb
<%= form_for @post do |f| %>
<%= f.label :type, value: "long" %>
<% end %>
# en.yml
en:
activerecord:
attributes:
post/long: "Long-form Post"
Used to simply return "long", but now it will return "Long-form
Post".
|
| |
|
|\
| |
| |
| |
| |
| |
| | |
Remove wrapping div with inline styles for hidden form fields.
Conflicts:
actionview/CHANGELOG.md
|
| |
| |
| |
| |
| |
| | |
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.
|
|/ |
|
|
|
|
|
| |
This is a follow up to #14170. While backporting I recognized
that this call is not needed at all.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The use of `display:inline` with the content_tag call in the
extra_tags_for_form method potentially causes display issues with some
browsers, namely Internet Explorer. IE's behaviour of not collapsing
the line height on divs with ostensibly no content means that the
automatically added div containing the hidden authenticity_token, utf8
and _method form input tags may interfere with other visible form
elements in certain circumstances. The use of `display:none` rather
than `display:inline` fixes this problem.
Fixes #6403
|
| |
|