mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-08 22:14:04 +08:00
init project
This commit is contained in:
2
app/views/admins/courses/destroy.js.erb
Normal file
2
app/views/admins/courses/destroy.js.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
alert("删除成功");
|
||||
$(".course-item-<%= @course.id %>").find(".delete-course-action").remove();
|
||||
34
app/views/admins/courses/index.html.erb
Normal file
34
app/views/admins/courses/index.html.erb
Normal file
@@ -0,0 +1,34 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('课堂列表') %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container course-list-form">
|
||||
<%= form_tag(admins_courses_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
|
||||
<div class="form-group mr-1">
|
||||
<label for="status">状态:</label>
|
||||
<% status_options = [['全部', ''], ["正在进行(#{@processed_courses})", 'processing'], ["已结束#{@ended_courses}", 'ended']] %>
|
||||
<%= 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_show, false, id:'') %>
|
||||
<%= check_box_tag(:homepage_show, true, params[:homepage_show].to_s == 'true', class: 'form-check-input course-homepage-show') %>
|
||||
<label class="form-check-label" for="homepage_show">只看首页展示</label>
|
||||
</div>
|
||||
|
||||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
|
||||
<input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
|
||||
<% end %>
|
||||
<a href="javascript:void(0)" class="btn btn-primary" id="course-export" data-disable-with = '导出中...'>导出</a>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container course-list-container">
|
||||
<%= render partial: 'admins/courses/shared/list', locals: { courses: @courses } %>
|
||||
</div>
|
||||
1
app/views/admins/courses/index.js.erb
Normal file
1
app/views/admins/courses/index.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$('.course-list-container').html("<%= j( render partial: 'admins/courses/shared/list', locals: { courses: @courses } ) %>");
|
||||
29
app/views/admins/courses/index.xlsx.axlsx
Normal file
29
app/views/admins/courses/index.xlsx.axlsx
Normal file
@@ -0,0 +1,29 @@
|
||||
wb = xlsx_package.workbook
|
||||
|
||||
wb.styles do |s|
|
||||
blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center}
|
||||
wb.add_worksheet(name: "课堂列表") do |sheet|
|
||||
sheet.add_row %w(ID 课堂名称 成员 资源 普通作业 分组作业 实训作业 试卷 评测次数 私有 状态 单位 创建者 创建时间 动态时间), :height => 25,:style => blue_cell
|
||||
|
||||
@courses.each do |course|
|
||||
data = [
|
||||
course.id,
|
||||
course.name,
|
||||
course.course_members_count,
|
||||
get_attachment_count(course, 0),
|
||||
course.course_homework_count(1),
|
||||
course.course_homework_count(3),
|
||||
course.course_homework_count(4),
|
||||
course.exercises_count,
|
||||
course.evaluate_count,
|
||||
course.is_public == 1 ? "--" : "√",
|
||||
course.is_end ? "已结束" : "正在进行",
|
||||
course.school&.name,
|
||||
course.teacher&.real_name,
|
||||
course.created_at&.strftime('%Y-%m-%d %H:%M'),
|
||||
course.max_activity_time ? course.max_activity_time&.strftime('%Y-%m-%d %H:%M') : "--"
|
||||
]
|
||||
sheet.add_row(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
<div class="modal fade admin-import-course-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-import-course-member-form" enctype="multipart/form-data">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">文件</span>
|
||||
</div>
|
||||
<div class="custom-file">
|
||||
<input type="file" name="file" id="import-course-member-input" class="upload-file-input" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
|
||||
<label class="custom-file-label file-names" for="import-course-member-input">选择文件</label>
|
||||
</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>
|
||||
37
app/views/admins/courses/shared/_list.html.erb
Normal file
37
app/views/admins/courses/shared/_list.html.erb
Normal file
@@ -0,0 +1,37 @@
|
||||
<table class="table table-hover text-center subject-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="4%">序号</th>
|
||||
<th width="4%">ID</th>
|
||||
<th width="10%" class="text-left">课堂名称</th>
|
||||
<th width="5%">成员</th>
|
||||
<th width="4%">资源</th>
|
||||
<th width="4%">普通作业</th>
|
||||
<th width="4%">分组作业</th>
|
||||
<th width="4%">实训作业</th>
|
||||
<th width="4%">试卷</th>
|
||||
<th width="6%">评测次数</th>
|
||||
<th width="4%">私有</th>
|
||||
<th width="6%">状态</th>
|
||||
<th width="10%">单位</th>
|
||||
<th width="7%">创建者</th>
|
||||
<th width="10%"><%= sort_tag('创建时间', name: 'created_at', path: admins_courses_path) %></th>
|
||||
<th width="4%">首页</th>
|
||||
<th width="5%">邮件通知</th>
|
||||
<th width="5%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if courses.present? %>
|
||||
<% courses.each_with_index do |course, index| %>
|
||||
<tr class="course-item-<%= course.id %>">
|
||||
<%= render partial: 'admins/courses/shared/td', locals: {course: course, no: index} %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: courses } %>
|
||||
28
app/views/admins/courses/shared/_td.html.erb
Normal file
28
app/views/admins/courses/shared/_td.html.erb
Normal file
@@ -0,0 +1,28 @@
|
||||
<td><%= list_index_no((params[:page] || 1).to_i, no) %></td>
|
||||
<td><%= course.id %></td>
|
||||
<td class="text-left">
|
||||
<%= link_to(course.name, "/courses/#{course.id}", target: '_blank') %>
|
||||
</td>
|
||||
<td><%= course.course_members_count %></td>
|
||||
<td><%= get_attachment_count(course, 0) %></td>
|
||||
<td><%= course.course_homework_count(1) %></td>
|
||||
<td><%= course.course_homework_count(3) %></td>
|
||||
<td><%= course.course_homework_count(4) %></td>
|
||||
<td><%= course.exercises_count %></td>
|
||||
<td><%= course.evaluate_count %></td>
|
||||
<td><%= course.is_public == 1 ? "--" : "√" %></td>
|
||||
<td><%= course.is_end ? "已结束" : "正在进行" %></td>
|
||||
<td><%= course.school&.name %></td>
|
||||
<td><%= course.teacher&.real_name %></td>
|
||||
<td><%= course.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
|
||||
<td>
|
||||
<%= check_box_tag :homepage_show,!course.homepage_show,course.homepage_show,remote:true,data:{id:course.id},class:"course-setting-form" %>
|
||||
</td>
|
||||
<td>
|
||||
<%= check_box_tag :email_notify,!course.email_notify,course.email_notify,remote:true,data:{id:course.id},class:"course-setting-form" %>
|
||||
</td>
|
||||
<td class="action-container">
|
||||
<% if course.is_delete == 0 %>
|
||||
<%= delete_link '删除', admins_course_path(course, element: ".course-item-#{course.id}"), class: 'delete-course-action' %>
|
||||
<% end %>
|
||||
</td>
|
||||
3
app/views/admins/courses/update.js.erb
Normal file
3
app/views/admins/courses/update.js.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
var index = $("#course-item-<%= @course.id %>").children(":first").html();
|
||||
$("#course-item-<%= @course.id %>").html("<%= j render partial: "admins/courses/shared/td",locals: {course: @course, no: 1} %>");
|
||||
$("#course-item-<%= @course.id %>").children(":first").html(index);
|
||||
Reference in New Issue
Block a user