Class: GalleriesController
- Inherits:
-
InheritedResources::Base
- Object
- InheritedResources::Base
- GalleriesController
- Defined in:
- app/controllers/galleries_controller.rb
Instance Method Summary collapse
- #ckeditor_params ⇒ Object
- #create ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #load_user ⇒ Object
- #new ⇒ Object
- #paginated_images_for(gallery) ⇒ Object
- #show ⇒ Object
Instance Method Details
#ckeditor_params ⇒ Object
56 57 58 |
# File 'app/controllers/galleries_controller.rb', line 56 def ckeditor_params params.slice(:CKEditor, :CKEditorFuncNum, :langCode) end |
#create ⇒ Object
41 42 43 |
# File 'app/controllers/galleries_controller.rb', line 41 def create create! {images_path(params.slice(:CKEditor, :CKEditorFuncNum, :langCode))} end |
#edit ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/galleries_controller.rb', line 15 def edit edit! do |format| if params[:CKEditorFuncNum] format.html{ render :action=>:edit, :layout=>"image_dialog" } end end end |
#index ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'app/controllers/galleries_controller.rb', line 5 def index index! do |format| if params[:CKEditorFuncNum] format.html{ render :action=>:index, :layout=>"image_dialog" } end end end |
#load_user ⇒ Object
45 46 47 48 49 |
# File 'app/controllers/galleries_controller.rb', line 45 def load_user unless params[:user_id] @user ||= (current_user ? User.find(current_user.id) : super_user) end end |
#new ⇒ Object
36 37 38 39 |
# File 'app/controllers/galleries_controller.rb', line 36 def new @gallery = Gallery.create(:user=>@user) new! end |
#paginated_images_for(gallery) ⇒ Object
52 53 54 |
# File 'app/controllers/galleries_controller.rb', line 52 def paginated_images_for(gallery) @images ||= Image.where(:gallery_id=>gallery.id).paginate(:page => params[:page], :order => 'created_at DESC' ) end |
#show ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/galleries_controller.rb', line 25 def show show! do |format| @images = paginated_images_for(@gallery) if params[:CKEditorFuncNum] format.html{ render :action=>:show, :layout=>"image_dialog" } end end end |