require 'dm-timestamps'
require 'dm-migrations'
require 'rqr'
+require 'rdiscount'
#config
set :haml, :format => :html5
end
post '/' do
- @grito = Grito.new(:title => params[:title], :text => params[:text])
- @grito.save
+ @grito = Grito.create(:title => params[:title], :text => params[:text])
haml :index
end
rpr_filepath = tmpfile.path + '.png'
RQR::QRCode.create do |qr|
- qr.save('http://grita.heroku.com/'+params[:grito], rpr_filepath)
+ qr.save("http://#{request.host}/"+params[:grito], rpr_filepath)
end
buffer = File.open(rpr_filepath).read
get '/:grito' do
@grito = Grito.first(:id => params[:grito].to_i(36))
raise "Invalid Post" if @grito.nil?
- haml :grito
+
+ @markdown = RDiscount.new(@grito.text)
+
+ haml :grito, :layout => :layoutmini
end
error do