aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/asset_tag_helper.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into require_relative_2017Xavier Noria2017-07-021-2/+16
|\
| * Avoid shadowed variableMatthew Draper2017-07-021-2/+2
| |
| * Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
| * Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-021-0/+1
| |\ | | | | | | | | | Enforce frozen string in Rubocop
| | * Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
| | |
| * | Merge pull request #29349 from robertomiranda/responsive-imagesMatthew Draper2017-07-021-2/+16
| |\ \ | | |/ | |/| | | | Add srcset option to image_tag helper
| | * Add `srcset` option to `image_tag` helperRoberto Miranda2017-06-291-1/+15
| |/
* / [Action View] require => require_relativeAkira Matsuda2017-07-011-2/+2
|/
* Add :json type to auto_discovery_link_tagMike Gunderloy2017-05-201-5/+7
| | | | | This allows auto_discovery_link_tag to support the JSON Feed standard. See https://jsonfeed.org/version/1 for more information.
* Fix typo extention -> extension [ci skip]kenta-s2017-01-131-1/+1
|
* Fix grammar in asset tag documentationeileencodes2016-12-201-1/+1
| | | | | Updated the docmentation because "options supports" is not grammatically correct.
* Improve `javascript_include_tag` documentation (#27403)Pablo Ifrán2016-12-201-5/+24
| | | | Add all the available options, and correct the samples of the `javascript_include_tag`.
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-2/+2
|
* let Regexp#match? be globally availableXavier Noria2016-10-271-1/+0
| | | | | | Regexp#match? should be considered to be part of the Ruby core library. We are emulating it for < 2.4, but not having to require the extension is part of the illusion of the emulation.
* remove warning from `video_tag`yuuji.yaginuma2016-09-011-3/+3
| | | | | | | | This removes the following warning. ``` actionview/lib/action_view/helpers/asset_tag_helper.rb:291: warning: shadowing outer local variable - options ```
* Better keyword argument nameschneems2016-08-301-3/+3
|
* Address comment via @dhh, better option namingschneems2016-08-301-8/+8
|
* Document public_poster_folder optionschneems2016-08-291-0/+4
|
* Missed 2 public_* methods in cleanupschneems2016-08-291-16/+0
|
* Favor `public_folder: true` over `public_*`schneems2016-08-291-32/+3
| | | | Adding all those `public_*` methods is a bit heavy handed, we can change the API to instead use `public_folder: true`. Change was pretty easy since it was already implemented that way.
* Fix formattingschneems2016-08-291-8/+8
|
* Add `public_*` helpers to all the `_tag` methods.schneems2016-08-291-10/+58
|
* modernizes hash syntax in actionviewXavier Noria2016-08-061-5/+5
|
* applies new string literal convention in actionview/libXavier Noria2016-08-061-16/+16
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* systematic revision of =~ usage in AVXavier Noria2016-07-251-4/+5
| | | | | Where appropriate, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
* Bring Boolean Attributes list for AV Tags helper upto speed with current spec.Vipul A M2016-06-281-2/+2
| | | | | | | | | This is based on https://github.com/kangax/html-minifier/blob/6b2d4536d82819143b468b41a89c700b6c61631f/src/htmlminifier.js#L197 and spec from https://www.w3.org/TR/html51/single-page.html. Couple of other changes to tests due to support update: - autobuffer has been dropped in favour of preload attribute, ref: https://msdn.microsoft.com/en-us/library/ff974743(v=vs.85).aspx - pubdate attribute has been dropped from spec, ref: https://www.w3.org/html/wg/tracker/issues/185
* Fix img alt attribute generation when using Sprockets >= 3.0Bart de Water2016-01-271-1/+1
|
* Remove ActionView dependence on ActionPack's Mime implementationJon Moss2016-01-171-1/+1
|
* Example of setting data attributes for image_tagNishant Modak2015-11-201-0/+2
|
* Allow `host` option in javscript and css helpersGrzegorz Witek2015-11-081-2/+2
| | | | | Now both `javascript_include_tag` and `stylesheet_tag` can accept `host` option to provide custom host for the asset
* Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compatJeremy Daer2015-10-061-1/+1
| | | | | | | | | | | | | | | | | Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries that support multiple Rails versions would've had to feature-detect whether to use `Mime::Type[:FOO]` or `Mime::FOO`. `Mime[:foo]` has been around for ages to look up registered MIME types by symbol / extension, though, so libraries and plugins can safely switch to that without breaking backward- or forward-compatibility. Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup by type or extension, so it's not available as `Mime[:all]`. We use it internally as a wildcard for `respond_to` negotiation. If you use this internal constant, continue to reference it with `Mime::ALL`. Ref. efc6dd550ee49e7e443f9d72785caa0f240def53
* Cut string allocations in content_tag_stringschneems2015-07-291-1/+1
| | | | | | content_tag's first argument is will generate a string with an html tag so `:a` will generate: `<a></a>`. When this happens, the symbol is implicitly `to_s`-d so a new string is allocated. We can get around that by using a frozen string instead which This change buys us 74,236 bytes of memory and 1,855 fewer objects per request.
* Freeze string literals when not mutated.schneems2015-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I wrote a utility that helps find areas where you could optimize your program using a frozen string instead of a string literal, it's called [let_it_go](https://github.com/schneems/let_it_go). After going through the output and adding `.freeze` I was able to eliminate the creation of 1,114 string objects on EVERY request to [codetriage](codetriage.com). How does this impact execution? To look at memory: ```ruby require 'get_process_mem' mem = GetProcessMem.new GC.start GC.disable 1_114.times { " " } before = mem.mb after = mem.mb GC.enable puts "Diff: #{after - before} mb" ``` Creating 1,114 string objects results in `Diff: 0.03125 mb` of RAM allocated on every request. Or 1mb every 32 requests. To look at raw speed: ```ruby require 'benchmark/ips' number_of_objects_reduced = 1_114 Benchmark.ips do |x| x.report("freeze") { number_of_objects_reduced.times { " ".freeze } } x.report("no-freeze") { number_of_objects_reduced.times { " " } } end ``` We get the results ``` Calculating ------------------------------------- freeze 1.428k i/100ms no-freeze 609.000 i/100ms ------------------------------------------------- freeze 14.363k (± 8.5%) i/s - 71.400k no-freeze 6.084k (± 8.1%) i/s - 30.450k ``` Now we can do some maths: ```ruby ips = 6_226k # iterations / 1 second call_time_before = 1.0 / ips # seconds per iteration ips = 15_254 # iterations / 1 second call_time_after = 1.0 / ips # seconds per iteration diff = call_time_before - call_time_after number_of_objects_reduced * diff * 100 # => 0.4530373333993266 miliseconds saved per request ``` So we're shaving off 1 second of execution time for every 220 requests. Is this going to be an insane speed boost to any Rails app: nope. Should we merge it: yep. p.s. If you know of a method call that doesn't modify a string input such as [String#gsub](https://github.com/schneems/let_it_go/blob/b0e2da69f0cca87ab581022baa43291cdf48638c/lib/let_it_go/core_ext/string.rb#L37) please [give me a pull request to the appropriate file](https://github.com/schneems/let_it_go/blob/b0e2da69f0cca87ab581022baa43291cdf48638c/lib/let_it_go/core_ext/string.rb#L37), or open an issue in LetItGo so we can track and freeze more strings. Keep those strings Frozen ![](https://www.dropbox.com/s/z4dj9fdsv213r4v/let-it-go.gif?dl=1)
* image_tag raises an error if size is passed with height and/or widthMike Stone2015-04-241-0/+7
|
* correct output of auto_discovery_link_tag [ci skip]yuuji.yaginuma2015-04-041-1/+1
|
* Allow to pass a string value to size option in `image_tag` and `video_tag`Mehdi Lahmam2015-02-161-0/+1
| | | | This makes the behavior more consistent with `width` or `height` options
* Uppercase HTML in docs.Hendy Tanata2014-08-081-2/+2
| | | | [skip ci]
* [ci skip] /javascript/ ~> JavaScriptAditya Kapoor2014-06-171-1/+1
|
* Revert "Correct Documentation for asset_tag_helpers"Rafael Mendonça França2014-06-041-17/+16
| | | | | | | | | | This reverts commit c22a253d1a72602331db1eba3e91bc945eff2346. Reason: Our documentation assumes the assets are in the proper place and we are using the default Rails stack. With the default Rails stack and the assets being in the correct place the assets helpers uses the `/assets` prefix.
* correct doc for (audio|video)_tag [ci skip]Aditya Kapoor2014-05-271-10/+10
|
* Correct Documentation for asset_tag_helpersAditya Kapoor2014-05-261-15/+16
|
* rewrites the API docs of favicon_link_tag [ci skip]Xavier Noria2014-04-291-9/+16
| | | | Motivated by #14907.
* Change favicon_link_tag helper mimetype from image/vnd.microsoft.icon to ↵glorieux2014-04-211-3/+3
| | | | | | | | image/x-icon. Although the official IANA-registered MIME type for ICO files is image/vnd.microsoft.icon, registered in 2003, it was submitted to IANA by a third party and is not recognized by Microsoft products. The MIME type image/x-icon should be used since is the one recognized by the major browsers on the market.
* Fix typo in image_tag documentationAdrien2014-01-071-1/+1
| | | image_tag only supports :alt and :size as additional keys, not three.
* duplication removed(DRY)abhishek2013-12-181-16/+10
|
* allow video_tag to accept `size` as `Number` for square shaped videosKuldeep Aggarwal2013-12-181-4/+10
|
* Typo and grammatical fixes [ci skip]Akshay Vishnoi2013-12-021-1/+1
|
* unnecessary checking of `size` with `second regex` if matched with first oneKuldeep Aggarwal2013-11-271-2/+5
|
* Merge pull request #12788 from kylefritz/patch-1Rafael Mendonça França2013-11-061-2/+2
| | | | | | rdoc: favicon source shouldn't begin with a slash to reference asset pipeline resource [ci skip] Conflicts: actionview/lib/action_view/helpers/asset_tag_helper.rb
* Fixed return strings in documentationJoseph Zidell2013-10-031-3/+3
|