SchedulesController introduced

The actions #schedule and #events were moved from conference controller to the new controller
This commit is contained in:
Ana 2016-07-29 22:02:01 +02:00
parent b037a5eb7c
commit 71dab6b79c
18 changed files with 87 additions and 69 deletions

View file

@ -1,59 +0,0 @@
- intervals = number_columns * 60 / EventType::LENGTH_STEP + 1
- width = 85 / intervals
- carousel_number = (@conf_period / number_columns.to_f).ceil
.carousel.slide{ id: "carousel-#{ date }-#{ number_columns }", |
"data-ride" => "carousel", |
"data-wrap" => "false", |
"data-interval" => "false" }
/ Wrapper for slides
.carousel-inner
- start_time = DateTime.parse("#{date} #{@conf_start}:00")
- (0..carousel_number-1).each do |number|
%div{ class: "#{ carousel_item_class(number, carousel_number, number_columns, @hour_column)}" }
%table.table.table-bordered.schedule-table#schedule
%tr
%th
- td_start_time = start_time
- (1..intervals).each do |i|
%th.date
= (td_start_time).strftime("%H:%M")
- td_start_time += @step_minutes
- start_room_time = start_time
- @rooms.each do |room|
- start_room_time = start_time
- span = 1
%tr
%td.room{ style: "height: #{ td_height(@rooms) }px;" }
.room.elipsis.break-words{ style: "-webkit-line-clamp: #{ room_lines(@rooms) }; height: #{ room_height(@rooms) }px;" }
= room.name
- event_schedules = room.event_schedules.select{ |e| (e.schedule_id == @conference.program.selected_schedule.id) && (e.start_time >= start_time) && (e.start_time < (start_time + number_columns.hour)) }
- (1..intervals).each do |i|
- if span > 1
- span -= 1
- else
- event_schedule = event_schedules.find{ |e| e.start_time <= start_room_time and e.end_time > start_room_time }
- if event_schedule && (event_schedule.event.state == 'canceled' || event_schedule.event.state == 'withdrawn') && !event_schedule.intersecting_events.confirmed.empty?
- replacement_event = event_schedule.intersecting_events.confirmed.first
- event_schedule = (replacement_event.start_time <= start_room_time && replacement_event.end_time > start_room_time) ? replacement_event : nil
- if event_schedule
/ There is an event, calculate the span and show it
- event_span = (event_schedule.end_time.to_i - start_room_time.to_i) / 60 / EventType::LENGTH_STEP
- span = ((event_span + i - 1 ) > intervals ? intervals + 1 - i : event_span)
= render partial: 'schedule_item', locals: {event: event_schedule.event, event_schedule: event_schedule, span: span, width: width}
- else
/ if span equals 1 show an empty td
%td.no-padding{ width: "#{ width }%"}
- start_room_time += @step_minutes
- start_time = start_room_time - @step_minutes
/ Controls
%a.left.carousel-control{ href: "#carousel-#{ date }-#{ number_columns }", |
role: "button", |
"data-slide" => "prev" }
%span.glyphicon.glyphicon-chevron-left
%a.right.carousel-control{ href: "#carousel-#{ date }-#{ number_columns }", |
role: "button", |
"data-slide" => "next" }
%span.glyphicon.glyphicon-chevron-right

View file

@ -22,7 +22,7 @@
- if conference.splashpage && conference.splashpage.public
= link_to "View Conference", conference_path(conference.short_title), :class =>"btn btn-default"
- if conference.program and conference.program.schedule_public
= link_to "Schedule", schedule_conference_path(conference.short_title), :class =>"btn btn-default"
= link_to "Schedule", conference_schedule_path(conference.short_title), :class =>"btn btn-default"
- if conference.registration_open?
- if conference.user_registered?(current_user)
= link_to "My Registration", conference_conference_registration_path(conference.short_title), :class =>"btn btn-default"

View file

