Sha256: ead1c358f7438235edd029f1424f1e8f8809950f0801039abd719e5c7238b065

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

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 initialize(*args)
      super
      @data[:value] ||={}
    end

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

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

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

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

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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ducksboard-0.1.6 lib/ducksboard/timeline.rb
ducksboard-0.1.5 lib/ducksboard/timeline.rb
ducksboard-0.1.4 lib/ducksboard/timeline.rb
atk-ducksboard-0.1.4 lib/ducksboard/timeline.rb
ducksboard-0.1.3 lib/ducksboard/timeline.rb
ducksboard-0.1.2 lib/ducksboard/timeline.rb