Merge branches 'dev_aliyun' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into develop

chromesetting
杨树明 5 years ago
commit 0d1a018b46

@ -12,6 +12,11 @@ $(document).on('turbolinks:load', function() {
window.location.href = "/admins/shixun_settings.xls?" + searchForm.serialize();
});
// 基础数据导出
searchContainer.on('click', "#shixun-settings-base-export", function () {
window.location.href = "/admins/shixun_settings.xls?base_data=1" + searchForm.serialize();
});
$(".shixun-settings-list-container").on("change", '.shixun-setting-form', function () {
var s_id = $(this).attr("data-id");
var s_value = $(this).val();

@ -53,3 +53,8 @@ input.form-control {
position: absolute;
}
.export-base-absolute{
right:100px;
position: absolute;
}

@ -28,7 +28,13 @@ class Admins::ShixunSettingsController < Admins::BaseController
format.html
format.xls{
filename = "实训详情_#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}.xls"
send_data(shixun_list_xls(shixun_settings), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
export_url =
if params[:base_data].present?
shixun_base_list_xls(shixun_settings)
else
shixun_list_xls(shixun_settings)
end
send_data(export_url, :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
end
@ -91,6 +97,34 @@ class Admins::ShixunSettingsController < Admins::BaseController
xls_report.string
end
def shixun_base_list_xls shixuns
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "sheet"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
sheet1.row(0).concat(["实训ID","实训名称","技术平台", "Fork源", "状态","创建者", "单位", "职业", "关卡序号","关卡名称"])
count_row = 1
shixuns.includes(:mirror_repositories, :challenges, user: [user_extension: :school]).find_each do |shixun|
sheet1[count_row, 0] = shixun.identifier
sheet1[count_row, 1] = shixun.name
sheet1[count_row, 2] = shixun.mirror_repositories.select{|mr| mr.main_type == "1"}.first&.type_name
sheet1[count_row, 3] = shixun.fork_from
sheet1[count_row, 4] = shixun.shixun_status
sheet1[count_row, 5] = shixun.user.show_real_name
sheet1[count_row, 6] = shixun.user.school_name
sheet1[count_row, 7] = shixun.user.identity
shixun.challenges.each do |challenge|
sheet1[count_row, 8] = "#{challenge.position}"
sheet1[count_row, 9] = challenge.subject
count_row += 1
end
count_row += 1
end
book.write xls_report
xls_report.string
end
def setting_params
params.permit(:use_scope,:excute_time,:close,:status,:can_copy,:webssh,:hidden,:homepage_show,:task_pass,:code_hidden,:page_no, :id,tag_repertoires:[])
end

@ -47,10 +47,10 @@ class ApplicationController < ActionController::Base
end
if @user_course_identity == Course::STUDENT
# 实名认证和职业认证的身份判断
tip_exception(-2, "你的实名认证和职业认证审核未通过") if @course.authentication &&
tip_exception(411, "你的实名认证和职业认证审核未通过") if @course.authentication &&
@course.professional_certification && (!current_user.authentication && !current_user.professional_certification)
tip_exception(-2, "你的实名认证审核未通过") if @course.authentication && !current_user.authentication
tip_exception(-2, "你的职业认证审核未通过") if @course.professional_certification && !current_user.professional_certification
tip_exception(411, "你的实名认证审核未通过") if @course.authentication && !current_user.authentication
tip_exception(411, "你的职业认证审核未通过") if @course.professional_certification && !current_user.professional_certification
end
uid_logger("###############user_course_identity:#{@user_course_identity}")
end

@ -24,6 +24,7 @@
<%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with': '搜索中...') %>
<%= link_to "清除",admins_shixun_settings_path,class: "btn btn-default",'data-disable-with': '清除中...' %>
<div class="">
<a href="javascript:void(0)" class="btn btn-primary export-base-absolute" id="shixun-settings-base-export" data-disable-with = '导出中...'>导出基础数据</a>
<a href="javascript:void(0)" class="btn btn-primary export-absolute" id="shixun-settings-export" data-disable-with = '导出中...'>导出</a>
</div>
</div>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -33,12 +33,17 @@ Released under the MIT license
(function() {
(function() {
var cspNonce;
var nonce;
cspNonce = Rails.cspNonce = function() {
var meta;
meta = document.querySelector('meta[name=csp-nonce]');
return meta && meta.content;
nonce = null;
Rails.loadCSPNonce = function() {
var ref;
return nonce = (ref = document.querySelector("meta[name=csp-nonce]")) != null ? ref.content : void 0;
};
Rails.cspNonce = function() {
return nonce != null ? nonce : Rails.loadCSPNonce();
};
}).call(this);
@ -617,24 +622,29 @@ Released under the MIT license
return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));
};
Rails.handleMetaClick = function(e) {
var data, link, metaClick, method;
Rails.preventInsignificantClick = function(e) {
var data, insignificantMetaClick, link, metaClick, method, primaryMouseKey;
link = this;
method = (link.getAttribute('data-method') || 'GET').toUpperCase();
data = link.getAttribute('data-params');
metaClick = e.metaKey || e.ctrlKey;
if (metaClick && method === 'GET' && !data) {
insignificantMetaClick = metaClick && method === 'GET' && !data;
primaryMouseKey = e.button === 0;
if (!primaryMouseKey || insignificantMetaClick) {
return e.stopImmediatePropagation();
}
};
}).call(this);
(function() {
var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMetaClick, handleMethod, handleRemote, refreshCSRFTokens;
var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;
fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMetaClick = Rails.handleMetaClick, handleMethod = Rails.handleMethod;
fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;
if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null) && !jQuery.rails) {
if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null)) {
if (jQuery.rails) {
throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');
}
jQuery.rails = Rails;
jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {
if (!options.crossDomain) {
@ -663,12 +673,13 @@ Released under the MIT license
delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);
delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);
delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);
delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick);
delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);
delegate(document, Rails.linkClickSelector, 'click', handleConfirm);
delegate(document, Rails.linkClickSelector, 'click', handleMetaClick);
delegate(document, Rails.linkClickSelector, 'click', disableElement);
delegate(document, Rails.linkClickSelector, 'click', handleRemote);
delegate(document, Rails.linkClickSelector, 'click', handleMethod);
delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick);
delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);
delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);
delegate(document, Rails.buttonClickSelector, 'click', disableElement);
@ -686,10 +697,12 @@ Released under the MIT license
});
delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);
delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);
delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick);
delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);
delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);
delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);
document.addEventListener('DOMContentLoaded', refreshCSRFTokens);
document.addEventListener('DOMContentLoaded', loadCSPNonce);
return window._rails_loaded = true;
};
Loading…
Cancel
Save