This commit is contained in:
Ana María Martínez Gómez 2017-01-26 15:36:04 +00:00 committed by GitHub
commit 24582706be
9 changed files with 311 additions and 125 deletions

View file

@ -5,17 +5,22 @@
.room-name
- room_date_event_schedules = date_event_schedules.select{ |e| e.room == room }
= room.name
- cells_with_event = 0
- (9*4..18*4).each do |slot|
- hour = slot / 4
- minutes = (15 * (slot % 4) == 0) ? '00' : 15 * (slot % 4)
- time = "#{hour}:#{minutes}"
.schedule-room-slot{ id: "schedule-room-#{room.guid}-#{hour}-#{minutes}", |
room_id: room.id, |
hour: time, |
date: date}
- event_schedules = room_date_event_schedules.select{ |e| (e.start_time.hour.to_s + e.start_time.strftime(':%M')).eql? time }
- if event_schedules.any?
- event_schedule = event_schedules.first
- cells_with_event = event_schedule.event.event_type.length / EventType::LENGTH_STEP
%div{ class: "schedule-room-slot #{'with-event' if cells_with_event > 0}", |
id: "schedule-room-#{room.guid}-#{hour}-#{minutes}", |
room_id: room.id, |
hour: time, |
date: date}
.div
= time
- event_schedules = room_date_event_schedules.select{ |e| (e.start_time.hour.to_s + e.start_time.strftime(':%M')).eql? time }
- if event_schedules.any?
- event_schedule = event_schedules.first
- if event_schedule
= render partial: 'event', locals: { event: event_schedule.event, event_schedule_id: event_schedule.id}
- (cells_with_event = cells_with_event - 1) if cells_with_event > 0

View file

@ -4,8 +4,14 @@
.col-md-12
.page-header
%h1 Schedule
%p.text-muted
Create the schedules for the conference
.row
.col-md-10.col-xs-8
%p.text-muted
Create the schedules for the conference
.col-md-2.col-xs-4
.text-right
%button.btn.btn-success.schedule-save
Save
- if @rooms.present?
.row
@ -32,6 +38,10 @@
- @dates.each do |date|
.tab-pane{ class: "#{ (@dates.first == date) ? 'active' : '' }", id: "#{date}" }
= render partial: 'day_tab', locals: { date: date }
.row
.col-md-12.text-right
%button.btn.btn-success.schedule-save
Save
- else
.h3
No Rooms!
@ -41,5 +51,13 @@
:javascript
$(document).ready( function() {
Schedule.initialize("#{admin_conference_event_schedules_path(@conference)}", "#{@schedule.id}");
// When reload the page after saving, show flash messages in the url.
var url = window.location.href;
if (url.indexOf("?") > 0){
var params = (url.split("?"))[1].split(/[&=]/);
if(params[0] == 'flash' && params[2] == 'type')
showMessage(decodeURI(params[1]), params[3]);
}
Schedule.initialize("#{@conference.short_title}", "#{@schedule.id}");
});