Class: Ducksboard::Timeline

Inherits:
Widget
  • Object
show all
Defined in:
lib/ducksboard/timeline.rb

Constant Summary collapse

ICONS =
{
  :orange  => "https://app.ducksboard.com/static/img/timeline/orange.gif",
  :red     => "https://app.ducksboard.com/static/img/timeline/red.gif",
  :green   => "https://app.ducksboard.com/static/img/timeline/green.gif",
  :created => "https://app.ducksboard.com/static/img/timeline/created.png",
  :edited  => "https://app.ducksboard.com/static/img/timeline/edited.png",
  :deleted => "https://app.ducksboard.com/static/img/timeline/deleted.png"
}

Instance Attribute Summary

Attributes inherited from Widget

#data, #id, #type

Instance Method Summary collapse

Methods inherited from Widget

#save, #timestamp, #timestamp=, #update, #valid?, #value, #value=

Constructor Details

#initialize(*args) ⇒ Timeline

Returns a new instance of Timeline.



13
14
15
16
# File 'lib/ducksboard/timeline.rb', line 13

def initialize(*args)
  super
  @data[:value] ||={}
end

Instance Method Details

#contentObject



20
# File 'lib/ducksboard/timeline.rb', line 20

def content; @data[:image] end

#content=(text) ⇒ Object



35
36
37
# File 'lib/ducksboard/timeline.rb', line 35

def content=(text)
  @data[:value][:content] = text
end

#imageObject



19
# File 'lib/ducksboard/timeline.rb', line 19

def image; @data[:image] end

#image=(url) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/ducksboard/timeline.rb', line 27

def image=(url)
  @data[:value][:image] = if url =~ /^http/
    url
  else
    ICONS[url.to_sym]
  end
end


21
# File 'lib/ducksboard/timeline.rb', line 21

def link; @data[:image] end

#link=(url) ⇒ Object



39
40
41
# File 'lib/ducksboard/timeline.rb', line 39

def link=(url)
  @data[:value][:link] = url
end

#titleObject



18
# File 'lib/ducksboard/timeline.rb', line 18

def title; @data[:title] end

#title=(text) ⇒ Object



23
24
25
# File 'lib/ducksboard/timeline.rb', line 23

def title=(text)
  @data[:value][:title] = text
end