Class: Admin::Areas::PostsController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::Areas::PostsController
- Defined in:
- app/controllers/admin/areas/posts_controller.rb
Instance Method Summary collapse
- #destroy ⇒ Object
- #edit ⇒ Object
- #order ⇒ Object
- #show ⇒ Object
- #toggle_reviewed_by ⇒ Object
- #update ⇒ Object
Instance Method Details
#destroy ⇒ Object
34 35 36 |
# File 'app/controllers/admin/areas/posts_controller.rb', line 34 def destroy @post.destroy end |
#edit ⇒ Object
6 7 |
# File 'app/controllers/admin/areas/posts_controller.rb', line 6 def edit end |
#order ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/controllers/admin/areas/posts_controller.rb', line 16 def order if params[:post].present? params[:post].each_with_index do |post, i| Post.update_all(['position = %d', i], ['id = %d', post]) end end render :nothing => true end |
#show ⇒ Object
13 14 |
# File 'app/controllers/admin/areas/posts_controller.rb', line 13 def show end |
#toggle_reviewed_by ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/admin/areas/posts_controller.rb', line 25 def toggle_reviewed_by if !@post.reviewed_by @post.update_attribute(:reviewed_by, current_user.full_name) else @post.update_attribute(:reviewed_by, nil) end render :layout => false end |
#update ⇒ Object
9 10 11 |
# File 'app/controllers/admin/areas/posts_controller.rb', line 9 def update @post.update_attributes(params[:post]) end |