module Netzke module Railz module ActionViewExt # Implementation of Ext-specific helpers module Ext #:nodoc: protected def netzke_ext_css_include(theme) # ExtJS base res = stylesheet_link_tag("/extjs/resources/css/ext-all") # ExtJS theming res << "\n" << stylesheet_link_tag("/extjs/resources/css/xtheme-#{theme}") unless theme.to_sym == :default # Netzke-related (dynamically generated by NetzkeController) res << "\n" << stylesheet_link_tag("/netzke/ext") res << "\n" << stylesheet_link_tag(Netzke::Core.external_ext_css) res end def netzke_ext_js_include res = [] # ExtJS res << (ENV['RAILS_ENV'] == 'development' ? javascript_include_tag("/extjs/adapter/ext/ext-base-debug", "/extjs/ext-all-debug") : javascript_include_tag("/extjs/adapter/ext/ext-base", "/extjs/ext-all")) # Netzke (dynamically generated) res << javascript_include_tag("/netzke/ext") res.join("\n") end def netzke_ext_js res = [] res << content_for(:netzke_js_classes) res << "\n" res << "Ext.onReady(function(){" res << content_for(:netzke_on_ready) res << "});" javascript_tag res.join("\n") end # (Experimental) Embeds a "pure" (non-Netzke) Ext component into the view, e.g.: # <%= ext :my_panel, :xtype => :panel, :html => "Simple Panel" def ext(name, config = {}) #:doc: comp = Netzke::ExtComponent.new(name, config) content_for :netzke_on_ready, raw("#{comp.js_component_render}") raw(comp.js_component_html) end end end end end