Merge branch 'standalone_develop' of https://gitlink.org.cn/Trustie/forgeplus into standalone_develop
This commit is contained in:
		
						commit
						5bd686dcb4
					
				| 
						 | 
				
			
			@ -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: '更新成功.' }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,15 @@
 | 
			
		|||
<p><a href="<%= action_templates_path %>" style="font-size: 14px;">>>前往模板配置</a></p>
 | 
			
		||||
<p>说明:该界面适用于action 节点配置参数配置</p>
 | 
			
		||||
 | 
			
		||||
<div class="box search-form-container edu_settings-list-form">
 | 
			
		||||
  <%= form_tag(action_nodes_path, method: :get, class: 'form-inline search-form flex-1') do %>
 | 
			
		||||
    <%= text_field_tag(:search, params[:search], class: 'form-control col-12 col-md-2 mr-3', placeholder: '关键字检索') %>
 | 
			
		||||
    <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
 | 
			
		||||
    <input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
 | 
			
		||||
  <% end %>
 | 
			
		||||
  <%= link_to "新增", new_action_node_path, remote: true, class: "btn btn-primary pull-right", "data-disabled-with":"...新增" %>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<table border="1" width="100%">
 | 
			
		||||
  <thead>
 | 
			
		||||
  <tr>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue