Sha256: cea2d01b4271149d3e38cd9cf86827cc6652c825466b47fa7e58693edc63c766

Contents?: true

Size: 1.1 KB

Versions: 10

Compression:

Stored size: 1.1 KB

Contents

module PanelHelper
    
	def p_panel(id,options={},&block)    
    output = panel_encode_markup(id,options,&block)  
    output += panel_encode_script(id,options)              		                        
	end		
	
	protected
	
	def panel_encode_markup(id,options={},&block)
    clientid = sanitize_to_id(id)	
		options = options.stringify_keys   
    options = options.merge(:id => clientid)                         		     
    output = content_tag('div', options) do
      content_tag('title',options['title']) +
        capture(&block)
    end 
    output.html_safe			
	end
	
	def panel_encode_script(id,options={})
    options = options.stringify_keys
    clientid = sanitize_to_id(id)
    widgetvar = options.has_key?("widgetVar") ? options["widgetVar"] : "widget_"+clientid		
    options_ui = options
    options_ui = options_ui.merge(:id => clientid)                         
    options_ui = options_ui.to_json        
        
    script = '$(function() {'
    script += "PrimeFaces.cw('Panel','#{widgetvar}',#{options_ui})"
    script += '});'         
    javascript_tag(script, "id" => clientid+"_s")        		
	end
	
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
prime-rails-0.0.12 app/helpers/panel_helper.rb
prime-rails-0.0.11 app/helpers/panel_helper.rb
prime-rails-0.0.10 app/helpers/panel_helper.rb
prime-rails-0.0.9 app/helpers/panel_helper.rb
prime-rails-0.0.8 app/helpers/panel_helper.rb
prime-rails-0.0.7 app/helpers/panel_helper.rb
prime-rails-0.0.6 app/helpers/panel_helper.rb
prime-rails-0.0.5 app/helpers/panel_helper.rb
prime-rails-0.0.4 app/helpers/panel_helper.rb
prime-rails-0.0.3 app/helpers/panel_helper.rb