From c945da583b8f802216300d037e5a70ebc5da834c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Ifr=C3=A1n?= Date: Tue, 20 Dec 2016 18:12:38 -0300 Subject: Improve `javascript_include_tag` documentation (#27403) Add all the available options, and correct the samples of the `javascript_include_tag`. --- .../lib/action_view/helpers/asset_tag_helper.rb | 29 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'actionview/lib/action_view/helpers/asset_tag_helper.rb') diff --git a/actionview/lib/action_view/helpers/asset_tag_helper.rb b/actionview/lib/action_view/helpers/asset_tag_helper.rb index 4e4f4823e6..397a12f137 100644 --- a/actionview/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb @@ -35,18 +35,37 @@ module ActionView # When the Asset Pipeline is enabled, you can pass the name of your manifest as # source, and include other JavaScript or CoffeeScript files inside the manifest. # + # ==== Options + # + # When the last parameter is a hash you can add HTML attributes using that + # parameter. That options supports the following keys as well: + # + # * :extname - Append a extention to the generated url unless the extension + # already exists. This only applies for relative urls. + # * :protocol - Sets the protocol of the generated url, this option only + # applies when a relative url and +host+ options are provided. + # * :host - When a relative url is provided the host is added to the + # that path. + # * :skip_pipeline - This option is used to bypass the asset pipeline + # when it is set to true. + # + # ==== Examples + # # javascript_include_tag "xmlhr" - # # => + # # => + # + # javascript_include_tag "xmlhr", host: "localhost", protocol: "https" + # # => # # javascript_include_tag "template.jst", extname: false - # # => + # # => # # javascript_include_tag "xmlhr.js" - # # => + # # => # # javascript_include_tag "common.javascript", "/elsewhere/cools" - # # => - # # + # # => + # # # # javascript_include_tag "http://www.example.com/xmlhr" # # => -- cgit v1.2.3