Class: Admin::PapersController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::PapersController
- Defined in:
- app/controllers/admin/papers_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
Create a Paper ==== Params * paper = Hash of Paper’s attributes.
-
#destroy ⇒ Object
Destroy a Paper ==== Params * id = Paper’s id ==== Output if destroy succed, return the Categories list.
-
#edit ⇒ Object
Edit a Paper ==== Params * id = Paper’s id to edit * paper = Hash of Paper’s attributes.
-
#index ⇒ Object
List Categories.
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
- #url ⇒ Object
Instance Method Details
#create ⇒ Object
Create a Paper
Params
-
paper = Hash of Paper’s attributes
The Paper can be a child of another Paper.
33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/admin/papers_controller.rb', line 33 def create if @paper.save flash[:notice] = t('paper.create.success').capitalize redirect_to([forgeos_blog, :admin, :papers]) else flash[:error] = t('paper.create.failed').capitalize render :action => 'new' end end |
#destroy ⇒ Object
Destroy a Paper
Params
-
id = Paper’s id
Output
if destroy succed, return the Categories list
67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/admin/papers_controller.rb', line 67 def destroy #set page_url for cache sweeper @paper.paper_url = @paper.paper_urls.dup if @paper.destroy flash[:notice] = t('paper.destroy.success').capitalize else flash[:error] = t('paper.destroy.failed').capitalize end end |
#edit ⇒ Object
Edit a Paper
Params
-
id = Paper’s id to edit
-
paper = Hash of Paper’s attributes
The Paper can be a child of another Paper.
49 50 |
# File 'app/controllers/admin/papers_controller.rb', line 49 def edit end |
#index ⇒ Object
List Categories
12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/admin/papers_controller.rb', line 12 def index respond_to do |format| format.html format.json do sort render :layout => false end end end |
#new ⇒ Object
22 23 |
# File 'app/controllers/admin/papers_controller.rb', line 22 def new end |
#show ⇒ Object
25 26 |
# File 'app/controllers/admin/papers_controller.rb', line 25 def show end |
#update ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/admin/papers_controller.rb', line 52 def update if @paper.update_attributes(params[:paper]) flash[:notice] = t('paper.update.success').capitalize redirect_to([forgeos_blog, :admin, :papers]) else flash[:error] = t('paper.update.failed').capitalize render :action => 'edit' end end |
#url ⇒ Object
7 8 9 |
# File 'app/controllers/admin/papers_controller.rb', line 7 def url render :text => Forgeos::url_generator(params[:url]) end |