app/controllers/spina/admin/navigations_controller.rb in spina-1.0.3 vs app/controllers/spina/admin/navigations_controller.rb in spina-1.1.0
- old
+ new
@@ -2,26 +2,24 @@
module Admin
class NavigationsController < AdminController
layout 'spina/admin/pages'
before_action :set_breadcrumb, except: [:show]
+ before_action :set_navigation, only: [:show, :edit, :update]
- def show
- @navigation = Navigation.find(params[:id])
+ def show
add_breadcrumb t('spina.website.pages')
end
- def edit
- @navigation = Navigation.find(params[:id])
+ def edit
add_breadcrumb @navigation.label, spina.admin_navigation_path(@navigation)
add_breadcrumb t('spina.edit')
render layout: 'spina/admin/admin'
end
- def update
- @navigation = Navigation.find(params[:id])
- if @navigation.update_attributes(navigation_params)
+ def update
+ if @navigation.update(navigation_params)
redirect_to spina.admin_navigation_path(@navigation)
else
render :edit
end
end
@@ -53,9 +51,13 @@
add_breadcrumb t('spina.website.pages'), spina.admin_pages_path
end
def navigation_params
params.require(:navigation).permit(:auto_add_pages, page_ids: [])
+ end
+
+ def set_navigation
+ @navigation = Navigation.find(params[:id])
end
end
end
end
\ No newline at end of file