From 41d272b70a22262e5ccdd90bbb659fdf818a203c Mon Sep 17 00:00:00 2001 From: Godwin Date: Sat, 19 Aug 2017 13:47:13 -0700 Subject: [PATCH] Added schedule interval --- app/assets/stylesheets/_admin.scss | 1 + app/assets/stylesheets/_application.scss | 6 ++++++ app/controllers/application_controller.rb | 8 ++++---- app/views/conference_administration/_schedule.html.haml | 4 ++-- .../conference_administration/_workshop_times.html.haml | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/_admin.scss b/app/assets/stylesheets/_admin.scss index 1e480f9..cdc2e08 100644 --- a/app/assets/stylesheets/_admin.scss +++ b/app/assets/stylesheets/_admin.scss @@ -1393,6 +1393,7 @@ nav.sub-menu { position: absolute; top: 0; right: 0.25em; + z-index: 2; ul { width: 15em; diff --git a/app/assets/stylesheets/_application.scss b/app/assets/stylesheets/_application.scss index 7d30198..4d14697 100644 --- a/app/assets/stylesheets/_application.scss +++ b/app/assets/stylesheets/_application.scss @@ -2060,6 +2060,12 @@ table.schedule { white-space: nowrap; text-align: right; } + + .row-type-nil { + th { + color: $almost-light-gray; + } + } } &.locations-1 td.workshop.filled { diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9e9ee2c..184ff24 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -472,15 +472,15 @@ class ApplicationController < BaseController @schedule.deep_dup.each do |day, data| data[:times].each do |time, time_data| - if time_data[:next_event].present? || time_data[:length] > 0.5 - span = 0.5 + if time_data[:next_event].present? || time_data[:length] > @this_conference.schedule_interval + span = @this_conference.schedule_interval length = time_data[:next_event].present? ? time_data[:next_event] - time : time_data[:length] while span < length @schedule[day][:times][time + span] ||= { type: (span >= time_data[:length] ? :empty : :nil), - length: 0.5 + length: @this_conference.schedule_interval } - span += 0.5 + span += @this_conference.schedule_interval end end end diff --git a/app/views/conference_administration/_schedule.html.haml b/app/views/conference_administration/_schedule.html.haml index f2157ad..b8d8815 100644 --- a/app/views/conference_administration/_schedule.html.haml +++ b/app/views/conference_administration/_schedule.html.haml @@ -17,8 +17,8 @@ %th=location.is_a?(Symbol) ? '' : _!(location.title) %tbody - data[:times].each do |time, time_data| - %tr - - rowspan = (time_data[:length] * 2).to_i + %tr{class: "row-type-#{time_data[:type] || 'nil'}"} + - rowspan = (time_data[:length] * (1 / @this_conference.schedule_interval)).to_i %th=time(time).html_safe - if time_data[:type] == :workshop - data[:locations].each do |id, location| diff --git a/app/views/conference_administration/_workshop_times.html.haml b/app/views/conference_administration/_workshop_times.html.haml index d0e0c71..2d4b51f 100644 --- a/app/views/conference_administration/_workshop_times.html.haml +++ b/app/views/conference_administration/_workshop_times.html.haml @@ -11,7 +11,7 @@ = form_tag administration_update_path(@this_conference.slug, @admin_step), class: ['table-tr', is_new ? 'new' : 'saved'] do .table-th.center.big= is_new ? '' : (block + 1) .table-td=hour_select info['time'], small: true, label: false - .table-td=length_select info['length'], {small: true, label: false}, 0.5, 2 + .table-td=length_select info['length'], {small: true, label: false}, 0.5, 2, @this_conference.schedule_interval .table-td=checkboxes :days, @block_days, info['days'].map(&:to_i), 'date.day_names', vertical: true, small: true .table-td.form = hidden_field_tag :workshop_block, block