Class: Binda::FieldGroupsController
Instance Method Summary
collapse
#after_sign_in_path_for, #after_sign_out_path_for
Instance Method Details
#create ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'app/controllers/binda/field_groups_controller.rb', line 23
def create
@field_group = @structure.field_groups.build(field_group_params)
if @field_group.save
reset_field_settings_cache
redirect_to structure_field_group_path( @structure.slug, @field_group.slug ), notice: 'Field group was successfully created.'
else
redirect_to new_structure_field_group_path( @structure.slug ), flash: { alert: @field_group.errors }
end
end
|
#destroy ⇒ Object
49
50
51
52
53
|
# File 'app/controllers/binda/field_groups_controller.rb', line 49
def destroy
@field_group.destroy
reset_field_settings_cache
redirect_to structure_path( @structure.slug ), notice: 'Field group was successfully destroyed.'
end
|
#edit ⇒ Object
20
21
|
# File 'app/controllers/binda/field_groups_controller.rb', line 20
def edit
end
|
#index ⇒ Object
8
9
10
|
# File 'app/controllers/binda/field_groups_controller.rb', line 8
def index
redirect_to structure_field_group_path( @structure.slug )
end
|
#new ⇒ Object
16
17
18
|
# File 'app/controllers/binda/field_groups_controller.rb', line 16
def new
@field_group = @structure.field_groups.build()
end
|
#show ⇒ Object
12
13
14
|
# File 'app/controllers/binda/field_groups_controller.rb', line 12
def show
redirect_to action: :edit
end
|
#update ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/controllers/binda/field_groups_controller.rb', line 34
def update
add_new_field_settings
add_new_choices
check_if_needs_to_update_choices
if @field_group.update(field_group_params)
reset_field_settings_cache
redirect_to structure_field_group_path( @structure.slug, @field_group.slug ), notice: 'Field group was successfully updated.'
else
redirect_to edit_structure_field_group_path( @structure.slug, @field_group.slug ), flash: { alert: @field_group.errors }
end
end
|