Browse Source

Fixed companions heading, time_select bug, and emails on comments

development
Godwin 8 years ago
parent
commit
22375e73e0
  1. 13
      app/assets/javascripts/schedule.js
  2. 21
      app/assets/stylesheets/_application.scss
  3. 1
      app/controllers/application_controller.rb
  4. 4
      app/controllers/conferences_controller.rb
  5. 2
      app/helpers/application_helper.rb
  6. 2
      app/views/conferences/admin/_events.html.haml
  7. 2
      app/views/conferences/admin/_meals.html.haml
  8. 7
      app/views/conferences/admin/_schedule.html.haml
  9. 2
      app/views/conferences/admin/_select_guest_table.html.haml
  10. 2
      app/views/conferences/admin/_workshop_times.html.haml

13
app/assets/javascripts/schedule.js

@ -1,5 +1,14 @@
(function() { (function() {
var body = document.querySelector('body'); function initSchedule() {
forEachElement('table.schedule td.workshop.empty', function(block) {
block.addEventListener('click', function(event) {
console.log('clicked');
});
});
}
initSchedule();
/*var body = document.querySelector('body');
var primaryContent = document.getElementById('primary-content'); var primaryContent = document.getElementById('primary-content');
var eventDlg = document.getElementById('event-dlg'); var eventDlg = document.getElementById('event-dlg');
@ -26,5 +35,5 @@
eventDlg.querySelector('.close-btn').onclick = closeDlg; eventDlg.querySelector('.close-btn').onclick = closeDlg;
document.getElementById('overlay').onclick = closeDlg; document.getElementById('overlay').onclick = closeDlg;
}); });
}); });*/
})(); })();

21
app/assets/stylesheets/_application.scss

@ -1913,27 +1913,27 @@ table.schedule {
width: 100%; width: 100%;
margin: 0 0 1em; margin: 0 0 1em;
&.locations-1 td.workshop { &.locations-1 td.workshop.filled {
width: 100%; width: 100%;
} }
&.locations-2 td.workshop { &.locations-2 td.workshop.filled {
width: 50%; width: 50%;
} }
&.locations-3 td.workshop { &.locations-3 td.workshop.filled {
width: 33.333%; width: 33.333%;
} }
&.locations-4 td.workshop { &.locations-4 td.workshop.filled {
width: 25%; width: 25%;
} }
&.locations-5 td.workshop { &.locations-5 td.workshop.filled {
width: 20%; width: 20%;
} }
&.locations-6 td.workshop { &.locations-6 td.workshop.filled {
width: 16.66667%; width: 16.66667%;
} }
@ -1953,6 +1953,15 @@ table.schedule {
&.filled { &.filled {
background-color: lighten($colour-1, 25%); background-color: lighten($colour-1, 25%);
} }
&.open {
cursor: pointer;
white-space: nowrap;
&:hover {
background-color: lighten($colour-1, 25%);
}
}
} }
&.event { &.event {

1
app/controllers/application_controller.rb

@ -547,6 +547,7 @@ class ApplicationController < LinguaFrancaApplicationController
end end
last_event = time last_event = time
end end
@schedule[day][:num_locations] = data[:locations].size
end end
@schedule.deep_dup.each do | day, data | @schedule.deep_dup.each do | day, data |

4
app/controllers/conferences_controller.rb

@ -1281,17 +1281,21 @@ class ConferencesController < ApplicationController
comment = Comment.find_by!(id: params[:comment_id].to_i, model_type: :workshops, model_id: workshop.id) comment = Comment.find_by!(id: params[:comment_id].to_i, model_type: :workshops, model_id: workshop.id)
new_comment = comment.add_comment(current_user, params[:reply]) new_comment = comment.add_comment(current_user, params[:reply])
unless comment.user.id == current_user.id
UserMailer.send_mail :workshop_comment, comment.user.locale do UserMailer.send_mail :workshop_comment, comment.user.locale do
[ workshop, new_comment, comment.user ] [ workshop, new_comment, comment.user ]
end end
end
elsif params[:button] = 'add_comment' elsif params[:button] = 'add_comment'
new_comment = workshop.add_comment(current_user, params[:comment]) new_comment = workshop.add_comment(current_user, params[:comment])
workshop.active_facilitators.each do | u | workshop.active_facilitators.each do | u |
unless u.id == current_user.id
UserMailer.send_mail :workshop_comment, u.locale do UserMailer.send_mail :workshop_comment, u.locale do
[ workshop, new_comment, u ] [ workshop, new_comment, u ]
end end
end end
end
else else
return do_404 return do_404
end end

2
app/helpers/application_helper.rb

@ -777,7 +777,7 @@ module ApplicationHelper
selectfield :day, value, conference_days_options_list(:during, nil, args[:format]), args selectfield :day, value, conference_days_options_list(:during, nil, args[:format]), args
end end
def time_select(value = nil, args = {}, start_time = 8, end_time = 23.5, step = 0.5) def hour_select(value = nil, args = {}, start_time = 8, end_time = 23.5, step = 0.5)
time = start_time time = start_time
times = [] times = []
while time <= end_time while time <= end_time

2
app/views/conferences/admin/_events.html.haml

@ -31,7 +31,7 @@
.flex-inputs .flex-inputs
= location_select @event.event_location_id, small: true, stretch: true = location_select @event.event_location_id, small: true, stretch: true
= day_select @day, small: true, format: :weekday = day_select @day, small: true, format: :weekday
= time_select @time, small: true = hour_select @time, small: true
= length_select @length, small: true = length_select @length, small: true
- I18n.backend.enabled_locales.each do | locale | - I18n.backend.enabled_locales.each do | locale |
- if locale.to_s != @event.locale.to_s - if locale.to_s != @event.locale.to_s

2
app/views/conferences/admin/_meals.html.haml

@ -25,7 +25,7 @@
.flex-inputs .flex-inputs
= location_select nil, small: true, stretch: true = location_select nil, small: true, stretch: true
= day_select nil, small: true, format: :weekday = day_select nil, small: true, format: :weekday
= time_select nil, small: true = hour_select nil, small: true
= textfield :title, nil, required: true, big: true, help: 'articles.admin.locations.paragraphs.meal_title' = textfield :title, nil, required: true, big: true, help: 'articles.admin.locations.paragraphs.meal_title'
= textfield :info, nil, help: 'articles.admin.locations.paragraphs.meal_info' = textfield :info, nil, help: 'articles.admin.locations.paragraphs.meal_info'
.actions.next-prev .actions.next-prev

7
app/views/conferences/admin/_schedule.html.haml

@ -1,3 +1,4 @@
- add_inline_script :schedule
- 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'
@ -14,7 +15,7 @@
#schedule-preview #schedule-preview
- @schedule.each do | day, data | - @schedule.each do | day, data |
%h4=date(day, :weekday) %h4=date(day, :weekday)
%table.schedule{class: [data[:locations].present? ? 'has-locations' : 'no-locations', "locations-#{data[:locations].size}"]} %table.schedule{class: [data[:locations].present? ? 'has-locations' : 'no-locations', "locations-#{data[:num_locations]}"]}
- if data[:locations].present? - if data[:locations].present?
%thead %thead
%tr %tr
@ -35,7 +36,7 @@
- status = time_data[:item][:workshops][id][:status] - status = time_data[:item][:workshops][id][:status]
- else - else
- workshop = status = nil - workshop = status = nil
%td{class: [time_data[:type], workshop.present? ? :filled : nil], rowspan: rowspan} %td{class: [time_data[:type], workshop.present? ? :filled : :open], rowspan: rowspan, data: workshop.present? ? nil : { block: (time_data[:item][:block] + 1), day: day }}
- if workshop.present? && workshop.event_location.present? - if workshop.present? && workshop.event_location.present?
= link_to off_screen(workshop.title), view_workshop_path(@conference.slug, workshop.id), class: 'event-detail-link' = link_to off_screen(workshop.title), view_workshop_path(@conference.slug, workshop.id), class: 'event-detail-link'
%template.event-details{data: { href: view_workshop_path(@conference.slug, workshop.id) }} %template.event-details{data: { href: view_workshop_path(@conference.slug, workshop.id) }}
@ -60,7 +61,7 @@
- elsif @can_edit - elsif @can_edit
.title="Block #{time_data[:item][:block] + 1}" .title="Block #{time_data[:item][:block] + 1}"
- else - else
%td{class: time_data[:type], rowspan: rowspan, colspan: data[:locations].present? ? data[:locations].size : 1} %td{class: [time_data[:type], :open], rowspan: rowspan, colspan: data[:locations].present? ? data[:locations].size : 1, data: { block: (time_data[:item][:block] + 1), day: day }}
- if @can_edit - if @can_edit
.title="Block #{time_data[:item][:block] + 1}" .title="Block #{time_data[:item][:block] + 1}"
%td.status{rowspan: rowspan} %td.status{rowspan: rowspan}

2
app/views/conferences/admin/_select_guest_table.html.haml

@ -19,7 +19,7 @@
%th=_'forms.labels.generic.city' %th=_'forms.labels.generic.city'
%th=_'forms.labels.generic.housing' %th=_'forms.labels.generic.housing'
%th=_'articles.admin.housing.headings.arrival_departure' %th=_'articles.admin.housing.headings.arrival_departure'
%th=_'forms.labels.generic.companion' %th=_'articles.conference_registration.headings.companion'
%th=_'forms.labels.generic.food' %th=_'forms.labels.generic.food'
%th=_'forms.labels.generic.allergies' %th=_'forms.labels.generic.allergies'
%th=_'forms.labels.generic.other' %th=_'forms.labels.generic.other'

2
app/views/conferences/admin/_workshop_times.html.haml

@ -9,7 +9,7 @@
- is_new = info['time'].blank? - is_new = info['time'].blank?
= form_tag administration_update_path(@this_conference.slug, :workshop_times), class: ['table-tr', is_new ? 'new' : 'saved'] do = form_tag administration_update_path(@this_conference.slug, :workshop_times), class: ['table-tr', is_new ? 'new' : 'saved'] do
.table-th.center.big= is_new ? '' : (block + 1) .table-th.center.big= is_new ? '' : (block + 1)
.table-td=time_select info['time'], small: true, label: false .table-td=hour_select info['time'], small: true, label: false
.table-td=length_select info['length'], {small: true, label: false}, 0.5, 2 .table-td=length_select info['length'], {small: true, label: false}, 0.5, 2
.table-td=checkboxes :days, @block_days, info['days'].map(&:to_i), 'date.day_names', vertical: true, small: true .table-td=checkboxes :days, @block_days, info['days'].map(&:to_i), 'date.day_names', vertical: true, small: true
.table-td.form .table-td.form

Loading…
Cancel
Save