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