Commit Graph

236 Commits

Author SHA1 Message Date
Andrew White
96eeea538c Don't enforce UTF-8 by default
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.
2018-02-27 15:03:50 +00:00
Rui Onodera
e579c7430a Change translation key of submit_tag from module_name_class_name to 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.
2018-02-27 11:41:56 +09:00
Jeremy Daer
d4eb0dc89e Rails 6 requires Ruby 2.4.1+
Skipping over 2.4.0 to sidestep the `"symbol_from_string".to_sym.dup` bug.

References #32028
2018-02-17 15:34:57 -08:00
Rafael Mendonça França
1c383df324 Start Rails 6.0 development!!!
🎉🎉🎉
2018-01-30 18:51:17 -05:00
Jérémie Bonal
0d73056436 Allow the use of callable objects as group methods for grouped selects.
Replaced the uses of `group.send(...)` in `option_groups_from_collection_for_select`
by calls to `value_for_collection(group, ...)`, allowing the use of
procs, lambdas and other callable objects as parameters.
2017-12-27 17:49:07 +01:00
Ryuta Kamizono
6b16f6db27 Tweaks CHANGELOGs [ci skip] 2017-12-01 20:42:04 +09:00
Guillermo Iguaran
eb90b8bc86 Add preload_link_tag helper.
This helper creates a link tag with preload keyword that allows to
browser to initiate early fetch of resources. Additionally this send
Early Hints if supported.

See 59a02fb7bc
for more details about Early Hints.

