mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-13 08:15:55 +08:00
init project
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<div class="modal fade admin-add-department-member-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">添加部门管理员</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="admin-add-department-member-form">
|
||||
<%= hidden_field_tag(:department_id, nil) %>
|
||||
|
||||
<div class="form-group d-flex">
|
||||
<label for="school_id" class="col-form-label">部门管理员:</label>
|
||||
<div class="d-flex flex-column-reverse w-75">
|
||||
<select id="user_ids" name="user_ids" class="form-control department-member-select"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary submit-btn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,35 @@
|
||||
<div class="modal fade admin-create-department-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">新建部门</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="admin-create-department-form" data-url="<%= admins_departments_path %>">
|
||||
<div class="form-group d-flex">
|
||||
<label for="school_id" class="col-form-label">所属单位:</label>
|
||||
<div class="d-flex flex-column-reverse w-75">
|
||||
<select id="school_id" name="school_id" class="form-control school-select"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group d-flex">
|
||||
<label for="new_mirror_id" class="col-form-label">部门名称:</label>
|
||||
<div class="w-75 d-flex flex-column">
|
||||
<%= text_field_tag(:department_name, nil, class: 'form-control', placeholder: '请输入部门名称') %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary submit-btn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,36 @@
|
||||
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
||||
<% not_list = defined?(:users_count) %>
|
||||
|
||||
<td class="text-left"><%= overflow_hidden_span department.name, width: 150 %></td>
|
||||
<td class="text-left"><%= overflow_hidden_span department.school.name, width: 150 %></td>
|
||||
|
||||
<% if not_list %>
|
||||
<td><%= department.user_extensions.count %></td>
|
||||
<td><%= department.user_extensions.joins(:user).where(users: { professional_certification: true }).count %></td>
|
||||
<% else %>
|
||||
<td><%= users_count.fetch(department.id, 0) %></td>
|
||||
<td><%= professional_auth_count.fetch(department.id, 0) %></td>
|
||||
<% end %>
|
||||
|
||||
<td class="member-container">
|
||||
<%= render partial: 'admins/departments/shared/member_users', locals: { department: department } %>
|
||||
</td>
|
||||
<td>
|
||||
<% if department.identifier.present? %>
|
||||
<%= link_to department.identifier.to_s, "/colleges/#{department.identifier}/statistics", target: '_blank' %>
|
||||
<% else %>
|
||||
--
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= department.host_count %></td>
|
||||
<td><%= department.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
|
||||
<td class="action-container">
|
||||
<%= link_to '编辑', edit_admins_department_path(department), remote: true, class: 'action' %>
|
||||
|
||||
<%= javascript_void_link '添加管理员', class: 'action', data: { department_id: department.id, toggle: 'modal', target: '.admin-add-department-member-modal' } %>
|
||||
|
||||
<%= javascript_void_link '更改', class: 'action', data: { school_id: department.school_id, department_id: department.id,
|
||||
toggle: 'modal', target: '.admin-merge-department-modal', url: merge_admins_departments_path } %>
|
||||
|
||||
<%= delete_link '删除', admins_department_path(department, element: ".department-item-#{department.id}"), class: 'delete-department-action' %>
|
||||
</td>
|
||||
@@ -0,0 +1,25 @@
|
||||
<div class="modal fade admin-edit-department-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">编辑部门信息</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<%= simple_form_for([:admins, department], html: { class: 'admin-edit-department-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
|
||||
<%= f.input :name, as: :string, label: '名称' %>
|
||||
<%= f.input :identifier, as: :string, label: '统计链接' %>
|
||||
<%= f.input :host_count, as: :integer, label: '云主机数' %>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary submit-btn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
29
app/views/admins/departments/shared/_list.html.erb
Normal file
29
app/views/admins/departments/shared/_list.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<table class="table table-hover text-center department-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="4%">序号</th>
|
||||
<th width="14%" class="text-left">部门名称</th>
|
||||
<th width="14%" class="text-left">单位名称</th>
|
||||
<th width="6%">用户数</th>
|
||||
<th width="6%">已职业认证</th>
|
||||
<th width="20%">部门管理员</th>
|
||||
<th width="8%">统计链接</th>
|
||||
<th width="8%">云主机数</th>
|
||||
<th width="10%"><%= sort_tag('创建时间', name: 'created_at', path: admins_departments_path) %></th>
|
||||
<th width="14%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if departments.present? %>
|
||||
<% departments.each_with_index do |department, index| %>
|
||||
<tr class="department-item-<%= department.id %>">
|
||||
<%= render partial: 'admins/departments/shared/department_item', locals: {department: department, index: index} %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: departments } %>
|
||||
12
app/views/admins/departments/shared/_member_users.html.erb
Normal file
12
app/views/admins/departments/shared/_member_users.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<div class="member-user">
|
||||
<% department.member_users.each do |user| %>
|
||||
<span class="member-user-item member-user-item-<%= user.id %>">
|
||||
<%= link_to user.real_name, "/users/#{user.login}", target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } %>
|
||||
<%= link_to(admins_department_department_member_path(department, user_id: user.id),
|
||||
method: :delete, remote: true, class: 'ml-1 delete-member-action',
|
||||
data: { confirm: '确认删除吗?' }) do %>
|
||||
<i class="fa fa-close"></i>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -0,0 +1,30 @@
|
||||
<div class="modal fade admin-merge-department-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">更改部门</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="admin-merge-department-form" data-url="<%= merge_admins_departments_path %>">
|
||||
<%= hidden_field_tag(:school_id, nil) %>
|
||||
<%= hidden_field_tag(:origin_department_id, nil) %>
|
||||
|
||||
<div class="form-group d-flex">
|
||||
<label for="school_id" class="col-form-label">更改为:</label>
|
||||
<div class="d-flex flex-column-reverse w-75">
|
||||
<select id="department_id" name="department_id" class="form-control department-select"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="error text-danger"></div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary submit-btn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user