Add surveys during proposal submission
This commit is contained in:
parent
4de554e0d4
commit
f8d6283f44
6 changed files with 40 additions and 2 deletions
|
|
@ -12,6 +12,7 @@ class ProposalsController < ApplicationController
|
|||
@event = @program.events.new
|
||||
@event.event_users.new(user: current_user, event_role: 'submitter')
|
||||
@events = current_user.proposals(@conference)
|
||||
@surveys = @conference.surveys.during_proposal.select(&:active?)
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
|
|||
|
|
@ -57,6 +57,10 @@ class Conference < ApplicationRecord
|
|||
has_many :event_types, through: :program
|
||||
|
||||
has_many :surveys, as: :surveyable, dependent: :destroy do
|
||||
def during_proposal
|
||||
where(target: targets[:during_proposal])
|
||||
end
|
||||
|
||||
def for_registration
|
||||
where(target: targets[:during_registration])
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class Survey < ActiveRecord::Base
|
|||
has_many :survey_questions, dependent: :destroy
|
||||
has_many :survey_submissions, dependent: :destroy
|
||||
|
||||
enum target: [:after_conference, :during_registration, :after_event]
|
||||
enum target: [:after_conference, :during_registration, :after_event, :during_proposal]
|
||||
validates :title, presence: true
|
||||
|
||||
##
|
||||
|
|
|
|||
|
|
@ -117,3 +117,10 @@
|
|||
.col-md-12
|
||||
- if can? :create, @event
|
||||
= link_to "New Proposal", new_conference_program_proposal_path(@conference.short_title), class: 'btn btn-success pull-right'
|
||||
|
||||
- if @surveys.any?
|
||||
.row
|
||||
.col-md-12
|
||||
%h2 Surveys
|
||||
|
||||
= render partial: 'surveys/list', locals: { surveys: @surveys, conference: @conference }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue