Sha256: 156a4977f3c6cc83e64ea0de843ea8b8b45188056c3b7c3cf9d6e75140f79319
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
<% app_name = Rails.application.class.to_s.split('::').first %> class SeedTray constructor: () -> if window.Turbolinks != undefined if Turbolinks.EVENTS != undefined $(window).on "page:change", => @render() else $(window).on "turbolinks:load", => @render() else $(@render) @root = <%= app_name %> # Dynamically delegate render to controller#action specific render methods render: => # Run the page specific render code @delegate_render() # Run the code that should run on every page. @site_wide_render() delegate_render: => suppress_console = <%= SeedTray.configuration.suppress_console %> controller = $("[data-controller]").data("controller") action = $("[data-action]").data("action") if @root[controller] && @render_defined(@root[controller]) @root[controller].render() else unless suppress_console console.info "Skipped #{@root.name}.#{controller}.render()." if @root[controller] && @root[controller][action] && @render_defined(@root[controller][action]) @root[controller][action].render() unless suppress_console console.info "Executed #{@root.name}.#{controller}.#{action}.render()." else unless suppress_console console.info "Skipped #{@root.name}.#{controller}.#{action}.render()." render_defined: (object) -> object.render != undefined site_wide_render: -> <%= app_name %>.delegator = new SeedTray()
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
seed_tray-0.4.1 | app/assets/javascripts/seed_tray.js.coffee.erb |