Sha256: a21573fa72fd2230b8dc0890593fd2370a05259d15bdaef73baf5882ec0253c2

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

module Slightcms
  
  module Admin
    
    class AssetsController < ApplicationController
    
      layout "slightcms_admin_assets"
      
      # List all Assets
      def index
        @assets = Slightcms::Asset.find :all
      end
      
      # Render the form for uploading a new asset
      def new
        @asset = Slightcms::Asset.new
      end
      
      # Create a new Assert
      def create
        @asset = Slightcms::Asset.new(params[:slightcms_asset])
        if @asset.save
          flash[:notice] = "The asset was saved successfully."
          redirect_to slightcms_admin_assets_path
        else
          flash[:error] = "An error occured uploading your asset!"
          render :action => :new
        end
      end
      
      # Delet an existing asset
      def destroy
        @asset = Slightcms::Asset.find(params[:id])
        if @asset.destroy
          flash[:notice] = "The asset was deleted successfully."
          redirect_to slightcms_admin_assets_path
        else
          flash[:error] = "An error occured deleting the asset!"
          redirect_to slightcms_admin_assets_path
        end
      end
    
    end
  
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slightcms-0.0.11 lib/app/controller/slightcms/admin/assets_controller.rb