Files

Class Index [+]

Quicksearch

UbiquoDesign::UbiquoWidgets

Public Instance Methods

available_widgets() click to toggle source

Returns an array with all the available widgets

Example: available_widgets.include?(:my_widgets)

    # File vendor/plugins/ubiquo_design/lib/ubiquo_design/ubiquo_widgets.rb, line 89
89:     def available_widgets
90:       ::Widget.behaviours.keys
91:     end
render_widget(widget) click to toggle source

Renders the widget as a string

The widget is the instance to be rendered

     # File vendor/plugins/ubiquo_design/lib/ubiquo_design/ubiquo_widgets.rb, line 101
101:     def render_widget widget
102:       widget_name = widget.key
103:       unless available_widgets.include?(widget_name)
104:         require "widgets/#{widget_name}_widget"
105:         raise WidgetNotFound.new("Widget #{widget_name} not found") unless available_widgets.include?(widget_name)
106:       end
107:       run_behaviour(widget)
108:       template_file = search_template widget_name
109:       # Add template directory to view_paths, so as to render uses this directory by default
110:       self.view_paths.unshift(File.dirname(template_file))
111:       render_output = render_to_string :file => File.basename(template_file)
112:       self.view_paths.shift
113:       render_output
114:     end
run_behaviour(widget) click to toggle source

Run a widget behaviour, given a widget instance

    # File vendor/plugins/ubiquo_design/lib/ubiquo_design/ubiquo_widgets.rb, line 94
94:     def run_behaviour widget
95:       ::Widget.behaviours[widget.key][:proc].bind(self).call(widget)
96:     end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.