Preload spec: https://w3c.github.io/preload/
2017-11-28 20:53:30 -05:00
Rafael Mendonça França
2837d0f334
Preparing for 5.2.0.beta2 release 2017-11-28 14:41:02 -05:00
Rafael Mendonça França
cceeeb6e57
Preparing for 5.2.0.beta1 release 2017-11-27 14:50:03 -05:00
npezza93
260d6f112a
Change form_with to generates ids by default
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.`
2017-11-25 11:55:02 -05:00
neumayr
ead4776b82 Fix field_error_proc wrap form select optgroup and divider option tag
### Summary

The [`:field_error_proc`](https://github.com/rails/rails/blob/master/actionview/lib/action_view/base.rb#L145) is responsible for decorating input tags that refer to attributes with errors. This default build-in rails feature wrap invalid form elements with additional markup: `<div class="field_with_errors">[…]</div>`.

* Fix for `field_error_proc` wraps form select `optgroup`
* Fix for `field_error_proc` wraps form select divider `option`
* Add tests for uncovered elements with errors

[Fixes #31088]

#### Test coverage
* `test_select_grouped_options_with_errors`
* `test_time_zone_select_with_priority_zones_and_errors`

#### Extend test coverage
* `test_collection_select_with_errors`
* `test_label_with_errors`
* `test_check_box_with_errors`
* `test_check_boxes_with_errors`
* `test_radio_button_with_errors`
* `test_radio_buttons_with_errors`
* `test_collection_check_boxes_with_errors`
* `test_collection_radio_buttons_with_errors`
2017-11-09 17:37:06 +01:00
Rafael Mendonça França
7de7f12fd1
Remove deprecated Erubis ERB handler 2017-10-23 12:50:31 -04:00
Cameron Cundiff
9a74c7b99b Do not generate default alt text in image tags
- Auto-generating content from the filename of an image is not suitable
  alternative text; alt text that isn't fully considered can be
  distracting and fatiguing for screen readers users (blind, low vision,
  dyslexic people).
- Setting a filename fallback short circuits screen reader default
  behavior and configuration for blank descriptions.
- Setting poor defaults also creates false negatives for accessibility
  linting and testing software, that makes it harder to improve
  application accessibility.

***

- After this change, if authors leave images without alt text, screen
  readers will fallback to default behavior for missing alt text.
- Also with this change, Automated linting and testing tools will
  correctly generate warnings.

[Fixes #30096]
2017-08-17 16:13:15 -04:00
Matthew Draper
9ecdcac167 Merge pull request #29349 from robertomiranda/responsive-images
Add srcset option to image_tag helper
2017-07-02 00:46:12 +09:30
Roberto Miranda
43efae22a7 Add srcset option to image_tag helper 2017-06-29 08:59:54 -05:00
Ryuta Kamizono
9fdebb17ff ✂️
[ci skip]
2017-06-28 22:21:03 +09:00
savroff
01ddd1cecf Add changes to CHANGELOG
fix

fix
2017-06-19 18:39:54 -04:00
yuuji.yaginuma
bc90514228 Generate field ids in collection_check_boxes and collection_radio_buttons
This makes sure that the labels are linked up with the fields.
Fixes #29014
2017-06-11 16:30:26 +09:00
Mike Gunderloy
062e5f2b06
Add :json type to auto_discovery_link_tag
This allows auto_discovery_link_tag to support the JSON Feed standard.
See https://jsonfeed.org/version/1 for more information.
2017-05-20 04:00:13 -05:00
Ryuta Kamizono
89389428b5 Cleanup CHANGELOGs [ci skip]
* Remove trailing spaces.
* Add backticks around method and command.
* Fix indentation.
2017-04-30 02:41:44 +09:00
Jay Hayes
756de667ae Ensure input to distance_of_time_in_words is not nil
* Internally all input is converted to time so that it can be treated
  uniformly.

Remove now-unneeded condition

* Now that all input is treated is converted to time, we no longer need
  to type check it.

Rename variables to clarify their purpose

Extract private method to normalize distance_of_time args to time

Update actionview changelog
2017-04-27 12:00:13 -07:00
Matthew Draper
6c08d480f1 Start Rails 5.2 development 2017-03-22 10:11:39 +10:30
Richard Schneeman
42f676d10b Merge pull request #28407 from claudiob/changelog-skip-pipeline
Add CHANGELOG for #26226 [ci skip]
2017-03-13 22:06:44 -05:00
claudiob
7709ea3d59 Add CHANGELOG for #26226 [ci skip] 2017-03-13 20:04:47 -07:00
Jon Moss
804f27baf7 Small grammar change + new line for "fixes"
[ci skip]
2017-03-13 19:39:20 -04:00
Andrew Hood
504a9715ee
Remove encode_special_chars option from strip_tags 2017-02-27 14:17:17 -08:00
Rafael Mendonça França
f4acdd83ff
Preparing for 5.1.0.beta1 release 2017-02-23 14:53:21 -05:00
Jeremy Evans
7da8d76206
Change ActionView ERB Handler from Erubis to Erubi
Erubi offers the following advantages for Rails:

* Works with ruby's --enable-frozen-string-literal option
* Has 88% smaller memory footprint
* Does no freedom patching (Erubis adds a method to Kernel)
* Has simpler internals (1 file, <150 lines of code)
* Has an open development model (Erubis doesn't have a
  public source control repository or bug tracker)
* Is not dead (Erubis hasn't been updated since 2011)

Erubi is a simplified fork of Erubis that contains just the
parts that are generally needed (which includes the parts
that Rails uses).  The only intentional difference in
behavior is that it does not include support for <%=== tags
for debug output.  That could be added to the ActionView ERB
handler if it is desired.

The Erubis template handler remains in a deprecated state
so that code that accesses it directly does not break.  It
can be removed after Rails 5.1.
2017-01-25 01:41:27 -07:00
Andrew White
b5edc55d9f Allow render locals to be assigned to instance variables
In #26672 we blocked use of Ruby keywords as identifiers for view
locals but inadvertently broke the use of instance variable names
as identifiers. Whilst not explicitly documented this behavior has
been around for a long time and there's no need to break it now.

Fixes #27480.
2017-01-15 13:41:39 +00:00
Maksym Pugach
13352f6972 Add check_parameters option to current_page?
Example:

For "http://www.example.com/shop/checkout?order=desc&page=1"

current_page?('http://www.example.com/shop/checkout')
=> true

current_page?(
  'http://www.example.com/shop/checkout',
  check_parameters: true
)
=> false
2017-01-04 06:33:29 +02:00
yuuji.yaginuma
ebeeceeb2a do not mutate object_name of class in fields_for
Since it affects the entire form, should not mutate `object_name` of class.

Fixes #26931
2016-12-27 14:22:36 +09:00
Max Melentiev
238035409e Fixed usage of cache_template_loading
It disables recompilation of templates on every request in test env.
2016-12-06 23:36:47 +03:00
Kasper Timm Hansen
1f2e896edb [ci skip] Mention form_with and fields in changelog.
Implemented in 67f81cc.
2016-11-21 20:59:35 +01:00
Vipul A M
7e7d6ccf34
Changelog edits 2016-11-12 13:14:49 -05:00
Rafael Mendonça França
b9ba263e5a
Removed deprecated #original_exception in ActionView::Template::Error. 2016-10-10 02:20:11 -03:00
Peter Schilling
f9960f2d74 Change render to support any hash keys in locals
this lets you pass ruby keywords to templates:

    <%= render 'example', class: "cool" %>

    <%= render 'example', "spaces are" => "a-ok" %>

    <%= render 'example', Foo: "bar" %>

Previously you'd see confusing syntax errors like this:

    SyntaxError (.../_example.html.erb:1: syntax error, unexpected '='

Now you can reference invalid identifiers through local_assigns.

If you try to use an invalid keyword (e.g. class) in your template, you
get a syntax error on the line where you use it.
2016-10-02 00:21:17 -07:00
Vipul A M
8b984161d6
Pass over changelogs [ci skip] 2016-08-10 09:33:13 +05:30
Kasper Timm Hansen
2dc0918718 Move CHANGELOG entry to the top. 2016-08-07 19:14:31 +02:00
Stan Lo
ab2af4dfcb Modify LogSubscriber for single partial's cache message.
Implement naive partial caching mechanism.

Add test for LogSubscriber

Use ActionView::Base#log_payload to store log_subscriber's payload, so we can pass cache result into it.

Fixed tests

Remove useless settings

Check if #log_payload exists before calling it. Because other classes also includes CacheHelper but don't have is attribute

Use @log_payload_for_partial_reder instead of #log_payload to carry ActionView's payload.

Update test's hash syntax

Add configuration to enable/disable fragment caching logging

Remove unless test and add new test to ensure cache info won't effect next rendering's log

Move :enable_fragment_cache_logging config from ActionView to ActionPack

Apply new config to tests

Update actionview's changelog

Update configuration guide

Improve actionview's changelog

Refactor PartialRenderer#render and log tests

Mute subscriber's log instead of disabling instrumentation.

Fix typo, remove useless comment and use new hash syntax

Improve actionpack's log_subscriber test

Fix rebase mistake

Apply new config to all caching intstrument actions
2016-08-08 00:24:39 +08:00
Steven Harman
87899cfcf0 Use to_a to pre-buffer the collection
We can safely assume we're not dealing with an infinite collection as
we're about to call `each` on it and collect the results until it
terminates on its own. Given that, `to_a` is implemented by the normal
Array-like objects, and less Array-like objects like `Enumerator` and
`Enumerator::Lazy`.
2016-07-26 11:33:34 -04:00
Steven Harman
ae75930b59 Fix collection_from_options to allow Enumerators
An optimization was introduced in
27f4ffd11a
which tried to `#to_ary` the collection to prevent unnecessary queries
for ActiveRecord scopes/relations. If the given collection did not
respond to `#to_ary`, and empty collection was returned. That meant you
couldn't use collections built from `Enumerator` nor `Enumerable`.

