app/controllers/katalyst/navigation/menus_controller.rb in katalyst-navigation-1.3.0 vs app/controllers/katalyst/navigation/menus_controller.rb in katalyst-navigation-1.3.1

- old
+ new

@@ -7,43 +7,44 @@ sort, menus = table_sort(Menu.all) render locals: { menus: menus, sort: sort } end + def show + menu = Menu.find(params[:id]) + + render locals: { menu: menu } + end + def new render locals: { menu: Menu.new } end + def edit + menu = Menu.find(params[:id]) + + render locals: { menu: menu } + end + def create @menu = Menu.new(menu_params) if @menu.save redirect_to @menu else render :new, locals: { menu: @menu }, status: :unprocessable_entity end end - def show - menu = Menu.find(params[:id]) - - render locals: { menu: menu } - end - - def edit - menu = Menu.find(params[:id]) - - render locals: { menu: menu } - end - # PATCH /admins/navigation_menus/:slug def update menu = Menu.find(params[:id]) menu.attributes = menu_params unless menu.valid? - return render :show, locals: { menu: menu }, status: :unprocessable_entity + return render turbo_stream: helpers.navigation_editor_errors(menu: menu), + status: :unprocessable_entity end case params[:commit] when "publish" menu.save!