Class: RaveEmbed::WavePanel

Inherits:
Object show all
Includes:
ClassLevelInheritableAttributes
Defined in:
lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ClassLevelInheritableAttributes

included

Constructor Details

#initialize(wave_id_str, opts = {}) ⇒ WavePanel

Returns a new instance of WavePanel.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 21

def initialize(wave_id_str, opts = {})
  @wave_id       = wave_id_str
  @dom_id        = opts[:dom_id]        || WavePanel.g_dom_id
  @root_url      = opts[:root_url]      || WavePanel.g_root_url
  @bg_color      = opts[:bg_color]      || WavePanel.g_bg_color
  @color         = opts[:color]         || WavePanel.g_color
  @font          = opts[:font]          || WavePanel.g_font
  @font_size     = opts[:font_size]     || WavePanel.g_font_size
  @height        = opts[:height]        || WavePanel.g_height
  @width         = opts[:width]         || WavePanel.g_width
  @jquery        = opts[:jquery]        || WavePanel.g_jquery
  @is_public = if opts[:is_public].nil?
    WavePanel.g_is_public
  else
    opts[:is_public] ? true : false
  end
  @participants  = opts[:participants]  || []
  validate
end

Instance Attribute Details

#bg_colorObject

Returns the value of attribute bg_color.



18
19
20
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 18

def bg_color
  @bg_color
end

#colorObject

Returns the value of attribute color.



18
19
20
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 18

def color
  @color
end

#dom_idObject

Returns the value of attribute dom_id.



18
19
20
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 18

def dom_id
  @dom_id
end

#fontObject

Returns the value of attribute font.



18
19
20
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 18

def font
  @font
end

#font_sizeObject

Returns the value of attribute font_size.



18
19
20
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 18

def font_size
  @font_size
end

#heightObject

Returns the value of attribute height.



18
19
20
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 18

def height
  @height
end

#is_publicObject

Returns the value of attribute is_public.



18
19
20
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 18

def is_public
  @is_public
end

#jqueryObject

Returns the value of attribute jquery.



18
19
20
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 18

def jquery
  @jquery
end

#participantsObject

Returns the value of attribute participants.



18
19
20
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 18

def participants
  @participants
end

#root_urlObject

Returns the value of attribute root_url.



18
19
20
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 18

def root_url
  @root_url
end

#wave_idObject

Returns the value of attribute wave_id.



18
19
20
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 18

def wave_id
  @wave_id
end

#widthObject

Returns the value of attribute width.



18
19
20
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 18

def width
  @width
end

Instance Method Details

#to_htmlObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/six-updater-web/vendor/plugins/rave_embed/lib/rave_embed/wave_panel.rb', line 51

def to_html
  html = "<div id='#{dom_id}'"
  unless width.blank? and height.blank?
    styles = []
    styles << "width:#{width}" unless width.blank?
    styles << "height:#{height}" unless height.blank?
    html << " style='#{styles.join(";")}'"
  end
  html << "></div>\n"
	  html << "<script type='text/javascript'>\ngoogle.load(\"wave\", \"1\"); google.setOnLoadCallback(function() { new google.wave.WavePanel({target: document.getElementById(\"#{dom_id}\")}).loadWave(\"googlewave.com!#{wave_id}\");}); </script>\n"
  #html << "<script type='text/javascript'>\n"
  #html << "$(document).ready({\n" if jquery?
  #html << "  var wavePanel = new WavePanel('#{root_url}');\n"
  #html << "  wavePanel.loadWave('#{wave_id}');\n"
  #html << ui_options_js if ui_configured?
  #html << "  wavePanel.init(document.getElementById('#{dom_id}'));\n"
  #html << "})\n" if jquery?
  #html << "</script>\n"
end