diff options
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/node_actions_controller.rb | 14 | ||||
| -rw-r--r-- | app/controllers/nodes_controller.rb | 12 |
2 files changed, 16 insertions, 10 deletions
diff --git a/app/controllers/node_actions_controller.rb b/app/controllers/node_actions_controller.rb new file mode 100644 index 0000000..6e46719 --- /dev/null +++ b/app/controllers/node_actions_controller.rb | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | class NodeActionsController < ApplicationController | ||
| 2 | |||
| 3 | before_action :login_required | ||
| 4 | |||
| 5 | layout 'admin' | ||
| 6 | |||
| 7 | def index | ||
| 8 | @actions = NodeAction.order(:occurred_at => :desc, :id => :desc) | ||
| 9 | @actions = @actions.where(:node_id => params[:node_id]) if params[:node_id].present? | ||
| 10 | @actions = @actions.where(:user_id => params[:user_id]) if params[:user_id].present? | ||
| 11 | @actions = @actions.includes(:node, :user) | ||
| 12 | .paginate(:page => params[:page], :per_page => 50) | ||
| 13 | end | ||
| 14 | end | ||
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index b66ea49..9834a17 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb | |||
| @@ -27,12 +27,7 @@ class NodesController < ApplicationController | |||
| 27 | def new | 27 | def new |
| 28 | @node = Node.new node_params | 28 | @node = Node.new node_params |
| 29 | @selected_kind = CccConventions::NODE_KINDS.key?(params[:kind]) ? params[:kind] : "generic" | 29 | @selected_kind = CccConventions::NODE_KINDS.key?(params[:kind]) ? params[:kind] : "generic" |
| 30 | if params.has_key?(:parent_id) | 30 | @parent = Node.find(params[:parent_id]) if params.has_key?(:parent_id) |
| 31 | @parent_id = params[:parent_id] | ||
| 32 | parent = Node.find(@parent_id) | ||
| 33 | @parent_name = parent.title | ||
| 34 | @parent_unique_name = parent.current_unique_name | ||
| 35 | end | ||
| 36 | end | 31 | end |
| 37 | 32 | ||
| 38 | def create | 33 | def create |
| @@ -57,10 +52,7 @@ class NodesController < ApplicationController | |||
| 57 | redirect_to(edit_node_path(@node)) | 52 | redirect_to(edit_node_path(@node)) |
| 58 | else | 53 | else |
| 59 | @selected_kind = CccConventions::NODE_KINDS.key?(params[:kind]) ? params[:kind] : "generic" | 54 | @selected_kind = CccConventions::NODE_KINDS.key?(params[:kind]) ? params[:kind] : "generic" |
| 60 | if params[:parent_id].present? | 55 | @parent = Node.find(params[:parent_id]) if params.has_key?(:parent_id) |
| 61 | @parent_id = params[:parent_id] | ||
| 62 | @parent_name = Node.find(@parent_id).title | ||
| 63 | end | ||
| 64 | render :new | 56 | render :new |
| 65 | end | 57 | end |
| 66 | end | 58 | end |
