Browse Source

Fixed workshop times and schedule

development
Godwin 8 years ago
parent
commit
572e0d6644
  1. 41
      app/controllers/conference_administration_controller.rb
  2. 3
      app/views/conference_administration/_schedule.html.haml
  3. 2
      app/views/conferences/_conference.html.haml
  4. 2
      app/views/conferences/view.html.haml
  5. 7
      config/locales/en.yml

41
app/controllers/conference_administration_controller.rb

@ -1149,6 +1149,10 @@ 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 ||= []
@this_conference.workshop_blocks[params[:workshop_block].to_i] = { @this_conference.workshop_blocks[params[:workshop_block].to_i] = {
'time' => params[:time], 'time' => params[:time],
@ -1156,6 +1160,14 @@ class ConferenceAdministrationController < ApplicationController
'days' => params[:days].keys 'days' => params[:days].keys
} }
@this_conference.save @this_conference.save
set_success_message :block_saved
end
return false
when 'delete_block'
@this_conference.workshop_blocks ||= []
@this_conference.workshop_blocks.delete_at(params[:workshop_block].to_i)
@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

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

@ -1,4 +1,5 @@
= columns(medium: 12) do = row do
= columns(medium: 12) do
- conference = @this_conference || @conference - conference = @this_conference || @conference
- if conference.event_locations.blank? && @entire_page - if conference.event_locations.blank? && @entire_page
.warning-info=_'articles.admin.schedule.no_locations_warning' .warning-info=_'articles.admin.schedule.no_locations_warning'

2
app/views/conferences/_conference.html.haml

@ -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
app/views/conferences/view.html.haml

@ -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]

7
config/locales/en.yml

@ -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…
Cancel
Save