Schedules!

This commit is contained in:
Godwin
2015-09-26 20:05:55 -07:00
parent 34e72144cc
commit bc80c09938
82 changed files with 1669 additions and 268 deletions
+16 -12
View File
@@ -4,16 +4,20 @@
%article
%h2=_!@conference.title
=@conference.info.html_safe
%h3=_'articles.workshops.headings.Proposed_Workshops'
%p=_'articles.workshops.paragraphs.Proposed_Workshops', "Would you like to facilitate your own workshop? Simply register and visit the workshops page. If you have already registered you can access the page by restarting the registration process."
- if @conference.workshops
%ul.workshop-list
- @conference.workshops.sort_by{|w| w.title}.each do |w|
%li
%h4=w.title
.workshop-interest
- if w.interested?(current_user)
=_'articles.workshops.info.you_are_interested_count', "You and #{w.interested_count - 1} others are interested in this workshop", :vars => {:count => (w.interested_count - 1)}
- elsif w.interested_count > 0
=_'articles.workshops.info.interested_count', "#{w.interested_count} people are interested in this workshop", :vars => {:count => w.interested_count}
.workshop-description=markdown w.info
- if @schedule
%h3=_'articles.workshops.headings.Schedule'
= render 'schedule/programme', :schedule => @schedule, :conference => @conference, :workshops => @workshops, :events => @events, :locations => @locations, :show_interest => true, :day_parts => @day_parts, :show_previews => true
- else
%h3=_'articles.workshops.headings.Proposed_Workshops'
%p=_'articles.workshops.paragraphs.Proposed_Workshops', "Would you like to facilitate your own workshop? Simply register and visit the workshops page. If you have already registered you can access the page by restarting the registration process."
%ul.workshop-list
- @conference.workshops.sort_by{|w| w.title}.each do |w|
%li
%h4=w.title
.workshop-interest
- if w.interested?(current_user)
=_'articles.workshops.info.you_are_interested_count', "You and #{w.interested_count - 1} others are interested in this workshop", :vars => {:count => (w.interested_count - 1)}
- elsif w.interested_count > 0
=_'articles.workshops.info.interested_count', "#{w.interested_count} people are interested in this workshop", :vars => {:count => w.interested_count}
.workshop-description=markdown w.info
+23
View File
@@ -0,0 +1,23 @@
= render 'conferences/page_header', :page_key => (@location ? 'Edit_Location' : 'New_Location')
%article
= form_tag save_location_path(@this_conference.slug), class: 'composition' do
= row do
= columns(medium: 12) do
= (hidden_field_tag :location_id, @location.id) if @location
.text-field.input-field.big
= label_tag :title
= text_field_tag :title, @location ? @location.title : nil, :required => true
= row do
= columns(medium: 6) do
.text-area-field.input-field
= label_tag :address
= text_area_tag :address, @location ? @location.address : nil, :required => true
= columns(medium: 6) do
%h3=_'articles.locations.headings.amenities'
- [:sound, :projector, :tools].each do |need|
.single-check-box-field.input-field
= label_tag "needs_#{need}" do
= check_box_tag "needs[#{need}]", 1, @location && @amenities.include?(need)
= _"workshop.options.needs.#{need}"
.actions
= button_tag :save, :value => :save
+22 -7
View File
@@ -1,7 +1,22 @@
%h1 Editing event
= render 'form'
= link_to 'Show', @event
\|
= link_to 'Back', events_path
= render 'conferences/page_header', :page_key => (@event ? 'Edit_Event' : 'New_Event')
%article
= form_tag save_event_path(@this_conference.slug), class: 'composition' do
= row do
= columns(medium: 9) do
= (hidden_field_tag :event_id, @event.id) if @event
.text-field.input-field.big
= label_tag :title
= text_field_tag :title, @event ? @event.title : nil, :required => true
= columns(medium: 3) do
.select-field.input-field
= label_tag :event_type do
= select_tag :event_type, options_for_select([:event, :meal], @event ? @event.event_type : nil), :include_blank => true
=_'forms.labels.generic.event_type'
= row do
= columns(medium: 12) do
.text-area-field.input-field
= label_tag :info
= text_area_tag :info, @event ? @event.info : nil, :required => true
= columns(medium: 12) do
.actions.right
= button_tag :save, :value => :save
+36
View File
@@ -0,0 +1,36 @@
.programme
- schedule.each do |day, day_schedule|
.programme-day
%h2=I18n.l(conference.start_date + (day - 1).days, :format => "%A")
- (0...day_parts.length).each do |day_part|
.programme-day-part
- times = schedule_start_and_end_times(day_part, day_parts, day_schedule)
- if times.present?
%h3=_"articles.headings.schedule.day_parts.#{day_parts.keys[day_part].to_s}" if day_parts.length > 1
%table.schedule
%tr
%th
- (times.first...times.last).step(0.5).each do |t|
- t = t.to_i if t == t.to_i
%th=I18n.l(Date.today + t.hours, :format => :short)
- day_schedule[:locations].each do |location, location_schedule|
%tr
%th=locations[location.to_s].title
- skip = 0
- (times.first...times.last).step(0.5).each do |t|
- t = t.to_i if t == t.to_i
- if location_schedule[t].present?
- workshop = location_schedule[t]
- w = get_workshop(workshop, workshops, events)
%td{:class => workshop_classes(w, show_interest) + [show_previews && workshop[:type] == :workshop ? 'previewable' : nil], :colspan => (workshop[:span] * 2), :id => "workshop-#{w.id}"}
.title= w.title
- if show_previews && workshop[:type] == :workshop
.info
%a.close{href: "#!"}
= render 'workshops/show', :workshop => w, :preview => true
%a{class: 'preview', href: "#workshop-#{w.id}"}
- skip = workshop[:span] - 0.5
- elsif skip > 0
- skip -= 0.5
- else
%td.empty
+77
View File
@@ -0,0 +1,77 @@
= render 'conferences/page_header', :page_key => 'Edit_Schedule'
%article
= form_tag save_schedule_path(@this_conference.slug), class: 'composition' do
= row do
= columns(medium: 12) do
= render 'schedule/programme', :schedule => @schedule, :conference => @this_conference, :workshops => @workshops, :events => @events, :locations => @location_hash, :show_interest => false, :day_parts => @day_parts, :show_previews => false
= row do
= columns(medium: 12) do
- if @error_count && @error_count > 0
%h3.errors
=_'errors.schedule.errors',"Errors:"
= @error_count
- if @conflict_score && @conflict_score > 0
%h3.conflict-score
=_'errors.schedule.conflict_score',"Interest Conflicts:"
= @conflict_score
= row do
= columns(medium: 12) do
= (hidden_field_tag :location_id, @location.id) if @location
.actions
- if @this_conference.workshop_schedule_published
= button_tag :Unpublish, :value => :unpublish, :class => 'delete'
- elsif @error_count < 1
= button_tag :Publish, :value => :publish
= button_tag :Preview, :value => :preview, :class => 'secondary'
- unless @this_conference.workshop_schedule_published && @error_count > 0
= button_tag :save, :value => :save
- unless @saved
.unsaved=_'errors.schedule.unsaved','Your changes will not be saved until you press Save or Publish'
= row do
= columns(medium: 6) do
%h2=_"articles.headings.schedule.day_parts.Workshops"
%ul.all-workshops
- @workshops.each do |i|
- error = @errors["w#{i.id}"]
- warnings = @warnings["w#{i.id}"]
%li{class: error.present? ? :error : nil}
%h3=i.title
.workshop-interest=_'articles.workshops.info.interested_count', "#{i.interested_count} people are interested in this workshop", :vars => {:count => i.interested_count}
.time
= select_tag "workshop_day[#{i.id}]", options_for_select(@days, i.conference_day), :include_blank => true
= select_tag "workshop_hour[#{i.id}]", options_for_select(@hours, i.start_time ? i.start_time.strftime('%R') : nil), :include_blank => true
= select_tag "workshop_duration[#{i.id}]", options_for_select(@workshop_durations, i.duration || 60)
.location
= select_tag "workshop_location[#{i.id}]", options_from_collection_for_select(@locations, :id, :title, i.event_location_id), :include_blank => true
- if warnings
%ul.warnings
- warnings.each do |warning|
%li=warning
- if error
.error-description=error
= columns(medium: 6) do
%h2=_"articles.headings.schedule.day_parts.Events"
%ul.all-events
- @events.each do |i|
- error = @errors["e#{i.id}"]
%li{:class => [i.event_type, error.present? ? :error : nil]}
%h3=i.title
.time
= select_tag "event_day[#{i.id}]", options_for_select(@days, i.conference_day)
= select_tag "event_hour[#{i.id}]", options_for_select(@hours, i.start_time ? i.start_time.strftime('%R') : '12:00')
= select_tag "event_duration[#{i.id}]", options_for_select(@event_durations, i.duration || 60)
.location
= select_tag "event_location[#{i.id}]", options_from_collection_for_select(@locations, :id, :title, i.event_location_id), :include_blank => true
- if error
.error-description=error
%h2=_"articles.headings.schedule.day_parts.Day_Parts"
%ul.day_parts
- [:morning, :afternoon, :evening].each do |day_part|
%li
%h4
=_"articles.headings.schedule.day_parts.#{day_part.to_s}"
- h = (Date.today + @day_parts[day_part.to_s].to_f.hours).strftime('%R')
- if day_part == :morning
.select=h
- else
= select_tag "day_parts[#{day_part.to_s}]", options_for_select(@hours, h)
+28
View File
@@ -0,0 +1,28 @@
= render 'conferences/page_header', :page_key => 'Schedule'
%article
- if @this_conference.host?(current_user)
= row do
= columns(medium: 12) do
.actions.left
= link_to (_'actions.schedule.edit','Edit Schedule'), edit_schedule_path(@this_conference.slug), class: [:button]
= row do
= columns(medium: 6) do
%h2=_'articles.schedule.headings.Events'
- if @events
%ul
- @events.each do |event|
%li
%h3=_!event.title
= link_to (_'actions.events.edit','Edit'), edit_event_path(@this_conference.slug, event.id), class: [:button, :modify]
.actions.left
= link_to (_'actions.events.create','Add Event'), add_event_path(@this_conference.slug), class: [:button, :modify]
= columns(medium: 6) do
%h2=_'articles.schedule.headings.Locations'
- if @locations
%ul
- @locations.each do |location|
%li
%h3=_!location.title
= link_to (_'actions.locations.edit','Edit'), edit_location_path(@this_conference.slug, location.id), class: [:button, :modify]
.actions.left
= link_to (_'actions.schedule.edit','Add Location'), add_location_path(@this_conference.slug), class: [:button, :modify]
+58
View File
@@ -0,0 +1,58 @@
= row do
= columns(medium: 12) do
%h2=_!workshop.title
.workshop-interest
- if workshop.interested?(current_user)
=_'articles.workshops.info.you_are_interested_count', "You and #{workshop.interested_count - 1} others are interested in this workshop", :vars => {:count => (workshop.interested_count - 1)}
- else
=_'articles.workshops.info.interested_count', "#{workshop.interested_count} people are interested in this workshop", :vars => {:count => workshop.interested_count}
- if !preview && workshop.can_show_interest?(current_user)
= form_tag toggle_workshop_interest_path(workshop.conference.slug, workshop.id) do
= button_tag (workshop.interested?(current_user) ? :remove_interest : :show_interest), :value => :toggle_interest, :class => (workshop.interested?(current_user) ? 'delete' : 'add')
=markdown _!(workshop.info) || ''
- if !preview && logged_in? && current_user.can_translate?
.actions
- I18n.backend.enabled_locales.each do |locale|
= (link_to (_'actions.workshops.Translate', "Translate into #{language_name(locale)}", :vars => {:language => language_name(locale)}), edit_workshop_url(workshop.conference.slug, workshop.id, url_params(locale)), :class => 'button translate') if workshop.can_translate?(current_user, locale)
= columns(medium: 6) do
%h3=_'articles.workshops.headings.facilitators'
.facilitators
- workshop.workshop_facilitators.each do |f|
- u = User.find(f.user_id)
- if logged_in? && (workshop.public_facilitator?(u) || f.user_id == current_user.id || workshop.active_facilitator?(current_user))
.facilitator
.name=_!(u.firstname || u.username || u.email)
.role
=_"roles.workshops.facilitator.#{workshop.role(u).to_s}"
- if !preview && f.role.to_sym == :requested && workshop.active_facilitator?(current_user)
=(link_to (_'actions.workshops.Approve'), approve_facilitate_workshop_request_path(workshop.conference.slug, workshop.id, f.user_id, 'approve'), :class => 'button modify')
=(link_to (_'actions.workshops.Deny'), approve_facilitate_workshop_request_path(workshop.conference.slug, workshop.id, f.user_id, 'deny'), :class => 'button delete')
- elsif !preview && (f.user_id == current_user.id && f.role.to_sym != :creator) || (!workshop.conference.registered?(u) && workshop.active_facilitator?(current_user))
=(link_to (_'actions.workshops.Remove'), approve_facilitate_workshop_request_path(workshop.conference.slug, workshop.id, f.user_id, 'remove'), :class => 'button delete')
- if !preview
.actions
=(link_to (_'actions.workshops.Facilitate'), facilitate_workshop_path(workshop.conference.slug, workshop.id), :class => 'button modify') if !workshop.facilitator?(current_user)
- if workshop.active_facilitator?(current_user)
= form_tag workshop_add_facilitator_path(workshop.conference.slug, workshop.id), :class => 'add-facilitator' do
%h4='Add a facilitator'
.email-field.input-field
= email_field_tag :email, nil, required: true
= label_tag :email
= button_tag :add
- if workshop.languages
= columns(medium: 6) do
%h3=_'articles.workshops.headings.languages','Workshop Language'
%p= _!((JSON.parse(workshop.languages || '[]').map { |x| _"languages.#{x}" }).join(', ').to_s.html_safe)
- if workshop.theme
= columns(medium: 6) do
%h3=_'articles.workshops.headings.theme','Theme'
%p= [:race_gender, :mechanics, :funding, :organization, :community].include?((workshop.theme || '').to_sym) ? (_"workshop.options.theme.#{workshop.theme}") : workshop.theme
- if workshop.active_facilitator?(current_user) || workshop.conference.host?(current_user)
- if workshop.needs
= columns(medium: 6) do
%h3=_'articles.workshops.headings.needs','What do you need?'
%p= _!((JSON.parse(workshop.needs || '[]').map { |x| _"workshop.options.needs.#{x}" }).join(', ').to_s.html_safe)
- if workshop.notes
= columns(medium: 12) do
%h3=_'articles.workshops.headings.notes','Notes'
=markdown _!(workshop.notes)
+1 -56
View File
@@ -1,62 +1,7 @@
= render 'conferences/page_header', :page_key => 'View_Workshop'
%article
= render 'workshops/show', :workshop => @workshop, :preview => false
= row do
= columns(medium: 12) do
%h2=_!@workshop.title
.workshop-interest
- if @workshop.interested?(current_user)
=_'articles.workshops.info.you_are_interested_count', "You and #{@workshop.interested_count - 1} others are interested in this workshop", :vars => {:count => (@workshop.interested_count - 1)}
- else
=_'articles.workshops.info.interested_count', "#{@workshop.interested_count} people are interested in this workshop", :vars => {:count => @workshop.interested_count}
- if @workshop.can_show_interest?(current_user)
= form_tag toggle_workshop_interest_path(@this_conference.slug, @workshop.id) do
= button_tag (@workshop.interested?(current_user) ? :remove_interest : :show_interest), :value => :toggle_interest, :class => (@workshop.interested?(current_user) ? 'delete' : 'add')
=markdown _!(@workshop.info) || ''
- if current_user.can_translate?
.actions
- I18n.backend.enabled_locales.each do |locale|
= (link_to (_'actions.workshops.Translate', "Translate into #{language_name(locale)}", :vars => {:language => language_name(locale)}), edit_workshop_url(@this_conference.slug, @workshop.id, url_params(locale)), :class => 'button translate') if @workshop.can_translate?(current_user, locale)
= columns(medium: 6) do
%h3=_'articles.workshops.headings.facilitators'
.facilitators
- @workshop.workshop_facilitators.each do |f|
- u = User.find(f.user_id)
- if @workshop.public_facilitator?(u) || f.user_id == current_user.id || @workshop.active_facilitator?(current_user)
.facilitator
.name=_!(u.firstname || u.username || u.email)
.role
=_"roles.workshops.facilitator.#{@workshop.role(u).to_s}"
- if f.role.to_sym == :requested && @workshop.active_facilitator?(current_user)
=(link_to (_'actions.workshops.Approve'), approve_facilitate_workshop_request_path(@this_conference.slug, @workshop.id, f.user_id, 'approve'), :class => 'button modify')
=(link_to (_'actions.workshops.Deny'), approve_facilitate_workshop_request_path(@this_conference.slug, @workshop.id, f.user_id, 'deny'), :class => 'button delete')
- elsif (f.user_id == current_user.id && f.role.to_sym != :creator) || (!@this_conference.registered?(u) && @workshop.active_facilitator?(current_user))
=(link_to (_'actions.workshops.Remove'), approve_facilitate_workshop_request_path(@this_conference.slug, @workshop.id, f.user_id, 'remove'), :class => 'button delete')
.actions
=(link_to (_'actions.workshops.Facilitate'), facilitate_workshop_path(@this_conference.slug, @workshop.id), :class => 'button modify') if !@workshop.facilitator?(current_user)
- if @workshop.active_facilitator?(current_user)
= form_tag workshop_add_facilitator_path(@this_conference.slug, @workshop.id), :class => 'add-facilitator' do
%h4='Add a facilitator'
.email-field.input-field
= email_field_tag :email, nil, required: true
= label_tag :email
= button_tag :add
- if @workshop.languages
= columns(medium: 6) do
%h3=_'articles.workshops.headings.languages','Workshop Language'
%p= _!((JSON.parse(@workshop.languages || '[]').map { |x| _"languages.#{x}" }).join(', ').to_s.html_safe)
- if @workshop.theme
= columns(medium: 6) do
%h3=_'articles.workshops.headings.theme','Theme'
%p= [:race_gender, :mechanics, :funding, :organization, :community].include?((@workshop.theme || '').to_sym) ? (_"workshop.options.theme.#{@workshop.theme}") : @workshop.theme
- if @workshop.active_facilitator?(current_user) || @this_conference.host?(current_user)
- if @workshop.needs
= columns(medium: 6) do
%h3=_'articles.workshops.headings.needs','What do you need?'
%p= _!((JSON.parse(@workshop.needs || '[]').map { |x| _"workshop.options.needs.#{x}" }).join(', ').to_s.html_safe)
- if @workshop.notes
= columns(medium: 12) do
%h3=_'articles.workshops.headings.notes','Notes'
=markdown _!(@workshop.notes)
= columns(medium: 12) do
.actions.right
= (link_to (_'actions.workshops.Edit'), edit_workshop_path(@this_conference.slug, @workshop.id), :class => 'button modify') if @workshop.can_edit?(current_user)