Sha256: 909868a1b9ee27878d168360c089cd4ded7f4e2c6074dfe6db7592c805e78eca

Contents?: true

Size: 596 Bytes

Versions: 1

Compression:

Stored size: 596 Bytes

Contents

require 'sinatra/base'

module App
  class Routes < ::Sinatra::Base
    get '/' do
      @spreadsheets = GoogleCells::Spreadsheet.list
      @spreadsheets.sort_by!{|s| s.updated_at}
      @spreadsheets.reverse!
      text = "<h1>All Spreadsheets</h1>"
      if @spreadsheets.empty?
        text << "Nothing here."
      else
        text << "<% for s in @spreadsheets %>"
        text << "<br/><%= s.updated_at %> -- <a href=\"https://docs.google.com/"
        text << "spreadsheet/ccc?key=<%= s.key %>\"><%= s.title %></a>"
        text << "<% end %>"
      end
      erb text
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
google-cells-0.3.0 examples/sinatra/routes.rb