mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Add surveys; custom generated by admins
Available during registration or after conference Co-authored-by: Shyukri <shshyukriev@suse.com> Co-authored-by: Henne <hvogel@opensuse.org> Co-authored-by: Moises <mdeniz@suse.com>
This commit is contained in:
parent
4e742d170f
commit
9f3c0eff5d
43 changed files with 701 additions and 17 deletions
48
app/controllers/admin/surveys_controller.rb
Normal file
48
app/controllers/admin/surveys_controller.rb
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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), notice: 'Successfully created survey'
|
||||
else
|
||||
redirect_to new_admin_conference_survey_survey_question_path(@conference.short_title, @survey), error: 'Could not create survey.' + @survey.errors.full_messates.to_sentence
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue