Module: SkipEmbedded::Helpers::Ui

Included in:
SkipEmbedded::Helpers
Defined in:
lib/skip_embedded/helpers/ui.rb

Instance Method Summary collapse

Instance Method Details

#clippy(copy_text, bgcolor = '#FFFFFF') ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/skip_embedded/helpers/ui.rb', line 12

def clippy(copy_text, bgcolor='#FFFFFF')
  html = <<-EOF
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
            width="110"
            height="14"
            id="clippy" >
    <param name="movie" value="#{flash_path("clippy")}"/>
    <param name="allowScriptAccess" value="always" />
    <param name="quality" value="high" />
    <param name="scale" value="noscale" />
    <param NAME="FlashVars" value="text=#{copy_text}">
    <param name="bgcolor" value="#{bgcolor}">
    <embed src="#{flash_path("clippy")}"
           width="110"
           height="14"
           name="clippy"
           quality="high"
           allowScriptAccess="always"
           type="application/x-shockwave-flash"
           pluginspage="http://www.macromedia.com/go/getflashplayer"
           FlashVars="text=#{copy_text}"
           bgcolor="#{bgcolor}"
    />
    </object>
  EOF
end

#flash_path(source, suffix = "swf") ⇒ Object



47
48
49
# File 'lib/skip_embedded/helpers/ui.rb', line 47

def flash_path(source, suffix="swf")
  compute_public_path(source, "flash", suffix)
end

#render_flash(type) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/skip_embedded/helpers/ui.rb', line 39

def render_flash(type)
  if message = flash[type]
    ("div", :class => type.to_s) do
      ("h3", h(message) + ("span", _("[Click to hide]")))
    end
  end
end

#sanitize_richtext(content) ⇒ Object



5
6
7
8
9
# File 'lib/skip_embedded/helpers/ui.rb', line 5

def sanitize_richtext(content)
  allowed_tags = HTML::WhiteListSanitizer.allowed_tags.dup << "table" << "tbody" << "tr" << "th" << "td" << "caption" << "strike" << "u"
  allowed_attributes = HTML::WhiteListSanitizer.allowed_attributes.dup << "style" << "cellspacing" << "cellpadding" << "border" << "align" << "summary"
  sanitize(content, :tags => allowed_tags, :attributes => allowed_attributes)
end