class Settings::MenuItemOptionsController < ApplicationController
  load_and_authorize_resource except: [:create]
  before_action :set_settings_menu_item_option, only: [:show, :edit, :update, :destroy]

  # GET /settings/menu_item_options
  # GET /settings/menu_item_options.json
  def index
    @settings_menu_item_options = MenuItemOption.all
  end

  # GET /settings/menu_item_options/1
  # GET /settings/menu_item_options/1.json
  def show
  end

  # GET /settings/menu_item_options/new
  def new
    @settings_menu_item_option = MenuItemOption.new
  end

  # GET /settings/menu_item_options/1/edit
  def edit
  end

  # POST /settings/menu_item_options
  # POST /settings/menu_item_options.json
  def create
    @settings_menu_item_option = MenuItemOption.new(settings_menu_item_option_params)

    respond_to do |format|
      if @settings_menu_item_option.save
        format.html { redirect_to settings_menu_item_options_path, notice: 'Menu item option was successfully created.' }
        format.json { render :show, status: :created, location: @settings_menu_item_option }
      else
        format.html { render :new }
        format.json { render json: @settings_menu_item_option.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /settings/menu_item_options/1
  # PATCH/PUT /settings/menu_item_options/1.json
  def update
    respond_to do |format|
      if @settings_menu_item_option.update(settings_menu_item_option_params)
        format.html { redirect_to settings_menu_item_option_path(@settings_menu_item_option), notice: 'Menu item option was successfully updated.' }
        format.json { render :show, status: :ok, location: @settings_menu_item_option }
      else
        format.html { render :edit }
        format.json { render json: @settings_menu_item_option.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /settings/menu_item_options/1
  # DELETE /settings/menu_item_options/1.json
  def destroy
    @settings_menu_item_option.destroy
    respond_to do |format|
      format.html { redirect_to settings_menu_item_options_path, notice: 'Menu item option was successfully destroyed.' }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_settings_menu_item_option
      @settings_menu_item_option = MenuItemOption.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def settings_menu_item_option_params
      params.require(:menu_item_option).permit(:name, :value)
    end
end
