Class: PushType::NodesController
- Inherits:
-
AdminController
- Object
- ActionController::Base
- AdminController
- PushType::NodesController
- Defined in:
- app/controllers/push_type/nodes_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #position ⇒ Object
- #update ⇒ Object
Methods inherited from AdminController
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/controllers/push_type/nodes_controller.rb', line 16 def create if @node.save flash[:notice] = "#{ @node.type } successfully created." redirect_to redirect_path else render 'new' end end |
#destroy ⇒ Object
37 38 39 40 41 |
# File 'app/controllers/push_type/nodes_controller.rb', line 37 def destroy @node.trash! flash[:notice] = "#{ @node.type } trashed." redirect_to redirect_path end |
#edit ⇒ Object
25 26 |
# File 'app/controllers/push_type/nodes_controller.rb', line 25 def edit end |
#index ⇒ Object
9 10 11 |
# File 'app/controllers/push_type/nodes_controller.rb', line 9 def index @nodes = node_scope.not_trash.page(params[:page]) end |
#new ⇒ Object
13 14 |
# File 'app/controllers/push_type/nodes_controller.rb', line 13 def new end |
#position ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/controllers/push_type/nodes_controller.rb', line 43 def position if reorder_node head :ok else render json: @node.errors, status: :unprocessable_entity end end |
#update ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'app/controllers/push_type/nodes_controller.rb', line 28 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 |