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, #set_locale

Instance Method Details

#createObject



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

def create
  @question_group = @version.question_groups.build question_group_params
  # Note: Not used at the moment, because there are no validations atm
  # if @question_group.save
  #   flash[:success] = t 'shared.actions.created'
  # else
  #   flash.now[:danger] = t 'shared.actions.error'
  # end
  flash[:success] = t 'shared.actions.created' if @question_group.save
  respond_with @question_group, location: [@survey, @version, @question_group]
end

#destroyObject



47
48
49
50
# File 'app/controllers/helena_administration/question_groups_controller.rb', line 47

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

#editObject



29
30
31
# File 'app/controllers/helena_administration/question_groups_controller.rb', line 29

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



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/helena_administration/question_groups_controller.rb', line 33

def update
  flash[:success] = t('shared.actions.updated') if @question_group.update_attributes(question_group_params)

  # Note: Not used at the moment, because there are no validations atm
  # 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 @question_group, location: [@survey, @version, @question_group]
end