Class: PushType::Admin::NodesController
- Inherits:
-
PushType::AdminController
- Object
- ActionController::Base
- PushType::AdminController
- PushType::Admin::NodesController
- Defined in:
- app/controllers/push_type/admin/nodes_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #empty ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #position ⇒ Object
- #restore ⇒ Object
- #trash ⇒ Object
- #update ⇒ Object
Methods inherited from PushType::AdminController
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/controllers/push_type/admin/nodes_controller.rb', line 20 def create if @node.save flash[:notice] = "#{ @node.type } successfully created." redirect_to redirect_path else render 'new' end end |
#destroy ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/push_type/admin/nodes_controller.rb', line 41 def destroy if @node.trashed? @node.destroy flash[:notice] = "#{ @node.type } permanently deleted." redirect_to redirect_path else @node.trash! flash[:notice] = "#{ @node.type } trashed." redirect_to redirect_path(true) end end |
#edit ⇒ Object
29 30 |
# File 'app/controllers/push_type/admin/nodes_controller.rb', line 29 def edit end |
#empty ⇒ Object
67 68 69 70 71 |
# File 'app/controllers/push_type/admin/nodes_controller.rb', line 67 def empty PushType::Node.trashed.destroy_all flash[:notice] = 'Trash successfully emptied.' redirect_to push_type_admin.nodes_path end |
#index ⇒ Object
9 10 11 |
# File 'app/controllers/push_type/admin/nodes_controller.rb', line 9 def index @nodes = node_scope.not_trash.page(params[:page]).per(per_page_param) end |
#new ⇒ Object
17 18 |
# File 'app/controllers/push_type/admin/nodes_controller.rb', line 17 def new end |
#position ⇒ Object
53 54 55 56 57 58 59 |
# File 'app/controllers/push_type/admin/nodes_controller.rb', line 53 def position if reorder_node head :ok else render json: @node.errors, status: :unprocessable_entity end end |
#restore ⇒ Object
61 62 63 64 65 |
# File 'app/controllers/push_type/admin/nodes_controller.rb', line 61 def restore @node.restore! flash[:notice] = "#{ @node.type } successfully restored." redirect_to redirect_path end |
#trash ⇒ Object
13 14 15 |
# File 'app/controllers/push_type/admin/nodes_controller.rb', line 13 def trash @nodes = PushType::Node.all.trashed.page(params[:page]).per(per_page_param).reorder(deleted_at: :desc) end |
#update ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'app/controllers/push_type/admin/nodes_controller.rb', line 32 def update if @node.update_attributes node_params.merge(updater: push_type_user) flash[:notice] = "#{ @node.type } successfully updated." redirect_to redirect_path else render 'edit' end end |