Talk boxes with less information and schedule view simplified
This commit is contained in:
parent
6ba3512d2b
commit
2905c8858c
8 changed files with 38 additions and 31 deletions
|
|
@ -15,6 +15,12 @@ class ConferenceController < ApplicationController
|
|||
@rooms = @conference.venue.rooms if @conference.venue
|
||||
@events = @conference.program.events
|
||||
@dates = @conference.start_date..@conference.end_date
|
||||
@start_hour = 9
|
||||
@end_hour = 19
|
||||
@intervals = (@end_hour - @start_hour) * 60 / EventType::LENGTH_STEP
|
||||
@width = 95 / @intervals
|
||||
@step_minutes = EventType::LENGTH_STEP.minutes
|
||||
|
||||
if @dates == Date.current
|
||||
@today = Date.current.strftime('%Y-%m-%d')
|
||||
else
|
||||
|
|
|
|||
|
|
@ -81,6 +81,16 @@ class Conference < ActiveRecord::Base
|
|||
result
|
||||
end
|
||||
|
||||
##
|
||||
# Check if there is any event in the program scheduled.
|
||||
#
|
||||
# ====Returns
|
||||
# * +false+ -> If there aren't schedules events
|
||||
# * +true+ -> If there are schedules events
|
||||
def scheduled?
|
||||
self.program.events.where.not(start_time: nil).any?
|
||||
end
|
||||
|
||||
##
|
||||
# Checks if the user is registered to the conference
|
||||
#
|
||||
|
|
|
|||
|
|
@ -223,6 +223,13 @@ class Event < ActiveRecord::Base
|
|||
(100 * result.values.count(true) / result.values.compact.count).to_s
|
||||
end
|
||||
|
||||
##
|
||||
# Returns the number of columns this event should span in the schedule
|
||||
#
|
||||
def span
|
||||
self.event_type.length / EventType::LENGTH_STEP
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
|
|
|
|||
|
|
@ -8,4 +8,7 @@ class EventType < ActiveRecord::Base
|
|||
validates :maximum_abstract_length, presence: true
|
||||
|
||||
alias_attribute :name, :title
|
||||
|
||||
# If LENGTH_STEP > 60 the public schedule must be changed
|
||||
LENGTH_STEP = 15
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,10 +26,6 @@ class Program < ActiveRecord::Base
|
|||
where(state: :confirmed)
|
||||
end
|
||||
|
||||
def scheduled
|
||||
where.not(start_time: nil)
|
||||
end
|
||||
|
||||
def highlights
|
||||
where(state: :confirmed, is_highlight: true)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@
|
|||
<table class="table table-bordered" id="schedule" width="100%">
|
||||
<tr>
|
||||
<th>Rooms</th>
|
||||
<%# The conference starts at 9 and ends at 18:45 %>
|
||||
<% intervals = (19 - 9) * 4 %>
|
||||
<% (9..18).each do |i| %>
|
||||
<% (@start_hour..@end_hour-1).each do |i| %>
|
||||
<th colspan="4"><%= "#{i}:00" %></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
|
|
@ -25,24 +23,23 @@
|
|||
<tr>
|
||||
<td><%= room.name %></td>
|
||||
<% events_for_date = room.events.find_all{ |e| e.start_time.to_date == date } %>
|
||||
<% start_time = DateTime.parse("#{date} 09:00") %>
|
||||
<% (1..intervals).each do |i| %>
|
||||
<% start_time = DateTime.parse("#{date} #{@start_hour}:00") %>
|
||||
<% (1..@intervals).each do |i| %>
|
||||
<% events_for_time = events_for_date.find_all{|e| e.start_time == start_time} %>
|
||||
<% if !events_for_time.empty? %>
|
||||
<% event = events_for_time[0] %>
|
||||
<!-- There is an event, calculate the span and show it -->
|
||||
<% span = event.event_type.length / 15 %>
|
||||
<%= render partial: 'schedule_item', locals: {event: event, span: span, intervals: intervals} %>
|
||||
<% span = event.span %>
|
||||
<%= render partial: 'schedule_item', locals: {event: event, span: span, width: @width} %>
|
||||
<% span += 1 %>
|
||||
<% elsif span > 1 %>
|
||||
<% span -= 1 %>
|
||||
<% end %>
|
||||
<% if span == 1 %>
|
||||
<!-- span equals 1 show an empty td -->
|
||||
<td style="width: <%= 95 / intervals%>%">
|
||||
</td>
|
||||
<td style="width: <%= @width %>%"></td>
|
||||
<% end %>
|
||||
<% start_time += 15.minutes %>
|
||||
<% start_time += @step_minutes %>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -1,23 +1,11 @@
|
|||
%td.event{ style: "width: #{95 * span / intervals}%; cursor:pointer", |
|
||||
%td.event{ style: "width: #{width * span}%; cursor:pointer", |
|
||||
colspan: span, |
|
||||
role: "button" } |
|
||||
%a.unstyled-link{href: url_for(conference_program_proposal_path(@conference.short_title, event.id))}
|
||||
%h5
|
||||
= event.title
|
||||
- if speaker = event.speakers.first
|
||||
= image_tag speaker.gravatar_url, :class => "img-circle pull-right", |
|
||||
:alt => speaker.name, |
|
||||
:title => speaker.name, |
|
||||
:style => "padding:8px;" |
|
||||
%h5
|
||||
%span.fa.fa-comment
|
||||
= event.title
|
||||
- unless event.subtitle.blank?
|
||||
%span.schedule-subtitle
|
||||
= event.subtitle
|
||||
%span.schedule-speaker
|
||||
%span.fa.fa-user
|
||||
= speaker.name
|
||||
- if event.track
|
||||
%span.schedule-track
|
||||
%span.fa.fa-road
|
||||
%span.label{ style: "background-color: #{event.track.color}" }
|
||||
= event[0].track.name
|
||||
:style => "padding:2px 0px;" |
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<div class="container">
|
||||
<% if @conference.program.events.scheduled.any? %>
|
||||
<% if @conference.scheduled? %>
|
||||
<div role="tabpanel">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue