Commit 6c0c46830e500cc3dda2f8d5f00b8e8fbf288f78

nicer css

Commit diff

sinatra/events.rb

 
1010
1111class Event < DataMapper::Base
1212 property :name, :string
13 property :description, :text
1314end
1415Event.table.create!
1516
2222 haml(layout('Events', %q{
2323 %h1= "Events"
2424 %form{:action => '/events', :method => 'POST'}
25 %table
26 %tr
27 %th Name
28 %td
29 %input{:type => 'text', :name => 'name', :size => 30}
30 %tr
31 %td
32 %td
33 %input{:type => 'submit', :value => 'Create Event'}
25 %fieldset
26 %legend New Event
27
28 %label{:for => 'name'} Name
29 %input{:type => 'text', :name => 'name', :id => 'name', :size => 30}
30 %br
31
32 %label{:for => 'description'} Description
33 %textarea{:type => 'description', :name => 'description', :id => 'description', :cols => 30, :rows => 4}
34 %br
35
36 %input{:type => 'submit', :class => 'submit', :value => 'Create'}
3437 - if @events.empty?
3538 %p No events found.
3639 - else
37 %table.long
38 - c = 'even'
40 %table
41 %caption Events
42 %tr{:class => 'odd'}
43 %th{:class => 'name', :scope => 'col'} Name
44 - c = 'odd'
3945 - @events.each do |e|
4046 %tr{:class => (c == 'even' ? c = 'odd' : c = 'even') }
41 %td
42 %a{:href => "/event/#{e.id}" }
43 %code= e.name
47 %td{:class => 'name'}
48 %a{:href => '#'}= e.name
49 = e.description
4450 }))
4551end
4652
4753post '/events' do
4854 name = params[:name].to_s.strip
49 x = Event.new(:name => name).save
55 description = params[:description].to_s.strip
56 x = Event.new(:name => name, :description => description).save
5057 redirect '/events'
5158end
5259
7878 family: Verdana, Arial, "Bitstream Vera Sans", Helvetica, sans-serif
7979 color: black
8080 line-height: 160%
81 background-color: white
82 margin: 2em
81 background: #b5b5b5
82 margin: 0
83 padding: 30px
8384
84#navigation
85 a
86 background-color: #e0e0e0
87 color: black
88 text-decoration: none
89 padding: 2px
90 padding: 5px
91 border-bottom: 1px black solid
92
93#action
94 text-align: right
95
96.addtag
97 padding: 5px 0
98
9985h1
10086 display: block
10187 padding-bottom: 5px
10288
10389a
10490 color: black
105a.exists
106 font-weight: bold
107a.unknown
108 font-style: italic
109
110.comments
111 margin: 10px 20px
112 .comment
113 .head
114 background: #eee
115 padding: 4px
116 .comment-text
117 padding: 10px
118 color: #333
91
92form
93 label
94 float: left
95 text-align: right
96 width: 200px
97 :font
98 weight: bold
11999
120table.long
100 input, textarea
101 margin-left: 210px
102 display: block
103 margin-bottom: 0pt
104 width: 300px
105
106table
121107 width: 100%
108 border: 1px solid #000
109 background: #fff
110 border-collapse: collapse
122111
123table
124 tr.even
125 td
126 background: #eee
112 caption
113 margin: 0
114 padding: 8px 20px
115 text-align: left
116 border: 1px solid #000
117 border-bottom: none
118 background: #fff
119 th, td
120 margin: 0
121 padding: 8px 20px
122 text-align: center
123 border-bottom: 1px solid #b5b5b5
124 th.name, td.name
125 text-align: left
126 th
127 color: #999
127128 tr.odd
128 td
129 background: #fff
130
131table
132 tr
133 th
134 text-align: left
135 padding: 3px
136 vertical-align: top
137 td.open
138 background: #ada
139 td.resolved
140 background: #abd
141 td.hold
142 background: #dda
143 td.invalid
144 background: #aaa
129 background: #e6e6e6
130 tr.even
131 background: #f1f1f1
132 td
133 a
134 display: block
135 :font
136 weight: bold
145137
146138.submit
147139 font-size: large
toggle raw diff