Sha256: 7c53d4b03bac57e593039e8431a99e31fb1f1bc758e8776267264d04fdf99590

Contents?: true

Size: 966 Bytes

Versions: 2

Compression:

Stored size: 966 Bytes

Contents

gem "tumblr-rb"
require 'tumblr'

class Caboodle::Tumblr < Caboodle::Kit   
  description "Includes a tumblr.com account"
  
  helpers do
    def semantic_date post
      date = Date.parse(post.date)
      a = []
      a << "slug-#{post.slug}"
      a << "y#{date.year}"
      a << "m#{date.month}"
      a << "d#{date.day}"
      a.join(" ")
    end
  end
   
  required [:tumblr_email, :tumblr_password, :tumblr_sitename]
  
  menu "Tumblr" do
    tumblr = ::Tumblr::Reader.new(Caboodle::Site.tumblr_email,Caboodle::Site.tumblr_password)
    req = tumblr.read(Caboodle::Site.tumblr_sitename, {:num=>10}).perform_sleepily
    posts = ::Tumblr::Reader.get_posts(req)
    haml :tumblr, :locals => { :posts => posts }
  end
  
  get "/tumblr/page/:page" do
    tumblr = ::Tumblr::Reader.new(Caboodle::Site.tumblr_email,Caboodle::Site.tumblr_password)
    posts = tumblr.get_posts()
    haml :tumblr, :locals => { :posts => posts }
  end
  
  add_sass ["tumblr"]
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
caboodle-0.2.16 lib/caboodle/kits/tumblr/tumblr.rb
caboodle-0.2.15 lib/caboodle/kits/tumblr/tumblr.rb