Sha256: c5320267e32f4b5f473720f796d9f888d9533e4426fb7919b3c2dcb61e3be255

Contents?: true

Size: 979 Bytes

Versions: 2

Compression:

Stored size: 979 Bytes

Contents

module Ducksboard
  class Timeline < Widget

    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"
    }

    def title; @data[:title] end
    def image; @data[:image] end
    def content; @data[:image] end
    def link; @data[:image] end

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

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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ducksboard-0.1.1 lib/ducksboard/timeline.rb
ducksboard-0.1.0 lib/ducksboard/timeline.rb