Sha256: ff8e16df4c27ed7b7de00d0fe1c7c26009fd548f53251c4d3c4e3527c421bcb3
Contents?: true
Size: 1.46 KB
Versions: 18
Compression:
Stored size: 1.46 KB
Contents
module Netzke::Core module Stylesheets extend ActiveSupport::Concern included do class_attribute :css_included_files self.css_included_files = [] end module ClassMethods # Configures JS class def css_configure &block block.call(css_config) end def css_config @_css_config ||= Netzke::Core::CssConfig.new(self) end # Returns all extra CSS code (as string) required by this component's class def css_included # Prevent re-including code that was already included by the parent # (thus, only include those JS files when include_js was defined in the current class, not in its ancestors) ((singleton_methods(false).map(&:to_sym).include?(:include_css) ? include_css : [] ) + css_config.required_files).inject(""){ |r, path| r + File.new(path).read + "\n"} end # All CSS code needed for this class including the one from the ancestor component def css_code(cached = []) res = "" # include the base-class javascript if doing JS inheritance res << superclass.css_code << "\n" if !js_config.extending_extjs_component? && !cached.include?(superclass.name) res << css_included << "\n" res end end def css_missing_code(cached = []) code = dependency_classes.inject("") do |r,k| cached.include?(k.js_config.xtype) ? r : r + k.css_code(cached) end code.blank? ? nil : code end end end
Version data entries
18 entries across 18 versions & 1 rubygems