-
-
Save kivanio/c77bae5a005f59accf86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/assets/javascripts/active_admin.js.coffee | |
#= require active_admin/base | |
ActiveAdmin = { | |
dashboard: {}, | |
user: {} | |
} | |
ActiveAdmin.dashboard.index = () -> | |
console.log 'Hello' | |
$(() -> | |
controller = $('body').data('controller') | |
action = $('body').data('action') | |
ActiveAdmin[controller][action]() if ActiveAdmin[controller][action]? | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/admin/layout_hacks.rb | |
module ActiveAdmin::Views::Pages::BaseExtension | |
def add_classes_to_body | |
super | |
@body.set_attribute "data-controller", params[:controller].gsub(/^admin\//, '') | |
@body.set_attribute "data-action", params[:action] | |
end | |
end | |
class ActiveAdmin::Views::Pages::Base | |
# mixes in the module directly below the class | |
prepend ActiveAdmin::Views::Pages::BaseExtension | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment