Class: PushType::NodesController

Inherits:
AdminController show all
Defined in:
app/controllers/push_type/nodes_controller.rb

Instance Method Summary collapse

Methods inherited from AdminController

#info

Instance Method Details

#createObject



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

#destroyObject



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

#editObject



25
26
# File 'app/controllers/push_type/nodes_controller.rb', line 25

def edit
end

#indexObject



9
10
11
# File 'app/controllers/push_type/nodes_controller.rb', line 9

def index
  @nodes = node_scope.not_trash.page(params[:page])
end

#newObject



13
14
# File 'app/controllers/push_type/nodes_controller.rb', line 13

def new
end

#positionObject



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

#updateObject



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