Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_daiao
杨树林 5 years ago
commit b54eefd122

@ -26,6 +26,15 @@ $(document).on('turbolinks:load', function() {
});
});
// 清空
searchForm.on('click', '.clear-btn', function () {
searchForm.find('select[name="status"]').val('');
searchForm.find('.school-select').val('').trigger('change');
searchForm.find('input[name="keyword"]').val('');
searchForm.find('#homepage_show').attr('checked', false);
searchForm.find('input[type="submit"]').trigger('click');
});
// ************** 学校选择 *************
searchForm.find('.school-select').select2({
theme: 'bootstrap4',

@ -0,0 +1,11 @@
$(document).on('turbolinks:load', function () {
if ($('body.admins-projects-index-page').length > 0) {
var $form = $('.search-form');
// 清空
$form.on('click', '.clear-btn', function () {
$form.find('input[name="search"]').val('');
$form.find('input[type="submit"]').trigger('click');
});
}
});

@ -0,0 +1,12 @@
$(document).on('turbolinks:load', function () {
if ($('body.admins-shixun-modify-records-index-page').length > 0) {
var $form = $('.search-form');
// 清空
$form.on('click', '.clear-btn', function () {
$form.find('select[name="date"]').val('weekly');
$form.find('input[name="user_name"]').val('');
$form.find('input[type="submit"]').trigger('click');
});
}
});

@ -0,0 +1,14 @@
.diff{overflow:auto;}
.diff ul{background:#fff;overflow:auto;font-size:13px;list-style:none;margin:0;padding:0;display:table;width:100%;}
.diff del, .diff ins{display:block;text-decoration:none;}
.diff li{padding:0; display:table-row;margin: 0;height:1em;}
.diff li.ins{background:#dfd; color:#080}
.diff li.del{background:#fee; color:#b00}
.diff li:hover{background:#ffc}
/* try 'whitespace:pre;' if you don't want lines to wrap */
.diff del, .diff ins, .diff span{white-space:pre-wrap;font-family:courier;}
.diff del strong{font-weight:normal;background:#fcc;}
.diff ins strong{font-weight:normal;background:#9f9;}
.diff li.diff-comment { display: none; }
.diff li.diff-block-info { background: none repeat scroll 0 0 gray; }

@ -0,0 +1,9 @@
class Admins::ShixunModifyRecordsController < Admins::BaseController
def index
records = Admins::ShixunModifyRecordQuery.call(params)
@records = paginate records.includes(:diff_record_content)
end
end

@ -0,0 +1,33 @@
class Admins::ShixunModifyRecordQuery < ApplicationQuery
attr_reader :params
def initialize(params)
@params = params
end
def call
if params[:user_name].blank? || params[:date].blank?
records = DiffRecord.none
else
records = DiffRecord.joins(:user).where("concat(users.lastname, users.firstname) like ?", "%#{params[:user_name].strip}%")
if time_range.present?
records = records.where(created_at: time_range)
end
end
records.order("diff_records.created_at desc")
end
private
def time_range
@_time_range ||= begin
case params[:date]
when 'weekly' then 1.weeks.ago..Time.now
when 'monthly' then 1.months.ago..Time.now
when 'quarterly' then 3.months.ago..Time.now
when 'yearly' then 1.years.ago..Time.now
else ''
end
end
end
end

@ -27,8 +27,9 @@
<li><%= sidebar_item(admins_shixun_settings_path, '实训配置', icon: 'cog', controller: 'admins-shixun_settings') %></li>
<li><%= sidebar_item(admins_mirror_repositories_path, '镜像管理', icon: 'cubes', controller: 'admins-mirror_repositories') %></li>
<li><%= sidebar_item(admins_myshixuns_path, '学员实训列表', icon: 'server', controller: 'admins-myshixuns') %></li>
<li><%= sidebar_item(admins_shixun_recycles_path, '实训回收站', icon: 'recycle', controller: 'admins-myshixuns') %></li>
<% end %>
<li><%= sidebar_item(admins_shixun_modify_records_path, '实训修改记录', icon: 'eraser', controller: 'admins-shixun_modify_records') %></li>
<li><%= sidebar_item(admins_shixun_recycles_path, '实训回收站', icon: 'recycle', controller: 'admins-shixun_recycles') %></li>
<% end %>
</li>
<li>

@ -0,0 +1,25 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('实训修改记录') %>
<% end %>
<div class="box search-form-container shixun-modify-record-list-form">
<%= form_tag(admins_shixun_modify_records_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
<div class="form-group col-12 col-md-4">
<label for="user_name">用户名:</label>
<%= text_field_tag :user_name, params[:user_name], class: 'form-control flex-1', placeholder: '真实姓名搜索' %>
</div>
<div class="form-group col-12 col-md-auto">
<label for="status">时间范围:</label>
<% data_arrs = [['最近一周', 'weekly'], ['最近一个月', 'monthly']] %>
<%= select_tag(:date, options_for_select(data_arrs, params[:date]), class: 'form-control') %>
</div>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
<% end %>
</div>
<div class="box admin-list-container shixun-modify-record-list-container">
<%= render partial: 'admins/shixun_modify_records/shared/list', locals: { records: @records } %>
</div>

@ -0,0 +1 @@
$('.shixun-modify-record-list-container').html("<%= j( render partial: 'admins/shixun_modify_records/shared/list', locals: { records: @records } ) %>");

@ -0,0 +1,38 @@
<% if records.present? %>
<% records.each do |record| %>
<div class="record-item">
<div class="record-item-head font-16">
<span><%= record.user.real_name %></span>
<span class="ml-3"><%= format_time record.created_at %></span>
</div>
<div class="dropdown-divider"></div>
<div class="record-item-info font-14">
<span>实训名称:<%= record.container&.shixun&.name %></span>
<% if record.container_type == "Challenge" %>
<span class="ml-3">/</span>
<span class="ml-3">关卡名:<%= record.container&.subject %></span>
<% end %>
</div>
<div class="diff mt-2 font-12">
<ul>
<% record.diff_record_content&.content&.split("\n").each do |line| %>
<% if line =~ /^[\+]/ %>
<li class="ins"><ins><%= line %></ins></li>
<% elsif line =~ /^[\-]/ %>
<li class="del"><del><%= line %></del></li>
<% else %>
<li class="unchanged"><span><%= line %></span></li>
<% end %>
<% end %>
</ul>
</div>
</div>
<div class="dropdown-divider"></div>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
<%= render partial: 'admins/shared/paginate', locals: { objects: records } %>

@ -1056,6 +1056,7 @@ Rails.application.routes.draw do
resources :shixun_recycles, only: [:index, :destroy] do
post :resume, on: :member
end
resources :shixun_modify_records, only: [:index]
resources :department_applies,only: [:index,:destroy] do
collection do
post :merge

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save