]> git.r.bdr.sh - rbdr/grita/blame - grita.rb
Gemfile.lock y nuevas revisiones.
[rbdr/grita] / grita.rb
CommitLineData
3e43ab35
BB
1require 'sinatra'
2require 'haml'
3require 'less'
5573b3c2
BB
4require 'dm-core'
5require 'dm-timestamps'
3e43ab35
BB
6
7#config
8set :haml, :format => :html5
9
10#app
11get '/' do
12 haml :index
13end
14
5573b3c2
BB
15post '/' do
16 @grito = Grito.first_or_create(:title => params[:title], :text => params[:text])
17 haml :index
18end
19
3e43ab35
BB
20get '/style.css' do
21 less :style
22end
23
24not_found do
5573b3c2
BB
25 haml :error
26end
27
28DataMapper.setup(:default, ENV['DATABASE_URL'] || 'mysql://root:root@localhost/grita')
29class Grito
30 include DataMapper::Resource
31 property :id, Serial
32 property :title, String, :required => true
33 property :text, Text, :required => true
34 property :created_at, DateTime
35
36 def geturl()
37 self.id.to_s(36)
38 end
3e43ab35 39end