schedule renders 10x faster now. Caching disabled
This commit is contained in:
parent
740a604c01
commit
08637503e5
2 changed files with 10 additions and 6 deletions
|
|
@ -1,13 +1,12 @@
|
||||||
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.includes(:rooms, {:events => [:speakers, :track, :event_type]}).where("conferences.short_title" => params[:conference_id]).first
|
||||||
|
@rooms = @conference.rooms
|
||||||
@events = @conference.events
|
@events = @conference.events
|
||||||
@dates = @conference.start_date..@conference.end_date
|
@dates = @conference.start_date..@conference.end_date
|
||||||
@rooms = @conference.rooms
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,9 @@
|
||||||
<% conf_end = DateTime.parse("#{date} 19:00") %>
|
<% conf_end = DateTime.parse("#{date} 19:00") %>
|
||||||
|
|
||||||
<% while conf_start < conf_end %>
|
<% while conf_start < conf_end %>
|
||||||
|
<%-
|
||||||
|
start_hour = conf_start.hour
|
||||||
|
start_min = conf_start.min %>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width:5%">
|
<td style="width:5%">
|
||||||
|
|
@ -35,7 +38,8 @@
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<% @rooms.each do |room| %>
|
<% @rooms.each do |room| %>
|
||||||
<% event = @events.find_all{|event|event.start_time and event.start_time.strftime("%Y-%m-%d %H:%M").eql? conf_start.strftime("%Y-%m-%d %H:%M") and event.room_id == room.id } %>
|
<% events_for_date = @events.find_all {|e| e.room_id == room.id && e.start_time && e.start_time.to_date == date } %>
|
||||||
|
<% event = events_for_date.find_all{|e| e.start_time.hour == start_hour && e.start_time.min == start_min } %>
|
||||||
<% 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 %>
|
||||||
|
|
@ -44,8 +48,9 @@
|
||||||
class="event" role="button"
|
class="event" role="button"
|
||||||
data-href="<%= url_for(conference_proposal_path(@conference.short_title, event[0].id)) %>">
|
data-href="<%= url_for(conference_proposal_path(@conference.short_title, event[0].id)) %>">
|
||||||
<h5>
|
<h5>
|
||||||
<%- speaker = event[0].speakers.first || event[0].submitter %>
|
<%- if speaker = event[0].speakers.first %>
|
||||||
<%= image_tag speaker.gravatar_url, :class => "img-circle pull-right", :alt => speaker.public_name, :title => speaker.public_name, :style => "padding:8px;" %>
|
<%= image_tag speaker.gravatar_url, :class => "img-circle pull-right", :alt => speaker.public_name, :title => speaker.public_name, :style => "padding:8px;" %>
|
||||||
|
<%- end %>
|
||||||
<span class="schedule-title">
|
<span class="schedule-title">
|
||||||
<i class="icon-comment"></i>
|
<i class="icon-comment"></i>
|
||||||
<%= event[0].title %>
|
<%= event[0].title %>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue