Class: HelenaAdministration::QuestionsController
Instance Method Summary
collapse
#add_breadcrumb, #authenticate_administrator, #set_locale
Instance Method Details
#create ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/helena_administration/questions_controller.rb', line 17
def create
@question = @question_group.questions.build question_params
if @question.save
flash[:success] = t 'shared.actions.created'
else
flash.now[:danger] = t 'shared.actions.error'
end
respond_with [@survey, @version, @question_group, @question]
end
|
#destroy ⇒ Object
43
44
45
46
|
# File 'app/controllers/helena_administration/questions_controller.rb', line 43
def destroy
flash[:success] = t 'shared.actions.deleted' if @question.destroy
respond_with @question_group, location: [@survey, @version, @question_group]
end
|
#edit ⇒ Object
27
28
29
30
|
# File 'app/controllers/helena_administration/questions_controller.rb', line 27
def edit
add_ressources
add_breadcrumb @question.code
end
|
#new ⇒ Object
12
13
14
15
|
# File 'app/controllers/helena_administration/questions_controller.rb', line 12
def new
@question = @question_group.questions.build
add_breadcrumb t('.new')
end
|
#show ⇒ Object
8
9
10
|
# File 'app/controllers/helena_administration/questions_controller.rb', line 8
def show
add_breadcrumb @question.code
end
|
#update ⇒ Object
32
33
34
35
36
37
38
39
40
41
|
# File 'app/controllers/helena_administration/questions_controller.rb', line 32
def update
if @question.update_attributes(question_params)
flash[:success] = t 'shared.actions.updated'
else
flash[:danger] = t 'shared.actions.error'
add_breadcrumb @question.code_was
end
add_ressources
respond_with @question, location: [@survey, @version, @question_group, @question]
end
|