@ -1,43 +0,0 @@
.panel.panel-default.event-panel{ id: "link-#{event.id}" }
.panel-body
- if speaker = event.speakers.first
= image_tag speaker.gravatar_url, :class => "img-circle pull-right all-speaker-pic", |
:alt => speaker.name, |
:title => speaker.name |
%span.h3
= event.title
%br
%small
= event.subtitle
%h4
presented by #{event.speaker_names}
%p
= truncate(event.abstract, :length => 400)
= link_to 'more', conference_program_proposal_path(@conference.short_title, event.id) if event.abstract.length > 400
- if event_schedule.present?
%span.track
%span.fa.fa-clock-o
%span.label{ style: "background-color: grey" }
= event_schedule.start_time.strftime('%H:%M')
\-
= event_schedule.end_time.strftime('%H:%M')
%span.track
%span.fa.fa-map-marker
%span.label{ style: "background-color: grey" }
= event_schedule.room.name
- if event.track
%span.track
%span.fa.fa-road
%span.label{ style: "background-color: #{event.track.color}; color: #{ contrast_color(event.track.color) }" }
= event.track.name
:javascript
$("#link-#{event.id}").click(function(e) {
var url = "#{url_for(conference_program_proposal_path(@conference.short_title, event.id))}";
if(e.ctrlKey)
window.open(url,'_blank');
else
window.location = url;
});

View file

@ -1,68 +0,0 @@
#schedule-content
%h1.text-center
Schedule for
= @conference.title
.dropdown.schedule-dropdown
%button{ type: "button", class: "btn btn-default dropdown-toggle", 'data-toggle' => "dropdown" }
= @dates.first
%span.caret
%ul.dropdown-menu
- @dates.each do |date|
%li.li-dropdown-schedule
= link_to date, "#" + "#{date}", "data-toggle" => "tab", "class" => "date-tab"
.tab-content
- @dates.each do |date|
%div{ class: "tab-pane #{ 'active' if @dates.first == date }", id: "#{ date }" }
.visible-xs-inline
= render partial: 'carousel', locals: { date: date, number_columns: 1 }
.visible-sm-inline
= render partial: 'carousel', locals: { date: date, number_columns: 2 }
.visible-md-inline.visible-lg-inline
= render partial: 'carousel', locals: { date: date, number_columns: 3 }
:javascript
// change of active tab and the button title when a date clicked
$(function() {
$('.date-tab').on('click', function(e) {
$('.li-dropdown-schedule').removeClass('active');
$('.schedule-dropdown').find('button').text($(this).text());
});
});
// use the date tag in the url to select a tab and the title of the button
$(function() {
var hash = window.location.hash;
if(hash && !(hash === '#schedule')){
hash && $('ul a[href="' + hash + '"]').tab('show');
$('button.dropdown-toggle').text(hash.substr(1));
}
});
// hide the right and left controls when neccesary after moving the carousel
$('.carousel').on('slid.bs.carousel', '',
function(){
$(this).children('.left.carousel-control').show();
$(this).children('.right.carousel-control').show();
if($(this).find('.first').hasClass('active')) {
$(this).children('.left.carousel-control').hide();
} else if($(this).find('.last').hasClass('active')) {
$(this).children('.right.carousel-control').hide();
}
});
$(document).ready(function(){
// hide the left control when the page is ready
$('.carousel').children('.left.carousel-control').hide();
// carousel swipe
$(".carousel-inner").swiperight(function() {
$(this).parent().carousel('prev');
});
$(".carousel-inner").swipeleft(function() {
$(this).parent().carousel('next');
});
});

View file

@ -1,19 +0,0 @@
%td.event{ width: "#{ width * span }%" , |
colspan: span, |
role: "button" }
%a.unstyled-link{href: url_for(conference_program_proposal_path(@conference.short_title, event.id))}
%div{ class: "elipsis break-words event-title", |
style: "-webkit-line-clamp: #{ event_lines(@rooms) }; height: #{ event_height(@rooms) }px;"} |
- if event.state == 'canceled' || event.state == 'withdrawn'
%span.label.label-danger.schedule-label CANCELED
- elsif event.state == 'confirmed' && (!event_schedule.intersecting_events.canceled.empty? || !event_schedule.intersecting_events.withdrawn.empty?)
%span.label.label-info.schedule-label REPLACEMENT
= event.title
- if speaker = event.speakers.first
= image_tag speaker.gravatar_url, :class => "img-circle pull-right speaker-pic", |
:alt => speaker.name, |
:title => speaker.name, |
:style => "height: #{ speaker_height(@rooms) }px; width: #{ speaker_width(@rooms) }px;"

View file

@ -22,7 +22,7 @@
.row
.col-md-12
%p.cta-button.text-center
= link_to(schedule_conference_path(@conference.short_title), class: 'btn btn-default btn-lg') do
= link_to(conference_schedule_path(@conference.short_title), class: 'btn btn-default btn-lg') do
Full Schedule

View file

@ -1,7 +0,0 @@
%div{ role: "tabpanel" }
/ Nav tabs
%ul.nav.nav-tabs{ role: "tablist" }
%li{ class: "schedule #{ 'active' if active == 'schedule' }", role: "presentation" }
= link_to('Schedule', schedule_conference_path(@conference.short_title))
%li{ class: "program #{ 'active' if active == 'program' }", role: "presentation" }
= link_to('All events', events_conference_path(@conference.short_title))

View file

@ -1,65 +0,0 @@
.container#program
-if @events_schedules.any?
= render partial: 'schedule_tabs', locals: { active: 'program' }
%h1.text-center
Program for
= @conference.title
.dropdown.program-dropdown
%button{ type: "button", class: "btn btn-default dropdown-toggle", 'data-toggle' => "dropdown" }
Dates
%span.caret
%ul.dropdown-menu
- @dates.each do |date|
%li.li-dropdown-program
= link_to date, "##{date}", class: "program-selector#{ ' no-events-day' unless @conference.program.any_event_for_this_date?(date) }"
- if @unscheduled_events.any?
%li.li-dropdown-program
= link_to('Unscheduled', "#unscheduled", class: 'program-selector')
.row
/ scheduled events
- date = nil
- time = nil
- @events_schedules.each do |event_schedule|
- unless event_schedule.start_time.strftime('%Y-%m-%d').eql?(date)
.col-xs-12.col-md-12
.date-content
%span{ class: 'date-title', id: "#{ event_schedule.start_time.strftime('%Y-%m-%d') }" }
= date = event_schedule.start_time.strftime('%Y-%m-%d')
%a{ title: "Go up", class: "pull-right", href: "#program" }
%i{ class: "fa fa-angle-double-up fa-lg", 'aria-hidden' => true }
- unless event_schedule.start_time.strftime('%H:%M').eql?(time)
.col-xs-12.col-md-1
.start-time
= time = event_schedule.start_time.strftime('%H:%M')
.col-xs-12.col-md-11
.new-time-event
= render partial: 'event', locals: { event: event_schedule.event, event_schedule: event_schedule }
- else
.col-xs-12.col-md-11.col-md-offset-1
= render partial: 'event', locals: { event: event_schedule.event, event_schedule: event_schedule }
/ confirmed events that are not scheduled
- if @unscheduled_events.any?
.col-xs-12.col-md-12
.date-content
%span.date-title#unscheduled
Unscheduled events
%a{ title: "Go up", class: "pull-right", href: "#program" }
%i{ class: "fa fa-angle-double-up fa-lg", 'aria-hidden' => true }
- @unscheduled_events.each do |event|
.col-xs-12.col-md-12
.unscheduled-event
= render partial: 'event', locals: { event: event, event_schedule: nil }
:javascript
$('.program-selector').on('click', function(e) {
$('.li-dropdown-program').removeClass('active');
});
// Go to current date and time
$(document).ready(function(){
document.getElementById("#{ @tag }").scrollIntoView();
});

