Cache the schedule page, fix empty rooms

This commit is contained in:
Henne Vogelsang 2013-06-19 20:56:37 +02:00 committed by Henne Vogelsang
parent f0ff5544c3
commit 2d79e8e692
4 changed files with 10 additions and 8 deletions

View file

@ -153,7 +153,7 @@ div.dataTables_scrollFoot table {
border-top: none; border-top: none;
} }
.event { .eventtd {
background-image: linear-gradient(bottom, rgb(247,250,242) 24%, rgb(194,232,190) 97%, rgb(194,232,190) 100%); background-image: linear-gradient(bottom, rgb(247,250,242) 24%, rgb(194,232,190) 97%, rgb(194,232,190) 100%);
background-image: -o-linear-gradient(bottom, rgb(247,250,242) 24%, rgb(194,232,190) 97%, rgb(194,232,190) 100%); background-image: -o-linear-gradient(bottom, rgb(247,250,242) 24%, rgb(194,232,190) 97%, rgb(194,232,190) 100%);
background-image: -moz-linear-gradient(bottom, rgb(247,250,242) 24%, rgb(194,232,190) 97%, rgb(194,232,190) 100%); background-image: -moz-linear-gradient(bottom, rgb(247,250,242) 24%, rgb(194,232,190) 97%, rgb(194,232,190) 100%);

View file

@ -53,16 +53,18 @@ class Admin::EventsController < ApplicationController
if params.has_key? :track_id if params.has_key? :track_id
@event.update_attribute(:track_id, params[:track_id]) @event.update_attribute(:track_id, params[:track_id])
end end
expire_page :controller => '/schedule', :action => :index
redirect_back_or_to(admin_conference_event_path(@conference.short_title, @event), :notice => "Updated") redirect_back_or_to(admin_conference_event_path(@conference.short_title, @event), :notice => "Updated")
end end
def create def create
expire_page :controller => '/schedule', :action => :index
end end
def update_state def update_state
event = Event.find(params[:id]) event = Event.find(params[:id])
event.send(:"#{params[:transition]}!", :send_mail => params[:send_mail]) event.send(:"#{params[:transition]}!", :send_mail => params[:send_mail])
expire_page :controller => '/schedule', :action => :index
redirect_to(admin_conference_events_path(:conference_id => @conference.short_title), :notice => "Updated state") redirect_to(admin_conference_events_path(:conference_id => @conference.short_title), :notice => "Updated state")
end end
end end

View file

@ -1,7 +1,8 @@
class ScheduleController < ApplicationController class ScheduleController < ApplicationController
layout "application" layout "application"
caches_page :index
def index def index
@conference = Conference.find_all_by_short_title(params[:conference_id]).first @conference = Conference.find_all_by_short_title(params[:conference_id]).first
@events = @conference.events @events = @conference.events

View file

@ -39,7 +39,7 @@
<% if !event.empty? %> <% if !event.empty? %>
<!-- There is an event, calculate the span and show it --> <!-- There is an event, calculate the span and show it -->
<% span[room.id] = event[0].event_type.length / 15 %> <% span[room.id] = event[0].event_type.length / 15 %>
<td style="width: <%= 95 / @rooms.length %>%" rowspan ="<%= span[room.id] %>" class="event" > <td style="width: <%= 95 / @rooms.length %>%" rowspan ="<%= span[room.id] %>" class="eventtd" >
<h5> <h5>
<%= image_tag event[0].submitter.gravatar_url, :class => "img-circle pull-right", :alt => event[0].submitter.public_name, :title => event[0].submitter.public_name%> <%= image_tag event[0].submitter.gravatar_url, :class => "img-circle pull-right", :alt => event[0].submitter.public_name, :title => event[0].submitter.public_name%>
<i class="icon-comment"></i> <i class="icon-comment"></i>
@ -60,16 +60,15 @@
<% end %> <% end %>
</td> </td>
<% span[room.id] = span[room.id] + 1 %> <% span[room.id] = span[room.id] + 1 %>
<% elsif span[room.id] > 1 %>
<!-- span is <%= span[room.id] %> and bigger than 1, substract 1 from span -->
<% span[room.id] = ( span[room.id] - 1 ) if span[room.id] > 1 %>
<% end %> <% end %>
<% if span[room.id] == 1 %> <% if span[room.id] == 1 %>
<!-- span equals 1 show an empty td --> <!-- span equals 1 show an empty td -->
<td style="width: <%= 95 / @rooms.length %>%"> <td style="width: <%= 95 / @rooms.length %>%">
</td> </td>
<% end %> <% end %>
<% if span[room.id] > 1 %>
<!-- span is <%= span[room.id] %> and bigger than 1, substract 1 from span -->
<% span[room.id] = ( span[room.id] - 1 ) if span[room.id] > 1 %>
<% end %>
<%end %> <%end %>
</tr> </tr>
<% conf_start += 15.minutes %> <% conf_start += 15.minutes %>