Class: Flammarion::Writeable::ClickableImage
- Inherits:
-
Object
- Object
- Flammarion::Writeable::ClickableImage
- Defined in:
- lib/cem/cflame/clickable_img.rb
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(url, width, height, alt, title, name, owner, block) ⇒ ClickableImage
constructor
A new instance of ClickableImage.
- #to_s ⇒ Object
- #update(url, width, height, alt, title) ⇒ Object
- #url=(value) ⇒ Object
Constructor Details
#initialize(url, width, height, alt, title, name, owner, block) ⇒ ClickableImage
Returns a new instance of ClickableImage.
14 15 16 17 18 19 20 21 22 23 |
# 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 |
Instance Method Details
#html ⇒ Object
31 32 33 |
# 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 ⇒ Object
25 26 27 28 29 |
# 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) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# 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) ⇒ Object
46 47 48 49 50 |
# 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 |