Talk boxes with less information and schedule view simplified

This commit is contained in:
Ana 2016-06-01 11:22:22 +02:00
parent 6ba3512d2b
commit 2905c8858c
8 changed files with 38 additions and 31 deletions

View file

@ -15,6 +15,12 @@ class ConferenceController < ApplicationController
@rooms = @conference.venue.rooms if @conference.venue @rooms = @conference.venue.rooms if @conference.venue
@events = @conference.program.events @events = @conference.program.events
@dates = @conference.start_date..@conference.end_date @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 if @dates == Date.current
@today = Date.current.strftime('%Y-%m-%d') @today = Date.current.strftime('%Y-%m-%d')
else else

View file

@ -81,6 +81,16 @@ class Conference < ActiveRecord::Base
result result
end 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 # Checks if the user is registered to the conference
# #

View file

@ -223,6 +223,13 @@ class Event < ActiveRecord::Base
(100 * result.values.count(true) / result.values.compact.count).to_s (100 * result.values.count(true) / result.values.compact.count).to_s
end end
##
# Returns the number of columns this event should span in the schedule
#
def span
self.event_type.length / EventType::LENGTH_STEP
end
private private
## ##

View file

@ -8,4 +8,7 @@ class EventType < ActiveRecord::Base
validates :maximum_abstract_length, presence: true validates :maximum_abstract_length, presence: true
alias_attribute :name, :title alias_attribute :name, :title
# If LENGTH_STEP > 60 the public schedule must be changed
LENGTH_STEP = 15
end end

View file

@ -26,10 +26,6 @@ class Program < ActiveRecord::Base
where(state: :confirmed) where(state: :confirmed)
end end
def scheduled
where.not(start_time: nil)
end
def highlights def highlights
where(state: :confirmed, is_highlight: true) where(state: :confirmed, is_highlight: true)
end end

View file

@ -14,9 +14,7 @@
<table class="table table-bordered" id="schedule" width="100%"> <table class="table table-bordered" id="schedule" width="100%">
<tr> <tr>
<th>Rooms</th> <th>Rooms</th>
<%# The conference starts at 9 and ends at 18:45 %> <% (@start_hour..@end_hour-1).each do |i| %>
<% intervals = (19 - 9) * 4 %>
<% (9..18).each do |i| %>
<th colspan="4"><%= "#{i}:00" %></th> <th colspan="4"><%= "#{i}:00" %></th>
<% end %> <% end %>
</tr> </tr>
@ -25,24 +23,23 @@
<tr> <tr>
<td><%= room.name %></td> <td><%= room.name %></td>
<% events_for_date = room.events.find_all{ |e| e.start_time.to_date == date } %> <% events_for_date = room.events.find_all{ |e| e.start_time.to_date == date } %>
<% start_time = DateTime.parse("#{date} 09:00") %> <% start_time = DateTime.parse("#{date} #{@start_hour}:00") %>
<% (1..intervals).each do |i| %> <% (1..@intervals).each do |i| %>
<% events_for_time = events_for_date.find_all{|e| e.start_time == start_time} %> <% events_for_time = events_for_date.find_all{|e| e.start_time == start_time} %>
<% if !events_for_time.empty? %> <% if !events_for_time.empty? %>
<% event = events_for_time[0] %> <% event = events_for_time[0] %>
<!-- There is an event, calculate the span and show it --> <!-- There is an event, calculate the span and show it -->
<% span = event.event_type.length / 15 %> <% span = event.span %>
<%= render partial: 'schedule_item', locals: {event: event, span: span, intervals: intervals} %> <%= render partial: 'schedule_item', locals: {event: event, span: span, width: @width} %>
<% span += 1 %> <% span += 1 %>
<% elsif span > 1 %> <% elsif span > 1 %>
<% span -= 1 %> <% span -= 1 %>
<% end %> <% end %>
<% if span == 1 %> <% if span == 1 %>
<!-- span equals 1 show an empty td --> <!-- span equals 1 show an empty td -->
<td style="width: <%= 95 / intervals%>%"> <td style="width: <%= @width %>%"></td>
</td>
<% end %> <% end %>
<% start_time += 15.minutes %> <% start_time += @step_minutes %>
<% end %> <% end %>
</tr> </tr>
<% end %> <% end %>

View file

@ -1,23 +1,11 @@
%td.event{ style: "width: #{95 * span / intervals}%; cursor:pointer", | %td.event{ style: "width: #{width * span}%; cursor:pointer", |
colspan: span, | colspan: span, |
role: "button" } | role: "button" } |
%a.unstyled-link{href: url_for(conference_program_proposal_path(@conference.short_title, event.id))} %a.unstyled-link{href: url_for(conference_program_proposal_path(@conference.short_title, event.id))}
%h5
= event.title
- if speaker = event.speakers.first - if speaker = event.speakers.first
= image_tag speaker.gravatar_url, :class => "img-circle pull-right", | = image_tag speaker.gravatar_url, :class => "img-circle pull-right", |
:alt => speaker.name, | :alt => speaker.name, |
:title => speaker.name, | :title => speaker.name, |
:style => "padding:8px;" | :style => "padding:2px 0px;" |
%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

View file

@ -1,5 +1,5 @@
<div class="container"> <div class="container">
<% if @conference.program.events.scheduled.any? %> <% if @conference.scheduled? %>
<div role="tabpanel"> <div role="tabpanel">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">