Class: Forge::BannersController
Instance Method Summary
collapse
#get_menu_items, #load_help, #set_crumbs, #set_title, #uses_ckeditor
#app_init
Instance Method Details
#create ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/forge/app/controllers/forge/banners_controller.rb', line 22
def create
@banner = Banner.new(params[:banner])
if @banner.save
flash[:notice] = 'Banner was successfully created.'
redirect_to(forge_banners_path)
else
render :action => "new"
end
end
|
#destroy ⇒ Object
42
43
44
45
|
# File 'lib/forge/app/controllers/forge/banners_controller.rb', line 42
def destroy
@banner.destroy
redirect_to(forge_banners_path)
end
|
#edit ⇒ Object
19
20
|
# File 'lib/forge/app/controllers/forge/banners_controller.rb', line 19
def edit
end
|
#index ⇒ Object
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/forge/app/controllers/forge/banners_controller.rb', line 4
def index
respond_to do |format|
format.html { @banners = Banner.order(:list_order).paginate(:per_page => 10, :page => params[:page]) }
format.js {
params[:q] ||= ''
@banners = Banner.where("LOWER(title) LIKE ?", "%#{params[:q].downcase}%")
render :partial => "banner", :collection => @banners
}
end
end
|
#new ⇒ Object
15
16
17
|
# File 'lib/forge/app/controllers/forge/banners_controller.rb', line 15
def new
@banner = Banner.new
end
|
#reorder ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/forge/app/controllers/forge/banners_controller.rb', line 48
def reorder
Banner.reorder!(params[:banner_list])
respond_to do |format|
format.js { render :nothing => true }
format.html {
flash[:notice] = "Banners reordered!"
redirect_to :action => :index
}
end
end
|
#update ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/forge/app/controllers/forge/banners_controller.rb', line 32
def update
@banner.photo = nil if params[:remove_asset] == "1"
if @banner.update_attributes(params[:banner])
flash[:notice] = 'Banner was successfully updated.'
redirect_to(forge_banners_path)
else
render :action => "edit"
end
end
|