class Flammarion::Writeable::ClickableImage

Public Class Methods

new(url, width, height, alt, title, name, owner, block) click to toggle source
# File lib/cem/cflame/clickable_img.rb, line 14
def initialize(url, width, height, alt, title, name, owner, block)
  @name = name
  @owner = owner
  @block = block
  @url = url
  @width = width
  @height = height
  @alt = alt
  @title = title
end

Public Instance Methods

html() click to toggle source
# File lib/cem/cflame/clickable_img.rb, line 31
def html
  %|<img id="#{@name}" width=#{@width.to_s} max-height=#{@height.to_s} src="#{@url.to_s}" alt="#{@alt}" title="#{@title}"/>|
end
to_s() click to toggle source
# File lib/cem/cflame/clickable_img.rb, line 25
def to_s
  return @owner.callback_link(html) {
    @block.call(self) if @block
  }
end
update(url, width, height, alt, title) click to toggle source
# File lib/cem/cflame/clickable_img.rb, line 35
def update(url, width, height, alt, title)
  @url = url
  @width = width
  @height = height
  @alt = alt if alt
  @title = title if title
  
  @owner.js("$( '##{@name}' ).replaceWith('#{html}');")

end
url=(value) click to toggle source
# File lib/cem/cflame/clickable_img.rb, line 46
def url=(value)
  value = value.to_s
  # puts "urlset on #{@name}"
  @owner.js("$( '##{@name}' ).attr('src', '#{value}');")
end