Class: Spina::Admin::NavigationsController

Inherits:
AdminController show all
Defined in:
app/controllers/spina/admin/navigations_controller.rb

Instance Method Summary collapse

Methods inherited from AdminController

#current_admin_path

Instance Method Details

#editObject



13
14
15
16
17
# File 'app/controllers/spina/admin/navigations_controller.rb', line 13

def edit        
  add_breadcrumb @navigation.label, spina.admin_navigation_path(@navigation)
  add_breadcrumb t('spina.edit')
  render layout: 'spina/admin/admin'
end

#showObject



9
10
11
# File 'app/controllers/spina/admin/navigations_controller.rb', line 9

def show        
  add_breadcrumb t('spina.website.pages')
end

#sortObject



27
28
29
30
31
32
33
# File 'app/controllers/spina/admin/navigations_controller.rb', line 27

def sort
  params[:list].each_pair do |parent_pos, parent_node|
    update_child_pages_position(parent_node)
    update_navigation_item_position(parent_node[:id], parent_pos, nil)
  end
  head :ok
end

#updateObject



19
20
21
22
23
24
25
# File 'app/controllers/spina/admin/navigations_controller.rb', line 19

def update        
  if @navigation.update(navigation_params)
    redirect_to spina.admin_navigation_path(@navigation)
  else
    render :edit
  end
end