Merge ed087352e2 into 7a95c43a57
This commit is contained in:
commit
6b6fc61fd8
42 changed files with 772 additions and 37 deletions
3
Gemfile
3
Gemfile
|
|
@ -75,7 +75,6 @@ gem 'bootstrap-sass', '~> 3.3.4.1'
|
||||||
gem 'autoprefixer-rails'
|
gem 'autoprefixer-rails'
|
||||||
gem 'formtastic-bootstrap'
|
gem 'formtastic-bootstrap'
|
||||||
gem 'formtastic', '~> 3.1.1'
|
gem 'formtastic', '~> 3.1.1'
|
||||||
gem 'cocoon'
|
|
||||||
|
|
||||||
# as the JavaScript library
|
# as the JavaScript library
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
|
|
@ -105,6 +104,8 @@ source 'https://rails-assets.org' do
|
||||||
gem 'rails-assets-bootstrap-markdown'
|
gem 'rails-assets-bootstrap-markdown'
|
||||||
gem 'rails-assets-to-markdown'
|
gem 'rails-assets-to-markdown'
|
||||||
gem 'rails-assets-markdown'
|
gem 'rails-assets-markdown'
|
||||||
|
# for select with icon
|
||||||
|
gem 'rails-assets-bootstrap-select'
|
||||||
end
|
end
|
||||||
|
|
||||||
# as date picker
|
# as date picker
|
||||||
|
|
|
||||||
14
Gemfile.lock
14
Gemfile.lock
|
|
@ -115,7 +115,6 @@ GEM
|
||||||
cloudinary (1.1.6)
|
cloudinary (1.1.6)
|
||||||
aws_cf_signer
|
aws_cf_signer
|
||||||
rest-client
|
rest-client
|
||||||
cocoon (1.2.6)
|
|
||||||
coderay (1.1.0)
|
coderay (1.1.0)
|
||||||
coffee-rails (4.1.1)
|
coffee-rails (4.1.1)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
|
|
@ -356,17 +355,19 @@ GEM
|
||||||
rails-assets-jquery (>= 1.9.1, < 3)
|
rails-assets-jquery (>= 1.9.1, < 3)
|
||||||
rails-assets-bootstrap-markdown (2.10.0)
|
rails-assets-bootstrap-markdown (2.10.0)
|
||||||
rails-assets-bootstrap (~> 3)
|
rails-assets-bootstrap (~> 3)
|
||||||
|
rails-assets-bootstrap-select (1.10.0)
|
||||||
|
rails-assets-jquery (>= 1.8)
|
||||||
rails-assets-date.format (1.2.3)
|
rails-assets-date.format (1.2.3)
|
||||||
rails-assets-holderjs (2.9.3)
|
rails-assets-holderjs (2.9.3)
|
||||||
rails-assets-jquery (2.2.1)
|
rails-assets-jquery (2.2.4)
|
||||||
rails-assets-jquery-smooth-scroll (1.7.2)
|
rails-assets-jquery-smooth-scroll (1.7.2)
|
||||||
rails-assets-jquery (>= 1.4.2)
|
rails-assets-jquery (>= 1.4.2)
|
||||||
rails-assets-markdown (0.5.0)
|
rails-assets-markdown (0.5.0)
|
||||||
rails-assets-momentjs (2.11.2)
|
rails-assets-momentjs (2.13.0)
|
||||||
rails-assets-spectrum (1.8.0)
|
rails-assets-spectrum (1.8.0)
|
||||||
rails-assets-jquery (>= 1.7.2)
|
rails-assets-jquery (>= 1.7.2)
|
||||||
rails-assets-tinycolor (1.3.0)
|
rails-assets-tinycolor (1.3.0)
|
||||||
rails-assets-to-markdown (1.3.0)
|
rails-assets-to-markdown (3.0.0)
|
||||||
rails-assets-trianglify (0.4.0)
|
rails-assets-trianglify (0.4.0)
|
||||||
rails-assets-waypoints (4.0.0)
|
rails-assets-waypoints (4.0.0)
|
||||||
rails-deprecated_sanitizer (1.0.3)
|
rails-deprecated_sanitizer (1.0.3)
|
||||||
|
|
@ -546,7 +547,6 @@ DEPENDENCIES
|
||||||
carrierwave-bombshelter
|
carrierwave-bombshelter
|
||||||
chart-js-rails
|
chart-js-rails
|
||||||
cloudinary
|
cloudinary
|
||||||
cocoon
|
|
||||||
country_select
|
country_select
|
||||||
coveralls
|
coveralls
|
||||||
daemons
|
daemons
|
||||||
|
|
@ -587,6 +587,7 @@ DEPENDENCIES
|
||||||
quiet_assets
|
quiet_assets
|
||||||
rails (~> 4.2)
|
rails (~> 4.2)
|
||||||
rails-assets-bootstrap-markdown!
|
rails-assets-bootstrap-markdown!
|
||||||
|
rails-assets-bootstrap-select!
|
||||||
rails-assets-date.format!
|
rails-assets-date.format!
|
||||||
rails-assets-holderjs!
|
rails-assets-holderjs!
|
||||||
rails-assets-jquery-smooth-scroll!
|
rails-assets-jquery-smooth-scroll!
|
||||||
|
|
@ -620,6 +621,3 @@ DEPENDENCIES
|
||||||
web-console (~> 2.0)
|
web-console (~> 2.0)
|
||||||
webmock
|
webmock
|
||||||
whenever
|
whenever
|
||||||
|
|
||||||
BUNDLED WITH
|
|
||||||
1.12.5
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
//= require waypoints/jquery.waypoints
|
//= require waypoints/jquery.waypoints
|
||||||
//= require dataTables/jquery.dataTables
|
//= require dataTables/jquery.dataTables
|
||||||
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
|
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
|
||||||
//= require cocoon
|
|
||||||
//= require bootstrap
|
//= require bootstrap
|
||||||
//= require Chart
|
//= require Chart
|
||||||
//= require osem
|
//= require osem
|
||||||
|
|
@ -41,6 +40,8 @@
|
||||||
//= require osem-commercials
|
//= require osem-commercials
|
||||||
//= require unobtrusive_flash
|
//= require unobtrusive_flash
|
||||||
//= require unobtrusive_flash_bootstrap
|
//= require unobtrusive_flash_bootstrap
|
||||||
|
//= require bootstrap-select
|
||||||
|
//= require osem-survey
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('a[disabled=disabled]').click(function(event){
|
$('a[disabled=disabled]').click(function(event){
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
// get current_date
|
// get current_date
|
||||||
var today = new Date().toISOString().slice(0, 10);
|
var today = new Date().toISOString().slice(0, 10);
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
|
$('.datetimepicker').datetimepicker({
|
||||||
|
pickTime: true,
|
||||||
|
useCurrent: false,
|
||||||
|
sideBySide: true,
|
||||||
|
format: 'YYYY-MM-DD HH:mm'
|
||||||
|
});
|
||||||
|
|
||||||
$("#registration-arrival-datepicker").datetimepicker({
|
$("#registration-arrival-datepicker").datetimepicker({
|
||||||
pickTime: true,
|
pickTime: true,
|
||||||
useCurrent: false,
|
useCurrent: false,
|
||||||
|
|
|
||||||
33
app/assets/javascripts/osem-survey.js
Normal file
33
app/assets/javascripts/osem-survey.js
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
$(function() {
|
||||||
|
$('.selectpicker').on('changed.bs.select', function (e, clickedIndex) {
|
||||||
|
$('.kinds').addClass('hidden');
|
||||||
|
var selected = $('.selectpicker').find('option:selected').val();
|
||||||
|
$('.' + selected).removeClass('hidden');
|
||||||
|
|
||||||
|
if (selected == 'choice') {
|
||||||
|
$('.survey-possible-answers').removeClass('hidden');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('.survey-possible-answers').addClass('hidden');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#survey_question_title').on('keyup', function(){
|
||||||
|
$('#survey_question_preview #title').text($(this).val())
|
||||||
|
});
|
||||||
|
|
||||||
|
function render_possible_answers_preview() {
|
||||||
|
var options_html = '';
|
||||||
|
var options_array = $('#survey_question_possible_answers').val().split(',');
|
||||||
|
var input_type = ($('#survey_question_min_choices').val() == 1 &&
|
||||||
|
$('#survey_question_max_choices').val() == 1) ? 'radio' : 'checkbox';
|
||||||
|
$.each(options_array, function(index, option) {
|
||||||
|
options_html += '<input type="' + input_type + '" name="preview_option"/> ' + option.trim() + '<br/>';
|
||||||
|
});
|
||||||
|
$('#survey_question_preview .choice').html(options_html)
|
||||||
|
};
|
||||||
|
|
||||||
|
$('#survey_question_possible_answers').on('keyup', render_possible_answers_preview);
|
||||||
|
$('#survey_question_min_choices').on('change', render_possible_answers_preview);
|
||||||
|
$('#survey_question_max_choices').on('change', render_possible_answers_preview);
|
||||||
|
});
|
||||||
|
|
@ -14,4 +14,5 @@
|
||||||
*= require bootstrap-datetimepicker
|
*= require bootstrap-datetimepicker
|
||||||
*= require leaflet
|
*= require leaflet
|
||||||
*= require bootstrap3-switch
|
*= require bootstrap3-switch
|
||||||
|
*= require bootstrap-select
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
56
app/controllers/admin/survey_questions_controller.rb
Normal file
56
app/controllers/admin/survey_questions_controller.rb
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
module Admin
|
||||||
|
class SurveyQuestionsController < Admin::BaseController
|
||||||
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
load_and_authorize_resource :survey, through: :conference
|
||||||
|
load_and_authorize_resource through: :survey
|
||||||
|
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@survey_question = @survey.survey_questions.new(min_choices: 1, max_choices: 1)
|
||||||
|
@url = admin_conference_survey_survey_questions_path(@conference.short_title, @survey)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
if @survey.survey_questions.create(survey_question_params)
|
||||||
|
redirect_to admin_conference_survey_path(@conference.short_title, @survey), notice: 'Successfully created Survey Question.'
|
||||||
|
else
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET questions/1/edit
|
||||||
|
def edit
|
||||||
|
@url = admin_conference_survey_survey_question_path(@conference.short_title, @survey, @survey_question)
|
||||||
|
end
|
||||||
|
|
||||||
|
# PUT questions/1
|
||||||
|
def update
|
||||||
|
if @survey_question.update_attributes(survey_question_params)
|
||||||
|
redirect_to admin_conference_survey_path(@conference.short_title, @survey), notice: 'Successfully updated Survey Question.'
|
||||||
|
else
|
||||||
|
@url = admin_conference_survey_survey_question_path(@conference.short_title, @survey, @survey_question)
|
||||||
|
render :edit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE questions/1
|
||||||
|
def destroy
|
||||||
|
if @survey_question.destroy
|
||||||
|
redirect_to admin_conference_survey_path(@conference.short_title, @survey), notice: 'Successfully deleted Survey Question.'
|
||||||
|
else
|
||||||
|
redirect_to admin_conference_survey_path(@conference.short_title, @survey), error: "Can't delete this Survey Question"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def survey_question_params
|
||||||
|
params.require(:survey_question).permit(:title, :kind, :possible_answers, :min_choices, :max_choices, :mandatory)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
46
app/controllers/admin/surveys_controller.rb
Normal file
46
app/controllers/admin/surveys_controller.rb
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
module Admin
|
||||||
|
class SurveysController < Admin::BaseController
|
||||||
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
|
def index
|
||||||
|
@surveys = @conference.surveys
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@survey = Survey.new(survey_params)
|
||||||
|
@url = admin_conference_surveys_path(@conference.short_title)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@survey = Survey.new(survey_params)
|
||||||
|
if @survey.save
|
||||||
|
redirect_to new_admin_conference_survey_survey_question_path(@conference.short_title, @survey)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@url = admin_conference_survey_path(@conference.short_title, @survey)
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if @survey.update_attributes(survey_params)
|
||||||
|
redirect_to admin_conference_surveys_path(@conference.short_title)
|
||||||
|
else
|
||||||
|
@url = admin_conference_survey_path(@conference.short_title, @survey)
|
||||||
|
render action: :edit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@survey.destroy
|
||||||
|
redirect_to admin_conference_surveys_path(@conference.short_title)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def survey_params
|
||||||
|
params.require(:survey).permit(:title, :description, :target, :start_date, :end_date, :surveyable_type, :surveyable_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
21
app/controllers/survey_submissions_controller.rb
Normal file
21
app/controllers/survey_submissions_controller.rb
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
class SurveySubmissionsController < ApplicationController
|
||||||
|
load_resource :conference, find_by: :short_title
|
||||||
|
load_resource :survey
|
||||||
|
load_and_authorize_resource
|
||||||
|
# skip_before_filter :verify_authenticity_token
|
||||||
|
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
end
|
||||||
26
app/controllers/surveys_controller.rb
Normal file
26
app/controllers/surveys_controller.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
class SurveysController < ApplicationController
|
||||||
|
load_resource :conference, find_by: :short_title
|
||||||
|
load_and_authorize_resource
|
||||||
|
# skip_before_filter :verify_authenticity_token
|
||||||
|
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@survey_submission = @survey.survey_submissions.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def reply
|
||||||
|
redirect_to :back
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
@ -94,6 +94,9 @@ class Ability
|
||||||
|
|
||||||
# can manage the commercials of their own events
|
# can manage the commercials of their own events
|
||||||
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)
|
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)
|
||||||
|
|
||||||
|
# can view and reply a survey
|
||||||
|
can [:show, :reply], Survey, surveyable_type: 'Conference', surveyable_id: user.registrations.pluck(:conference_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Abilities for signed in users with roles
|
# Abilities for signed in users with roles
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,11 @@ class Conference < ActiveRecord::Base
|
||||||
has_many :campaigns, dependent: :destroy
|
has_many :campaigns, dependent: :destroy
|
||||||
has_many :commercials, as: :commercialable, dependent: :destroy
|
has_many :commercials, as: :commercialable, dependent: :destroy
|
||||||
has_many :subscriptions, dependent: :destroy
|
has_many :subscriptions, dependent: :destroy
|
||||||
|
has_many :surveys, as: :surveyable, dependent: :destroy do
|
||||||
|
def for_registration
|
||||||
|
where(target: targets[:during_registration])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
accepts_nested_attributes_for :venue
|
accepts_nested_attributes_for :venue
|
||||||
accepts_nested_attributes_for :tickets, allow_destroy: true
|
accepts_nested_attributes_for :tickets, allow_destroy: true
|
||||||
|
|
|
||||||
8
app/models/survey.rb
Normal file
8
app/models/survey.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
class Survey < ActiveRecord::Base
|
||||||
|
belongs_to :surveyable, polymorphic: true
|
||||||
|
has_many :survey_questions
|
||||||
|
has_many :survey_submissions
|
||||||
|
|
||||||
|
enum target: [:after_conference, :during_registration]
|
||||||
|
validates :title, presence: true
|
||||||
|
end
|
||||||
43
app/models/survey_question.rb
Normal file
43
app/models/survey_question.rb
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
class SurveyQuestion < ActiveRecord::Base
|
||||||
|
belongs_to :survey
|
||||||
|
|
||||||
|
# Order of this list should not be changed without proper action!
|
||||||
|
enum kind: [:boolean, :choice, :string, :text, :datetime, :numeric]
|
||||||
|
|
||||||
|
ICONS = { boolean: 'dot-circle-o', choice: 'check-square-o', string: 'edit', text: 'align-left', datetime: 'clock-o', numeric: 'slack' }
|
||||||
|
|
||||||
|
validates :title, presence: true
|
||||||
|
validates :possible_answers, :max_choices, :min_choices, presence: true, if: "choice?"
|
||||||
|
validates :min_choices, numericality: { greater_than_or_equal_to: 1 }, allow_blank: true
|
||||||
|
validates :max_choices, numericality: { greater_than_or_equal_to: 1 }, allow_blank: true
|
||||||
|
|
||||||
|
validate :max_choices_greater_than_min
|
||||||
|
has_many :survey_replies
|
||||||
|
|
||||||
|
|
||||||
|
def single_choice?
|
||||||
|
choice? && max_choices == 1 && min_choices == 1
|
||||||
|
end
|
||||||
|
|
||||||
|
def multiple_choice?
|
||||||
|
choice? && max_choices > 1
|
||||||
|
end
|
||||||
|
|
||||||
|
def possible_answers=(value)
|
||||||
|
write_attribute(:possible_answers, choice? ? value : nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
def min_choices=(value)
|
||||||
|
write_attribute(:min_choices, choice? ? value : nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
def max_choices=(value)
|
||||||
|
write_attribute(:max_choices, choice? ? value : nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def max_choices_greater_than_min
|
||||||
|
errors.add(:max_choices, "Max choices should not be less than min choices") if choice? && max_choices.to_i < min_choices.to_i
|
||||||
|
end
|
||||||
|
end
|
||||||
5
app/models/survey_reply.rb
Normal file
5
app/models/survey_reply.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
class SurveyReply < ActiveRecord::Base
|
||||||
|
belongs_to :user
|
||||||
|
belongs_to :survey_question
|
||||||
|
serialize :text
|
||||||
|
end
|
||||||
7
app/models/survey_submission.rb
Normal file
7
app/models/survey_submission.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
class SurveySubmission < ActiveRecord::Base
|
||||||
|
belongs_to :user
|
||||||
|
belongs_to :survey
|
||||||
|
has_many :survey_replies, through: :user
|
||||||
|
|
||||||
|
accepts_nested_attributes_for :survey_replies
|
||||||
|
end
|
||||||
|
|
@ -42,6 +42,8 @@ class User < ActiveRecord::Base
|
||||||
has_many :votes, dependent: :destroy
|
has_many :votes, dependent: :destroy
|
||||||
has_many :voted_events, through: :votes, source: :events
|
has_many :voted_events, through: :votes, source: :events
|
||||||
has_many :subscriptions, dependent: :destroy
|
has_many :subscriptions, dependent: :destroy
|
||||||
|
has_many :survey_replies
|
||||||
|
has_many :survey_submissions
|
||||||
accepts_nested_attributes_for :roles
|
accepts_nested_attributes_for :roles
|
||||||
|
|
||||||
scope :admin, -> { where(is_admin: true) }
|
scope :admin, -> { where(is_admin: true) }
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
.nested-fields
|
||||||
|
= f.inputs do
|
||||||
|
= f.input :title
|
||||||
|
= remove_association_link :answer, f
|
||||||
92
app/views/admin/survey_questions/_form.html.haml
Normal file
92
app/views/admin/survey_questions/_form.html.haml
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.page-header
|
||||||
|
- if @survey_question.new_record?
|
||||||
|
%h1
|
||||||
|
New Survey Question
|
||||||
|
- else
|
||||||
|
%h1
|
||||||
|
Edit Survey Question
|
||||||
|
.text-muted
|
||||||
|
= @survey_question.title
|
||||||
|
|
||||||
|
.col-md-6
|
||||||
|
= semantic_form_for @survey_question, url: @url do |f|
|
||||||
|
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
= f.input :title
|
||||||
|
= f.input :mandatory
|
||||||
|
%div.survey-possible-answers{ class: @survey_question.choice? ? '' : 'hidden'}
|
||||||
|
= f.input :possible_answers, hint: 'Comma separated', input_html: { rows: 3 }
|
||||||
|
.row
|
||||||
|
.col-md-6
|
||||||
|
= f.input :min_choices
|
||||||
|
.col-md-6
|
||||||
|
= f.input :max_choices
|
||||||
|
%hr
|
||||||
|
.row
|
||||||
|
.col-md-6
|
||||||
|
%label{ required: 'required' }
|
||||||
|
Type of Question:
|
||||||
|
.form-group
|
||||||
|
%select.selectpicker.form-control{ id: 'survey_question_kind', name: 'survey_question[kind]' }
|
||||||
|
- SurveyQuestion.kinds.each do |kind|
|
||||||
|
%option{ id: "#{kind.second}", 'data-icon' => "fa fa-#{SurveyQuestion::ICONS[kind.first.to_sym]}", selected: @survey_question.kind == kind.first }
|
||||||
|
= kind.first
|
||||||
|
.col-md-6
|
||||||
|
%label
|
||||||
|
Preview:
|
||||||
|
.panel.panel-default
|
||||||
|
.panel-body{id: 'survey_question_preview'}
|
||||||
|
%p{id: 'title', style: 'word-wrap: break-word'}
|
||||||
|
= @survey_question.title.blank? ? 'What is your answer?' : @survey_question.title
|
||||||
|
|
||||||
|
%div.kinds.boolean{ class: @survey_question.boolean? ? '' : 'hidden'}
|
||||||
|
%input{type: 'radio', name: 'radio'} Yes
|
||||||
|
%br
|
||||||
|
%input{type: 'radio', name: 'radio'} No
|
||||||
|
|
||||||
|
%div.kinds.choice{ id: '', class: @survey_question.choice? ? '' : 'hidden'}
|
||||||
|
- if @survey_question.possible_answers.blank?
|
||||||
|
- if @survey_question.single_choice?
|
||||||
|
%input{ type: 'radio', name: 'radio' } Choice 1
|
||||||
|
%br
|
||||||
|
%input{ type: 'radio', name: 'radio' } Choice 2
|
||||||
|
%br
|
||||||
|
%input{ type: 'radio', name: 'radio' } Choice 3
|
||||||
|
- else
|
||||||
|
%input{ type: 'checkbox', name: 'checkbox' } Choice 1
|
||||||
|
%br
|
||||||
|
%input{ type: 'checkbox', name: 'checkbox' } Choice 2
|
||||||
|
%br
|
||||||
|
%input{ type: 'checkbox', name: 'checkbox' } Choice 3
|
||||||
|
- else
|
||||||
|
- @survey_question.possible_answers.split(',').map(&:strip).each do |option|
|
||||||
|
- if @survey_question.single_choice?
|
||||||
|
%input{ type: 'radio', name: 'radio' }
|
||||||
|
= option
|
||||||
|
%br
|
||||||
|
- else
|
||||||
|
%input{ type: 'checkbox', name: 'checkbox' }
|
||||||
|
= option
|
||||||
|
%br
|
||||||
|
|
||||||
|
%div.kinds.string{ class: @survey_question.string? ? '' : 'hidden'}
|
||||||
|
%input.form-control
|
||||||
|
|
||||||
|
%div.kinds.text{ class: @survey_question.text? ? '' : 'hidden'}
|
||||||
|
%textarea.form-control{ rows: 4 }
|
||||||
|
|
||||||
|
|
||||||
|
%div.kinds.datetime{ class: @survey_question.datetime? ? '' : 'hidden'}
|
||||||
|
.form-group{class: 'datetimepicker'}
|
||||||
|
.input-group
|
||||||
|
.input-group-addon
|
||||||
|
%span.fa.fa-calendar
|
||||||
|
%input.form-control{readonly: 'readonly'}
|
||||||
|
|
||||||
|
%div.kinds.numeric{ class: @survey_question.numeric? ? '' : 'hidden'}
|
||||||
|
%input.form-control{ type: 'number' }
|
||||||
|
|
||||||
|
= f.submit 'Save', class: 'btn btn-primary'
|
||||||
27
app/views/admin/survey_questions/_questions.html.haml
Normal file
27
app/views/admin/survey_questions/_questions.html.haml
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
%table.table.table-hover#questions
|
||||||
|
%th Enabled
|
||||||
|
%th Question
|
||||||
|
%th Type
|
||||||
|
%th Answers
|
||||||
|
%th Actions
|
||||||
|
- @questions.each do |q|
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
= hidden_field_tag "conference[question_ids][]", nil
|
||||||
|
= check_box_tag "conference[question_ids][]", q.id,
|
||||||
|
@conference.question_ids.include?(q.id), id: dom_id(q)
|
||||||
|
%td
|
||||||
|
= q.title
|
||||||
|
%td
|
||||||
|
= q.question_type.title
|
||||||
|
%td
|
||||||
|
= q.answers.map {|a| a.title}.join(', ')
|
||||||
|
|
||||||
|
%td
|
||||||
|
.btn-group
|
||||||
|
= link_to 'Show', admin_conference_question_path(@conference.short_title, q), class: 'btn btn-success'
|
||||||
|
= link_to 'Edit', edit_admin_conference_question_path(@conference.short_title, q),
|
||||||
|
class: 'btn btn-primary', disabled: !(can? :update, q)
|
||||||
|
= link_to 'Delete', admin_conference_question_path(@conference.short_title, q),
|
||||||
|
method: :delete, remote: true, class: 'btn btn-danger',
|
||||||
|
confirm: "Delete question '#{q.title}'?", disabled: !(can? :destroy, q)
|
||||||
1
app/views/admin/survey_questions/destroy.js.erb
Normal file
1
app/views/admin/survey_questions/destroy.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
$('#myquestions').html("<%= escape_javascript(render :partial => 'questions') %>");
|
||||||
1
app/views/admin/survey_questions/edit.html.haml
Normal file
1
app/views/admin/survey_questions/edit.html.haml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
= render partial: 'form'
|
||||||
33
app/views/admin/survey_questions/index.html.haml
Normal file
33
app/views/admin/survey_questions/index.html.haml
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.page-header
|
||||||
|
%h1
|
||||||
|
Questions for survey
|
||||||
|
= link_to @survey.title, admin_conference_survey_path(@conference.short_title, @survey)
|
||||||
|
= "(#{@survey_questions.length})"
|
||||||
|
|
||||||
|
- if @survey_questions.any?
|
||||||
|
%table.table
|
||||||
|
%thead
|
||||||
|
%th
|
||||||
|
%th Title
|
||||||
|
%th Kind
|
||||||
|
%th Possible Answers
|
||||||
|
%th Mandatory
|
||||||
|
%th Answers
|
||||||
|
%th Actions
|
||||||
|
%tbody
|
||||||
|
- @survey_questions.each.with_index(1) do |survey_question, index|
|
||||||
|
%tr
|
||||||
|
%td= index
|
||||||
|
%td= survey_question.title
|
||||||
|
%td= survey_question.kind
|
||||||
|
%td= survey_question.possible_answers
|
||||||
|
%td= survey_question.mandatory
|
||||||
|
%td
|
||||||
|
%td
|
||||||
|
.btn-group
|
||||||
|
= link_to 'Edit', edit_admin_conference_survey_survey_question_path(@conference.short_title, @survey, survey_question), class: 'btn btn-primary'
|
||||||
|
= link_to 'Delete', admin_conference_survey_survey_question_path(@conference.short_title, @survey, survey_question), method: :delete, data: { confirm: 'Are you sure you want to delete this question?' }, class: 'btn btn-danger'
|
||||||
|
|
||||||
|
= link_to 'Add', new_admin_conference_survey_survey_question_path(@conference.short_title, @survey), class: 'btn btn-success pull-right'
|
||||||
26
app/views/admin/survey_questions/show.html.haml
Normal file
26
app/views/admin/survey_questions/show.html.haml
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.page-header
|
||||||
|
%h1= @question.title
|
||||||
|
- @question.answers.each do |answer|
|
||||||
|
= answer.title
|
||||||
|
(#{answer.qanswers.find_by(question: @question).registrations.where(conference: @conference).count})
|
||||||
|
|
||||||
|
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
|
||||||
|
%table.table.table-border.table-hover.datatable#question_users
|
||||||
|
%thead
|
||||||
|
%th Name
|
||||||
|
%th Username
|
||||||
|
%th Email
|
||||||
|
%th Answer
|
||||||
|
%tbody
|
||||||
|
- @registrations.each do |registration|
|
||||||
|
%tr
|
||||||
|
%td= registration.name
|
||||||
|
%td= registration.username
|
||||||
|
%td= registration.email
|
||||||
|
%td= registration.qanswers.find_by(question: @question).answer.title
|
||||||
15
app/views/admin/surveys/_form.html.haml
Normal file
15
app/views/admin/surveys/_form.html.haml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.page-header
|
||||||
|
%h1 New Survey
|
||||||
|
|
||||||
|
.col-md-6
|
||||||
|
= semantic_form_for @survey, url: @url do |f|
|
||||||
|
= f.hidden_field :surveyable_type
|
||||||
|
= f.hidden_field :surveyable_id
|
||||||
|
= f.input :title
|
||||||
|
= f.input :description, input_html: { rows: 3 }
|
||||||
|
= f.input :target, as: :select, collection: Survey.targets.keys, label: "When to ask"
|
||||||
|
= f.input :start_date, as: :string, input_html: { class: 'datetimepicker' }
|
||||||
|
= f.input :end_date, as: :string, input_html: { class: 'datetimepicker' }
|
||||||
|
= f.submit 'Save', class: 'btn btn-primary'
|
||||||
60
app/views/admin/surveys/_survey_question.html.haml
Normal file
60
app/views/admin/surveys/_survey_question.html.haml
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
.panel.panel-default
|
||||||
|
.panel-heading
|
||||||
|
%span.badge
|
||||||
|
= question_index
|
||||||
|
= survey_question.title
|
||||||
|
ID
|
||||||
|
= survey_question.id
|
||||||
|
|
||||||
|
- if survey_question.multiple_choice?
|
||||||
|
( Select
|
||||||
|
- if survey_question.min_choices != survey_question.max_choices
|
||||||
|
a minimum of
|
||||||
|
= survey_question.min_choices
|
||||||
|
- if survey_question.min_choices != survey_question.max_choices
|
||||||
|
and a maximum of
|
||||||
|
= survey_question.max_choices
|
||||||
|
choices )
|
||||||
|
- if survey_question.mandatory
|
||||||
|
%span.fa.fa-asterisk.text-danger
|
||||||
|
- if can? :edit, @survey
|
||||||
|
%p.pull-right
|
||||||
|
= link_to edit_admin_conference_survey_survey_question_path(@conference.short_title, @survey, survey_question) do
|
||||||
|
%span.fa.fa-edit
|
||||||
|
= link_to admin_conference_survey_survey_question_path(@conference.short_title, @survey, survey_question), method: :delete, data: { confirm: 'Are you sure you want to delete this question?' } do
|
||||||
|
%span.fa.fa-times
|
||||||
|
.panel-body
|
||||||
|
%input{ type: 'hidden', name: "survey_question_#{survey_question.id}", value: survey_question.id }
|
||||||
|
|
||||||
|
- if survey_question.boolean?
|
||||||
|
%input{ type: 'radio', name: "survey_question_#{survey_question.id}_reply", value: 'Yes' }
|
||||||
|
Yes
|
||||||
|
%input{ type: 'radio', name: "survey_question_#{survey_question.id}_reply", value: 'No' }
|
||||||
|
No
|
||||||
|
|
||||||
|
- elsif survey_question.choice?
|
||||||
|
- possible_answers = survey_question.possible_answers.split(',').map(&:strip)
|
||||||
|
|
||||||
|
- possible_answers.each do |answer|
|
||||||
|
- if survey_question.single_choice?
|
||||||
|
%input{ type: 'radio', name: "survey_question_#{survey_question.id}_reply", value: answer }
|
||||||
|
= label_tag answer
|
||||||
|
%br
|
||||||
|
- else
|
||||||
|
= hidden_field_tag "survey_submission[survey_question_#{survey_question.id}][survey_reply_ids][]", nil
|
||||||
|
= check_box_tag "survey_submission[survey_question_#{survey_question.id}][survey_reply_ids][]", possible_answers.index, false
|
||||||
|
= answer
|
||||||
|
%br
|
||||||
|
- elsif survey_question.string?
|
||||||
|
%input.form-control{ name: "survey_question_#{survey_question.id}" }
|
||||||
|
- elsif survey_question.text?
|
||||||
|
%textarea.form-control{ rows: 4, name: "survey_question_#{survey_question.id}" }
|
||||||
|
- elsif survey_question.datetime?
|
||||||
|
.form-group{ class: 'datetimepicker' }
|
||||||
|
.input-group
|
||||||
|
.input-group-addon
|
||||||
|
%span.fa.fa-calendar
|
||||||
|
%input.form-control{ readonly: 'readonly', name: "survey_question_#{survey_question.id}" }
|
||||||
|
- elsif survey_question.numeric?
|
||||||
|
%input.form-control{ type: 'number', name: "survey_question_#{survey_question.id}" }
|
||||||
|
|
||||||
1
app/views/admin/surveys/edit.html.haml
Normal file
1
app/views/admin/surveys/edit.html.haml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
= render partial: 'form'
|
||||||
38
app/views/admin/surveys/index.html.haml
Normal file
38
app/views/admin/surveys/index.html.haml
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.page-header
|
||||||
|
%h1
|
||||||
|
Surveys
|
||||||
|
= link_to 'New', new_admin_conference_survey_path(@conference.short_title, survey: { surveyable_type: 'Conference', surveyable_id: @conference.id }), class: 'btn btn-success pull-right'
|
||||||
|
%p.text-muted
|
||||||
|
Available surveys for this conference
|
||||||
|
|
||||||
|
|
||||||
|
- if @surveys.any?
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
%table.table.table-hover#surveys
|
||||||
|
%thead
|
||||||
|
%th Title
|
||||||
|
%th When
|
||||||
|
%th Start Date
|
||||||
|
%th End Date
|
||||||
|
%th Actions
|
||||||
|
%tbody
|
||||||
|
- @surveys.each_with_index do |survey, index|
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
= link_to survey.title, admin_conference_survey_path(@conference.short_title, survey)
|
||||||
|
%td
|
||||||
|
= survey.target
|
||||||
|
%td
|
||||||
|
= survey.start_date
|
||||||
|
%td
|
||||||
|
= survey.end_date
|
||||||
|
%td
|
||||||
|
.btn-group
|
||||||
|
= link_to 'Edit', edit_admin_conference_survey_path(@conference.short_title, survey),
|
||||||
|
class: 'btn btn-primary'
|
||||||
|
= link_to 'Delete', admin_conference_survey_path(@conference.short_title, survey),
|
||||||
|
method: :delete, class: 'btn btn-danger',
|
||||||
|
data: { confirm: "Do you really want to delete #{survey.title}?"}
|
||||||
14
app/views/admin/surveys/new.html.haml
Normal file
14
app/views/admin/surveys/new.html.haml
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.page-header
|
||||||
|
%h1 New Survey
|
||||||
|
|
||||||
|
.col-md-6
|
||||||
|
= semantic_form_for @survey, url: @url do |f|
|
||||||
|
= f.hidden_field :surveyable_type
|
||||||
|
= f.hidden_field :surveyable_id
|
||||||
|
= f.input :title
|
||||||
|
= f.input :description, input_html: { rows: 3 }
|
||||||
|
= f.input :start_date, as: :string, input_html: { class: 'datetimepicker' }
|
||||||
|
= f.input :end_date, as: :string, input_html: { class: 'datetimepicker' }
|
||||||
|
= f.submit 'Save', class: 'btn btn-primary'
|
||||||
19
app/views/admin/surveys/show.html.haml
Normal file
19
app/views/admin/surveys/show.html.haml
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.page-header
|
||||||
|
%h1
|
||||||
|
Survey #{@survey.title}
|
||||||
|
= link_to 'Edit Survey', edit_admin_conference_survey_path(@conference.short_title, @survey), class: 'btn btn-primary pull-right'
|
||||||
|
%p.text-muted
|
||||||
|
From:
|
||||||
|
= @survey.start_date
|
||||||
|
to
|
||||||
|
= @survey.end_date
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
= semantic_form_for 'survey_submission', url: '#' do |f|
|
||||||
|
- @survey.survey_questions.each.with_index(1) do |survey_question, index|
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
= render partial: 'survey_question', locals: { survey_question: survey_question, index: index, f: f }
|
||||||
|
= link_to 'Add Question', new_admin_conference_survey_survey_question_path(@conference.short_title, @survey), class: 'btn btn-success pull-right'
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
- if @conference.questions.any?
|
|
||||||
= render partial: 'conference_registrations/questions', locals: { f: f }
|
|
||||||
- if @conference.program.events.with_registration_open.any? || @registration.events.any?
|
- if @conference.program.events.with_registration_open.any? || @registration.events.any?
|
||||||
= f.inputs 'Pre-registration required for the following:' do
|
= f.inputs 'Pre-registration required for the following:' do
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,24 +36,20 @@
|
||||||
= @registration.departure.strftime('%A, %B %-d. %Y %H:%M')
|
= @registration.departure.strftime('%A, %B %-d. %Y %H:%M')
|
||||||
- else
|
- else
|
||||||
You haven't scheduled your departure
|
You haven't scheduled your departure
|
||||||
- if @conference.questions.any?
|
- if @conference.surveys.for_registration.any?
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
%h4
|
%h4
|
||||||
%span.fa-stack
|
%span.fa-stack
|
||||||
%i.fa.fa-square-o.fa-stack-2x
|
%i.fa.fa-square-o.fa-stack-2x
|
||||||
%i.fa.fa-info.fa-stack-1x
|
%i.fa.fa-info.fa-stack-1x
|
||||||
Additional Info
|
Surveys
|
||||||
|
|
||||||
%ul
|
%ul
|
||||||
- @conference.questions.each do |q|
|
- @conference.surveys.for_registration.each do |survey|
|
||||||
%li
|
%li
|
||||||
%strong
|
= link_to survey.title, conference_survey_path(@conference.short_title, survey)
|
||||||
= q.title
|
|
||||||
- if @registration.qanswers.any?
|
|
||||||
- @registration.qanswers.where(:question_id => q.id).each do |qa|
|
|
||||||
= qa.answer.title
|
|
||||||
- else
|
|
||||||
You haven't answered
|
|
||||||
- if @registration.events.any?
|
- if @registration.events.any?
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,10 @@
|
||||||
= link_to(admin_conference_emails_path(@conference.short_title)) do
|
= link_to(admin_conference_emails_path(@conference.short_title)) do
|
||||||
%span.fa.fa-envelope
|
%span.fa.fa-envelope
|
||||||
E-Mails
|
E-Mails
|
||||||
|
%li{ class: active_nav_li(admin_conference_surveys_path(@conference.short_title)) }
|
||||||
|
= link_to(admin_conference_surveys_path(@conference.short_title)) do
|
||||||
|
%span.fa.fa-list-alt
|
||||||
|
Surveys
|
||||||
- if can? :index, Role.new(resource: @conference)
|
- if can? :index, Role.new(resource: @conference)
|
||||||
%li{:class=> active_nav_li(admin_conference_roles_path(@conference.short_title))}
|
%li{:class=> active_nav_li(admin_conference_roles_path(@conference.short_title))}
|
||||||
= link_to(admin_conference_roles_path(@conference.short_title)) do
|
= link_to(admin_conference_roles_path(@conference.short_title)) do
|
||||||
|
|
|
||||||
22
app/views/survey_submissions/_form.html.haml
Normal file
22
app/views/survey_submissions/_form.html.haml
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
.row
|
||||||
|
.col-md-10.col-md-offset-1
|
||||||
|
.page-header
|
||||||
|
%h1
|
||||||
|
Survey #{@survey.title}
|
||||||
|
- if can? :edit, @survey
|
||||||
|
= link_to 'Edit Survey', admin_conference_survey_path(@conference.short_title, @survey), class: 'btn btn-primary pull-right'
|
||||||
|
%p.text-muted
|
||||||
|
From:
|
||||||
|
= @survey.start_date
|
||||||
|
to
|
||||||
|
= @survey.end_date
|
||||||
|
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
= semantic_form_for @survey_submission, url: conference_survey_reply_path(@conference.short_title, @survey) do |f|
|
||||||
|
- @survey.survey_questions.each.with_index(1) do |survey_question, question_index|
|
||||||
|
.row
|
||||||
|
.col-md-10.col-md-offset-1
|
||||||
|
|
||||||
|
= render partial: 'admin/surveys/survey_question', locals: { survey_question: survey_question, question_index: question_index, f: f }
|
||||||
|
= f.submit 'Submit', class: 'btn btn-primary pull-right'
|
||||||
22
app/views/surveys/show.html.haml
Normal file
22
app/views/surveys/show.html.haml
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
.row
|
||||||
|
.col-md-10.col-md-offset-1
|
||||||
|
.page-header
|
||||||
|
%h1
|
||||||
|
Survey #{@survey.title}
|
||||||
|
- if can? :edit, @survey
|
||||||
|
= link_to 'Edit Survey', admin_conference_survey_path(@conference.short_title, @survey), class: 'btn btn-primary pull-right'
|
||||||
|
%p.text-muted
|
||||||
|
From:
|
||||||
|
= @survey.start_date
|
||||||
|
to
|
||||||
|
= @survey.end_date
|
||||||
|
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
= semantic_form_for @survey_submission, url: conference_survey_reply_path(@conference.short_title, @survey) do |f|
|
||||||
|
- @survey.survey_questions.each.with_index(1) do |survey_question|
|
||||||
|
.row
|
||||||
|
.col-md-10.col-md-offset-1
|
||||||
|
= f.semantic_fields_for :survey_reply do |myreply, index|
|
||||||
|
= render partial: 'admin/surveys/survey_question', locals: { survey_question: survey_question, index: index, myreply: myreply }
|
||||||
|
= f.submit 'Submit', class: 'btn btn-primary pull-right'
|
||||||
|
|
@ -21,6 +21,9 @@ Osem::Application.routes.draw do
|
||||||
resources :users
|
resources :users
|
||||||
resources :comments, only: [:index]
|
resources :comments, only: [:index]
|
||||||
resources :conference do
|
resources :conference do
|
||||||
|
resources :surveys do
|
||||||
|
resources :survey_questions
|
||||||
|
end
|
||||||
resource :contact, except: [:index, :new, :create, :show, :destroy]
|
resource :contact, except: [:index, :new, :create, :show, :destroy]
|
||||||
resource :schedule, only: [:show, :update]
|
resource :schedule, only: [:show, :update]
|
||||||
get 'commercials/render_commercial' => 'commercials#render_commercial'
|
get 'commercials/render_commercial' => 'commercials#render_commercial'
|
||||||
|
|
@ -93,6 +96,10 @@ Osem::Application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :conference, only: [:index, :show] do
|
resources :conference, only: [:index, :show] do
|
||||||
|
resources :surveys, only: [:show] do
|
||||||
|
resource :survey_submission
|
||||||
|
post :reply
|
||||||
|
end
|
||||||
resource :program, only: [] do
|
resource :program, only: [] do
|
||||||
resources :proposal, except: :destroy do
|
resources :proposal, except: :destroy do
|
||||||
get 'commercials/render_commercial' => 'commercials#render_commercial'
|
get 'commercials/render_commercial' => 'commercials#render_commercial'
|
||||||
|
|
|
||||||
13
db/migrate/20160627122446_create_surveys.rb
Normal file
13
db/migrate/20160627122446_create_surveys.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
class CreateSurveys < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :surveys do |t|
|
||||||
|
t.datetime :start_date
|
||||||
|
t.datetime :end_date
|
||||||
|
t.string :title
|
||||||
|
t.text :description
|
||||||
|
t.references :surveyable, polymorphic: true, index: true
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
13
db/migrate/20160628093634_create_survey_questions.rb
Normal file
13
db/migrate/20160628093634_create_survey_questions.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
class CreateSurveyQuestions < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :survey_questions do |t|
|
||||||
|
t.references :survey
|
||||||
|
t.string :title
|
||||||
|
t.integer :kind, default: 0
|
||||||
|
t.integer :min_choices
|
||||||
|
t.integer :max_choices
|
||||||
|
t.text :possible_answers
|
||||||
|
t.boolean :mandatory, default: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
5
db/migrate/20160629145954_add_target_to_surveys.rb
Normal file
5
db/migrate/20160629145954_add_target_to_surveys.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddTargetToSurveys < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :surveys, :target, :integer, default: 0
|
||||||
|
end
|
||||||
|
end
|
||||||
11
db/migrate/20160630094850_create_survey_replies.rb
Normal file
11
db/migrate/20160630094850_create_survey_replies.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
class CreateSurveyReplies < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :survey_replies do |t|
|
||||||
|
t.integer :survey_question_id
|
||||||
|
t.integer :user_id
|
||||||
|
t.text :text
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
10
db/migrate/20160630130731_create_survey_submissions.rb
Normal file
10
db/migrate/20160630130731_create_survey_submissions.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
class CreateSurveySubmissions < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :survey_submissions do |t|
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :survey_id
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
41
db/schema.rb
41
db/schema.rb
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20160624151257) do
|
ActiveRecord::Schema.define(version: 20160630130731) do
|
||||||
|
|
||||||
create_table "ahoy_events", force: :cascade do |t|
|
create_table "ahoy_events", force: :cascade do |t|
|
||||||
t.uuid "visit_id", limit: 16
|
t.uuid "visit_id", limit: 16
|
||||||
|
|
@ -379,6 +379,45 @@ ActiveRecord::Schema.define(version: 20160624151257) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "survey_questions", force: :cascade do |t|
|
||||||
|
t.integer "survey_id"
|
||||||
|
t.string "title"
|
||||||
|
t.integer "kind", default: 0
|
||||||
|
t.integer "min_choices"
|
||||||
|
t.integer "max_choices"
|
||||||
|
t.text "possible_answers"
|
||||||
|
t.boolean "mandatory", default: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "survey_replies", force: :cascade do |t|
|
||||||
|
t.integer "survey_question_id"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.text "text"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "survey_submissions", force: :cascade do |t|
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "survey_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "surveys", force: :cascade do |t|
|
||||||
|
t.datetime "start_date"
|
||||||
|
t.datetime "end_date"
|
||||||
|
t.string "title"
|
||||||
|
t.text "description"
|
||||||
|
t.integer "surveyable_id"
|
||||||
|
t.string "surveyable_type"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.integer "target", default: 0
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "surveys", ["surveyable_type", "surveyable_id"], name: "index_surveys_on_surveyable_type_and_surveyable_id"
|
||||||
|
|
||||||
create_table "targets", force: :cascade do |t|
|
create_table "targets", force: :cascade do |t|
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
t.integer "campaign_id"
|
t.integer "campaign_id"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue