Skip to content

Instantly share code, notes, and snippets.

@bennyzr
Last active December 14, 2016 17:59
Show Gist options
  • Save bennyzr/0bd5d7c59c69010dec73fa4576a5a04d to your computer and use it in GitHub Desktop.
Save bennyzr/0bd5d7c59c69010dec73fa4576a5a04d to your computer and use it in GitHub Desktop.
Insert tag into Active Admin body tag to disable turbolinks
module ActiveAdmin
module Views
module Pages
class Base < Arbre::HTML::Document
def build(*args)
super
add_classes_to_body
add_attributes_to_body
build_active_admin_head
build_page
end
def add_attributes_to_body
@body.attributes[:"data-no-turbolink"] = "true"
end
end
end
end
end
@bennyzr
Copy link
Author

bennyzr commented Dec 14, 2016

app/lib/active_admin/disable_turbo_links.rb

module ActiveAdmin
module DisableTurbolinks

  def build(*args)
		super
    add_attributes_to_body
  end

	def add_attributes_to_body
		@body.attributes[:"data-no-turbolink"] = "true"
	end
end

end

config/initializers/active_admin_extensions.rb

ActiveAdmin::Views::Pages::Base.prepend(ActiveAdmin::DisableTurbolinks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment