mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-22 04:35:45 +08:00
节点库开放管理权限
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
class Action::NodesController < ApplicationController
|
||||
before_action :require_admin, except: [:index]
|
||||
# before_action :require_admin, except: [:index]
|
||||
before_action :require_login
|
||||
before_action :find_action_node, except: [:index, :create, :new]
|
||||
|
||||
def index
|
||||
@node_types = Action::NodeType.all
|
||||
@no_type_nodes = Action::Node.where(action_node_types_id: nil)
|
||||
respond_to do |format|
|
||||
format.html { @nodes = Action::Node.all }
|
||||
format.html { @nodes = Action::Node.where("name LIKE :search OR full_name LIKE :search", :search => "%#{params[:search]}%") }
|
||||
format.json
|
||||
end
|
||||
end
|
||||
@@ -16,6 +17,7 @@ class Action::NodesController < ApplicationController
|
||||
if params.require(:node).present? && params.require(:node)[:link_type_array].present?
|
||||
@node.link_type = (params.require(:node)[:link_type_array] - [""]).join(",")
|
||||
end
|
||||
@node.user_id = current_user.id
|
||||
respond_to do |format|
|
||||
if @node.save
|
||||
format.html { redirect_to action_nodes_path, notice: '创建成功.' }
|
||||
@@ -45,6 +47,7 @@ class Action::NodesController < ApplicationController
|
||||
if params.require(:node).present? && params.require(:node)[:link_type_array].present?
|
||||
@node.link_type = (params.require(:node)[:link_type_array] - [""]).join(",")
|
||||
end
|
||||
@node.user_id = current_user.id if @node.user_id.blank?
|
||||
@node.update(node_params)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to action_nodes_path, notice: '更新成功.' }
|
||||
|
||||
Reference in New Issue
Block a user