* Remove trailing space * Add period * etc
2.4 KiB
-
Change
ActionView::Helpers::UrlHelper#button_to
to always render a<button>
element, regardless of whether or not the content is passed as the first argument or as a block.<%= button_to "Delete", post_path(@post), method: :delete %> <%# => <form method="/posts/1"><input type="_method" value="delete"><button type="submit">Delete</button></form> <%= button_to post_path(@post), method: :delete do %> Delete <% end %> <%# => <form method="/posts/1"><input type="_method" value="delete"><button type="submit">Delete</button></form>
Sean Doyle, Dusan Orlovic
-
Add
config.action_view.preload_links_header
to allow disabling of theLink
header being added by default when usingstylesheet_link_tag
andjavascript_include_tag
.Andrew White
-
The
translate
helper now resolvesdefault
values when anil
key is specified, instead of always returningnil
.Jonathan Hefner
-
Add
config.action_view.image_loading
to configure the default value of theimage_tag
:loading
option.By setting
config.action_view.image_loading = "lazy"
, an application can opt in to lazy loading images sitewide, without changing view code.Jonathan Hefner
-
ActionView::Helpers::FormBuilder#id
returns the value of the<form>
element'sid
attribute. With amethod
argument, returns theid
attribute for a form field with that name.<%= form_for @post do |f| %> <%# ... %> <% content_for :sticky_footer do %> <%= form.button(form: f.id) %> <% end %> <% end %>
Sean Doyle
-
ActionView::Helpers::FormBuilder#field_id
returns the value generated by the FormBuilder for the given attribute name.<%= form_for @post do |f| %> <%= f.label :title %> <%= f.text_field :title, aria: { describedby: f.field_id(:title, :error) } %> <%= tag.span("is blank", id: f.field_id(:title, :error) %> <% end %>
Sean Doyle
-
Add
tag.attributes
to transform a Hash into HTML Attributes, ready to be interpolated into ERB.<input <%= tag.attributes(type: :text, aria: { label: "Search" }) %> > # => <input type="text" aria-label="Search">
Sean Doyle
Please check 6-1-stable for previous changes.