| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
helper into actionview
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Replace `FormOptionHelper` to `FormOptionsHelper`.
|
| |
|
|
|
|
|
|
| |
Since it affects the entire form, should not mutate `object_name` of class.
Fixes #26931
|
|
|
|
| |
Ensure the support works like form_with.
|
| |
|
|
|
|
|
|
|
|
| |
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]`.
|
|
|
|
| |
Remote is gone, long live local.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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" ...>
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Follow up to #26976.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 `# 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":`
|
| |
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
| |
Datetime input type was removed from HTML specification.
One can use `datetime_local_field` and `datetime_local_field_tag` instead.
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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()
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
When this method was implemented
(https://github.com/rails/rails/pull/5016/files), `to_date` is called.
But this behavior was chagned refactoring
(https://github.com/rails/rails/pull/6452/files).
In the first commit, there were not test which asserts `to_date` is called.
I think trying `to_date` is more useful than trying `strftime`, because
we can write `"2015-01-01".to_date`. But first fix comments to match
actual behavior.
|
|\
| |
| | |
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
|
| | |
|
| | |
|
|/ |
|
|\ |
|
| | |
|
| | |
|
|/ |
|
| |
|
|\
| |
| |
| |
| | |
Conflicts:
guides/source/4_0_release_notes.md
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The previous change 92a3c8dcdf174dab5e8759031b6bbe6cd891fe3c improved
this example, but calling .create + #valid? ends up running validations
twice, and we don't want to showcase that.
Lets use the normal use case of building a new object and calling #save
on it, which is what a basic scaffold with Active Record does.
[ci skip]
|
|/ |
|
| |
|