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:
45
app/views/admins/laboratory_subjects/index.html.erb
Normal file
45
app/views/admins/laboratory_subjects/index.html.erb
Normal file
@@ -0,0 +1,45 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('云上实验室', admins_laboratories_path) %>
|
||||
<% add_admin_breadcrumb("#{current_laboratory.name} - 实践课程") %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<div class="box search-form-container laboratory-subject-list-form">
|
||||
<%= form_tag(admins_laboratory_laboratory_subjects_path(current_laboratory), method: :get, class: 'form-inline search-form', remote: true) do %>
|
||||
<div class="form-group mr-1">
|
||||
<label for="status">状态:</label>
|
||||
<% status_options = [['全部', ''], ['编辑中', 0], ['审核中', 1], ['已发布', 2]] %>
|
||||
<%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-12 col-md-3">
|
||||
<label for="school_name">单位:</label>
|
||||
<%= select_tag :school_id, options_for_select([''], params[:school_id]), class: 'form-control school-select flex-1' %>
|
||||
</div>
|
||||
|
||||
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-12 col-md-2 mr-3', placeholder: '创建者/课程名称检索') %>
|
||||
|
||||
<div class="form-check mr-2">
|
||||
<%= hidden_field_tag(:homepage, false, id:'') %>
|
||||
<%= check_box_tag(:homepage, true, params[:homepage].to_s == 'true', class: 'form-check-input') %>
|
||||
<label class="form-check-label" for="homepage">只看首页展示</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check mr-2">
|
||||
<%= hidden_field_tag(:ownership, false, id:'') %>
|
||||
<%= check_box_tag(:ownership, true, params[:ownership].to_s == 'true', class: 'form-check-input') %>
|
||||
<label class="form-check-label" for="ownership">只看自建</label>
|
||||
</div>
|
||||
|
||||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
|
||||
<%= link_to '清空', admins_laboratory_laboratory_subjects_path(current_laboratory), class: 'btn btn-default','data-disable-with': '清空中...' %>
|
||||
<% end %>
|
||||
|
||||
<%= javascript_void_link('添加课程', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-add-laboratory-subject-modal' }) %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container laboratory-subject-list-container" data-id="<%= current_laboratory.id %>">
|
||||
<%= render partial: 'admins/laboratory_subjects/shared/list', locals: { laboratory_subjects: @laboratory_subjects } %>
|
||||
</div>
|
||||
|
||||
<%= render partial: 'admins/laboratory_subjects/shared/add_laboratory_subject_modal' %>
|
||||
1
app/views/admins/laboratory_subjects/index.js.erb
Normal file
1
app/views/admins/laboratory_subjects/index.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$('.laboratory-subject-list-container').html("<%= j(render partial: 'admins/laboratory_subjects/shared/list', locals: { laboratory_subjects: @laboratory_subjects }) %>");
|
||||
@@ -0,0 +1,28 @@
|
||||
<div class="modal fade admin-add-laboratory-subject-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">
|
||||
<div class="form-group d-flex">
|
||||
<label class="col-form-label">选择实践课程:</label>
|
||||
<div class="d-flex flex-column-reverse w-75">
|
||||
<select id="subject_ids" name="subject_ids" class="form-control subject-select" multiple></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>
|
||||
<a href="javascript:void(0)" class="btn btn-primary submit-btn" data-disable-with = '导入中...'>确认</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
54
app/views/admins/laboratory_subjects/shared/_list.html.erb
Normal file
54
app/views/admins/laboratory_subjects/shared/_list.html.erb
Normal file
@@ -0,0 +1,54 @@
|
||||
<table class="table text-center laboratory-subject-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="4%">序号</th>
|
||||
<th width="24%" class="text-left">课程名称</th>
|
||||
<th width="12%">技术体系</th>
|
||||
<th width="10%">等级体系</th>
|
||||
<th width="10%">封面</th>
|
||||
<th width="8%">创建者</th>
|
||||
<th width="10%">单位</th>
|
||||
<th width="8%">状态</th>
|
||||
<th width="14%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if laboratory_subjects.present? %>
|
||||
<% laboratory_subjects.each_with_index do |laboratory_subject, index| %>
|
||||
<tr class="laboratory-subject-item-<%= laboratory_subject.id %>">
|
||||
<%- subject = laboratory_subject.subject -%>
|
||||
|
||||
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
||||
<td class="text-left">
|
||||
<%= link_to(subject.name, "/paths/#{subject.id}", target: '_blank') %>
|
||||
<span class="badge badge-pill badge-success homepage-badge" style="<%= laboratory_subject.homepage? ? '' : 'display:none' %>">首页</span>
|
||||
<span class="badge badge-pill badge-success ownership-badge" style="<%= laboratory_subject.ownership? ? '' : 'display:none' %>">自建</span>
|
||||
</td>
|
||||
<td><%= display_text subject.repertoire&.name %></td>
|
||||
<td><%= display_text subject.subject_level_system&.name %></td>
|
||||
<td>
|
||||
<% image_exists = Util::FileManage.exists?(subject) %>
|
||||
<%= image_tag(image_exists ? Util::FileManage.source_disk_file_url(subject) : '', height: 40, class: "w-100 preview-image subject-image-#{subject.id}", style: image_exists ? '' : 'display:none') %>
|
||||
</td>
|
||||
<td><%= subject.user.real_name %></td>
|
||||
<td><%= subject.user.school_name %></td>
|
||||
<td><%= display_subject_status(subject) %></td>
|
||||
|
||||
<td class="action-container">
|
||||
<%= link_to('去修改', admins_subjects_path(id: laboratory_subject.subject_id)) %>
|
||||
<%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? 'display:none' : '') %>
|
||||
<%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? '' : 'display:none') %>
|
||||
|
||||
<% unless laboratory_subject.ownership? %>
|
||||
<%= delete_link '删除', admins_laboratory_laboratory_subject_path(current_laboratory, laboratory_subject, element: ".laboratory-subject-item-#{laboratory_subject.id}") %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: laboratory_subjects } %>
|
||||
Reference in New Issue
Block a user