parent
0894d9ec29
commit
232cc249d4
11 changed files with 193 additions and 147 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
# GET /users/1
|
# GET /users/1
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,10 @@ class Conference < 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
|
||||||
|
|
|
||||||
|
|
@ -205,11 +205,11 @@ class Event < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def speaker_names
|
def speaker_names
|
||||||
result = []
|
result = Set.new
|
||||||
speakers.each do |speaker|
|
speakers.each do |speaker|
|
||||||
result.push(speaker.name)
|
result.add(speaker.name)
|
||||||
end
|
end
|
||||||
result.to_sentence
|
result.to_a.to_sentence
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
19
app/views/conference/_all_events.html.erb
Normal file
19
app/views/conference/_all_events.html.erb
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<h1 class="text-center">Program for <%= @conference.title %></h1>
|
||||||
|
<% @conference.events.confirmed.each do |event| %>
|
||||||
|
<div>
|
||||||
|
<h3>
|
||||||
|
<%= link_to event.title, conference_proposal_path(@conference.short_title, event.id) %>
|
||||||
|
<br>
|
||||||
|
<small>
|
||||||
|
<%= event.subtitle %>
|
||||||
|
</small>
|
||||||
|
</h3>
|
||||||
|
<h4>
|
||||||
|
presented by <%= event.speaker_names %>
|
||||||
|
</h4>
|
||||||
|
<p>
|
||||||
|
<%= truncate(event.abstract, :length => 400) -%>
|
||||||
|
<%= link_to 'more', conference_proposal_path(@conference.short_title, event.id) if event.abstract.length > 400 %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
137
app/views/conference/_schedule.html.erb
Normal file
137
app/views/conference/_schedule.html.erb
Normal file
|
|
@ -0,0 +1,137 @@
|
||||||
|
<div id="schedule-content">
|
||||||
|
<h1 class="text-center"> Schedule for <%= @conference.title %></h1>
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<% @dates.each do |date| %>
|
||||||
|
<li <%= "class=active" if @dates.first == date %>>
|
||||||
|
<%= link_to date, "#" + "#{date}", "data-toggle" => "tab" %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
<% @dates.each do |date| %>
|
||||||
|
<div class="tab-pane <%= 'active' if @dates.first == date %>" id ="<%= date %>" >
|
||||||
|
<table class="table table-bordered" id="schedule" width="100%">
|
||||||
|
<tr>
|
||||||
|
<th>Time</th>
|
||||||
|
<% @rooms.each do |room| %>
|
||||||
|
<th><%= room.name %></th>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% span = {} %>
|
||||||
|
<% @rooms.each do |room| %>
|
||||||
|
<% span[room.id] = 1 %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% conf_start = DateTime.parse("#{date} 09:00") %>
|
||||||
|
<% conf_end = DateTime.parse("#{date} 19:00") %>
|
||||||
|
|
||||||
|
<% while conf_start < conf_end %>
|
||||||
|
<%-
|
||||||
|
start_hour = conf_start.hour
|
||||||
|
start_min = conf_start.min %>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td style="width:5%">
|
||||||
|
<%= conf_start.strftime("%H:%M") %>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<% @rooms.each do |room| %>
|
||||||
|
<% 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? %>
|
||||||
|
<!-- There is an event, calculate the span and show it -->
|
||||||
|
<% span[room.id] = event[0].event_type.length / 15 %>
|
||||||
|
<td style="width: <%= 95 / @rooms.length %>%; cursor:pointer"
|
||||||
|
rowspan ="<%= span[room.id] %>"
|
||||||
|
class="event" role="button"
|
||||||
|
data-href="<%= url_for(conference_proposal_path(@conference.short_title, event[0].id)) %>">
|
||||||
|
<%- if speaker = event[0].speakers.first %>
|
||||||
|
<%= image_tag speaker.gravatar_url, :class => "img-circle pull-right",
|
||||||
|
:alt => speaker.name,
|
||||||
|
:title => speaker.name,
|
||||||
|
:style => "padding:8px;" %>
|
||||||
|
<%- end %>
|
||||||
|
<h5>
|
||||||
|
<span class="fa fa-comment"></span>
|
||||||
|
<%= event[0].title %>
|
||||||
|
<% unless event[0].subtitle.blank? %>
|
||||||
|
<span class="schedule-subtitle">
|
||||||
|
<%= event[0].subtitle %>
|
||||||
|
<span>
|
||||||
|
<% end %>
|
||||||
|
</h5>
|
||||||
|
</span>
|
||||||
|
<span class="schedule-speaker">
|
||||||
|
<span class="fa fa-user"></span>
|
||||||
|
<%= "#{speaker.name}" %>
|
||||||
|
</span>
|
||||||
|
<% if event[0].track%>
|
||||||
|
<span class="schedule-track">
|
||||||
|
<span class="fa fa-road"></span>
|
||||||
|
<span class="label" style="background-color:<%= event[0].track.color if event[0].track %>"><%= event[0].track.name %></span>
|
||||||
|
</span>
|
||||||
|
<% end -%>
|
||||||
|
</td>
|
||||||
|
<% 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 %>
|
||||||
|
<% if span[room.id] == 1 %>
|
||||||
|
<!-- span equals 1 show an empty td -->
|
||||||
|
<td style="width: <%= 95 / @rooms.length %>%">
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
|
<%end %>
|
||||||
|
</tr>
|
||||||
|
<% conf_start += 15.minutes %>
|
||||||
|
<%end %>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%= javascript_tag do %>
|
||||||
|
jQuery( function($) {
|
||||||
|
$('tbody tr td[data-href]').addClass('clickable').mouseup(function(e) {
|
||||||
|
var url = $(this).attr('data-href');
|
||||||
|
if (e.which === 1 && e.ctrlKey){
|
||||||
|
var win = window.open(url, '_blank');
|
||||||
|
win.focus();
|
||||||
|
}
|
||||||
|
else if(e.which === 1)
|
||||||
|
{
|
||||||
|
window.location = url;
|
||||||
|
}
|
||||||
|
else if(e.which === 2)
|
||||||
|
{
|
||||||
|
var win = window.open(url, '_blank');
|
||||||
|
win.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
// add a hash to the URL when the user clicks on a tab
|
||||||
|
$('a[data-toggle="tab"]').on('click', function(e) {
|
||||||
|
history.pushState(null, null, $(this).attr('href'));
|
||||||
|
});
|
||||||
|
// navigate to a tab when the history changes
|
||||||
|
window.addEventListener("popstate", function(e) {
|
||||||
|
var activeTab = $('[href=' + location.hash + ']');
|
||||||
|
if (activeTab.length) {
|
||||||
|
activeTab.tab('show');
|
||||||
|
} else {
|
||||||
|
$('.nav-tabs a[href=#<%= j @today %>]').tab('show');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
var hash = window.location.hash;
|
||||||
|
hash && $('ul.nav a[href="' + hash + '"]').tab('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
@ -1,138 +1,27 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="schedule-content">
|
<% if @conference.events.scheduled.any? %>
|
||||||
<h2> Schedule for <%= @conference.title %></h2>
|
<div role="tabpanel">
|
||||||
<ul class="nav nav-tabs">
|
<!-- Nav tabs -->
|
||||||
<% @dates.each do |date| %>
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
<li <%= "class=active" if @dates.first == date %>>
|
<li role="presentation" class="active">
|
||||||
<%= link_to date, "#" + "#{date}", "data-toggle" => "tab" %>
|
<a title="Timetable of the events" href="#schedule" aria-controls="schedule" role="tab" data-toggle="tab">Schedule</a>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<li role="presentation">
|
||||||
</ul>
|
<a title="All, including unscheduled Events" href="#program" aria-controls="program" role="tab" data-toggle="tab">All Events</a>
|
||||||
|
</li>
|
||||||
<div class="tab-content">
|
</ul>
|
||||||
<% @dates.each do |date| %>
|
|
||||||
<div class="tab-pane <%= 'active' if @dates.first == date %>" id ="<%= date %>" >
|
<!-- Tab panes -->
|
||||||
<table class="table table-bordered" id="schedule" width="100%">
|
<div class="tab-content">
|
||||||
<tr>
|
<div role="tabpanel" class="tab-pane active" id="schedule">
|
||||||
<th>Time</th>
|
<%= render 'schedule' %>
|
||||||
<% @rooms.each do |room| %>
|
</div>
|
||||||
<th><%= room.name %></th>
|
<div role="tabpanel" class="tab-pane" id="program">
|
||||||
<% end %>
|
<%= render 'all_events' %>
|
||||||
</tr>
|
</div>
|
||||||
|
|
||||||
<% span = {} %>
|
|
||||||
<% @rooms.each do |room| %>
|
|
||||||
<% span[room.id] = 1 %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% conf_start = DateTime.parse("#{date} 09:00") %>
|
|
||||||
<% conf_end = DateTime.parse("#{date} 19:00") %>
|
|
||||||
|
|
||||||
<% while conf_start < conf_end %>
|
|
||||||
<%-
|
|
||||||
start_hour = conf_start.hour
|
|
||||||
start_min = conf_start.min %>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td style="width:5%">
|
|
||||||
<%= conf_start.strftime("%H:%M") %>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<% @rooms.each do |room| %>
|
|
||||||
<% 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? %>
|
|
||||||
<!-- There is an event, calculate the span and show it -->
|
|
||||||
<% span[room.id] = event[0].event_type.length / 15 %>
|
|
||||||
<td style="width: <%= 95 / @rooms.length %>%; cursor:pointer"
|
|
||||||
rowspan ="<%= span[room.id] %>"
|
|
||||||
class="event" role="button"
|
|
||||||
data-href="<%= url_for(conference_proposal_path(@conference.short_title, event[0].id)) %>">
|
|
||||||
<%- if speaker = event[0].speakers.first %>
|
|
||||||
<%= image_tag speaker.gravatar_url, :class => "img-circle pull-right",
|
|
||||||
:alt => speaker.name,
|
|
||||||
:title => speaker.name,
|
|
||||||
:style => "padding:8px;" %>
|
|
||||||
<%- end %>
|
|
||||||
<h5>
|
|
||||||
<span class="fa fa-comment"></span>
|
|
||||||
<%= event[0].title %>
|
|
||||||
<% unless event[0].subtitle.blank? %>
|
|
||||||
<span class="schedule-subtitle">
|
|
||||||
<%= event[0].subtitle %>
|
|
||||||
<span>
|
|
||||||
<% end %>
|
|
||||||
</h5>
|
|
||||||
</span>
|
|
||||||
<span class="schedule-speaker">
|
|
||||||
<span class="fa fa-user"></span>
|
|
||||||
<%= "#{speaker.name}" %>
|
|
||||||
</span>
|
|
||||||
<% if event[0].track%>
|
|
||||||
<span class="schedule-track">
|
|
||||||
<span class="fa fa-road"></span>
|
|
||||||
<span class="label" style="background-color:<%= event[0].track.color if event[0].track %>"><%= event[0].track.name %></span>
|
|
||||||
</span>
|
|
||||||
<% end -%>
|
|
||||||
</td>
|
|
||||||
<% 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 %>
|
|
||||||
<% if span[room.id] == 1 %>
|
|
||||||
<!-- span equals 1 show an empty td -->
|
|
||||||
<td style="width: <%= 95 / @rooms.length %>%">
|
|
||||||
</td>
|
|
||||||
<% end %>
|
|
||||||
<%end %>
|
|
||||||
</tr>
|
|
||||||
<% conf_start += 15.minutes %>
|
|
||||||
<%end %>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
</div>
|
||||||
</div>
|
<% else %>
|
||||||
</div>
|
<%= render 'all_events' %>
|
||||||
<%= javascript_tag do %>
|
<% end %>
|
||||||
jQuery( function($) {
|
</div>
|
||||||
$('tbody tr td[data-href]').addClass('clickable').mouseup(function(e) {
|
|
||||||
var url = $(this).attr('data-href');
|
|
||||||
if (e.which === 1 && e.ctrlKey){
|
|
||||||
var win = window.open(url, '_blank');
|
|
||||||
win.focus();
|
|
||||||
}
|
|
||||||
else if(e.which === 1)
|
|
||||||
{
|
|
||||||
window.location = url;
|
|
||||||
}
|
|
||||||
else if(e.which === 2)
|
|
||||||
{
|
|
||||||
var win = window.open(url, '_blank');
|
|
||||||
win.focus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$(function() {
|
|
||||||
// add a hash to the URL when the user clicks on a tab
|
|
||||||
$('a[data-toggle="tab"]').on('click', function(e) {
|
|
||||||
history.pushState(null, null, $(this).attr('href'));
|
|
||||||
});
|
|
||||||
// navigate to a tab when the history changes
|
|
||||||
window.addEventListener("popstate", function(e) {
|
|
||||||
var activeTab = $('[href=' + location.hash + ']');
|
|
||||||
if (activeTab.length) {
|
|
||||||
activeTab.tab('show');
|
|
||||||
} else {
|
|
||||||
$('.nav-tabs a[href=#<%= j @today %>]').tab('show');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$(function() {
|
|
||||||
var hash = window.location.hash;
|
|
||||||
hash && $('ul.nav a[href="' + hash + '"]').tab('show');
|
|
||||||
});
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
- if @conference.splashpage.include_program
|
- if @conference.splashpage.include_program
|
||||||
%section#program
|
%section#program
|
||||||
= render 'program'
|
= render 'schedule_splashpage'
|
||||||
|
|
||||||
- if @conference.cfp_open? and @conference.splashpage.include_cfp
|
- if @conference.cfp_open? and @conference.splashpage.include_cfp
|
||||||
%section#callforpapers
|
%section#callforpapers
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,8 @@
|
||||||
.col-md-8
|
.col-md-8
|
||||||
%h3
|
%h3
|
||||||
by
|
by
|
||||||
= @speaker.name
|
= link_to @speaker.name, user_path(@speaker.id)
|
||||||
(
|
= "(#{@speaker.email})"
|
||||||
= @speaker.email
|
|
||||||
)
|
|
||||||
- if @speaker.affiliation?
|
- if @speaker.affiliation?
|
||||||
%br
|
%br
|
||||||
%span.muted
|
%span.muted
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
.col-md-12
|
.col-md-12
|
||||||
.page-header
|
.page-header
|
||||||
%h1
|
%h1
|
||||||
= image_tag(current_user.gravatar_url(size: '48'), title: "Yo #{current_user.name}!", :alt => '')
|
= image_tag(@user.gravatar_url(size: '48'), title: "Yo #{@user.name}!", :alt => '')
|
||||||
= @user.name
|
= @user.name
|
||||||
%small
|
%small
|
||||||
= @user.nickname
|
= @user.nickname
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ describe 'conference/show.html.haml' do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'renders program partial' do
|
it 'renders program partial' do
|
||||||
expect(view).to render_template(partial: 'conference/_program')
|
expect(view).to render_template(partial: 'conference/_schedule_splashpage')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'renders registration partial' do
|
it 'renders registration partial' do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue