Module: SidebarHelper
- Defined in:
- lib/sidebar_helper.rb
Instance Method Summary collapse
-
#content_hash ⇒ Object
get controller instance variables.
-
#render_scene_sidebars(scene) ⇒ Object
render scene sidebars params:
scene
scene name. -
#render_sidebar(sidebar, current_user = controller.current_user, options = {}) ⇒ Object
render_sidebar params:
sidebar
Sidebar instance or sidebar namecurrent_user
sidebar of current_user, default controller.current_useroptions
optional parameters.
Instance Method Details
#content_hash ⇒ Object
get controller instance variables
34 35 36 37 38 39 40 |
# File 'lib/sidebar_helper.rb', line 34 def content_hash hash = {} controller.instance_variables.grep(/@[a-zA-Z]/).map do |var| hash[var.to_s] = controller.instance_variable_get(var) end hash end |
#render_scene_sidebars(scene) ⇒ Object
render scene sidebars
params:
+scene+ scene name
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/sidebar_helper.rb', line 5 def (scene) scene_htmls = [] begin @scene = SceneSidebar.parse_scene(scene) if @scene @scene..each do |sb| scene_htmls << (sb) end end end scene_htmls.join.html_safe end |
#render_sidebar(sidebar, current_user = controller.current_user, options = {}) ⇒ Object
render_sidebar
params:
+sidebar+ Sidebar instance or sidebar name
+current_user+ sidebar of current_user, default controller.current_user
+options+ optional parameters
23 24 25 26 27 28 29 30 31 |
# File 'lib/sidebar_helper.rb', line 23 def (,current_user=controller.current_user,={}) = .is_a?(Sidebar) ? : Sidebar.() if .parse_request(params,content_hash,current_user) render_to_string(:partial => .content_partial, :locals => .to_locals_hash, :layout => false).html_safe end end |