Sha256: 717f37d9df29fdbadb2db1c272d178050075b65634517499cc4d693390067fd0

Contents?: true

Size: 1.16 KB

Versions: 9

Compression:

Stored size: 1.16 KB

Contents

class Plugins::Sidebars::DeliciousController < Sidebars::ComponentPlugin
  display_name "Del.icio.us"
  description 'Bookmarks from <a href="http://del.icio.us">del.icio.us</a>'

  setting :feed, nil, :label => 'Feed URL'
  setting :count, 10, :label => 'Items Limit'
  setting :groupdate,   false, :input_type => :checkbox, :label => 'Group links by day'
  setting :description, false, :input_type => :checkbox, :label => 'Show description'
  setting :desclink,    false, :input_type => :checkbox, :label => 'Allow links in description'

  def content
    response.lifetime = 1.hour
    @delicious = check_cache(Delicious, @sb_config['feed']) rescue nil

    return unless @delicious

    if @sb_config['groupdate']
      @delicious.days = {}
      @delicious.items.each_with_index do |d,i|
        break if i >= @sb_config['count'].to_i
        index = d.date.strftime("%Y-%m-%d").to_sym
        (@delicious.days[index] ||= Array.new) << d
      end
      @delicious.days = @delicious.days.sort_by { |d| d.to_s }.reverse.collect { |d| {:container => d.last, :date => d.first} }
    else
      @delicious.items = @delicious.items.slice(0, @sb_config['count'].to_i)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
typo-3.99.0 components/plugins/sidebars/delicious_controller.rb
typo-3.99.2 components/plugins/sidebars/delicious_controller.rb
typo-3.99.1 components/plugins/sidebars/delicious_controller.rb
typo-3.99.3 components/plugins/sidebars/delicious_controller.rb
typo-4.0.1 components/plugins/sidebars/delicious_controller.rb
typo-3.99.4 components/plugins/sidebars/delicious_controller.rb
typo-4.0.0 components/plugins/sidebars/delicious_controller.rb
typo-4.0.2 components/plugins/sidebars/delicious_controller.rb
typo-4.0.3 components/plugins/sidebars/delicious_controller.rb