Sha256: 61b2ba073ddbf2b5ae9876a40a3c68b856eeef9ca9e4152fc4935daa0bdbc3c4
Contents?: true
Size: 1.31 KB
Versions: 13
Compression:
Stored size: 1.31 KB
Contents
class GalleriesController < InheritedResources::Base belongs_to :user, :optional=>true before_filter :load_user def index index! do |format| if params[:CKEditorFuncNum] format.html{ render :action=>:index, :layout=>"image_dialog" } end end end def edit edit! do |format| if params[:CKEditorFuncNum] format.html{ render :action=>:edit, :layout=>"image_dialog" } end end end def show show! do |format| images = paginated_images_for(@gallery) if params[:CKEditorFuncNum] format.html{ render :action=>:show, :layout=>"image_dialog", :locals=>{:images=>images} } end end end def new @gallery = Gallery.create(:user=>@user) new! end def create create! {images_path(params.slice(:CKEditor, :CKEditorFuncNum, :langCode))} end def load_user unless params[:user_id] @user ||= (current_user ? User.find(current_user.id) : User.super_user) end end helper_method :ckeditor_params, :paginated_images_for def paginated_images_for(gallery) @images ||= Image.where(:gallery_id=>gallery.id).paginate(:page => params[:page], :order => 'created_at DESC' ) end def ckeditor_params params.slice(:CKEditor, :CKEditorFuncNum, :langCode) end end
Version data entries
13 entries across 13 versions & 1 rubygems