Browse Source

Merge branch 'development', remote-tracking branch 'origin'

development
Godwin 7 years ago
parent
commit
8f2fc86462
  1. 28
      app/assets/stylesheets/_application.scss
  2. 31
      app/controllers/application_controller.rb
  3. 8
      app/views/conference_administration/_schedule.html.haml

28
app/assets/stylesheets/_application.scss

@ -2053,6 +2053,16 @@ table.schedule {
width: 100%;
margin: 0 0 1em;
thead a {
@include link($black);
}
@for $i from 1 through 10 {
thead tr.locations-#{$i} .location-header {
width: percentage(100 / $i);
}
}
tbody {
border: 0.1rem solid $light-gray;
@ -2093,6 +2103,7 @@ table.schedule {
}
td {
position: relative;
text-align: center;
border: 0;
background-color: $extra-light-gray;
@ -2135,21 +2146,32 @@ table.schedule {
.event-detail-link {
display: inline-block;
display: inline-flex;
position: relative;
position: static;
height: 100%;
width: 100%;
color: inherit;
align-items: center;
@include not-link-like;
@include before {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
}
}
}
body.home table.schedule td .event-detail-link:hover {
outline: 0.33rem solid #02CA9E;
outline-offset: 0.25rem;
@include before {
outline: 0.33rem solid $green;
outline-offset: -0.3rem;
z-index: 1;
}
}
.event-dlg {

31
app/controllers/application_controller.rb

@ -472,34 +472,26 @@ 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] > @this_conference.schedule_interval
span = @this_conference.schedule_interval
if time_data[:next_event].present? || time_data[:length] > conference.schedule_interval
span = 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: @this_conference.schedule_interval
length: conference.schedule_interval
}
span += @this_conference.schedule_interval
span += conference.schedule_interval
end
end
end
end
# schedule = schedule.sort.to_h
schedule.each do |day, data|
# @schedule[day] = [{}]
# division = 0
# schedule[day][:num_locations] = schedule[day][:num_locations]
# schedule[day][:times] = data[:times].sort.to_h
schedule[day][:times] = data[:times].sort.to_h
schedule[day][:locations] ||= {}
# # sort the locations by name
schedule[day][:locations] = schedule[day][:locations].sort_by { |event_id, event| event.present? ? event.title.downcase : '' }.to_h
# # add an empty block if no workshops are scheduled on this day yet
# schedule[day][:locations][0] = :add if do_analyze || schedule[day][:locations].empty?
# sort the locations by name
schedule[day][:locations] = schedule[day][:locations].sort_by { |event_id, event| event.present? ? event.title.downcase : '' }.to_h
if do_analyze
data[:times].each do |time, time_data|
@ -571,24 +563,13 @@ class ApplicationController < BaseController
schedule.sort.to_h.each do |day, data|
@schedule[day] = []
division = 0
# @schedule[day][division] = data
locations = nil
@schedule[day][division] = {}
@schedule[day][division][:times] = {}
# @schedule[day][division][:times] = data[:times]
# # sort the locations by name
# @schedule[day][:locations] = schedule[day][:locations].sort_by { |event_id, event| event.present? ? event.title.downcase : '' }.to_h
# # add an empty block if no workshops are scheduled on this day yet
# schedule[day][:locations][0] = :add if do_analyze || schedule[day][:locations].empty?
# last_time_data = nil
data[:times].each do |time, time_data|
if time_data[:type] == :workshop && time_data[:item].present? && time_data[:item][:workshops].present?
if !locations.nil? && ((locations.keys - time_data[:item][:workshops].keys) | (time_data[:item][:workshops].keys - locations.keys)).length > 0
# data[:locations]
# xxx
@schedule[day][division][:locations] = locations.deep_dup
@schedule[day][division][:locations][0] = :add if do_analyze || locations.empty?
locations = data[:locations].select { |id, l| time_data[:item][:workshops][id].present? }

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

@ -9,17 +9,17 @@
- @schedule.each do |day, data_array|
%h4=date(day, :weekday).html_safe
- data_array.each_with_index do |data, division|
%table.schedule{class: [data[:locations].present? ? 'has-locations' : 'no-locations', "locations-#{data[:num_locations]}"]}
%table.schedule{class: [data[:locations].present? ? "has-locations locations-#{data[:locations].length}" : 'no-locations']}
- if data[:locations].present? && data[:locations].values.first != :add
%thead
%tr
%th.corner
- data[:locations].each do |id, location|
%th=location.is_a?(Symbol) ? '' : _!(location.title)
%th.location-header=location.is_a?(Symbol) ? '' : location_link(location)
%tbody
- data[:times].each do |time, time_data|
%tr{class: "row-type-#{time_data[:type] || 'nil'}"}
- rowspan = (time_data[:length] * (1 / @this_conference.schedule_interval)).to_i
- rowspan = (time_data[:length] * (1 / conference.schedule_interval)).to_i
%th=time(time).html_safe
- if time_data[:type] == :workshop
- data[:locations].each do |id, location|
@ -84,6 +84,6 @@
= richtext time_data[:item][:info], 1
- if @entire_page
#workshop-selector
= form_tag administration_update_path(@this_conference.slug, @admin_step), class: 'workshop-dlg', id: 'workshop-table-form' do
= form_tag administration_update_path(conference.slug, @admin_step), class: 'workshop-dlg', id: 'workshop-table-form' do
%h3 Select a Workshop
#table

Loading…
Cancel
Save