Browse files

update event lists to one liners, acct for path variations between cu…

…rrent & deleted events
  • Loading branch information...
1 parent eb2e9c4 commit 2a5501b118d91b38cc62dcd0abf205d148c10188 @inertialbit inertialbit committed Mar 1, 2011
View
12 app/helpers/events_helper.rb
@@ -1,2 +1,14 @@
module EventsHelper
+ def event_one_liner(event)
+ path = event.deleted? ? 'event_revision_path' : 'event_path'
+ "#{h(event.name)} #{event_abbrev_date(event)} <span class=\"fake_button\">#{link_to('details', send(path, event))}</span>".html_safe
+ end
+
+ def event_abbrev_date(event)
+ if event.one_day?
+ "(<em>#{event.start_on.strftime("%a")} #{event.start_day.ordinalize}</em>)"
+ else
+ "(<em>#{event.start_on.strftime("%a")} #{event.start_day.ordinalize} - #{event.end_on.strftime("%a")} #{event.end_day.ordinalize}</em>)"
+ end
+ end
end
View
11 app/views/event_revisions/_list_group.html.erb
@@ -6,19 +6,12 @@
<li><%= month %>
<ul>
<% months_events.each do |event| %>
- <li class="zoom">
- <p>
- <%= link_to event.name, event_revision_path(event) %>
+ <li>
+ <%= event_one_liner(event) %>
<%= link_to 'restore', restore_event_revision_path(event),
:confirm => 'Are you sure you want to restore this deleted event?',
:method => "post",
:class => 'fake_button' %>
- </p>
- <%- if event.one_day? -%>
- <%= render :partial => 'events/one_day_list_event', :object => event %>
- <%- else -%>
- <%= render :partial => 'events/multi_day_list_event', :object => event %>
- <%- end -%>
</li>
<% end %>
</ul>
View
4 app/views/events/_list.html.erb
@@ -1,8 +1,8 @@
-<div class="span-8">
+<div class="span-9">
<h2>Current Events (<em><%= @current_events.count %></em>)</h2>
<%= render :partial => 'events/list_group', :locals => {:events => @current_events} %>
</div>
-<div class="span-8 last">
+<div class="span-9 last">
<h2>Past Events (<em><%= @past_events.count %></em>)</h2>
<%= render :partial => 'events/list_group', :locals => {:events => @past_events} %>
</div>
View
9 app/views/events/_list_group.html.erb
@@ -7,13 +7,8 @@
<li><span class="collapsible <%= closed_or_open %>"><%= month %></span>
<ul>
<% months_events.each do |event| %>
- <li class="zoom">
- <p class="collapsible closed"><%= event.name %> (<%= event.start_on.strftime("%a") %> <%= event.start_day.ordinalize %>)</p>
- <%- if event.one_day? -%>
- <%= render :partial => 'events/one_day_list_event', :object => event %>
- <%- else -%>
- <%= render :partial => 'events/multi_day_list_event', :object => event %>
- <%- end -%>
+ <li>
+ <%= event_one_liner(event) %>
</li>
<% end %>
</ul>
View
3 features/manage_events.feature
@@ -70,8 +70,7 @@ Feature: Manage events
And I should see "Restorable Event"
And I should see "2011"
And I should see "February"
- And I should see "Friday 4th"
- And I should see "09:00 AM - 10:00 AM Eastern / 08:00 AM - 09:00 AM Central / 07:00 AM - 08:00 AM Mountain / 06:00 AM - 07:00 AM Pacific"
+ And I should see "Fri 4th"
When I follow "restore"
Then I should be on the event page for "Restorable Event"
And I should see "Date: Friday, February 04 2011"

0 comments on commit 2a5501b

Please sign in to comment.