public
Description: The PhillyonRails.org website
Homepage: http://www.PhillyonRails.org
Clone URL: git://github.com/cbartlett/phillyonrails.org.git
made the events page look all nice and stuff
cbartlett (author)
Wed Jul 23 04:16:12 -0700 2008
commit  f29b676d4083e67d397999b970eee4e0783979d1
tree    7b85fb3faefdd1a65d844c0091800e43bf17400e
parent  0647cf093bb8d4836bc11cb3f7227ed825a726f6
...
3
4
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
...
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
0
@@ -3,4 +3,19 @@ module ApplicationHelper
0
   def action_body_id
0
     return @action_body_id || "#{params[:controller].gsub(/admin\//, 'admin_')+'_'+params[:action]}"
0
   end
0
+
0
+ # Takes 2 DateTime's and returns a date range text string
0
+ # that reads nice. It doesn't repeat the date if the days
0
+ # are the same.
0
+ def time_range(date1, date2)
0
+ output = date1.to_s(:nice)
0
+ output += " - "
0
+ if date1.beginning_of_day == date2.beginning_of_day
0
+ output += date2.strftime("%I:%M %p")
0
+ else
0
+ output += date2.to_s(:nice)
0
+ end
0
+ return output
0
+ end
0
+
0
 end
...
2
3
4
5
6
 
 
 
 
 
 
 
 
 
 
7
8
9
...
2
3
4
 
 
5
6
7
8
9
10
11
12
13
14
15
16
17
0
@@ -2,7 +2,15 @@
0
 
0
 <% @events.each do |event| %>
0
   <% div_for(event) do %>
0
- <h2><%= event.starts_at.to_s(:nice) %></h2>
0
- <%= event.name %>
0
+ <h2><%= time_range(event.starts_at, event.ends_at) %></h2>
0
+ <p><%= h event.name %></p>
0
+ <p><%= textilize event.description %></p>
0
+ <p>
0
+ <%= h event.location.name %><br />
0
+ <%= h event.location.address_1 %><br />
0
+ <%= h(event.location.address_2) + '<br />' if event.location.address_2 %>
0
+ <%= h event.location.city %>, <%= h event.location.state %> <%= h event.location.zip %>
0
+ </p>
0
+ <p><em><%= textilize event.location.description %></em></p>
0
   <% end %>
0
 <% end %>
0
\ No newline at end of file
...
42
43
44
45
 
46
47
48
...
42
43
44
 
45
46
47
48
0
@@ -42,7 +42,7 @@ Released for free under a Creative Commons Attribution 2.5 License
0
           <ul>
0
             <li>
0
               <% if category.upcoming_event %>
0
- <h3><%= category.upcoming_event.starts_at %></h3>
0
+ <h3><%= time_range(category.upcoming_event.starts_at, category.upcoming_event.ends_at) %></h3>
0
                 <p><%= link_to(category.upcoming_event.name, event_path(category.upcoming_event)) %></p>
0
               <% else %>
0
                 <p><em>None scheduled.</em></p>
...
273
274
275
 
 
 
 
276
277
278
...
297
298
299
 
 
 
 
 
 
 
 
 
 
 
 
 
300
301
...
273
274
275
276
277
278
279
280
281
282
...
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
0
@@ -273,6 +273,10 @@ a:hover {
0
   font-size: 85%;
0
 }
0
 
0
+#news ul {
0
+ margin-bottom: 20px;
0
+}
0
+
0
 /* Footer */
0
 
0
 #footer {
0
@@ -297,4 +301,17 @@ a:hover {
0
 
0
 #footer a:hover {
0
   text-decoration: none;
0
+}
0
+
0
+/* Events */
0
+#content .event {
0
+ margin-bottom: 10px;
0
+ padding-bottom: 10px;
0
+ border-bottom: 1px dotted;
0
+}
0
+#content .event h2 {
0
+ margin-bottom: 0px;
0
+}
0
+#content .event p {
0
+ margin-bottom: 10px;
0
 }
0
\ No newline at end of file

Comments

    No one has commented yet.