Fixed workshop times and schedule
This commit is contained in:
parent
89af3c5aae
commit
572e0d6644
@ -1149,13 +1149,25 @@ class ConferenceAdministrationController < ApplicationController
|
|||||||
def admin_update_workshop_times
|
def admin_update_workshop_times
|
||||||
case params[:button]
|
case params[:button]
|
||||||
when 'save_block'
|
when 'save_block'
|
||||||
|
empty_param = empty_params(:time, :time_span, :days)
|
||||||
|
if empty_param.present?
|
||||||
|
set_error_message "save_block_#{empty_param}_required".to_sym
|
||||||
|
else
|
||||||
|
@this_conference.workshop_blocks ||= []
|
||||||
|
@this_conference.workshop_blocks[params[:workshop_block].to_i] = {
|
||||||
|
'time' => params[:time],
|
||||||
|
'length' => params[:time_span],
|
||||||
|
'days' => params[:days].keys
|
||||||
|
}
|
||||||
|
@this_conference.save
|
||||||
|
set_success_message :block_saved
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
when 'delete_block'
|
||||||
@this_conference.workshop_blocks ||= []
|
@this_conference.workshop_blocks ||= []
|
||||||
@this_conference.workshop_blocks[params[:workshop_block].to_i] = {
|
@this_conference.workshop_blocks.delete_at(params[:workshop_block].to_i)
|
||||||
'time' => params[:time],
|
|
||||||
'length' => params[:time_span],
|
|
||||||
'days' => params[:days].keys
|
|
||||||
}
|
|
||||||
@this_conference.save
|
@this_conference.save
|
||||||
|
set_success_message :block_deleted
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1163,6 +1175,19 @@ class ConferenceAdministrationController < ApplicationController
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def admin_update_publish_schedule
|
||||||
|
case params[:button]
|
||||||
|
when 'publish'
|
||||||
|
@this_conference.workshop_schedule_published = !@this_conference.workshop_schedule_published
|
||||||
|
@this_conference.save
|
||||||
|
set_success_message "schedule_#{@this_conference.workshop_schedule_published ? '' : 'un'}published".to_sym
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
do_404
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
def admin_update_schedule
|
def admin_update_schedule
|
||||||
case params[:button]
|
case params[:button]
|
||||||
when 'deschedule_workshop'
|
when 'deschedule_workshop'
|
||||||
@ -1207,18 +1232,6 @@ class ConferenceAdministrationController < ApplicationController
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def admin_update_schedule
|
|
||||||
case params[:button]
|
|
||||||
when 'publish'
|
|
||||||
@this_conference.workshop_schedule_published = !@this_conference.workshop_schedule_published
|
|
||||||
@this_conference.save
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
do_404
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
def admin_update_providers
|
def admin_update_providers
|
||||||
case params[:button]
|
case params[:button]
|
||||||
when 'save_distance'
|
when 'save_distance'
|
||||||
@ -1243,4 +1256,8 @@ class ConferenceAdministrationController < ApplicationController
|
|||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def empty_params(*args)
|
||||||
|
get_empty(params, args)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,85 +1,86 @@
|
|||||||
= columns(medium: 12) do
|
= row do
|
||||||
- conference = @this_conference || @conference
|
= columns(medium: 12) do
|
||||||
- if conference.event_locations.blank? && @entire_page
|
- conference = @this_conference || @conference
|
||||||
.warning-info=_'articles.admin.schedule.no_locations_warning'
|
- if conference.event_locations.blank? && @entire_page
|
||||||
- else
|
.warning-info=_'articles.admin.schedule.no_locations_warning'
|
||||||
- add_inline_script :schedule if @entire_page
|
- else
|
||||||
#schedule-preview
|
- add_inline_script :schedule if @entire_page
|
||||||
- @schedule.each do | day, data |
|
#schedule-preview
|
||||||
%h4=date(day, :weekday)
|
- @schedule.each do | day, data |
|
||||||
%table.schedule{class: [data[:locations].present? ? 'has-locations' : 'no-locations', "locations-#{data[:num_locations]}"]}
|
%h4=date(day, :weekday)
|
||||||
- if data[:locations].present? && data[:locations].values.first != :add
|
%table.schedule{class: [data[:locations].present? ? 'has-locations' : 'no-locations', "locations-#{data[:num_locations]}"]}
|
||||||
%thead
|
- if data[:locations].present? && data[:locations].values.first != :add
|
||||||
%tr
|
%thead
|
||||||
%th.corner
|
%tr
|
||||||
- data[:locations].each do | id, location |
|
%th.corner
|
||||||
%th=location.is_a?(Symbol) ? '' : location.title
|
|
||||||
%tbody
|
|
||||||
- data[:times].each do | time, time_data |
|
|
||||||
%tr
|
|
||||||
- rowspan = (time_data[:length] * 2).to_i
|
|
||||||
%th=time(time)
|
|
||||||
- if time_data[:type] == :workshop
|
|
||||||
- data[:locations].each do | id, location |
|
- data[:locations].each do | id, location |
|
||||||
- if time_data[:item][:workshops][id].present?
|
%th=location.is_a?(Symbol) ? '' : location.title
|
||||||
- workshop = time_data[:item][:workshops][id][:workshop]
|
%tbody
|
||||||
- status = time_data[:item][:workshops][id][:status]
|
- data[:times].each do | time, time_data |
|
||||||
- else
|
%tr
|
||||||
- workshop = status = nil
|
- rowspan = (time_data[:length] * 2).to_i
|
||||||
%td{class: [time_data[:type], workshop.present? ? :filled : :open], rowspan: rowspan, data: workshop.present? ? nil : { block: time_data[:item][:block], day: day, location: id }}
|
%th=time(time)
|
||||||
- if workshop.present? && workshop.event_location.present?
|
- if time_data[:type] == :workshop
|
||||||
= link_to view_workshop_path(@conference.slug, workshop.id), class: 'event-detail-link' do
|
- data[:locations].each do | id, location |
|
||||||
.details
|
- if time_data[:item][:workshops][id].present?
|
||||||
.title=workshop.title
|
- workshop = time_data[:item][:workshops][id][:workshop]
|
||||||
%template.event-details{data: { href: view_workshop_path(@conference.slug, workshop.id) }}
|
- status = time_data[:item][:workshops][id][:status]
|
||||||
%h1.title=workshop.title
|
- else
|
||||||
%p.address
|
- workshop = status = nil
|
||||||
= workshop.event_location.title + _!(': ')
|
%td{class: [time_data[:type], workshop.present? ? :filled : :open], rowspan: rowspan, data: workshop.present? ? nil : { block: time_data[:item][:block], day: day, location: id }}
|
||||||
= location_link workshop.event_location
|
- if workshop.present? && workshop.event_location.present?
|
||||||
.workshop-description= richtext workshop.info, 1
|
= link_to view_workshop_path(@conference.slug, workshop.id), class: 'event-detail-link' do
|
||||||
- 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}"
|
|
||||||
- if status[:errors].present?
|
|
||||||
.errors
|
|
||||||
- status[:errors].each do | error |
|
|
||||||
.error=_"errors.messages.schedule.#{error[:name].to_s}", vars: error[:i18nVars]
|
|
||||||
= hidden_field_tag :id, workshop.id
|
|
||||||
= button_tag :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
|
.details
|
||||||
.title= time_data[:item]['title']
|
.title=workshop.title
|
||||||
.location= location.title
|
%template.event-details{data: { href: view_workshop_path(@conference.slug, workshop.id) }}
|
||||||
%template.event-details
|
%h1.title=workshop.title
|
||||||
%h1.title=time_data[:item]['title']
|
|
||||||
%p.address
|
%p.address
|
||||||
= location.title + _!(': ')
|
= workshop.event_location.title + _!(': ')
|
||||||
= location_link location
|
= location_link workshop.event_location
|
||||||
- when :event
|
.workshop-description= richtext workshop.info, 1
|
||||||
- if time_data[:item].event_location.present?
|
- if @can_edit
|
||||||
%a.event-detail-link
|
= form_tag administration_update_path(conference.slug, @admin_step), class: 'deschedule-workshop' do
|
||||||
.details
|
.status
|
||||||
.title= time_data[:item][:title]
|
.conflict-score
|
||||||
.location= time_data[:item].event_location.title
|
%span.title Conflicts:
|
||||||
%template.event-details
|
%span.value="#{status[:conflict_score]} / #{workshop.interested.size}"
|
||||||
%h1.title=time_data[:item][:title]
|
- if status[:errors].present?
|
||||||
%p.address
|
.errors
|
||||||
= time_data[:item].event_location.title + _!(': ')
|
- status[:errors].each do | error |
|
||||||
= location_link time_data[:item].event_location
|
.error=_"errors.messages.schedule.#{error[:name].to_s}", vars: error[:i18nVars]
|
||||||
= richtext time_data[:item][:info], 1
|
= hidden_field_tag :id, workshop.id
|
||||||
- if @entire_page
|
= button_tag :deschedule, value: :deschedule_workshop, class: [:delete, :small]
|
||||||
#workshop-selector
|
- elsif @can_edit
|
||||||
= form_tag administration_update_path(@this_conference.slug, @admin_step), class: 'workshop-dlg', id: 'workshop-table-form' do
|
.title="Block #{time_data[:item][:block] + 1}"
|
||||||
%h3 Select a Workshop
|
- elsif time_data[:type] != :nil
|
||||||
#table
|
%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]
|
||||||
|
.location= time_data[:item].event_location.title
|
||||||
|
%template.event-details
|
||||||
|
%h1.title=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
|
||||||
|
%h3 Select a Workshop
|
||||||
|
#table
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
- if conference.workshop_schedule_published
|
- if conference.workshop_schedule_published
|
||||||
- add_inline_script :home_schedule
|
- add_inline_script :home_schedule
|
||||||
%h3=_'articles.workshops.headings.Schedule'
|
%h3=_'articles.workshops.headings.Schedule'
|
||||||
= render 'conferences/admin/schedule'
|
= render 'conference_administration/schedule'
|
||||||
- else
|
- else
|
||||||
%h3=_'articles.workshops.headings.Proposed_Workshops'
|
%h3=_'articles.workshops.headings.Proposed_Workshops'
|
||||||
%p=_'articles.workshops.paragraphs.Proposed_Workshops'
|
%p=_'articles.workshops.paragraphs.Proposed_Workshops'
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
= @this_conference.poster.full.url || image_path('default_poster.jpg')
|
= @this_conference.poster.full.url || image_path('default_poster.jpg')
|
||||||
- content_for :title do
|
- content_for :title do
|
||||||
=@this_conference.title
|
=@this_conference.title
|
||||||
= render 'conferences/conference', conference: @this_conference, links: @links
|
= render 'conferences/conference', conference: @this_conference, links: @links, sections: [:info, :workshops]
|
||||||
|
@ -202,6 +202,9 @@ en:
|
|||||||
error_removing_org_member: Error removing user from organization
|
error_removing_org_member: Error removing user from organization
|
||||||
error_adding_administrator: Error adding administrator
|
error_adding_administrator: Error adding administrator
|
||||||
error_removing_administrator: Error removing administrator
|
error_removing_administrator: Error removing administrator
|
||||||
|
save_block_time_required: Time is required
|
||||||
|
save_block_time_span_required: Length is required
|
||||||
|
save_block_days_required: Please select at least one day
|
||||||
template:
|
template:
|
||||||
body: 'There were problems with the following fields:'
|
body: 'There were problems with the following fields:'
|
||||||
header:
|
header:
|
||||||
@ -244,6 +247,10 @@ en:
|
|||||||
administrator_added: Administrator added to conference
|
administrator_added: Administrator added to conference
|
||||||
administrator_removed: Administrator removed from conference
|
administrator_removed: Administrator removed from conference
|
||||||
distance_saved: Provider options updated
|
distance_saved: Provider options updated
|
||||||
|
block_saved: Workshop time has been saved
|
||||||
|
block_deleted: Workshop time has been deleted
|
||||||
|
schedule_published: Your schedule has been published and should be visible on your conference page
|
||||||
|
schedule_unpublished: Your schedule has been un-published and should no longer be visible to users
|
||||||
helpers:
|
helpers:
|
||||||
select:
|
select:
|
||||||
prompt: Please select
|
prompt: Please select
|
||||||
|
Loading…
x
Reference in New Issue
Block a user