Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Admin::UserImagesController < ApplicationController
- before_filter :login_required, :require_ssl
- def index
- @user_images = UserImage.find(:all, :conditions => 'thumbnail is null')
- respond_to do |format|
- format.html { render :template => '/admin/user_images/index.rhtml.erb' }
- format.js { render :template => '/admin/user_images/index.rjs', :layout => false}
- end
- end
- def new
- @user_image = UserImage.new
- end
- def edit
- @user_image = UserImage.find(params[:id])
- end
- def create
- @user_image = UserImage.new(params[:user_image])
- if @user_image.save
- flash[:notice] = 'Image was successfully created.'
- redirect_to user_images_url
- else
- render :action => "new"
- end
- end
- def update
- @user_image = UserImage.find(params[:id])
- if @user_image.update_attributes(params[:user_image])
- flash[:notice] = 'Image was successfully updated.'
- redirect_to user_images_url
- else
- render :action => "edit"
- end
- end
- def destroy
- @user_image = UserImage.find(params[:id])
- @user_image.destroy
- redirect_to user_images_url
- end
- # only allow ADMIN's
- def authorized?
- current_user.can_manage_user_images?
- end
- end
Add Comment
Please, Sign In to add comment