With this change, `#collection_from_options` will attempt the
optimization, but fall back to passing along the given collection,
as-is.
2016-07-26 10:38:58 -04:00
Marek
a65a3bde0b New syntax for tag helpers i.e. tag.br instead of tag(br) #25195 2016-06-27 19:00:54 +02:00
George Millo
8415996317 English fix
--skip-ci
2016-06-23 14:10:53 +02:00
Rafael Mendonça França
7b0b3d835a
Merge pull request #25469 from herminiotorres/update-datetime-to-datetime-local-by-html-specification
Change datetime to datetime-local helper tag
2016-06-22 13:51:13 -03:00
Herminio Torres
aa6dde37cd
Change datetime to datetime-local helper tag
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)
2016-06-21 22:37:42 -03:00
eileencodes
1de0df8669 Change the raw template handler to render html-safe strings
In PR #24929 the changelog was updated to make note that while the new
template handler was changed to raw this changed the behavior when
outputting plain html or js files. Previously ERB would output the files
unescaped. Changing the default handler to RAW meant that these same
files would be rendered as escaped rather than as js or html.

Because of this change in behavior and after the discussion #24949 in we
decided to change the behavior of the Raw handler to output html_safe
strings by default.

Now files rendered with the default handler (raw) render the file
unescaped.
2016-06-21 17:08:48 -04:00
Jon Moss
ae7b5314f1
Remove space, properly italicize
Difference in rendering --> https://gist.github.com/maclover7/a50ff9231eb825c39c77cd5858af6d9a

[ci skip]
2016-05-21 12:32:55 -04:00
Vipul A M
9bfd968bed
Confirm with the specification when generating emtpy option for select with include_blank: true option.
We now generate option with empty label, example:

`<select id="places" name="places"><option value="" label=" "></option></select>`

 for include_blank: true. This is only done, if content is missing on the option, and we providing the value from this option.

 Fixes #24816
2016-05-21 15:43:35 +08:00
Rafael Mendonça França
8ecc5ab1d8 Start Rails 5.1 development 🎉 2016-05-10 03:46:56 -03:00
Rodrigo Rosenfeld Rosas
c609bb619d Improve AV changelog with regards to default RAW handler
It highlights which kind of incompatibilities this could lead to when rendering plain JS or HTML partials.
2016-05-09 16:40:52 -03:00