View file

@ -1,81 +0,0 @@
.container
= render partial: 'schedule_tabs', locals: { active: 'schedule' }
#schedule-content
%h1.text-center
Schedule for
= @conference.title
.dropdown.schedule-dropdown
%button{ type: "button", class: "btn btn-default dropdown-toggle", 'data-toggle' => "dropdown" }
= @day
%span.caret
%ul.dropdown-menu
- @dates.each do |date|
%li.li-dropdown-schedule{ class: "#{ 'active' if @day == date }" }
= link_to date, "#" + "#{date}", "data-toggle" => "tab", "class" => "date-tab"
.tab-content
- @dates.each do |date|
%div{ class: "tab-pane #{ 'active' if @day == date }", id: "#{ date }" }
.visible-xs-inline
= render partial: 'carousel', locals: { date: date, number_columns: 1 }
.visible-sm-inline
= render partial: 'carousel', locals: { date: date, number_columns: 2 }
.visible-md-inline.visible-lg-inline
= render partial: 'carousel', locals: { date: date, number_columns: 3 }
:javascript
// change of active tab and the button title when a date is clicked
$(function() {
$('.date-tab').on('click', function(e) {
$('.li-dropdown-schedule').removeClass('active');
$('.schedule-dropdown').find('button').text($(this).text());
});
});
// hide the right and left controls when neccesary after moving the carousel
$('.carousel').on('slid.bs.carousel', '',
function(){
$(this).children('.left.carousel-control').show();
$(this).children('.right.carousel-control').show();
if($(this).find('.first').hasClass('active')) {
$(this).children('.left.carousel-control').hide();
}
if($(this).find('.last').hasClass('active')) {
$(this).children('.right.carousel-control').hide();
}
});
$(document).ready(function(){
// hide the left control when the page is ready
$('.carousel').each(function() {
if($(this).find('.first').hasClass('active')) {
$(this).children('.left.carousel-control').hide();
}
if($(this).find('.last').hasClass('active')) {
$(this).children('.right.carousel-control').hide();
}
});
// carousel swipe
$(".carousel-inner").swiperight(function() {
$(this).parent().carousel('prev');
});
$(".carousel-inner").swipeleft(function() {
$(this).parent().carousel('next');
});
var day = "#{@current_day}";
// we only go to the date tag in the url if the conference is not taking place now
if(day === ""){
// use the date tag in the url to select a tab and the title of the button
var hash = window.location.hash;
if(hash && !(hash === '#schedule')){
hash && $('ul a[href="' + hash + '"]').tab('show');
$('button.dropdown-toggle').text(hash.substr(1));
}
}
});

View file

@ -1,35 +0,0 @@
%schedule
%version= @conference.revision
%conference
%acronym= @conference.short_title
%title= @conference.title
%start= @conference.start_date
%end= @conference.end_date
%days= (@conference.end_date - @conference.start_date).to_i + 1
%timeslot_duration= length_timestamp(EventType::LENGTH_STEP)
- if @events_xml.any?
- @events_xml.keys.each.with_index(1) do |day, index|
%day{ date: day, index: index }
- events_in_rooms = @events_xml[day].group_by(&:room)
- events_in_rooms.keys.each do |room|
%room{ name: room.name }
- events_in_rooms[room].each do |event|
%event{ guid: event.guid, id: event.id }
%date= event.scheduled_start_time.iso8601
%start= event.scheduled_start_time.strftime('%H:%M')
%duration= length_timestamp(event.event_type.length)
%room= event.scheduled_room.name
%type= event.event_type.name
%language= ISO_639.find_by_english_name(event.language).third if event.language
%slug= "#{event.id} #{event.title}".parameterize
%title= event.title
%subtitle= event.subtitle
%track= event.track.name if event.track
%abstract= event.abstract
%recording
%license/
%optout=false #FIXME
%persons
- event.speakers.uniq.each do |speaker|
%person{ id: speaker.id }= speaker.name