Schedule divisions and workshops table

This commit is contained in:
Godwin
2017-08-20 16:04:39 -07:00
parent c1f9b5db82
commit ad3136a5cb
13 changed files with 614 additions and 280 deletions
@@ -35,7 +35,7 @@
= day_select @day, small: true, format: :weekday
= hour_select @time, small: true
= length_select @length, small: true
= translate_fields @event, { title: { type: :textfield, big: true, label: 'forms.labels.generic.title' }, info: { type: :textarea, label: 'forms.labels.generic.info', edit_on: :focus } }
= translate_fields @event, { title: { type: :textfield, big: true }, info: { type: :textarea, label: 'forms.labels.generic.info', edit_on: :focus } }
.actions.next-prev
= button :save, value: :save
= button :cancel, value: :cancel, class: :subdued, formnovalidate: true if @event.id.present?
@@ -6,81 +6,82 @@
- else
- add_inline_script :schedule if @entire_page
#schedule-preview
- @schedule.each do |day, data|
- @schedule.each do |day, data_array|
%h4=date(day, :weekday).html_safe
%table.schedule{class: [data[:locations].present? ? 'has-locations' : 'no-locations', "locations-#{data[:num_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)
%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
%th=time(time).html_safe
- if time_data[:type] == :workshop
- data_array.each_with_index do |data, division|
%table.schedule{class: [data[:locations].present? ? 'has-locations' : 'no-locations', "locations-#{data[:num_locations]}"]}
- if data[:locations].present? && data[:locations].values.first != :add
%thead
%tr
%th.corner
- data[:locations].each do |id, location|
- if time_data[:item][:workshops][id].present?
- workshop = time_data[:item][:workshops][id][:workshop]
- status = time_data[:item][:workshops][id][:status]
- else
- workshop = status = nil
%td{class: [time_data[:type], workshop.present? ? :filled : :open], rowspan: rowspan, data: workshop.present? ? nil : { block: time_data[:item][:block], day: day, location: id }}
- if workshop.present? && workshop.event_location.present?
.workshop-container
- if @can_edit
-if strip_tags(workshop.notes).strip.present?
= admin_notes(workshop.notes)
- if status[:errors].present?
= admin_status content_tag(:ul, (status[:errors].collect { |error| (_"errors.messages.schedule.#{error[:name].to_s}", vars: error[:i18nVars])}.join).html_safe).html_safe
= link_to view_workshop_path(@conference.slug, workshop.id), class: 'event-detail-link' do
.details
.title=_!workshop.title
%template.event-details{data: { href: view_workshop_path(@conference.slug, workshop.id) }}
%h1.title=_!workshop.title
%p.address
= _!("#{workshop.event_location.title}:")
= location_link workshop.event_location
.workshop-description= richtext workshop.info, 1
- if @can_edit
= form_tag administration_update_path(conference.slug, @admin_step), class: 'deschedule-workshop' do
.status
.conflict-score
%span.title Conflicts:
%span.value="#{status[:conflict_score]} / #{workshop.interested.size}"
= hidden_field_tag :id, workshop.id
= button :deschedule, value: :deschedule_workshop, class: [:delete, :small]
- elsif @can_edit
.title="Block #{time_data[:item][:block] + 1}"
- elsif time_data[:type] != :nil
%td{class: time_data[:type], rowspan: rowspan, colspan: data[:locations].present? ? data[:locations].size : 1}
- case time_data[:type]
- when :meal
- location = EventLocation.where(id: time_data[:item]['location'].to_i).first
- if location.present?
%a.event-detail-link
.details
.title=_!(time_data[:item]['title'])
.location=_!location.title
%template.event-details
%h1.title=_!(time_data[:item]['title'])
%p.address
= _!("#{location.title}:")
= location_link location
- when :event
- if time_data[:item].event_location.present?
%a.event-detail-link
.details
.title=_!(time_data[:item][:title]) if time_data[:item][:title]
.location=_!(time_data[:item].event_location.title)
%template.event-details
%h1.title=_!(time_data[:item][:title]) if time_data[:item][:title]
%p.address
= _!("#{time_data[:item].event_location.title}:")
= location_link time_data[:item].event_location
= richtext time_data[:item][:info], 1
%th=location.is_a?(Symbol) ? '' : _!(location.title)
%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
%th=time(time).html_safe
- if time_data[:type] == :workshop
- data[:locations].each do |id, location|
- if time_data[:item][:workshops][id].present?
- workshop = time_data[:item][:workshops][id][:workshop]
- status = time_data[:item][:workshops][id][:status]
- else
- workshop = status = nil
%td{class: [time_data[:type], workshop.present? ? :filled : :open], rowspan: rowspan, data: workshop.present? ? nil : { block: time_data[:item][:block], day: day, location: id, division: division }}
- if workshop.present? && workshop.event_location.present?
.workshop-container
- if @can_edit
-if strip_tags(workshop.notes).strip.present?
= admin_notes(workshop.notes)
- if status[:errors].present?
= admin_status content_tag(:ul, (status[:errors].collect { |error| "<li>#{(_"errors.messages.schedule.#{error[:name].to_s}", vars: error[:i18nVars])}</li>"}.join).html_safe).html_safe
= link_to view_workshop_path(@conference.slug, workshop.id), class: 'event-detail-link' do
.details
.title=_!workshop.title
%template.event-details{data: { href: view_workshop_path(@conference.slug, workshop.id) }}
%h1.title=_!workshop.title
%p.address
= _!("#{workshop.event_location.title}:")
= location_link workshop.event_location
.workshop-description= richtext workshop.info, 1
- if @can_edit
= form_tag administration_update_path(conference.slug, @admin_step), class: 'deschedule-workshop' do
.status
.conflict-score
%span.title Conflicts:
%span.value="#{status[:conflict_score]} / #{workshop.interested.size}"
= hidden_field_tag :id, workshop.id
= button :deschedule, value: :deschedule_workshop, class: [:delete, :small]
- elsif @can_edit
.title="Block #{time_data[:item][:block] + 1}"
- elsif time_data[:type] != :nil
%td{class: time_data[:type], rowspan: rowspan, colspan: data[:locations].present? ? data[:locations].size : 1}
- case time_data[:type]
- when :meal
- location = EventLocation.where(id: time_data[:item]['location'].to_i).first
- if location.present?
%a.event-detail-link
.details
.title=_!(time_data[:item]['title'])
.location=_!location.title
%template.event-details
%h1.title=_!(time_data[:item]['title'])
%p.address
= _!("#{location.title}:")
= location_link location
- when :event
- if time_data[:item].event_location.present?
%a.event-detail-link
.details
.title=_!(time_data[:item][:title]) if time_data[:item][:title]
.location=_!(time_data[:item].event_location.title)
%template.event-details
%h1.title=_!(time_data[:item][:title]) if time_data[:item][:title]
%p.address
= _!("#{time_data[:item].event_location.title}:")
= location_link time_data[:item].event_location
= 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
@@ -5,7 +5,7 @@
= @event_location.title
= hidden_field_tag :event_location, @location
- else
= location_select(nil, inline_label: true, small: true, invalid_locations: (((((@schedule[@day] || {})[:times] || {})[@time] || {})[:item] || {})[:workshops] || {}).keys, label: false)
= location_select(nil, inline_label: true, small: true, invalid_locations: @invalid_locations, label: false)
- if @event_location.present?
.host-field
%h4.inline=_'articles.admin.locations.headings.amenities'
@@ -38,7 +38,7 @@
%td=(workshop.active_facilitators.map { |x| x.named_email }).join(', ')
%td=workshop.interested_count
%td
.text=workshop.notes
.text=strip_tags(workshop.notes)
.legend
%h4 Legend
@@ -0,0 +1,12 @@
- add_inline_script :registrations
= columns(medium: 12) do
.goes-fullscreen#registrations-table
.flex-column
= searchfield :search, nil, big: true, stretch: true
%a.button{data: { expands: 'registrations-table' }}='expand'
%a.button.delete{data: { contracts: 'registrations-table' }}='close'
.table-scroller#registrations
= html_table(@excel_data, workshops_table_options)
= columns(medium: 12) do
.actions.center
= link_to (_'links.download.Excel'), administration_step_path(@this_conference.slug, :workshops, format: :xlsx), class: [:button, :download]