Sha256: 1e7025512a839463aded0447d8e9ddee6ca73ac64da49c0ec6d78a50e3c725e7

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

# -*- encoding : utf-8 -*-
module LoyalAdmin
  module LoyalCore
    module Skin
      class RecipesController < ::LoyalAdmin::ApplicationController
        def index
          @loyal_core_skin_recipes = ::LoyalCore::Skin::Recipe.page(params[:page])
        end

        def show
          @loyal_core_skin_recipe = ::LoyalCore::Skin::Recipe.find params[:id]
        end

        def new
          @loyal_core_skin_recipe = ::LoyalCore::Skin::Recipe.new
        end

        def create
          @loyal_core_skin_recipe = ::LoyalCore::Skin::Recipe.new(params[:loyal_core_skin_recipe])

          @loyal_core_skin_recipe.created_by = current_user.id
          @loyal_core_skin_recipe.created_ip = request.remote_ip

          if @loyal_core_skin_recipe.save
            redirect_to loyal_admin_app.loyal_core_skin_recipe_url(:id => @loyal_core_skin_recipe.id)
          else
            render :new
          end
        end

        def edit
          @loyal_core_skin_recipe = ::LoyalCore::Skin::Recipe.find params[:id]
        end

        def update
          @loyal_core_skin_recipe = ::LoyalCore::Skin::Recipe.find params[:id]

          if @loyal_core_skin_recipe.update_attributes(params[:loyal_core_skin_recipe])
            redirect_to loyal_admin_app.loyal_core_skin_recipe_url(:id => @loyal_core_skin_recipe.id)
          else
            render :edit
          end
        end

        def destroy
          @loyal_core_skin_recipe = ::LoyalCore::Skin::Recipe.find params[:id]

          @loyal_core_skin_recipe.destroy

          redirect_to params[:return_to] || loyal_admin_app.loyal_core_skin_recipes_url
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
loyal_admin-0.0.4 app/controllers/loyal_admin/loyal_core/skin/recipes_controller.rb