0
0
Fork 0

added haml and sass

This commit is contained in:
Gibheer 2011-06-24 15:40:37 +02:00
parent 94c4dd9d0b
commit 76a652ce39
7 changed files with 48 additions and 5 deletions

View File

@ -1,5 +1,8 @@
source :rubygems
gem 'sinatra'
gem 'haml'
gem 'sass'
gem 'compass'
gem 'data_mapper'
gem 'dm-postgres-adapter'

View File

@ -3,6 +3,11 @@ GEM
specs:
addressable (2.2.6)
bcrypt-ruby (2.1.4)
chunky_png (1.2.0)
compass (0.11.3)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
data_mapper (1.1.0)
dm-aggregates (= 1.1.0)
dm-constraints (= 1.1.0)
@ -49,8 +54,11 @@ GEM
do_postgres (0.10.6)
data_objects (= 0.10.6)
fastercsv (1.5.4)
fssm (0.2.7)
haml (3.1.2)
json (1.4.6)
rack (1.3.0)
sass (3.1.3)
sinatra (1.2.6)
rack (~> 1.1)
tilt (>= 1.2.2, < 2.0)
@ -62,6 +70,9 @@ PLATFORMS
ruby
DEPENDENCIES
compass
data_mapper
dm-postgres-adapter
haml
sass
sinatra

View File

@ -3,6 +3,9 @@ require 'rubygems'
require 'bundler/setup'
require 'bcrypt'
require 'data_mapper'
require 'haml'
require 'sass'
require 'compass'
require 'sinatra'
require 'settings'

15
page.rb
View File

@ -2,11 +2,12 @@ class Blog < Sinatra::Base
set $settings
get '/' do
s = '<p><a href="/admin">Adminpanel</a></p>'
Post.all(:released => true, :order => [:written.desc]).each do |post|
s += "Post: #{post.title} von #{post.account.username}<br />"
end
s
@posts = Post.all(:released => true, :order => [:written.desc])
haml :index
end
get '/stylesheet.css' do
scss :stylesheet
end
get '/404' do
@ -24,4 +25,8 @@ class Blog < Sinatra::Base
error 502 do
'oh no, i think i wet myself'
end
def link_to display, link
"<a href=\"${link}\">#{display}</a>"
end
end

5
views/index.haml Normal file
View File

@ -0,0 +1,5 @@
-@posts.each do |post|
%article
%header
%h1=post.title
%section.content=post.content

12
views/layout.haml Normal file
View File

@ -0,0 +1,12 @@
!!! 5
%html
%head
%title="zero-knowledge"
%link{:rel => 'stylesheet', :href => '/stylesheet.css', :type => 'text/css'}
%body
%header#header
%h1="zero-knowledge.org"
#content
%p.hint= link_to('Adminpanel', '/admin')
=yield
%footer#footer="ein footer"

4
views/stylesheet.scss Normal file
View File

@ -0,0 +1,4 @@
body {
color: white;
background: black;
}