AutoCommit Sam Aug 1 22:03:01 CEST 2015

This commit is contained in:
Andreas Stephanides
2015-08-01 22:03:01 +02:00
parent 2a7ae7c2bf
commit 2b01a87d15
9 changed files with 25 additions and 10 deletions

View File

@@ -18,15 +18,19 @@ class Survey::ChoicesController < ApplicationController
respond_to do |format|
format.html {redirect_to @survey_choice.question}
format.json { render json: @survey_choice }
format.js
end
end
# GET /survey/choices/new
# GET /survey/choices/new.json
def new
@survey_choice = Survey::Choice.new
@question= Survey::Question.find(params[:question_id])
@choice=Survey::Choice.new
@choice.question=@question
respond_to do |format|
format.js
format.html # new.html.erb
format.json { render json: @survey_choice }
end
@@ -43,13 +47,16 @@ class Survey::ChoicesController < ApplicationController
# POST /survey/choices
# POST /survey/choices.json
include PluginsHelper
def create
@survey_choice = Survey::Choice.new(params[:survey_choice])
@divid = divid_for(@survey_choice)
respond_to do |format|
if @survey_choice.save
format.html { redirect_to @survey_choice, notice: 'Choice was successfully created.' }
format.json { render json: @survey_choice, status: :created, location: @survey_choice }
format.js
else
format.html { render action: "new" }
format.json { render json: @survey_choice.errors, status: :unprocessable_entity }

View File

@@ -20,7 +20,10 @@ class Survey::QuestionsController < ApplicationController
end
@survey_question.do_answer(params[:survey_question][:selected],user)
render :show
respond_to do |format|
format.html { redirect_to action: :show}
format.js { render action: :show}
end
end
# GET /survey/questions/1
# GET /survey/questions/1.json