Commit Graph

1903 Commits

Author SHA1 Message Date
Ryuta Kamizono
b2c1e29c14 Enable Style/ParenthesesAroundCondition cop
To prevent style check in review like https://github.com/rails/rails/pull/33608#discussion_r211087605.
2018-08-19 08:16:21 +09:00
yuuji.yaginuma
87d5415f0a Fix unclosed tags [ci skip] 2018-08-18 16:23:20 +09:00
Prem Sichanugrist
88c4ea1d2d Update coffeelint to 2.1.0
There was a warning when running `npm install` in Action View:

    coffee-script@1.11.1: CoffeeScript on NPM has moved to
    "coffeescript" (no hyphen)

We are not requiring `coffee-script` explicitly, but `coffeelint` does.
The latest version, 2.1.0, already fix the dependency package name, so
we should upgrade to it to suppress the warning.
2018-08-13 10:22:25 +09:00
Alberto Almagro
67265a3ab0 [ci skip] Change references from Rake task to Rails command
This commit follows the path we started at commit #ea4f0e2
and continued at PR #33229.
2018-08-01 22:44:53 +02:00
Kazuhiro NISHIYAMA
9df747c9f0 Throw if ujs loaded twice
I saw two posts of problem about ajax requesting twice on qiita.
So I think detecting double loaded earlier make easy to find the problem.

https://qiita.com/hot_study_man/items/56dc87ad734cfda68bb6
https://qiita.com/hisas/items/8399aec3a5377bf75017
2018-07-31 22:16:02 +09:00
Bart de Water
eb5fea40a4 Enable Start/EndWith and RegexpMatch cops
In cases where the MatchData object is not used, this provides a speed-up:
https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
2018-07-28 17:37:17 -04:00
Dillon Welch
d108288c2f
Turn on performance based cops
Use attr_reader/attr_writer instead of methods

method is 12% slower

Use flat_map over map.flatten(1)

flatten is 66% slower

Use hash[]= instead of hash.merge! with single arguments

merge! is 166% slower

See https://github.com/rails/rails/pull/32337 for more conversation
2018-07-23 15:37:06 -07:00
Richard Schneeman
c11fc3b71c
Merge pull request #33268 from benpickles/remove-pubdate-from-docs
Keep time_tag docs up-to-date.
2018-07-21 13:39:37 -05:00
Yurii Cherniavskyi
d4a4a6f118 Fix leaking special form_with attributes into html attributes
Special form_with attributes `skip_default_ids` and `allow_method_names_outside_object`
attributes are leaking into html attributes of option select tag helpers.
2018-07-20 23:21:02 +03:00
Georgi Georgiev
113d8a2ba3 Fix issue with button_to's to_form_params
`button_to` was throwing exception when invoked with `params` hash that
contains symbol and string keys. The reason for the exception was that
`to_form_params` was comparing the given symbol and string keys.

The issue is fixed by turning all keys to strings inside
`to_form_params` before comparing them.
2018-07-16 09:44:22 +03:00
Tsukuru Tanimichi
4eb9c01e39
[ci skip] sanitizer_vendor will be removed in Rails 6
Related to https://github.com/rails/rails/pull/24386#issuecomment-403926683
2018-07-11 10:04:49 +09:00
Ryuta Kamizono
90e2739d86 Merge pull request #33286 from ph3t/add-changelog-entry-for-42c3537
Add changelog entry for 42c3537 [ci skip]
2018-07-04 09:43:56 +09:00
Juan Broullon
54c2c6de17 Add changelog entry for 42c3537 [ci skip] 2018-07-03 16:38:25 -04:00
Kasper Timm Hansen
a3a876f809
Merge pull request #32361 from ph3t/safe-html-translation-arrays
Add safe html support to arrays of translations
2018-07-03 18:27:29 +02:00
Juan Broullon
42c353705a Add safe html support to arrays of translations 2018-07-03 11:50:02 -04:00
Ben Pickles
46bb787c04 Keep time_tag docs up-to-date.
The pubdate attribute was removed from the spec, see
940eec417f20e53abd3e3114c7fa845dac0d3a62 for context.
2018-07-01 12:33:00 +01:00
bogdanvlviv
04f9b8fe07
Add to docs mention about :year_format option of date select
Follow up #32190

[ci skip]
2018-06-22 00:50:22 +03:00
Ryuta Kamizono
8f6c85f036 Merge pull request #32190 from liwii/use_year_names
Add `use_year_names` option to date_select tag
2018-06-21 17:01:35 +09:00
Koki Ryu
8f46a23d37 Add year_format option to date_select tag. This option makes it possible to customize year
names. Lambda should be passed to use this option. Example:

    date_select('user_birthday', '', start_year: 1998, end_year: 2000, year_format: ->year { "Heisei #{year - 1988}" })

The HTML produced:

    <select id="user_birthday__1i" name="user_birthday[(1i)]">
    <option value="1998">Heisei 10</option>
    <option value="1999">Heisei 11</option>
    <option value="2000">Heisei 12</option>
    </select>
    /* The rest is omitted */
2018-06-10 21:07:59 +09:00
yuuji.yaginuma
36390b6bdc Remove unnecessary with_default_enforce_utf8 method
Because the same method is defined in `FormWithTest` of the parent class.
fe9547b6fb/actionview/test/template/form_helper/form_with_test.rb (L19..L26)
2018-05-28 11:08:09 +09:00
yuuji.yaginuma
2f76256127 Fix RDoc formatting: + doesn't work with space [ci skip]
Follow up of #32958.
2018-05-23 08:12:20 +09:00
Corey Farwell
0077462be0
Indicate true in a doc comment is code-like. 2018-05-22 17:24:33 -04:00
Ryuta Kamizono
1dc17e7b2e Fix CustomCops/AssertNot to allow it to have failure message
Follow up of #32605.
2018-05-13 11:32:47 +09:00
Tyler Hunt
c6e1afdea4
Remove reference to old :text rendering option
[ci skip]
2018-05-11 14:19:29 -04:00
T.J. Schuck
a471ddf7c7 Remove leftover requires
* Concurrent::Map usage was removed from this file in 3239ed48d28f3c0baf4445e6c279107e892b7cab

* Monitor usage was removed in f233598d2da773c2024cbe62a199ddc70d9fd7a1
2018-05-07 17:20:37 -04:00
printercu
2d50374be8 Use usual method definition instead of extracting args from array
Follows #32612
2018-05-03 12:47:36 +03:00
Max Melentiev
20b4794ff7 Don't allocate unnecessary array in translation helper 2018-04-28 10:42:19 +03:00
Rafael França
ce58a64f19
Merge pull request #30647 from droptheplot/render-partials-string-locals
Allow usage of strings as locals for partial renderer
2018-04-27 19:17:36 -04:00
Ryuta Kamizono
0f9fc2b1e6 Address Style/StringLiterals offence
Caused at 9276ea89d2b0be9fdd1ad6590857f8d45a38c267.
2018-04-27 04:15:29 +09:00
Akira Matsuda
7d2400ab61 Don't try to destoy the given string via method argument
Or it would raise if the argument was frozen.

And even with this change, it would still reduce String allocations together with 9276ea89d2b0be9fdd1ad6590857f8d45a38c267
because `escape` should be `true` in most cases
2018-04-27 03:25:07 +09:00
Akira Matsuda
9276ea89d2 Reduce String allocations when building Action View tags
This method is called against each tag option for each tag,
and creates an extra garbage String per each call
2018-04-27 02:54:53 +09:00
George Claghorn
ef5902a2f1
Merge pull request #32471 from janko-m/use-image_processing-gem
Use ImageProcessing gem for ActiveStorage variants
2018-04-23 16:01:16 -05:00
Janko Marohnić
eef0bd0c0a
Recommend using :resize_to_fit after all 2018-04-23 21:04:35 +02:00
Rafael França
cde7c30781
Merge pull request #31881 from yewton/rails-ujs-with-yarn-autoclean
Update rails-ujs readme
2018-04-23 12:20:15 -04:00
yuuji.yaginuma
1694b02909 Make JS views rendered work with content security policy
As of now,  `HTMLElement.nonce` seems to work only in Chrome.
So, it should not be used now.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/nonce#Browser_compatibility

