Browse Source

Added schedule interval

development
Godwin 7 years ago
parent
commit
41d272b70a
  1. 1
      app/assets/stylesheets/_admin.scss
  2. 6
      app/assets/stylesheets/_application.scss
  3. 8
      app/controllers/application_controller.rb
  4. 4
      app/views/conference_administration/_schedule.html.haml
  5. 2
      app/views/conference_administration/_workshop_times.html.haml

1
app/assets/stylesheets/_admin.scss

@ -1393,6 +1393,7 @@ nav.sub-menu {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0.25em; right: 0.25em;
z-index: 2;
ul { ul {
width: 15em; width: 15em;

6
app/assets/stylesheets/_application.scss

@ -2060,6 +2060,12 @@ table.schedule {
white-space: nowrap; white-space: nowrap;
text-align: right; text-align: right;
} }
.row-type-nil {
th {
color: $almost-light-gray;
}
}
} }
&.locations-1 td.workshop.filled { &.locations-1 td.workshop.filled {

8
app/controllers/application_controller.rb

@ -472,15 +472,15 @@ class ApplicationController < BaseController
@schedule.deep_dup.each do |day, data| @schedule.deep_dup.each do |day, data|
data[:times].each do |time, time_data| data[:times].each do |time, time_data|
if time_data[:next_event].present? || time_data[:length] > 0.5 if time_data[:next_event].present? || time_data[:length] > @this_conference.schedule_interval
span = 0.5 span = @this_conference.schedule_interval
length = time_data[:next_event].present? ? time_data[:next_event] - time : time_data[:length] length = time_data[:next_event].present? ? time_data[:next_event] - time : time_data[:length]
while span < length while span < length
@schedule[day][:times][time + span] ||= { @schedule[day][:times][time + span] ||= {
type: (span >= time_data[:length] ? :empty : :nil), 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 end
end end

4
app/views/conference_administration/_schedule.html.haml

@ -17,8 +17,8 @@
%th=location.is_a?(Symbol) ? '' : _!(location.title) %th=location.is_a?(Symbol) ? '' : _!(location.title)
%tbody %tbody
- data[:times].each do |time, time_data| - data[:times].each do |time, time_data|
%tr %tr{class: "row-type-#{time_data[:type] || 'nil'}"}
- rowspan = (time_data[:length] * 2).to_i - rowspan = (time_data[:length] * (1 / @this_conference.schedule_interval)).to_i
%th=time(time).html_safe %th=time(time).html_safe
- if time_data[:type] == :workshop - if time_data[:type] == :workshop
- data[:locations].each do |id, location| - data[:locations].each do |id, location|

2
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 = 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-th.center.big= is_new ? '' : (block + 1)
.table-td=hour_select info['time'], small: true, label: false .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=checkboxes :days, @block_days, info['days'].map(&:to_i), 'date.day_names', vertical: true, small: true
.table-td.form .table-td.form
= hidden_field_tag :workshop_block, block = hidden_field_tag :workshop_block, block

Loading…
Cancel
Save