All CSS code needed for this class including the one from the ancestor component
# File lib/netzke/stylesheets.rb, line 19 def css_code(cached = []) res = "" # include the base-class javascript if doing JS inheritance res << superclass.css_code << "\n" if extends_netzke_component? && !cached.include?(superclass.short_component_class_name) res << css_included << "\n" res end
Use it to specify stylesheet files to be loaded along with this component. It may accept one or more symbols or strings. Strings will be interpreted as full paths to included files:
css_include "#{File.dirname(__FILE__)}/my_component/one.css", "#{File.dirname(__FILE__)}/my_component/two.css"
Symbols will be expanded following a convention, e.g.:
class MyComponent < Netzke::Base css_include :some_library # ... end
This will “include” a stylesheet file +{component_location}/my_component/stylesheets/some_library.js+
# File lib/netzke/stylesheets.rb, line 43 def css_include(*args) callr = caller.first self.css_included_files += args.map{ |a| a.is_a?(Symbol) ? expand_css_include_path(a, callr) : a } end
Returns all extra CSS code (as string) required by this component’s class
# File lib/netzke/stylesheets.rb, line 12 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_included_files).inject(""){ |r, path| r + File.new(path).read + "\n"} end
Generated with the Darkfish Rdoc Generator 2.