Fixes #32577.
2018-04-20 15:41:56 +09:00
Rafael França
3812ef8b66
Merge pull request #32574 from DmytroVasin/rails-ujs-stoppable-events
Rails-ujs: Info about stoppable events
2018-04-19 23:37:01 -04:00
Rafael França
fca08b8167
Merge pull request #32636 from yhirano55/improve_line_tasks
Improve redundancy in line tasks
2018-04-19 15:36:23 -04:00
Yoshiyuki Hirano
6aaeb8ef10 Improve redundancy in line tasks
* Remove needless concat from actionpack/Rakefile
* Remove neesless File.join from actionview/Rakefile
2018-04-19 23:45:28 +09:00
Daniel Colson
a1ac18671a Replace assert ! with assert_not
This autocorrects the violations after adding a custom cop in
3305c78dcd.
2018-04-19 08:11:33 -04:00
Andrew White
185fce1597
Merge pull request #32607 from yaroslav/feature/nonce-for-javascript_include_tag
Add the `nonce: true` option for `javascript_include_tag` helper.
2018-04-18 18:49:27 +01:00
Guillermo Iguaran
7bcb04c73d
Merge pull request #32326 from q-centrix/perf-improvement-translation-helper-default-array
Only create an array with default options if we have default options
2018-04-18 12:21:05 -05:00
utilum
8201646327 Ruby 2.6 warning: passing splat keyword arguments as a single Hash
Before:

```
$ ruby -v
ruby 2.6.0dev (2018-04-04 trunk 63085) [x86_64-linux]

$ bundle exec rake test:template
...
/rails/actionview/lib/action_view/digestor.rb:76: warning: passing splat keyword arguments as a single Hash to `find_all'
```
2018-04-17 22:07:26 +02:00
Yaroslav Markin
47013a7126 Add the nonce: true option for javascript_include_tag helper. 2018-04-17 22:50:33 +03:00
Xavier Noria
4824b4a8a6 ActionController -> Action Controller [ci skip]
Really just an excuse to trigger edge docs generation
2018-04-17 12:14:10 +02:00
Cassidy Kobewka
2aa8e0a56f
Inclusive Language in Documentation Examples [ci skip] 2018-04-15 12:34:30 -04:00
Dmytro Vasin
e3fcd96dc4 Fix stoppable events in tests and docs. 2018-04-14 19:44:14 +03:00
George Claghorn
4f99a21864
Fix rendering a differently-formatted partial after caching 2018-04-13 14:43:12 -04:00
Xavier Noria
d654677973 couple of edits [ci skip]
Legit, but really an excuse to trigger the master hook in the docs server.
2018-04-13 16:39:51 +02:00
bogdanvlviv
f0bde0167c
Fix actionview/CHANGELOG.md
- Add missing dots at the end of sentences.
- Wrap RecordTagHelper into `.
- `RecordTagHelper` => `ActionView::Helpers::RecordTagHelper`.

[ci skip]
2018-04-07 11:28:26 +03:00
Yoshiyuki Hirano
5c5ddd69b1 Remove RecordTagHelper
* Since #18411, we started to inform about extracted gem (record_tag_helper)
  to developers who use `ActionView::Helpers::RecordTagHelper` 's methods.

* Currently, it seems no problem that we don't have to support no longer.
2018-04-07 09:28:01 +09:00