2012-06-06 13 views
7

सहित मैं अपने activeadminसक्रिय व्यवस्थापक: जावास्क्रिप्ट

को गोन जोड़ने के लिए (https://github.com/gazay/gon) चाहते हैं, लेकिन मैं लेआउट

लेकिन मैं में शीर्ष अनुभाग के लाइन

<%= include_gon %> 

जोड़ने की जरूरत कैसे पता नहीं लगा सकता है?

उत्तर

19

Mexxer की टिप्पणी में जोड़ने के लिए।

# == Register Stylesheets & Javascripts 
# 
# We recommend using the built in Active Admin layout and loading 
# up your own stylesheets/javascripts to customize the look 
# and feel. 
# 
# To load a stylesheet: 
# config.register_stylesheet 'my_stylesheet.css' 
# 
# To load a javascript file: 
# config.register_javascript 'my_javascript.js' 

टिप्पणी हटाएं अंतिम पंक्ति और अपनी फ़ाइल के साथ my_javascript.js की जगह, इस तरह: पृष्ठ के नीचे `करने के लिए config/initializers/active_admin.rb

जाएं, तो आपको निम्न मिल जाएगा ...

# To load a javascript file: 
config.register_javascript 'invoices.js' 

फ़ाइल app/assets/javascripts/invoices.js

5

पर स्थित हो सकता है कि यह भी प्रासंगिक हो सकता है:

# The Active Admin equivalent of putting this in your application layout: 
# <head> 
# <%= cloudinary_js_config %> 
# </head> 

module ActiveAdmin 
    module Views 
    module Pages 
     class Base < Arbre::HTML::Document 

     alias_method :original_build_head, :build_active_admin_head 

     def build_active_admin_head 
      original_build_head 

      within @head do 
      text_node include_gon 
      end 
     end 

     end 
    end 
    end 
end 

स्रोत: https://gist.github.com/seanlinsley/9786622

संबंधित मुद्दे