mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-09 14:34:03 +08:00
init project
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<div class="modal fade admin-edit-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">
|
||||
<%= simple_form_for([:admins, subject], html: { class: 'admin-edit-subject-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
|
||||
<%= f.input :repertoire_id, label: '技术体系:' do %>
|
||||
<% repertoire_options = Repertoire.order('CONVERT(name USING gbk) COLLATE gbk_chinese_ci ASC').map{|r| [r.name, r.id]} %>
|
||||
<%= f.select :repertoire_id, [['请选择', '']] + repertoire_options, {}, class: 'form-control' %>
|
||||
<% end %>
|
||||
|
||||
<%= f.input :subject_level_system_id, label: '等级体系:' do %>
|
||||
<% level_options = SubjectLevelSystem.all.map{|r| [r.name, r.id]} %>
|
||||
<%= f.select :subject_level_system_id, [['请选择', '']] + level_options, {}, class: 'form-control' %>
|
||||
<% end %>
|
||||
|
||||
<%= f.input :student_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>
|
||||
28
app/views/admins/subject_settings/shared/_list.html.erb
Normal file
28
app/views/admins/subject_settings/shared/_list.html.erb
Normal file
@@ -0,0 +1,28 @@
|
||||
<table class="table table-hover text-center subject-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="5%">序号</th>
|
||||
<th width="23%" class="text-left">名称</th>
|
||||
<th width="10%">老版技术体系</th>
|
||||
<th width="10%">状态</th>
|
||||
<th width="25%">课程体系</th>
|
||||
<th width="10%">封面</th>
|
||||
<th width="5%">开课人数</th>
|
||||
<th width="12%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if subjects.present? %>
|
||||
<% subjects.each_with_index do |subject, index| %>
|
||||
<tr class="subject-item-<%= subject.id %>">
|
||||
<% page_no = ((params[:page] || 1).to_i - 1) * 20 + index + 1 %>
|
||||
<%= render partial: "admins/subject_settings/shared/td",locals: {subject: subject,page_no:page_no} %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: subjects } %>
|
||||
47
app/views/admins/subject_settings/shared/_td.html.erb
Normal file
47
app/views/admins/subject_settings/shared/_td.html.erb
Normal file
@@ -0,0 +1,47 @@
|
||||
<td class="subject-line-no"><%= page_no %></td>
|
||||
<td class="text-left">
|
||||
<%= link_to(subject.name, "/paths/#{subject.id}", target: '_blank') %>
|
||||
<span class="badge badge-pill badge-success homepage-show-badge" style="<%= subject.homepage_show? ? '' : 'display:none' %>">首页</span>
|
||||
<span class="badge badge-pill badge-info excellent-badge" style="<%= subject.excellent? ? '' : 'display:none' %>">金课</span>
|
||||
</td>
|
||||
<td><%= display_text subject.repertoire&.name %></td>
|
||||
<td><%= display_text subject.public == 2 ? "已公开" : ((subject.public == 1 && subject.status == 2) ? "审核中" : "未发布") %></td>
|
||||
<td>
|
||||
<%= select_tag(:sub_disciplines, options_for_select(@sub_disciplines, subject.sub_disciplines.pluck(:id)),multiple:true,class:"form-control subject-setting-form",data:{id:subject.id},id:"tags-chosen-#{subject.id}") %>
|
||||
</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') %>
|
||||
<%= javascript_void_link image_exists ? '重新上传' : '上传图片', class: 'action upload-image-action', data: { source_id: subject.id, source_type: 'Subject', toggle: 'modal', target: '.admin-upload-file-modal' } %>
|
||||
</td>
|
||||
<td><%= subject.student_count %></td>
|
||||
<td class="action-container">
|
||||
<%= check_box_tag :show_mobile, !subject.show_mobile, subject.show_mobile, remote: true,
|
||||
data: {id: subject.id, toggle: "tooltip", placement: "top"}, class: "subject-mobile-form mr10", title: "小程序端显示" %>
|
||||
<%= link_to('编辑', edit_admins_subject_path(subject), remote: true, class: 'edit-action') %>
|
||||
</td>
|
||||
|
||||
<script>
|
||||
$("#tags-chosen-<%= subject.id %>").select2({
|
||||
multiple: true,
|
||||
maximumSelectionLength: 3,
|
||||
placeholder: '请选择课程体系'});
|
||||
|
||||
|
||||
$(".action-container").on("change", '.subject-mobile-form', function () {
|
||||
var s_id = $(this).attr("data-id");
|
||||
var s_value = $(this).val();
|
||||
var s_name = $(this).attr("name");
|
||||
var json = {};
|
||||
var s_index = $(this).parent("td").siblings(".shixun-line-no").text();
|
||||
json[s_name] = s_value;
|
||||
json["page_no"] = s_index;
|
||||
$.ajax({
|
||||
url: "/admins/subject_settings/update_mobile_show?subject_id=" + s_id,
|
||||
type: "POST",
|
||||
dataType:'script',
|
||||
data: json
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user