Added post-conference survey

This commit is contained in:
Godwin
2017-09-04 14:10:55 -07:00
parent 90448e059f
commit 611716bbd3
15 changed files with 481 additions and 99 deletions
+207 -25
View File
@@ -80,31 +80,6 @@ a {
cursor: pointer;
text-decoration-skip: ink;
@include link;
// border-bottom: 0 solid;
// position: relative;
// @include after {
// content: '';
// position: absolute;
// border-bottom: 0 solid;
// right: 0;
// bottom: 0;
// left: 0;
// opacity: 0;
// @include _(transition, all 150ms ease-in-out);
// @include _(transform-origin, 25% 50%);
// @include _(transform, scaleX(0));
// }
// &:hover,
// &:active,
// &:focus {
// @include after {
// border-bottom: 0.1em solid;
// opacity: 1;
// @include _(transform, scaleX(1));
// }
// }
}
.target:target {
@@ -121,6 +96,10 @@ a {
position: absolute !important;
}
.medium-up {
display: none;
}
table, .table {
margin-bottom: 2em;
margin-left: 1em;
@@ -2349,6 +2328,19 @@ a.logo {
font-size: 0.75em;
margin: 0.5em 0 0;
}
.access-registration {
display: inline-block;
font-size: 0.85em;
color: $mid-gray;
margin: 0.5em 1em;
text-align: right;
right: 0;
a {
display: block;
}
}
}
.help-link {
@@ -3340,7 +3332,151 @@ body.policy .policy-agreement ul {
}
}
#main ol.survey {
counter-reset: survey-question;
list-style: none;
padding: 0 1em;
$item-color: $dark-gray;
li {
margin: 2em 0;
border: 0.1em solid $item-color;
background-color: $extra-light-gray;
@include before {
content: counter(survey-question);
counter-increment: survey-question;
@include font-family(secondary);
float: left;
font-size: 3.5em;
background-color: $item-color;
color: $white;
width: 1.25em;
height: 1.25em;
line-height: 1.25em;
text-align: center;
margin: 0;// 0.3333em 0 0;
}
}
header {
@include _-(display, flex);
@include _(align-items, center);
overflow: auto;
margin: 0;
padding: 0.5em 1em;
min-height: 4.375em;
}
p {
margin: 0;
line-height: 1.25em;
}
.question-title {
margin: 0;
color: $mid-gray;
line-height: 2.6667em;
}
.question-details {
margin: 0.05em;
padding: 1em;
background-color: $white;
overflow: auto; // let it scroll just in case
}
.comment {
max-width: 40em;
margin: auto;
textarea {
min-height: 5em;
}
}
.open-ended {
margin: 2em 1em;
}
label {
cursor: pointer;
&:hover {
background-color: $light-gray;
}
input {
cursor: inherit;
}
}
}
fieldset.likert {
margin: 0 0 0.5em;
label {
display: block;
margin-bottom: 0.5em;
}
}
.responsive-table.likert {
width: 100%;
margin: 0;
.table-th {
padding: 0.5em;
}
.table-td {
padding: 0;
}
label {
display: block;
padding: 0.5em;
}
}
@include breakpoint(medium) {
#main ol.survey {
.open-ended {
margin: 2em 1em 2em 5em;
}
}
fieldset.likert {
margin: 0 0 0.5em 5em;
}
.responsive-table.likert {
margin: 2em 0 1em;
.table-td, .table-thead .table-th {
text-align: center;
}
.table-th {
vertical-align: middle;
}
.table-td {
position: relative;
vertical-align: middle;
text-align: center;
}
label {
width: 100%;
padding: 1.7em 0;
}
input {
margin: auto;
}
}
:focus,
input[type="submit"]:focus,
.check-box-field input:focus + label,
@@ -3355,6 +3491,14 @@ body.policy .policy-agreement ul {
}
}
.medium-up {
display: inherit;
}
.small-only {
display: none;
}
html[data-input="kb"] {
#main-nav .logo:focus {
outline-offset: -0.2em;
@@ -3471,6 +3615,7 @@ body.policy .policy-agreement ul {
margin-top: 0;
padding-top: 0.1em;
font-size: 4.25em;
min-width: 2.25em;
}
.nav {
@@ -3556,6 +3701,11 @@ body.policy .policy-agreement ul {
margin-bottom: 5.5em;
@include _(box-shadow, 0 0 2em -0.5em rgba(0, 0, 0, 0.5));
}
.access-registration {
position: absolute;
max-width: 11.5em;
}
}
ul.warnings {
@@ -3891,10 +4041,26 @@ body.policy .policy-agreement ul {
.table-th, .table-td {
display: table-cell;
}
.table-thead {
display: table-header-group;
}
.table-tbody {
display: table-row-group;
}
.table-tfoot {
display: table-footer-group;
}
}
} // medium
@include breakpoint(large) {
.responsive-table.likert {
table-layout: fixed;
}
#main {
padding-left: $sidebar-width;
}
@@ -3958,4 +4124,20 @@ body.policy .policy-agreement ul {
#main-nav .columns.medium-3 {
width: auto;
}
.responsive-table.likert {
.table-tr {
border: 0.1rem solid $light-gray;
}
.table-td {
border: 0;
}
.table-th {
border-top: 0;
border-right: 0;
border-left: 0;
}
}
}
+45 -6
View File
@@ -43,7 +43,7 @@ class ConferencesController < ApplicationController
def register
set_conference
do_403 unless @this_conference.is_public || @this_conference.host?(current_user)
do_403 unless @this_conference.registration_open
do_403 unless @this_conference.registration_open || @this_conference.registered?(current_user)
if logged_in?
if request.post?
@@ -110,10 +110,49 @@ class ConferencesController < ApplicationController
end
def survey
return do_404
# set_conference
# do_403 unless @this_conference.is_public || @this_conference.host?(current_user)
# do_403 if @this_conference.registration_open
set_conference
ensure_registration_is_complete!
return do_403 unless @this_conference.post_conference_survey_available? || @registration.survey_taken
end
def save_survey
set_conference
ensure_registration_is_complete!
return do_403 unless @this_conference.post_conference_survey_available?(@registration) && !@registration.survey_taken
# compile the results
results = {}
@this_conference.post_conference_survey_questions.each do |name, question|
case question[:type]
when :multi_likert
answer = {}
question[:questions].each do |q|
r = params["#{name}_#{q}"]
answer[q] = r if r.present? && question[:options].include?(r.to_sym)
end
results[name] = answer
else
answer = params[name]
if answer.present?
unless question[:waive_option].present? && answer.to_sym == question[:waive_option]
results[name] = answer
end
end
end
end
# create the survey
Survey.create(
name: @this_conference.post_conference_survey_name,
version: @this_conference.post_conference_survey_version,
results: results
)
# mark this user as having taken the survey
@registration.survey_taken = true
@registration.save!
redirect_to conference_survey_path
end
helper_method :registration_complete?
@@ -166,7 +205,7 @@ class ConferencesController < ApplicationController
rescue_from ActiveRecord::PremissionDenied do |exception|
if !@this_conference.can_register?
do_404
do_403
elsif logged_in?
redirect_to 'conferences/register'
else
+3 -1
View File
@@ -26,6 +26,7 @@ class WorkshopsController < ApplicationController
def create_workshop
set_conference
return do_404 unless @this_conference.registration_open
ensure_registration_is_complete!
@workshop = Workshop.new
@@ -121,6 +122,7 @@ class WorkshopsController < ApplicationController
return do_404 unless workshop.present?
can_edit = workshop.can_edit?(current_user)
else
return do_404 unless @this_conference.registration_open
workshop = Workshop.new(conference_id: @this_conference.id)
workshop.workshop_facilitators = [WorkshopFacilitator.new(user_id: current_user.id, role: :creator)]
can_edit = true
@@ -175,7 +177,7 @@ class WorkshopsController < ApplicationController
set_conference
ensure_registration_is_complete!
workshop = Workshop.find_by_id_and_conference_id(params[:workshop_id], @this_conference.id)
return do_404 unless workshop
return do_404 unless workshop.present? && workshop.can_show_interest?(current_user)
# save the current state
interested = workshop.interested? current_user
+1 -1
View File
@@ -476,7 +476,7 @@ module FormHelper
label = labels[i]
elsif is_single
label = options[:translate] == false ? label_key.to_s : _(label_key.to_s)
elsif box.is_a?(Integer)
elsif box.is_a?(Integer) && options[:translate] != false
label = I18n.t(label_key.to_s)[box]
else
label = options[:translate] == false ? box : _("#{label_key.to_s}.#{box}")
@@ -1,4 +1,4 @@
= render :partial => 'application/header', :locals => {:image_file => @banner_image || '403.jpg'}
= render partial: 'application/header', locals: {image_file: @banner_image || '403.jpg'}
%article
- if @template.present?
=render @template
@@ -6,5 +6,9 @@
= row do
= columns do
%h2=_'error.403.title','Sorry, you currently don\'t have access to this page'
%p=_'error.403.description', :p
= render 'contact', cancel_btn: false, contact_reason: :website
- if logged_in?
%p=_'error.403.description', :p
= render 'contact', cancel_btn: false, contact_reason: :website
- else
%p=_'error.403.not_logged_in', :p
= render "application/login"
+6 -2
View File
@@ -10,8 +10,12 @@
- if conference.start_date.present? && conference.end_date.present?
.secondary
= date_span(conference.start_date.to_date, conference.end_date.to_date)
- if conference.poster.present? && links.include?(:register) && conference.can_register?
- if conference.poster.present? && links.include?(:register) && conference.can_register?(current_user)
.register-link
- unless logged_in?
.access-registration
= _'actions.conference.already_registered'
= link_to (_'actions.conference.access_registration'), register_path(conference.slug)
= (link_to _(is_registered ? 'actions.conference.edit_registration' : 'forms.actions.generic.register'), register_path(conference.slug), class: [:button, :register])
- if conference.poster.present?
%figure
@@ -23,7 +27,7 @@
= richtext conference.info
.links
= (link_to (_(is_registered ? 'actions.conference.edit_registration' : 'forms.actions.generic.register')), register_path(conference.slug), class: [:button, :register]) if links.include?(:register) && conference.can_register?
= (link_to (_(is_registered ? 'actions.conference.edit_registration' : 'forms.actions.generic.register')), register_path(conference.slug), class: [:button, :register]) if links.include?(:register) && conference.can_register?(current_user)
= (link_to (_'articles.workshops.info.read_more'), conference_path(conference.slug), class: :button) if links.include?(:read_more)
= (link_to (_'forms.actions.generic.administrate'), administrate_conference_path(conference.slug), class: [:button]) if links.include?(:administrate)
= (link_to (_'forms.actions.generic.edit'), edit_conference_path(conference.slug), class: [:button, :subdued]) if links.include?(:edit)
+70
View File
@@ -0,0 +1,70 @@
= render partial: 'conferences/page_header', locals: {page_key: 'Conference_Survey'}
- if @warnings.present?
= row class: 'warnings', tag: :ul do
- @warnings.each do |warning|
= columns tag: :li, class: 'warning-info' do
= warning
%article
- if !@registration.checked_in?
= row do
= columns(medium: 12) do
%h2=_"articles.conference_survey.headings.post_conference", :t
%p=_"articles.conference_survey.paragraphs.post_conference_not_checked_in", :p
- elsif @registration.survey_taken
= row do
= columns(medium: 12) do
%h2=_"articles.conference_survey.headings.post_conference", :t
%p=_"articles.conference_survey.paragraphs.post_conference_taken", :p
- else
= form_tag conference_survey_save_path(@this_conference.slug) do
= row do
= columns(medium: 12) do
%h2=_"articles.conference_survey.headings.post_conference", :t
%p=_"articles.conference_survey.paragraphs.post_conference", :p
= textfield :email, nil, required: true, big: true unless logged_in?
%ol.survey
- @this_conference.post_conference_survey_questions.each do |name, question|
%li
%header
%p= _"articles.conference_survey.paragraphs.#{name}", :p
.question-details
- case question[:type]
- when :open_ended
.open-ended= textarea name, nil, plain: true, short: true, label: false, class: question[:comment_size]
- when :multi_likert
- options = question[:options].to_a
- options << question[:waive_option] if question[:waive_option].present?
.table.responsive-table.likert
.table-thead.medium-up
.table-tr
.table-th.corner
- options.each do |option|
.table-th{id: "#{name}-option-#{option}"}=_("articles.conference_survey.likert.#{option}")
.table-tbody
- question[:questions].each do |q|
.table-tr
.table-th{id: "#{name}-question-#{q}"}=_("articles.conference_survey.questions.#{q}")
- options.each do |option|
.table-td
=label_tag do
=radio_button_tag "#{name}_#{q}", option, aria: { labelledby: "#{name}-question-#{q} #{name}-option-#{option}" }
%span.small-only=_("articles.conference_survey.likert.#{option}")
- when :likert
- options = question[:options].to_a
- options << question[:waive_option] if question[:waive_option].present?
- is_numerical = question[:options].is_a?(Range)
%fieldset.likert
- options.each do |option|
= label_tag do
= radio_button_tag name, option
= _("articles.conference_survey.likert.#{option}")
- if question[:comment].present?
.comment
= textarea "#{name}_comment", nil, label: "articles.conference_survey.comment.#{question[:comment] == true ? 'default' : question[:comment]}", plain: true, short: true
= row do
= columns(medium: 12) do
%p=_"articles.conference_survey.paragraphs.post_conference_submit", :p
.actions.center
= button :submit
+21 -13
View File
@@ -1,3 +1,10 @@
- if @allow_survey
= row do
= columns(medium: 12) do
%h2=_'articles.conference_survey.headings.post_conference', :t
%p=_'articles.conference_survey.paragraphs.post_conference', :p
.actions.centered
= link_to (_'actions.conference_registration.take_survey'), conference_survey_path(@this_conference), class: [:button, :modify]
= registration_step_header
= row do
= columns(medium: 12) do
@@ -9,7 +16,7 @@
.table-tr
.table-th
=_"articles.conference_registration.step_names.#{step}"
= button :edit, name: :edit_step, value: step, class: [:unstyled, :edit]
= button :edit, name: :edit_step, value: step, class: [:unstyled, :edit] if @this_conference.registration_open
.table-td
- case data[:type]
- when :bool
@@ -32,7 +39,7 @@
- else
= value.html_safe
- else
%p.centered=_'articles.conference_registration.paragraphs.registration_cancelled', :p
%p=_'articles.conference_registration.paragraphs.registration_cancelled', :p
- if @allow_cancel_attendance
.actions.centered
= button :cancel_registration, value: :cancel_registration, class: :red
@@ -70,17 +77,18 @@
%td{colspan: 3, lang: guest.user.locale.to_s == I18n.locale.to_s ? nil : guest.user.locale}
= paragraph guest.housing_data['other']
= row do
= columns(medium: 12) do
%h3=_'articles.workshops.headings.Workshops', :t
- if @this_conference.workshop_info.present?
= richtext @this_conference.workshop_info
- else
%p=_'articles.conference_registration.paragraphs.workshops', :p
.actions.centered
.buttons
= link_to (_'articles.conference_registration.actions.View_Workshops'), workshops_path(@this_conference), class: :button
= link_to (_'actions.workshops.create'), create_workshop_path(@this_conference), class: [:button, :modify]
- if @this_conference.registration_open
= row do
= columns(medium: 12) do
%h3=_'articles.workshops.headings.Workshops', :t
- if @this_conference.workshop_info.present?
= richtext @this_conference.workshop_info
- else
%p=_'articles.conference_registration.paragraphs.workshops', :p
.actions.centered
.buttons
= link_to (_'articles.conference_registration.actions.View_Workshops'), workshops_path(@this_conference), class: :button
= link_to (_'actions.workshops.create'), create_workshop_path(@this_conference), class: [:button, :modify]
- if @my_workshops.present?
= row do
= columns(medium: 12) do