mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
init project
This commit is contained in:
19
app/views/admins/laboratories/index.html.erb
Normal file
19
app/views/admins/laboratories/index.html.erb
Normal file
@@ -0,0 +1,19 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('云上实验室') %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container laboratory-list-form">
|
||||
<%= form_tag(admins_laboratories_path(unsafe_params), method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
|
||||
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-6 col-md-4 ml-3', placeholder: '学校名称/二级域名前缀检索') %>
|
||||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
|
||||
<% end %>
|
||||
|
||||
<%= javascript_void_link '新建', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-laboratory-modal' } %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container laboratory-list-container">
|
||||
<%= render(partial: 'admins/laboratories/shared/list', locals: { laboratories: @laboratories }) %>
|
||||
</div>
|
||||
|
||||
<%= render 'admins/laboratories/shared/create_laboratory_modal' %>
|
||||
<%= render 'admins/laboratories/shared/add_laboratory_user_modal' %>
|
||||
1
app/views/admins/laboratories/index.js.erb
Normal file
1
app/views/admins/laboratories/index.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$('.laboratory-list-container').html("<%= j(render partial: 'admins/laboratories/shared/list', locals: { laboratories: @laboratories }) %>");
|
||||
@@ -0,0 +1,30 @@
|
||||
<div class="modal fade admin-add-laboratory-user-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-laboratory-user-form">
|
||||
<%= hidden_field_tag(:laboratory_id, nil) %>
|
||||
|
||||
<div class="form-group d-flex">
|
||||
<label class="col-form-label">管理员:</label>
|
||||
<div class="d-flex flex-column-reverse w-75">
|
||||
<select id="user_ids" name="user_ids" class="form-control laboratory-user-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,28 @@
|
||||
<div class="modal fade admin-create-laboratory-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-laboratory-form" data-url="<%= admins_laboratories_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="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,69 @@
|
||||
<% school = laboratory.school %>
|
||||
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
||||
<td class="text-left"><%= school&.name || 'EduCoder主站' %></td>
|
||||
<td class="text-left">
|
||||
<% if laboratory.identifier %>
|
||||
<%= link_to laboratory.site, "https://#{laboratory.site}", target: '_blank' %>
|
||||
<% else %>
|
||||
--
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if school && school.identifier.present? %>
|
||||
<%= link_to school.identifier.to_s, statistics_college_path(school.identifier), target: '_blank' %>
|
||||
<% else %>
|
||||
--
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="member-container">
|
||||
<div class="laboratory-user">
|
||||
<% laboratory.users.each do |user| %>
|
||||
<span class="laboratory-user-item laboratory-user-item-<%= user.id %>">
|
||||
<%= link_to user.real_name, "/users/#{user.login}", target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } %>
|
||||
<%= link_to(admins_laboratory_laboratory_user_path(laboratory, user_id: user.id),
|
||||
method: :delete, remote: true, class: 'ml-1 delete-laboratory-user-action',
|
||||
data: { confirm: '确认删除吗?' }) do %>
|
||||
<i class="fa fa-close"></i>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= laboratory.created_at.strftime('%Y-%m-%d %H:%M') %></td>
|
||||
<td>
|
||||
<% if school.present? && laboratory.id != 1 %>
|
||||
<%= check_box_tag :sync_course,!laboratory.sync_course,laboratory.sync_course,remote:true,data:{id:laboratory.id},class:"laboratory-sync-form" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if school.present? && laboratory.id != 1 %>
|
||||
<%= check_box_tag :sync_subject,!laboratory.sync_subject,laboratory.sync_subject,remote:true,data:{id:laboratory.id},class:"laboratory-sync-form" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if school.present? && laboratory.id != 1 %>
|
||||
<%= check_box_tag :sync_shixun,!laboratory.sync_shixun,laboratory.sync_shixun,remote:true,data:{id:laboratory.id},class:"laboratory-sync-form" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="action-container">
|
||||
<%= link_to '定制', admins_laboratory_laboratory_setting_path(laboratory), class: 'action' %>
|
||||
|
||||
<% if school.present? && laboratory.id != 1 %>
|
||||
<%= javascript_void_link '添加管理员', class: 'action', data: { laboratory_id: laboratory.id, toggle: 'modal', target: '.admin-add-laboratory-user-modal' } %>
|
||||
<%= link_to '同步用户', synchronize_user_admins_laboratory_path(laboratory), remote: true, data: { confirm: '确认同步该单位下的所有用户到云上实验室吗?' }, class: 'action' %>
|
||||
<% end %>
|
||||
|
||||
<div class="d-inline">
|
||||
<%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
|
||||
<div class="dropdown-menu more-action-dropdown">
|
||||
<%= link_to '轮播图', admins_laboratory_carousels_path(laboratory), class: 'dropdown-item' %>
|
||||
|
||||
<%= link_to '查看实训项目', admins_laboratory_laboratory_shixuns_path(laboratory), class: 'dropdown-item' %>
|
||||
<%= link_to '查看实践课程', admins_laboratory_laboratory_subjects_path(laboratory), class: 'dropdown-item' %>
|
||||
|
||||
<% if school.present? && laboratory.id != 1 %>
|
||||
<%= delete_link '删除', admins_laboratory_path(laboratory, element: ".laboratory-item-#{laboratory.id}"), class: 'dropdown-item delete-laboratory-action' %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
29
app/views/admins/laboratories/shared/_list.html.erb
Normal file
29
app/views/admins/laboratories/shared/_list.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<table class="table table-hover text-center laboratory-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="4%">序号</th>
|
||||
<th width="14%" class="text-left">单位名称</th>
|
||||
<th width="16%" class="text-left">域名</th>
|
||||
<th width="6%">统计链接</th>
|
||||
<th width="22%">管理员</th>
|
||||
<th width="10%"><%= sort_tag('创建时间', name: 'id', path: admins_laboratories_path) %></th>
|
||||
<th width="4%" title="同步显示主站下该单位的课堂">同步课堂</th>
|
||||
<th width="4%" title="同步显示主站下该单位用户创建的实践课程">同步实践课程</th>
|
||||
<th width="4%" title="同步显示主站下该单位用户创建的实训">同步实训</th>
|
||||
<th width="16%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if laboratories.present? %>
|
||||
<% laboratories.each_with_index do |laboratory, index| %>
|
||||
<tr class="laboratory-item laboratory-item-<%= laboratory.id %>">
|
||||
<%= render partial: 'admins/laboratories/shared/laboratory_item', locals: {laboratory: laboratory, index: index} %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: laboratories } %>
|
||||
@@ -0,0 +1,8 @@
|
||||
json.count @count
|
||||
json.shixuns do
|
||||
json.array! @shixuns do |shixun|
|
||||
json.extract! shixun, :id, :name, :status
|
||||
json.status_text I18n.t("shixun.status.#{shixun.status}")
|
||||
json.creator_name shixun.user.real_name
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
json.count @count
|
||||
json.subjects do
|
||||
json.array! @subjects do |subject|
|
||||
json.extract! subject, :id, :name, :status
|
||||
json.status_text I18n.t("subject.status.#{subject.status}")
|
||||
json.creator_name subject.user.real_name
|
||||
end
|
||||
end
|
||||
1
app/views/admins/laboratories/synchronize_user.js.erb
Normal file
1
app/views/admins/laboratories/synchronize_user.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
alert("同步成功");
|
||||
3
app/views/admins/laboratories/update.js.erb
Normal file
3
app/views/admins/laboratories/update.js.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
var index = $(".laboratory-item-<%= @laboratory.id %>").children(":first").html();
|
||||
$(".laboratory-item-<%= @laboratory.id %>").html("<%= j render partial: "admins/laboratories/shared/laboratory_item",locals: {laboratory: @laboratory, index: 1} %>");
|
||||
$(".laboratory-item-<%= @laboratory.id %>").children(":first").html(index);
|
||||
3
app/views/admins/laboratories/update_sync_course.js.erb
Normal file
3
app/views/admins/laboratories/update_sync_course.js.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
var index = $(".laboratory-item-<%= @laboratory.id %>").children(":first").html();
|
||||
$("#laboratory-item-<%= @laboratory.id %>").html("<%= j render partial: 'admins/laboratories/shared/laboratory_item', locals: {laboratory: @laboratory, index: 1} %>");
|
||||
$(".laboratory-item-<%= @laboratory.id %>").children(":first").html(index);
|
||||
Reference in New Issue
Block a user