Class: Adminpanel::GalleriesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Adminpanel::GalleriesController
- Defined in:
- app/controllers/adminpanel/galleries_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
def edit @gallery = Gallery.find(params) end.
- #destroy ⇒ Object
- #index ⇒ Object
- #move_better ⇒ Object
- #move_worst ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
def edit @gallery = Gallery.find(params) end
17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 17 def create @gallery = Gallery.new(params[:gallery]) if @gallery.save redirect_to gallery_path(@gallery), :notice => t("gallery.success") else render 'new' end end |
#destroy ⇒ Object
39 40 41 42 43 44 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 39 def destroy @gallery = Gallery.find(params[:id]) @gallery.destroy redirect_to galleries_path, :notice => t("gallery.deleted") end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 5 def index @galleries = Gallery.all end |
#move_better ⇒ Object
27 28 29 30 31 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 27 def move_better @gallery = Gallery.find(params[:id]) @gallery.move_to_better_position respond end |
#move_worst ⇒ Object
33 34 35 36 37 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 33 def move_worst @gallery = Gallery.find(params[:id]) @gallery.move_to_worst_position respond end |
#update ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'app/controllers/adminpanel/galleries_controller.rb', line 46 def update @gallery = Gallery.find(params[:id]) if @gallery.update_attributes(params[:gallery]) redirect_to gallery_path(@gallery) else render 'edit' end end |