Class: Adminpanel::GalleriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/adminpanel/galleries_controller.rb

Instance Method Summary collapse

Methods included from TwitterActions

#twitter_publish

Methods included from FacebookActions

#fb_choose_page, #fb_publish, #fb_save_token

Methods included from RestActions

#edit, #new, #show

Methods included from SessionsHelper

#current_user, #current_user=, #sign_in, #sign_out, #signed_in?

Instance Method Details

#createObject

def edit

@gallery = Gallery.find(params[:id])

end



16
17
18
19
20
21
22
23
24
# File 'app/controllers/adminpanel/galleries_controller.rb', line 16

def create
  @gallery = Gallery.new(params[:gallery])

  if @gallery.save
    redirect_to gallery_path(@gallery), :notice => t("gallery.success")
  else
    render 'new'
  end
end

#destroyObject



38
39
40
41
42
43
# File 'app/controllers/adminpanel/galleries_controller.rb', line 38

def destroy
  @gallery = Gallery.find(params[:id])
  @gallery.destroy

  redirect_to galleries_path, :notice => t("gallery.deleted")
end

#indexObject



4
5
6
# File 'app/controllers/adminpanel/galleries_controller.rb', line 4

def index
  @galleries = Gallery.all
end

#move_betterObject



26
27
28
29
30
# File 'app/controllers/adminpanel/galleries_controller.rb', line 26

def move_better
  @gallery = Gallery.find(params[:id])
  @gallery.move_to_better_position
  respond
end

#move_worstObject



32
33
34
35
36
# File 'app/controllers/adminpanel/galleries_controller.rb', line 32

def move_worst
  @gallery = Gallery.find(params[:id])
  @gallery.move_to_worst_position
  respond
end

#updateObject



45
46
47
48
49
50
51
52
# File 'app/controllers/adminpanel/galleries_controller.rb', line 45

def update
  @gallery = Gallery.find(params[:id])
  if @gallery.update_attributes(params[:gallery])
    redirect_to gallery_path(@gallery)
  else
    render 'edit'
  end
end