Module: Platform::AssetTagHelper
- Includes:
- ActionView::Helpers::AssetTagHelper
- Included in:
- PlatformHelper
- Defined in:
- app/helpers/platform/asset_tag_helper.rb
Instance Method Summary collapse
- #admin_image_tag(source, options = {}) ⇒ Object
- #compute_public_path_with_context(source, dir, ext = nil, include_host = true) ⇒ Object
- #javascript_include_tag_with_context(*sources) ⇒ Object
- #stylesheet_link_tag_with_context(*sources) ⇒ Object
Instance Method Details
#admin_image_tag(source, options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/helpers/platform/asset_tag_helper.rb', line 31 def admin_image_tag(source, = {}) .symbolize_keys! src = [:src] = "/admin/images/#{source}" unless src =~ /^cid:/ [:alt] = .fetch(:alt){ File.basename(src, '.*').capitalize } end if size = .delete(:size) [:width], [:height] = size.split("x") if size =~ %r{^\d+x\d+$} end if mouseover = .delete(:mouseover) [:onmouseover] = "this.src='/admin/images/#{mouseover}'" [:onmouseout] = "this.src='#{src}'" end tag("img", ) end |
#compute_public_path_with_context(source, dir, ext = nil, include_host = true) ⇒ Object
47 48 49 50 |
# File 'app/helpers/platform/asset_tag_helper.rb', line 47 def compute_public_path_with_context(source, dir, ext = nil, include_host = true) r = compute_public_path_without_context(source, dir, ext, include_host) @active_context != :site ? "/#{@active_context}#{r}" : r end |
#javascript_include_tag_with_context(*sources) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/helpers/platform/asset_tag_helper.rb', line 18 def javascript_include_tag_with_context(*sources) = sources..stringify_keys context = .delete("context") || :site if context assets_with_context context do javascript_include_tag_without_context *(sources + []) end else javascript_include_tag_without_context *(sources + []) end end |
#stylesheet_link_tag_with_context(*sources) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/helpers/platform/asset_tag_helper.rb', line 5 def stylesheet_link_tag_with_context(*sources) = sources..stringify_keys context = .delete("context") || :site if context assets_with_context context do stylesheet_link_tag_without_context *(sources + []) end else stylesheet_link_tag_without_context *(sources + []) end end |