Class: Backend::Navigation::ItemsController

Inherits:
BaseController
  • Object
show all
Includes:
Concerns::Backend::PositionableController, Concerns::Backend::TranslatableController
Defined in:
app/controllers/backend/navigation/items_controller.rb

Instance Method Summary collapse

Methods included from Concerns::Backend::PositionableController

#update_position

Methods included from Concerns::Backend::TranslatableController

#update_translation

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
# File 'app/controllers/backend/navigation/items_controller.rb', line 13

def create
  @model = @navigation.items.new(allowed_params).decorate

  if @model.save
    redirect_to backend_navigations_path, notice: translate_notice(:added, :navigation_item)
  else
    render :new
  end
end

#destroyObject



31
32
33
34
# File 'app/controllers/backend/navigation/items_controller.rb', line 31

def destroy
  @model.destroy
  redirect_to backend_navigations_path, notice: translate_notice(:deleted, :navigation_item)
end

#newObject



9
10
11
# File 'app/controllers/backend/navigation/items_controller.rb', line 9

def new
  @model = @navigation.items.new.decorate
end

#updateObject



23
24
25
26
27
28
29
# File 'app/controllers/backend/navigation/items_controller.rb', line 23

def update
  if @model.update_attributes allowed_params
    redirect_to backend_navigations_path, notice: translate_notice(:changes_saved)
  else
    render :edit
  end
end