Class: HelenaAdministration::QuestionGroupsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/helena_administration/question_groups_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#add_breadcrumb, #authenticate_administrator, #set_locale

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/helena_administration/question_groups_controller.rb', line 17

def create
  @question_group = @version.question_groups.build question_group_params
  if @question_group.save
    flash[:success] = t 'shared.actions.created'
  else
    flash.now[:danger] = t 'shared.actions.error'
  end
  respond_with [@survey, @version, @question_group]
end

#destroyObject



41
42
43
44
# File 'app/controllers/helena_administration/question_groups_controller.rb', line 41

def destroy
  flash[:success] = t 'shared.actions.deleted' if @question_group.destroy
  respond_with @question_group, location: [@survey, @version]
end

#editObject



27
28
29
# File 'app/controllers/helena_administration/question_groups_controller.rb', line 27

def edit
  add_breadcrumb @question_group.title
end

#newObject



12
13
14
15
# File 'app/controllers/helena_administration/question_groups_controller.rb', line 12

def new
  @question_group = @version.question_groups.build
  add_breadcrumb t('.new')
end

#showObject



8
9
10
# File 'app/controllers/helena_administration/question_groups_controller.rb', line 8

def show
  add_breadcrumb @question_group.title
end

#updateObject



31
32
33
34
35
36
37
38
39
# File 'app/controllers/helena_administration/question_groups_controller.rb', line 31

def update
  if @question_group.update_attributes(question_group_params)
    flash[:success] = t 'shared.actions.updated'
  else
    flash.now[:danger] = t 'shared.actions.error'
    add_breadcrumb @question_group.title_was
  end
  respond_with [@survey, @version, @question_group]
end