commit
f46cee65db
@ -0,0 +1,6 @@
|
||||
|
||||
function show_add_manager(id) {
|
||||
$(".auth-schools-user-add").modal("show");
|
||||
|
||||
$(".auth-schools-user-add").find("#school_id_input").val(id)
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
$(document).on('turbolinks:load', function(){
|
||||
$(document).on('click', '.batch-all-check-box', function(){
|
||||
var $checkAll = $(this);
|
||||
|
||||
$('.batch-check-box').prop('checked', $checkAll.is(':checked'));
|
||||
})
|
||||
|
||||
$(document).on('click', '.batch-check-box', function(){
|
||||
var allChecked = $('.batch-check-box:checked').length === $('.batch-check-box').length
|
||||
$('.batch-all-check-box').prop('checked', allChecked);
|
||||
})
|
||||
});
|
@ -0,0 +1,132 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-carousels-index-page').length > 0) {
|
||||
var laboratoryId = $('#carousels-container').data('laboratoryId');
|
||||
var resetNo = function(){
|
||||
$('#carousels-container .custom-carousel-item-no').each(function(index, ele){
|
||||
$(ele).html(index + 1);
|
||||
})
|
||||
}
|
||||
// 删除后
|
||||
$(document).on('delete_success', resetNo);
|
||||
|
||||
// ------------ 保存链接 -----------
|
||||
$('.carousels-card').on('click', '.save-data-btn', function(){
|
||||
var $link = $(this);
|
||||
var id = $link.data('id');
|
||||
var link = $('.custom-carousel-item-' + id).find('.link-input').val();
|
||||
var name = $('.custom-carousel-item-' + id).find('.name-input').val();
|
||||
if(!name || name.length == 0){
|
||||
$.notify({ message: '名称不能为空' },{ type: 'danger' });
|
||||
return;
|
||||
}
|
||||
$link.attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/laboratories/' + laboratoryId + '/carousels/' + id,
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
data: { link: link, name: name },
|
||||
success: function(data){
|
||||
$.notify({ message: '操作成功' });
|
||||
},
|
||||
error: ajaxErrorNotifyHandler,
|
||||
complete: function(){
|
||||
$link.removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
});
|
||||
// -------------- 是否在首页展示 --------------
|
||||
$('.carousels-card').on('change', '.online-check-box', function(){
|
||||
var $checkbox = $(this);
|
||||
var id = $checkbox.data('id');
|
||||
var checked = $checkbox.is(':checked');
|
||||
$checkbox.attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/laboratories/' + laboratoryId + '/carousels/' + id,
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
data: { status: checked },
|
||||
success: function(data){
|
||||
$.notify({ message: '保存成功' });
|
||||
var box = $('.custom-carousel-item-' + id).find('.drag');
|
||||
if(checked){
|
||||
box.removeClass('not_active');
|
||||
}else{
|
||||
box.addClass('not_active');
|
||||
}
|
||||
},
|
||||
error: ajaxErrorNotifyHandler,
|
||||
complete: function(){
|
||||
$checkbox.removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// ------------ 拖拽 -------------
|
||||
var onDropFunc = function(el, _target, _source, sibling){
|
||||
var moveId = $(el).data('id');
|
||||
var insertId = $(sibling).data('id') || '';
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/laboratories/' + laboratoryId + '/carousels/drag',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: { move_id: moveId, after_id: insertId },
|
||||
success: function(data){
|
||||
resetNo();
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$.notify({message: '移动失败,原因:' + data.message}, {type: 'danger'});
|
||||
}
|
||||
})
|
||||
};
|
||||
var ele1 = document.getElementById('carousels-container');
|
||||
dragula([ele1], { mirrorContainer: ele1 }).on('drop', onDropFunc);
|
||||
|
||||
|
||||
// ----------- 新增 --------------
|
||||
var $createModal = $('.modal.admin-add-carousel-modal');
|
||||
var $createForm = $createModal.find('form.admin-add-carousel-form');
|
||||
|
||||
$createForm.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
"portal_image[image]": {
|
||||
required: true
|
||||
},
|
||||
"portal_image[name]": {
|
||||
required: true
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
$createModal.on('show.bs.modal', function(event){
|
||||
resetFileInputFunc($createModal.find('.img-file-input'));
|
||||
$createModal.find('.file-names').html('选择文件');
|
||||
});
|
||||
|
||||
$createModal.on('click', '.submit-btn', function() {
|
||||
$createForm.find('.error').html('');
|
||||
|
||||
if ($createForm.valid()) {
|
||||
$createForm.submit();
|
||||
} else {
|
||||
$createForm.find('.error').html('请选择图片');
|
||||
}
|
||||
});
|
||||
$createModal.on('change', '.img-file-input', function(){
|
||||
var file = $(this)[0].files[0];
|
||||
$createModal.find('.file-names').html(file ? file.name : '请选择文件');
|
||||
})
|
||||
|
||||
// -------------- 重新上传图片 --------------
|
||||
//replace_image_url
|
||||
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
|
||||
var $carouselItem = $('.custom-carousel-item-' + data.source_id);
|
||||
$carouselItem.find('.custom-carousel-item-img img').attr('src', data.url);
|
||||
})
|
||||
}
|
||||
})
|
@ -0,0 +1,73 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-competitions-index-page').length > 0) {
|
||||
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
|
||||
var $imageElement = $('.competition-image-' + data.source_id);
|
||||
$imageElement.attr('src', data.url);
|
||||
$imageElement.show();
|
||||
$imageElement.next().html('重新上传');
|
||||
});
|
||||
}
|
||||
|
||||
$(".admin-competition-list-form").on("change", '.competitions-hot-select', function () {
|
||||
var s_value = $(this).get(0).checked ? 1 : 0;
|
||||
var json = {};
|
||||
json["hot"] = s_value;
|
||||
$.ajax({
|
||||
url: "/admins/competitions/hot_setting",
|
||||
type: "POST",
|
||||
dataType:'json',
|
||||
data: json,
|
||||
success: function(){
|
||||
$.notify({ message: '操作成功' });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ============== 新增竞赛 ===============
|
||||
var $modal = $('.modal.admin-create-competition-modal');
|
||||
var $form = $modal.find('form.admin-create-competition-form');
|
||||
var $competitionNameInput = $form.find('input[name="competition_name"]');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
competition_name: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$competitionNameInput.val('');
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$modal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -0,0 +1,70 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-ec-templates-index-page').length > 0) {
|
||||
var add_modal = $(".ec-templates-new-add");
|
||||
var template_file_name = add_modal.find(".template-file-upload");
|
||||
var attachment_id_input = add_modal.find(".template_attachment_id");
|
||||
var template_container = $(".ec-templates-list-container");
|
||||
|
||||
//编辑附件
|
||||
template_container.on("click", ".edit-template-content", function () {
|
||||
var t_id = $(this).attr("data-id");
|
||||
var t_name = $(this).attr("data-name");
|
||||
var template_name = $(this).attr("data-template-name");
|
||||
var t_msg = $(this).attr("data-msg");
|
||||
var template_id = $(this).attr("data-template-id");
|
||||
add_modal.modal("show");
|
||||
add_modal.find(".template_add_title").html(t_msg);
|
||||
attachment_id_input.val(template_id);
|
||||
add_modal.find(".template_show_id").val(t_id);
|
||||
add_modal.find("input[name='name']").val(t_name);
|
||||
add_modal.find("i.delete-template-icon").attr("data-id", template_id);
|
||||
if(template_id !== "-1"){
|
||||
template_file_name.find("span.template-file-input").hide();
|
||||
template_file_name.find("span.template_file_show").show();
|
||||
template_file_name.find("span.template_file_show_title").html(template_name);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//删除附件
|
||||
add_modal.on("click",".delete-template-icon",function () {
|
||||
var attachment_id = $(this).attr("data-id");
|
||||
$.ajax({
|
||||
url: "/api/attachments/" + attachment_id,
|
||||
type: "delete",
|
||||
contentType:"application/json",
|
||||
dataType:"json",
|
||||
success: function (data) {
|
||||
template_file_name.find("span.template-file-input").show();
|
||||
template_file_name.find("span.template_file_show").hide();
|
||||
attachment_id_input.attr("value","-1")
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//上传附件
|
||||
add_modal.on("change", "#upload_template_file",function () {
|
||||
|
||||
var template = document.getElementById('upload_template_file').files[0];
|
||||
|
||||
var file_content = new FormData();
|
||||
|
||||
file_content.append("file", template);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api/attachments",
|
||||
data:file_content,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function (data) {
|
||||
template_file_name.find("span.template-file-input").hide();
|
||||
template_file_name.find("span.template_file_show").show();
|
||||
template_file_name.find("span.template_file_show_title").html(template.name);
|
||||
template_file_name.find("i.delete-template-icon").attr("data-id",data.id);
|
||||
attachment_id_input.val(data.id)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
@ -0,0 +1,9 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if($('body.admins-enroll-lists-index-page').length > 0){
|
||||
var search_form = $(".search-form");
|
||||
//导出
|
||||
$(".competition-enroll-list-form").on("click","#enroll-lists-export",function () {
|
||||
window.location.href = "/admins/competitions/"+$(this).attr("data-competition-id")+"/enroll_lists/export.xlsx?" + search_form.serialize();
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if($(".admins-graduation-standards-index-page").length > 0){
|
||||
$(".admin-body-container").on("click", ".standard-create-modal", function () {
|
||||
var content = $(this).attr("data-content");
|
||||
var g_id = $(this).attr("data-id");
|
||||
var g_msg = $(this).attr("data-msg");
|
||||
|
||||
$("#graduation-modal-type").html(g_msg);
|
||||
$("#graduation_standard_id").val(g_id);
|
||||
$("textarea[name='content']").val(content);
|
||||
})
|
||||
}
|
||||
});
|
@ -0,0 +1,86 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-laboratory-settings-show-page, body.admins-laboratory-settings-update-page').length > 0) {
|
||||
var $container = $('.edit-laboratory-setting-container');
|
||||
var $form = $container.find('.edit_laboratory');
|
||||
|
||||
$('.logo-item-left').on("change", 'input[type="file"]', function () {
|
||||
var $fileInput = $(this);
|
||||
var file = this.files[0];
|
||||
var imageType = /image.*/;
|
||||
if (file && file.type.match(imageType)) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function () {
|
||||
var $box = $fileInput.parent();
|
||||
$box.find('img').attr('src', reader.result).css('display', 'block');
|
||||
$box.addClass('has-img');
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
} else {
|
||||
}
|
||||
});
|
||||
|
||||
createMDEditor('laboratory-footer-editor', { height: 200, placeholder: '请输入备案信息' });
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
errorPlacement:function(error,element){
|
||||
if(element.parent().hasClass("input-group")){
|
||||
element.parent().after(error);
|
||||
}else{
|
||||
element.after(error)
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
identifier: {
|
||||
required: true,
|
||||
checkSite: true
|
||||
},
|
||||
name: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
$.validator.addMethod("checkSite",function(value,element,params){
|
||||
var checkSite = /^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$/;
|
||||
return this.optional(element)||(checkSite.test(value + '.educoder.com'));
|
||||
},"域名不合法!");
|
||||
|
||||
$form.on('click', '.submit-btn', function(){
|
||||
$form.find('.submit-btn').attr('disabled', 'disabled');
|
||||
$form.find('.error').html('');
|
||||
var valid = $form.valid();
|
||||
|
||||
$('input[name="navbar[][name]"]').each(function(_, e){
|
||||
var $ele = $(e);
|
||||
if($ele.val() === undefined || $ele.val().length === 0){
|
||||
$ele.addClass('danger text-danger');
|
||||
valid = false;
|
||||
} else {
|
||||
$ele.removeClass('danger text-danger');
|
||||
}
|
||||
});
|
||||
|
||||
if(!valid) return;
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
url: $form.attr('action'),
|
||||
data: new FormData($form[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data){
|
||||
$.notify({ message: '保存成功' });
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
},
|
||||
complete: function(){
|
||||
$form.find('.submit-btn').attr('disabled', false);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
@ -0,0 +1,164 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-laboratories-index-page').length > 0) {
|
||||
var $searchContainer = $('.laboratory-list-form');
|
||||
var $searchForm = $searchContainer.find('form.search-form');
|
||||
var $list = $('.laboratory-list-container');
|
||||
|
||||
// ============== 新建 ===============
|
||||
var $modal = $('.modal.admin-create-laboratory-modal');
|
||||
var $form = $modal.find('form.admin-create-laboratory-form');
|
||||
var $schoolSelect = $modal.find('.school-select');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
school_id: {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
school_id: {
|
||||
required: '请选择所属单位'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$schoolSelect.select2('val', ' ');
|
||||
});
|
||||
|
||||
// ************** 学校选择 *************
|
||||
var matcherFunc = function(params, data){
|
||||
if ($.trim(params.term) === '') {
|
||||
return data;
|
||||
}
|
||||
if (typeof data.text === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (data.name && data.name.indexOf(params.term) > -1) {
|
||||
var modifiedData = $.extend({}, data, true);
|
||||
return modifiedData;
|
||||
}
|
||||
|
||||
// Return `null` if the term should not be displayed
|
||||
return null;
|
||||
};
|
||||
|
||||
var defineSchoolSelect = function(schools) {
|
||||
$schoolSelect.select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请选择单位',
|
||||
minimumInputLength: 1,
|
||||
data: schools,
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
return item.name;
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
$('#school_id').val(item.id);
|
||||
}
|
||||
return item.name || item.text;
|
||||
},
|
||||
matcher: matcherFunc
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: '/api/schools/for_option.json',
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
defineSchoolSelect(data.schools);
|
||||
}
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$modal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// ============= 添加管理员 ==============
|
||||
var $addMemberModal = $('.admin-add-laboratory-user-modal');
|
||||
var $addMemberForm = $addMemberModal.find('.admin-add-laboratory-user-form');
|
||||
var $memberSelect = $addMemberModal.find('.laboratory-user-select');
|
||||
var $laboratoryIdInput = $addMemberForm.find('input[name="laboratory_id"]')
|
||||
|
||||
$addMemberModal.on('show.bs.modal', function(event){
|
||||
var $link = $(event.relatedTarget);
|
||||
var laboratoryId = $link.data('laboratory-id');
|
||||
$laboratoryIdInput.val(laboratoryId);
|
||||
|
||||
$memberSelect.select2('val', ' ');
|
||||
});
|
||||
|
||||
$memberSelect.select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请输入要添加的管理员姓名',
|
||||
multiple: true,
|
||||
minimumInputLength: 1,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/admins/users',
|
||||
dataType: 'json',
|
||||
data: function(params){
|
||||
return { name: params.term };
|
||||
},
|
||||
processResults: function(data){
|
||||
return { results: data.users }
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
return $("<span>" + item.real_name + " <span class='font-12'>" + item.school_name + ' ' + item.hidden_phone + "</span></span>");
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
}
|
||||
return item.real_name || item.text;
|
||||
}
|
||||
});
|
||||
|
||||
$addMemberModal.on('click', '.submit-btn', function(){
|
||||
$addMemberForm.find('.error').html('');
|
||||
|
||||
var laboratoryId = $laboratoryIdInput.val();
|
||||
var memberIds = $memberSelect.val();
|
||||
if (laboratoryId && memberIds && memberIds.length > 0) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'script',
|
||||
url: '/admins/laboratories/' + laboratoryId + '/laboratory_user',
|
||||
data: { user_ids: memberIds }
|
||||
});
|
||||
} else {
|
||||
$addMemberModal.modal('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-major-informations-index-page').length > 0) {
|
||||
var box_contain = $(".major-informations-list-container");
|
||||
box_contain.on("click",".collapse-item",function () {
|
||||
var a_fa = $(this).find("i");
|
||||
if(a_fa.hasClass("fa-caret-right")){
|
||||
a_fa.removeClass("fa-caret-right").addClass("fa-caret-down");
|
||||
}else{
|
||||
a_fa.removeClass("fa-caret-down").addClass("fa-caret-right");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
$(document).on('turbolinks:load', function () {
|
||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-subject-modal', function () {
|
||||
var $modal = $('.modal.admin-edit-subject-modal');
|
||||
var $form = $modal.find('form.admin-edit-subject-form');
|
||||
|
||||
$modal.on('click', '.submit-btn', function () {
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
@ -0,0 +1,46 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.admin-modal-container').on('show.bs.modal', '.admin-save-competition-prize-modal', function(event){
|
||||
var $modal = $('.modal.admin-save-competition-prize-modal');
|
||||
var $form = $modal.find('form.admin-save-competition-prize-form');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
'competition_prize[name]': {
|
||||
required: true,
|
||||
maxlength: 10
|
||||
},
|
||||
'competition_prize[num]': {
|
||||
required: true,
|
||||
digits: true,
|
||||
min: 1
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
var formMethod = $form.data('form-method')
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: formMethod,
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
success: function(data){
|
||||
if(data && data.status === 0) {
|
||||
show_success_flash();
|
||||
$(document).trigger('prize.save.success');
|
||||
$modal.modal('hide');
|
||||
} else {
|
||||
$modal.find('.error').html(data.message)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
@ -0,0 +1,4 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-schools-index-page').length > 0) {
|
||||
}
|
||||
});
|
@ -0,0 +1,113 @@
|
||||
$(document).on('turbolinks:load', function () {
|
||||
if ($('body.admins-subjects-index-page').length > 0) {
|
||||
var $form = $('.subject-list-form');
|
||||
|
||||
// ************** 学校选择 *************
|
||||
$form.find('.school-select').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请选择创建者单位',
|
||||
minimumInputLength: 1,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/api/schools/for_option.json',
|
||||
dataType: 'json',
|
||||
data: function (params) {
|
||||
return {keyword: params.term};
|
||||
},
|
||||
processResults: function (data) {
|
||||
return {results: data.schools}
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if (!item.id || item.id === '') return item.text;
|
||||
return item.name;
|
||||
},
|
||||
templateSelection: function (item) {
|
||||
if (item.id) {
|
||||
}
|
||||
return item.name || item.text;
|
||||
}
|
||||
});
|
||||
|
||||
// 清空
|
||||
$form.on('click', '.clear-btn', function () {
|
||||
$form.find('select[name="status"]').val('');
|
||||
$form.find('.school-select').val('').trigger('change');
|
||||
$form.find('input[name="keyword"]').val('');
|
||||
$form.find('#homepage_show').attr('checked', false);
|
||||
$form.find('#excellent').attr('checked', false);
|
||||
$form.find('input[type="submit"]').trigger('click');
|
||||
})
|
||||
|
||||
// 上传图片
|
||||
$('.modal.admin-upload-file-modal').on('upload:success', function (e, data) {
|
||||
if(data.suffix == '_qrcode'){
|
||||
var $imageElement = $('.subject-weapp-image-' + data.source_id);
|
||||
$imageElement.attr('src', data.url);
|
||||
$imageElement.show();
|
||||
$imageElement.next().html('重新上传');
|
||||
} else {
|
||||
var $imageElement = $('.subject-image-' + data.source_id);
|
||||
$imageElement.attr('src', data.url);
|
||||
$imageElement.show();
|
||||
$imageElement.next().html('重新上传');
|
||||
}
|
||||
});
|
||||
// 定义状态切换监听事件
|
||||
var defineStatusChangeFunc = function (doElement, undoElement, url, callback) {
|
||||
$('.subject-list-container').on('click', doElement, function () {
|
||||
var $doAction = $(this);
|
||||
var $undoAction = $doAction.siblings(undoElement);
|
||||
|
||||
var subjectId = $doAction.data('id');
|
||||
customConfirm({
|
||||
content: '确认进行该操作吗?',
|
||||
ok: function () {
|
||||
$.ajax({
|
||||
url: '/admins/subjects/' + subjectId + url,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function () {
|
||||
show_success_flash();
|
||||
$doAction.hide();
|
||||
$undoAction.show();
|
||||
if (callback && typeof callback === "function") {
|
||||
callback(subjectId, url);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
// 隐藏与取消隐藏
|
||||
defineStatusChangeFunc('.hide-action', '.active-action', '/hide');
|
||||
defineStatusChangeFunc('.active-action', '.hide-action', '/cancel_hide');
|
||||
|
||||
// 首页展示与取消首页展示
|
||||
var homepageShowCallback = function (subjectId, url) {
|
||||
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
|
||||
|
||||
if (url === '/homepage_show') {
|
||||
$subjectItem.find('.homepage-show-badge').show();
|
||||
} else {
|
||||
$subjectItem.find('.homepage-show-badge').hide();
|
||||
}
|
||||
}
|
||||
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage_show', homepageShowCallback);
|
||||
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage_show', homepageShowCallback);
|
||||
|
||||
// 设为金课与取消金课
|
||||
var excellentCallback = function (subjectId, url) {
|
||||
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
|
||||
|
||||
if (url === '/excellent') {
|
||||
$subjectItem.find('.excellent-badge').show();
|
||||
} else {
|
||||
$subjectItem.find('.excellent-badge').hide();
|
||||
}
|
||||
}
|
||||
defineStatusChangeFunc('.excellent-action', '.cancel-excellent-action', '/excellent', excellentCallback);
|
||||
defineStatusChangeFunc('.cancel-excellent-action', '.excellent-action', '/cancel_excellent', excellentCallback);
|
||||
}
|
||||
});
|
@ -0,0 +1,73 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-user-statistics-index-page').length > 0) {
|
||||
var $form = $('.user-statistic-list-form');
|
||||
|
||||
// ************** 学校选择 *************
|
||||
var matcherFunc = function(params, data){
|
||||
if ($.trim(params.term) === '') {
|
||||
return data;
|
||||
}
|
||||
if (typeof data.text === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (data.name && data.name.indexOf(params.term) > -1) {
|
||||
var modifiedData = $.extend({}, data, true);
|
||||
return modifiedData;
|
||||
}
|
||||
|
||||
// Return `null` if the term should not be displayed
|
||||
return null;
|
||||
}
|
||||
|
||||
var defineSchoolSelect = function (schools) {
|
||||
$form.find('.school-select').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '选择学校/单位',
|
||||
minimumInputLength: 1,
|
||||
data: schools,
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
return item.name;
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
$form.find('#school_id').val(item.id);
|
||||
}
|
||||
return item.name || item.text;
|
||||
},
|
||||
matcher: matcherFunc
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// 初始化学校选择器
|
||||
$.ajax({
|
||||
url: '/api/schools/for_option.json',
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
defineSchoolSelect(data.schools);
|
||||
}
|
||||
});
|
||||
|
||||
// 清空
|
||||
$form.on('click', '.clear-btn', function(){
|
||||
$form.find('select[name="date"]').val('');
|
||||
$form.find('.school-select').val('').trigger('change');
|
||||
$form.find('input[type="submit"]').trigger('click');
|
||||
})
|
||||
|
||||
|
||||
// 导出
|
||||
$('.export-action').on('click', function(){
|
||||
var form = $(".user-statistic-list-form .search-form")
|
||||
var exportLink = $(this);
|
||||
var date = form.find("select[name='date']").val();
|
||||
var schoolId = form.find('input[name="school_id"]').val();
|
||||
|
||||
var url = exportLink.data("url").split('?')[0] + "?date=" + date + "&school_id=" + schoolId;
|
||||
window.open(url);
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,124 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-weapp-adverts-index-page').length > 0) {
|
||||
var resetNo = function(){
|
||||
$('#adverts-container .advert-item-no').each(function(index, ele){
|
||||
$(ele).html(index + 1);
|
||||
})
|
||||
}
|
||||
|
||||
// ------------ 保存链接 -----------
|
||||
$('.adverts-card').on('click', '.save-data-btn', function(){
|
||||
var $link = $(this);
|
||||
var id = $link.data('id');
|
||||
var link = $('.advert-item-' + id).find('.link-input').val();
|
||||
$link.attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/weapp_adverts/' + id,
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
data: { link: link },
|
||||
success: function(data){
|
||||
$.notify({ message: '操作成功' });
|
||||
},
|
||||
error: ajaxErrorNotifyHandler,
|
||||
complete: function(){
|
||||
$link.removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
});
|
||||
// -------------- 是否在首页展示 --------------
|
||||
$('.adverts-card').on('change', '.online-check-box', function(){
|
||||
var $checkbox = $(this);
|
||||
var id = $checkbox.data('id');
|
||||
var checked = $checkbox.is(':checked');
|
||||
$checkbox.attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/weapp_adverts/' + id,
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
data: { online: checked },
|
||||
success: function(data){
|
||||
$.notify({ message: '保存成功' });
|
||||
var box = $('.advert-item-' + id).find('.drag');
|
||||
if(checked){
|
||||
box.removeClass('not_active');
|
||||
}else{
|
||||
box.addClass('not_active');
|
||||
}
|
||||
},
|
||||
error: ajaxErrorNotifyHandler,
|
||||
complete: function(){
|
||||
$checkbox.removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// ------------ 拖拽 -------------
|
||||
var onDropFunc = function(el, _target, _source, sibling){
|
||||
var moveId = $(el).data('id');
|
||||
var insertId = $(sibling).data('id') || '';
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/weapp_adverts/drag',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: { move_id: moveId, after_id: insertId },
|
||||
success: function(data){
|
||||
resetNo();
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$.notify({message: '移动失败,原因:' + data.message}, {type: 'danger'});
|
||||
}
|
||||
})
|
||||
};
|
||||
var ele1 = document.getElementById('adverts-container');
|
||||
dragula([ele1], { mirrorContainer: ele1 }).on('drop', onDropFunc);
|
||||
|
||||
|
||||
// ----------- 新增 --------------
|
||||
var $createModal = $('.modal.admin-add-weapp-advert-modal');
|
||||
var $createForm = $createModal.find('form.admin-add-weapp-advert-form');
|
||||
|
||||
$createForm.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
"weapp_settings_advert[image]": {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$createModal.on('show.bs.modal', function(event){
|
||||
resetFileInputFunc($createModal.find('.img-file-input'));
|
||||
$createModal.find('.file-names').html('选择文件');
|
||||
});
|
||||
|
||||
$createModal.on('click', '.submit-btn', function() {
|
||||
$createForm.find('.error').html('');
|
||||
|
||||
if ($createForm.valid()) {
|
||||
$createForm.submit();
|
||||
} else {
|
||||
$createForm.find('.error').html('请选择图片');
|
||||
}
|
||||
});
|
||||
$createModal.on('change', '.img-file-input', function(){
|
||||
var file = $(this)[0].files[0];
|
||||
$createModal.find('.file-names').html(file ? file.name : '请选择文件');
|
||||
})
|
||||
|
||||
// -------------- 重新上传图片 --------------
|
||||
//replace_image_url
|
||||
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
|
||||
var $advertItem = $('.advert-item-' + data.source_id);
|
||||
$advertItem.find('.advert-item-img img').attr('src', data.url);
|
||||
})
|
||||
|
||||
// 删除后
|
||||
$(document).on('delete_success', resetNo)
|
||||
}
|
||||
})
|
@ -0,0 +1,123 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-weapp-carousels-index-page').length > 0) {
|
||||
var resetNo = function(){
|
||||
$('#carousels-container .custom-carousel-item-no').each(function(index, ele){
|
||||
$(ele).html(index + 1);
|
||||
})
|
||||
}
|
||||
// ------------ 保存链接 -----------
|
||||
$('.carousels-card').on('click', '.save-data-btn', function(){
|
||||
var $link = $(this);
|
||||
var id = $link.data('id');
|
||||
var link = $('.custom-carousel-item-' + id).find('.link-input').val();
|
||||
$link.attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/weapp_carousels/' + id,
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
data: { link: link },
|
||||
success: function(data){
|
||||
$.notify({ message: '操作成功' });
|
||||
},
|
||||
error: ajaxErrorNotifyHandler,
|
||||
complete: function(){
|
||||
$link.removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
});
|
||||
// -------------- 是否在首页展示 --------------
|
||||
$('.carousels-card').on('change', '.online-check-box', function(){
|
||||
var $checkbox = $(this);
|
||||
var id = $checkbox.data('id');
|
||||
var checked = $checkbox.is(':checked');
|
||||
$checkbox.attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/weapp_carousels/' + id,
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
data: { online: checked },
|
||||
success: function(data){
|
||||
$.notify({ message: '保存成功' });
|
||||
var box = $('.custom-carousel-item-' + id).find('.drag');
|
||||
if(checked){
|
||||
box.removeClass('not_active');
|
||||
}else{
|
||||
box.addClass('not_active');
|
||||
}
|
||||
},
|
||||
error: ajaxErrorNotifyHandler,
|
||||
complete: function(){
|
||||
$checkbox.removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// ------------ 拖拽 -------------
|
||||
var onDropFunc = function(el, _target, _source, sibling){
|
||||
var moveId = $(el).data('id');
|
||||
var insertId = $(sibling).data('id') || '';
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/weapp_carousels/drag',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: { move_id: moveId, after_id: insertId },
|
||||
success: function(data){
|
||||
resetNo();
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$.notify({message: '移动失败,原因:' + data.message}, {type: 'danger'});
|
||||
}
|
||||
})
|
||||
};
|
||||
var ele1 = document.getElementById('carousels-container');
|
||||
dragula([ele1], { mirrorContainer: ele1 }).on('drop', onDropFunc);
|
||||
|
||||
|
||||
// ----------- 新增 --------------
|
||||
var $createModal = $('.modal.admin-add-weapp-carousel-modal');
|
||||
var $createForm = $createModal.find('form.admin-add-weapp-carousel-form');
|
||||
|
||||
$createForm.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
"weapp_settings_carousel[image]": {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$createModal.on('show.bs.modal', function(event){
|
||||
resetFileInputFunc($createModal.find('.img-file-input'));
|
||||
$createModal.find('.file-names').html('选择文件');
|
||||
});
|
||||
|
||||
$createModal.on('click', '.submit-btn', function() {
|
||||
$createForm.find('.error').html('');
|
||||
|
||||
if ($createForm.valid()) {
|
||||
$createForm.submit();
|
||||
} else {
|
||||
$createForm.find('.error').html('请选择图片');
|
||||
}
|
||||
});
|
||||
$createModal.on('change', '.img-file-input', function(){
|
||||
var file = $(this)[0].files[0];
|
||||
$createModal.find('.file-names').html(file ? file.name : '请选择文件');
|
||||
})
|
||||
|
||||
// -------------- 重新上传图片 --------------
|
||||
//replace_image_url
|
||||
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
|
||||
var $carouselItem = $('.custom-carousel-item-' + data.source_id);
|
||||
$carouselItem.find('.custom-carousel-item-img img').attr('src', data.url);
|
||||
})
|
||||
|
||||
// 删除后
|
||||
$(document).on('delete_success', resetNo)
|
||||
}
|
||||
})
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,92 @@
|
||||
//= require rails-ujs
|
||||
//= require activestorage
|
||||
//= require turbolinks
|
||||
//= require jquery3
|
||||
//= require popper
|
||||
//= require bootstrap-sprockets
|
||||
//= require jquery.validate.min
|
||||
//= require additional-methods.min
|
||||
//= require bootstrap-notify
|
||||
//= require jquery.cookie.min
|
||||
//= require select2
|
||||
//= require jquery.cxselect
|
||||
//= require bootstrap-datepicker
|
||||
//= require bootstrap-datetimepicker
|
||||
//= require bootstrap.viewer
|
||||
//= require jquery.mloading
|
||||
//= require jquery-confirm.min
|
||||
//= require common
|
||||
|
||||
//= require echarts
|
||||
//= require codemirror/lib/codemirror
|
||||
//= require codemirror/mode/shell/shell
|
||||
//= require editormd/editormd
|
||||
//= require editormd/languages/zh-tw
|
||||
//= require dragula/dragula
|
||||
|
||||
//= require_tree ./i18n
|
||||
//= require_tree ./cooperative
|
||||
|
||||
|
||||
$.ajaxSetup({
|
||||
beforeSend: function(xhr) {
|
||||
xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'));
|
||||
}
|
||||
});
|
||||
|
||||
// ******** select2 global config ********
|
||||
$.fn.select2.defaults.set('theme', 'bootstrap4');
|
||||
$.fn.select2.defaults.set('language', 'zh-CN');
|
||||
|
||||
Turbolinks.setProgressBarDelay(200);
|
||||
|
||||
$.notifyDefaults({
|
||||
type: 'success',
|
||||
z_index: 9999,
|
||||
delay: 2000
|
||||
});
|
||||
|
||||
$(document).on('turbolinks:load', function(){
|
||||
$('[data-toggle="tooltip"]').tooltip({ trigger : 'hover' });
|
||||
$('[data-toggle="popover"]').popover();
|
||||
|
||||
// 图片查看大图
|
||||
$('img.preview-image').bootstrapViewer();
|
||||
|
||||
// flash alert提示框自动关闭
|
||||
if($('.cooperative-alert-container .alert').length > 0){
|
||||
setTimeout(function(){
|
||||
$('.cooperative-alert-container .alert:not(.alert-danger)').alert('close');
|
||||
}, 2000);
|
||||
setTimeout(function(){
|
||||
$('.cooperative-alert-container .alert.alert-danger').alert('close');
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("turbolinks:before-cache", function () {
|
||||
$('[data-toggle="tooltip"]').tooltip('hide');
|
||||
$('[data-toggle="popover"]').popover('hide');
|
||||
});
|
||||
// var progressBar = new Turbolinks.ProgressBar();
|
||||
|
||||
// $(document).on('ajax:send', function(event){
|
||||
// console.log('ajax send', event);
|
||||
// progressBar.setValue(0)
|
||||
// progressBar.show()
|
||||
// });
|
||||
//
|
||||
// $(document).on('ajax:complete', function(event){
|
||||
// console.log('ajax complete', event);
|
||||
// progressBar.setValue(1)
|
||||
// progressBar.hide() // 分页时不触发,奇怪
|
||||
// });
|
||||
// $(document).on('ajax:success', function(event){
|
||||
// console.log('ajax success', event);
|
||||
// });
|
||||
// $(document).on('ajax:error', function(event){
|
||||
// console.log('ajax error', event);
|
||||
// });
|
||||
|
||||
$(function () {
|
||||
});
|
@ -0,0 +1,130 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.cooperative-carousels-index-page').length > 0) {
|
||||
var resetNo = function(){
|
||||
$('#carousels-container .custom-carousel-item-no').each(function(index, ele){
|
||||
$(ele).html(index + 1);
|
||||
})
|
||||
}
|
||||
// 删除后
|
||||
$(document).on('delete_success', resetNo);
|
||||
// ------------ 保存链接 -----------
|
||||
$('.carousels-card').on('click', '.save-data-btn', function(){
|
||||
var $link = $(this);
|
||||
var id = $link.data('id');
|
||||
var link = $('.custom-carousel-item-' + id).find('.link-input').val();
|
||||
var name = $('.custom-carousel-item-' + id).find('.name-input').val();
|
||||
if(!name || name.length == 0){
|
||||
$.notify({ message: '名称不能为空' },{ type: 'danger' });
|
||||
return;
|
||||
}
|
||||
$link.attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
url: '/cooperative/carousels/' + id,
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
data: { link: link, name: name },
|
||||
success: function(data){
|
||||
$.notify({ message: '操作成功' });
|
||||
},
|
||||
error: ajaxErrorNotifyHandler,
|
||||
complete: function(){
|
||||
$link.removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
});
|
||||
// -------------- 是否在首页展示 --------------
|
||||
$('.carousels-card').on('change', '.online-check-box', function(){
|
||||
var $checkbox = $(this);
|
||||
var id = $checkbox.data('id');
|
||||
var checked = $checkbox.is(':checked');
|
||||
$checkbox.attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
url: '/cooperative/carousels/' + id,
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
data: { status: checked },
|
||||
success: function(data){
|
||||
$.notify({ message: '保存成功' });
|
||||
var box = $('.custom-carousel-item-' + id).find('.drag');
|
||||
if(checked){
|
||||
box.removeClass('not_active');
|
||||
}else{
|
||||
box.addClass('not_active');
|
||||
}
|
||||
},
|
||||
error: ajaxErrorNotifyHandler,
|
||||
complete: function(){
|
||||
$checkbox.removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// ------------ 拖拽 -------------
|
||||
var onDropFunc = function(el, _target, _source, sibling){
|
||||
var moveId = $(el).data('id');
|
||||
var insertId = $(sibling).data('id') || '';
|
||||
|
||||
$.ajax({
|
||||
url: '/cooperative/carousels/drag',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: { move_id: moveId, after_id: insertId },
|
||||
success: function(data){
|
||||
resetNo();
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$.notify({message: '移动失败,原因:' + data.message}, {type: 'danger'});
|
||||
}
|
||||
})
|
||||
};
|
||||
var ele1 = document.getElementById('carousels-container');
|
||||
dragula([ele1], { mirrorContainer: ele1 }).on('drop', onDropFunc);
|
||||
|
||||
|
||||
// ----------- 新增 --------------
|
||||
var $createModal = $('.modal.cooperative-add-carousel-modal');
|
||||
var $createForm = $createModal.find('form.cooperative-add-carousel-form');
|
||||
|
||||
$createForm.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
"portal_image[image]": {
|
||||
required: true
|
||||
},
|
||||
"portal_image[name]": {
|
||||
required: true
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
$createModal.on('show.bs.modal', function(event){
|
||||
resetFileInputFunc($createModal.find('.img-file-input'));
|
||||
$createModal.find('.file-names').html('选择文件');
|
||||
});
|
||||
|
||||
$createModal.on('click', '.submit-btn', function() {
|
||||
$createForm.find('.error').html('');
|
||||
|
||||
if ($createForm.valid()) {
|
||||
$createForm.submit();
|
||||
} else {
|
||||
$createForm.find('.error').html('请选择图片');
|
||||
}
|
||||
});
|
||||
$createModal.on('change', '.img-file-input', function(){
|
||||
var file = $(this)[0].files[0];
|
||||
$createModal.find('.file-names').html(file ? file.name : '请选择文件');
|
||||
})
|
||||
|
||||
// -------------- 重新上传图片 --------------
|
||||
//replace_image_url
|
||||
$('.modal.cooperative-upload-file-modal').on('upload:success', function(e, data){
|
||||
var $carouselItem = $('.custom-carousel-item-' + data.source_id);
|
||||
$carouselItem.find('.custom-carousel-item-img img').attr('src', data.url);
|
||||
})
|
||||
}
|
||||
})
|
@ -0,0 +1,86 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.cooperative-laboratory-settings-edit-page, body.cooperative-laboratory-settings-update-page').length > 0) {
|
||||
var $container = $('.edit-laboratory-setting-container');
|
||||
var $form = $container.find('.edit_laboratory');
|
||||
|
||||
$('.logo-item-left').on("change", 'input[type="file"]', function () {
|
||||
var $fileInput = $(this);
|
||||
var file = this.files[0];
|
||||
var imageType = /image.*/;
|
||||
if (file && file.type.match(imageType)) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function () {
|
||||
var $box = $fileInput.parent();
|
||||
$box.find('img').attr('src', reader.result).css('display', 'block');
|
||||
$box.addClass('has-img');
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
} else {
|
||||
}
|
||||
});
|
||||
|
||||
createMDEditor('laboratory-footer-editor', { height: 200, placeholder: '请输入备案信息' });
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
errorPlacement:function(error,element){
|
||||
if(element.parent().hasClass("input-group")){
|
||||
element.parent().after(error);
|
||||
}else{
|
||||
element.after(error)
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
identifier: {
|
||||
required: true,
|
||||
checkSite: true
|
||||
},
|
||||
name: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
$.validator.addMethod("checkSite",function(value,element,params){
|
||||
var checkSite = /^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$/;
|
||||
return this.optional(element)||(checkSite.test(value + '.educoder.com'));
|
||||
},"域名不合法!");
|
||||
|
||||
$form.on('click', '.submit-btn', function(){
|
||||
$form.find('.submit-btn').attr('disabled', 'disabled');
|
||||
$form.find('.error').html('');
|
||||
var valid = $form.valid();
|
||||
|
||||
$('input[name="navbar[][name]"]').each(function(_, e){
|
||||
var $ele = $(e);
|
||||
if($ele.val() === undefined || $ele.val().length === 0){
|
||||
$ele.addClass('danger text-danger');
|
||||
valid = false;
|
||||
} else {
|
||||
$ele.removeClass('danger text-danger');
|
||||
}
|
||||
});
|
||||
|
||||
if(!valid) return;
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
url: $form.attr('action'),
|
||||
data: new FormData($form[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data){
|
||||
$.notify({ message: '保存成功' });
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
},
|
||||
complete: function(){
|
||||
$form.find('.submit-btn').attr('disabled', false);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
@ -0,0 +1,62 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.cooperative-laboratory-users-index-page').length > 0) {
|
||||
// ============= 添加管理员 ==============
|
||||
var $addMemberModal = $('.cooperative-add-laboratory-user-modal');
|
||||
var $addMemberForm = $addMemberModal.find('.cooperative-add-laboratory-user-form');
|
||||
var $memberSelect = $addMemberModal.find('.laboratory-user-select');
|
||||
|
||||
$addMemberModal.on('show.bs.modal', function(event){
|
||||
$memberSelect.select2('val', ' ');
|
||||
});
|
||||
|
||||
$memberSelect.select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请输入要添加的管理员姓名',
|
||||
multiple: true,
|
||||
minimumInputLength: 1,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/cooperative/users',
|
||||
dataType: 'json',
|
||||
data: function(params){
|
||||
return { name: params.term };
|
||||
},
|
||||
processResults: function(data){
|
||||
return { results: data.users }
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
return $("<span>" + item.real_name + " <span class='font-12'>" + item.school_name + ' ' + item.hidden_phone + "</span></span>");
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
}
|
||||
return item.real_name || item.text;
|
||||
}
|
||||
});
|
||||
|
||||
$addMemberModal.on('click', '.submit-btn', function(){
|
||||
$addMemberForm.find('.error').html('');
|
||||
|
||||
var memberIds = $memberSelect.val();
|
||||
if (memberIds && memberIds.length > 0) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: '/cooperative/laboratory_users',
|
||||
data: { user_ids: memberIds },
|
||||
success: function(data){
|
||||
if(data && data.status == 0){
|
||||
show_success_flash();
|
||||
$addMemberModal.modal('hide');
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$addMemberModal.modal('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,62 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
var $modal = $('.modal.cooperative-upload-file-modal');
|
||||
if ($modal.length > 0) {
|
||||
var $form = $modal.find('form.cooperative-upload-file-form')
|
||||
var $sourceIdInput = $modal.find('input[name="source_id"]');
|
||||
var $sourceTypeInput = $modal.find('input[name="source_type"]');
|
||||
|
||||
$modal.on('show.bs.modal', function(event){
|
||||
var $link = $(event.relatedTarget);
|
||||
var sourceId = $link.data('sourceId');
|
||||
var sourceType = $link.data('sourceType');
|
||||
|
||||
$sourceIdInput.val(sourceId);
|
||||
$sourceTypeInput.val(sourceType);
|
||||
|
||||
$modal.find('.upload-file-input').trigger('click');
|
||||
});
|
||||
|
||||
$modal.find('.upload-file-input').on('change', function(e){
|
||||
var file = $(this)[0].files[0];
|
||||
|
||||
if(file){
|
||||
$modal.find('.file-names').html(file.name);
|
||||
$modal.find('.submit-btn').trigger('click');
|
||||
}
|
||||
})
|
||||
|
||||
var formValid = function(){
|
||||
if($form.find('input[name="file"]').val() == undefined || $form.find('input[name="file"]').val().length == 0){
|
||||
$form.find('.error').html('请选择文件');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if (formValid()) {
|
||||
var formDataString = $form.serialize();
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: '/cooperatives/files?' + formDataString,
|
||||
data: new FormData($form[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data){
|
||||
$.notify({ message: '上传成功' });
|
||||
$modal.trigger('upload:success', data);
|
||||
$modal.modal('hide');
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,16 @@
|
||||
$(document).on('turbolinks:load', function(){
|
||||
$('#sidebarCollapse').on('click', function () {
|
||||
$(this).toggleClass('active');
|
||||
$('#sidebar').toggleClass('active');
|
||||
$.cookie('cooperative_sidebar_collapse', $(this).hasClass('active'), {path: '/cooperative'});
|
||||
});
|
||||
|
||||
var sidebarController = $('#sidebar').data('current-controller');
|
||||
if (sidebarController.length > 0) {
|
||||
$('#sidebar a.active').removeClass('active');
|
||||
$('#sidebar ul.collapse.show').removeClass('show');
|
||||
var activeLi = $('#sidebar a[data-controller="' + sidebarController + '"]');
|
||||
activeLi.addClass('active');
|
||||
activeLi.parent().parent('ul.collapse').addClass('show');
|
||||
}
|
||||
});
|
@ -0,0 +1,2 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Simplified Chinese translation for bootstrap-datetimepicker
|
||||
* Yuan Cheung <advanimal@gmail.com>
|
||||
*/
|
||||
;(function($){
|
||||
$.fn.datetimepicker.dates['zh-CN'] = {
|
||||
days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
|
||||
daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
|
||||
daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
|
||||
months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
|
||||
monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
|
||||
today: "今天",
|
||||
suffix: [],
|
||||
meridiem: ["上午", "下午"]
|
||||
};
|
||||
}(jQuery));
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,2 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
@ -0,0 +1,66 @@
|
||||
.admins-auth-schools-index-page{
|
||||
.list-item-title{
|
||||
padding-bottom:5px;
|
||||
padding-left: 33px;
|
||||
color: #555;
|
||||
}
|
||||
.list-item-title-1{
|
||||
width: 100px;
|
||||
display: inline-block;
|
||||
}
|
||||
.list-item-title-2{
|
||||
width: 200px;
|
||||
display: inline-block;
|
||||
}
|
||||
.collegeManage{
|
||||
float: left;
|
||||
padding: 0px 8px;
|
||||
border-radius: 6px;
|
||||
background-color: #f5f5f5;
|
||||
margin: 3px 0px 3px 10px;
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
a{
|
||||
color: #05101a;
|
||||
}
|
||||
a:hover{
|
||||
color: #007bff;
|
||||
}
|
||||
}
|
||||
i:hover{
|
||||
color: #333;
|
||||
}
|
||||
.add-manager-i{
|
||||
float: left;
|
||||
i{
|
||||
padding: 10px 5px;
|
||||
}
|
||||
}
|
||||
.auth-schools-new-add, .auth-schools-user-add{
|
||||
.flex-column{
|
||||
input{
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
.search-school{
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
}
|
||||
.school-search-list{
|
||||
background: #F4FAFF;
|
||||
height: 280px;
|
||||
overflow-y: scroll;
|
||||
padding: 10px 0;
|
||||
}
|
||||
.school-list-item{
|
||||
padding: 2px 10px;
|
||||
input{
|
||||
font-size: 20px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
.admins-carousels-index-page {
|
||||
.carousels-card {
|
||||
.custom-carousel-item {
|
||||
& > .drag {
|
||||
cursor: move;
|
||||
background: #fff;
|
||||
box-shadow: 1px 2px 5px 3px #f0f0f0;
|
||||
}
|
||||
|
||||
&-no {
|
||||
font-size: 28px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&-img {
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
|
||||
& > img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
background: #F5F5F5;
|
||||
}
|
||||
}
|
||||
|
||||
.not_active {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
font-size: 20px;
|
||||
color: red;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.save-url-btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.operate-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.online-check-box {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.name-input {
|
||||
flex: 1;
|
||||
}
|
||||
.link-input {
|
||||
flex: 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
.admins-competition-settings-index-page {
|
||||
.competition-mode-container {
|
||||
.row {
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
.des-row {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
//.mode-input {
|
||||
// input {
|
||||
// width: 40%;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
.col-md-label{
|
||||
-webkit-box-flex: 0;
|
||||
flex: 0 0 10%;
|
||||
max-width: 10%;
|
||||
min-width: 30px;
|
||||
padding-right: 15px;
|
||||
padding-left: 15px;
|
||||
position: relative;
|
||||
}
|
||||
.col-md-label-s{
|
||||
-webkit-box-flex: 0;
|
||||
flex: 0 0 30px;
|
||||
padding-right: 15px;
|
||||
padding-left: 15px;
|
||||
position: relative;
|
||||
}
|
||||
.setBtn_s{
|
||||
height: 35px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.sponsor_label{
|
||||
border:1px solid #4CACFF;
|
||||
border-radius: 5px;
|
||||
background-color: rgba(76,172,255,0.3);
|
||||
color: #333;
|
||||
padding:0px 4px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
float: left;
|
||||
margin: 4px 5px;
|
||||
|
||||
span{
|
||||
display: block;
|
||||
float: left;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
a{
|
||||
font-size: 18px;
|
||||
float: left;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
.large_panel{
|
||||
padding:0px 15px;
|
||||
|
||||
.large_panel_part{
|
||||
border-top: 1px solid #eaeaea;
|
||||
}
|
||||
.large_panel_part:first-child{
|
||||
border:none;
|
||||
}
|
||||
|
||||
.large_panel_part >.row ,.small_panel >.row{
|
||||
border-bottom: 1px solid #eaeaea;
|
||||
padding:20px 0px;
|
||||
}
|
||||
.small_panel{
|
||||
margin-left: 20px;
|
||||
}
|
||||
.row:last-child{
|
||||
border:none;
|
||||
}
|
||||
|
||||
.task_Input_div:nth-child(3n-2) > span.col-4{
|
||||
flex: 0 0 81px;
|
||||
max-width: 81px;
|
||||
}
|
||||
.task_Input_div:nth-child(3n-2){
|
||||
flex: 0 0 50%;
|
||||
max-width: 50%;
|
||||
}
|
||||
.task_Input_div:nth-child(3n-1){
|
||||
flex: 0 0 25%;
|
||||
max-width: 25%;
|
||||
}
|
||||
.task_Input_div:nth-child(3n){
|
||||
flex: 0 0 25%;
|
||||
max-width: 25%;
|
||||
}
|
||||
.task_Input_div:nth-child(3n) > span.col-4{
|
||||
flex: 0 0 33.3%;
|
||||
max-width: 33.3%;
|
||||
}
|
||||
.task_Input_div:nth-child(3n) > div.col-6{
|
||||
flex: 0 0 50%;
|
||||
max-width: 50%;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
.admins-ec-templates-index-page{
|
||||
.template-file-upload{
|
||||
padding: 10px;
|
||||
background: #fafafa;
|
||||
border: 1px dashed #ccc;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
input[name='file']{
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
left: 0;
|
||||
height: 43px;
|
||||
top: 0;
|
||||
width:100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
.admins-laboratories-index-page {
|
||||
.laboratory-list-table {
|
||||
.member-container {
|
||||
.laboratory-user {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.laboratory-user-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
padding: 2px 5px;
|
||||
margin: 2px 2px;
|
||||
border: 1px solid #91D5FF;
|
||||
background-color: #E6F7FF;
|
||||
color: #91D5FF;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.admins-laboratory-settings-show-page, .admins-laboratory-settings-update-page {
|
||||
.edit-laboratory-setting-container {
|
||||
.logo-item {
|
||||
display: flex;
|
||||
|
||||
&-img {
|
||||
display: block;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
&-upload {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: #F5F5F5;
|
||||
border: 1px solid #E5E5E5;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 27px;
|
||||
left: 39px;
|
||||
width: 2px;
|
||||
height: 26px;
|
||||
background: #E5E5E5;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 39px;
|
||||
left: 27px;
|
||||
width: 26px;
|
||||
height: 2px;
|
||||
background: #E5E5E5;
|
||||
}
|
||||
}
|
||||
|
||||
&-left {
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
|
||||
&.has-img {
|
||||
.logo-item-upload {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.logo-item-upload {
|
||||
display: block;
|
||||
background: rgba(145, 145, 145, 0.8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
color: #777777;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
&-title {
|
||||
color: #23272B;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
.admins-major-informations-index-page{
|
||||
.fr{
|
||||
float:right;
|
||||
}
|
||||
.panel-default{
|
||||
margin-bottom: 10px;
|
||||
background-color: rgb(245, 245, 245);
|
||||
.panel-heading{
|
||||
i{
|
||||
margin-right:15px;
|
||||
font-size:16px;
|
||||
color:rgb(204, 204, 204);
|
||||
}
|
||||
a{
|
||||
padding: 8px 10px;
|
||||
display: inline-block;
|
||||
width:100%;
|
||||
color:rgb(102, 102, 102);
|
||||
}
|
||||
}
|
||||
.panel-collapse{
|
||||
padding-top: 10px;
|
||||
background: #fff;
|
||||
table{
|
||||
text-align:center;
|
||||
th,td{
|
||||
padding: 8px;
|
||||
}
|
||||
td{
|
||||
color:#888;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
.admins-schools-index-page {
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
.admins-weapp-adverts-index-page {
|
||||
.adverts-card {
|
||||
.advert-item {
|
||||
& > .drag {
|
||||
cursor: move;
|
||||
background: #fff;
|
||||
box-shadow: 1px 2px 5px 3px #f0f0f0;
|
||||
}
|
||||
|
||||
&-no {
|
||||
font-size: 28px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&-img {
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
|
||||
& > img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
background: #F5F5F5;
|
||||
}
|
||||
}
|
||||
|
||||
.not_active {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
font-size: 20px;
|
||||
color: red;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.save-url-btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.operate-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.online-check-box {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.name-input {
|
||||
flex: 1;
|
||||
}
|
||||
.link-input {
|
||||
flex: 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
.admins-weapp-carousels-index-page {
|
||||
.carousels-card {
|
||||
.custom-carousel-item {
|
||||
& > .drag {
|
||||
cursor: move;
|
||||
background: #fff;
|
||||
box-shadow: 1px 2px 5px 3px #f0f0f0;
|
||||
}
|
||||
|
||||
&-no {
|
||||
font-size: 28px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&-img {
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
|
||||
& > img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
background: #F5F5F5;
|
||||
}
|
||||
}
|
||||
|
||||
.not_active {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
font-size: 20px;
|
||||
color: red;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.save-url-btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.operate-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.online-check-box {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.name-input {
|
||||
flex: 1;
|
||||
}
|
||||
.link-input {
|
||||
flex: 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
/*
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
*
|
||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
|
||||
* vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
||||
* files in this directory. Styles in this file should be added after the last require_* statement.
|
||||
* It is generally better to create a new file per style scope.
|
||||
*
|
||||
*= require_tree .
|
||||
*= require_self
|
||||
|
||||
*/
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,54 @@
|
||||
@import "bootstrap";
|
||||
@import "font-awesome-sprockets";
|
||||
@import "font-awesome";
|
||||
@import "select2.min";
|
||||
@import "select2-bootstrap4.min";
|
||||
@import "bootstrap-datepicker";
|
||||
@import "bootstrap-datepicker.standalone";
|
||||
@import "jquery.mloading";
|
||||
@import "jquery-confirm.min";
|
||||
|
||||
@import "codemirror/lib/codemirror";
|
||||
@import "editormd/css/editormd.min";
|
||||
@import "dragula/dragula";
|
||||
|
||||
@import "common";
|
||||
@import "cooperative/*";
|
||||
|
||||
body {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
max-width: 100vw;
|
||||
max-height: 100vh;
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
font-size: 14px;
|
||||
background: #efefef;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.simple_form {
|
||||
.form-group {
|
||||
.collection_radio_buttons {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.form-check-inline {
|
||||
height: calc(1.5em + 0.75rem + 2px)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
input.form-control {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.btn-default{
|
||||
color: #666;
|
||||
background: #e1e1e1!important;
|
||||
}
|
||||
.export-absolute{
|
||||
right:20px;
|
||||
position: absolute;
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
.cooperative-carousels-index-page {
|
||||
.carousels-card {
|
||||
.custom-carousel-item {
|
||||
& > .drag {
|
||||
cursor: move;
|
||||
background: #fff;
|
||||
box-shadow: 1px 2px 5px 3px #f0f0f0;
|
||||
}
|
||||
|
||||
&-no {
|
||||
font-size: 28px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&-img {
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
|
||||
& > img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
background: #F5F5F5;
|
||||
}
|
||||
}
|
||||
|
||||
.not_active {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
font-size: 20px;
|
||||
color: red;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.save-url-btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.operate-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.online-check-box {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.name-input {
|
||||
flex: 1;
|
||||
}
|
||||
.link-input {
|
||||
flex: 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
.cooperative-body-container {
|
||||
padding: 20px;
|
||||
flex: 1;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: scroll;
|
||||
|
||||
& > .content {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
|
||||
.box {
|
||||
padding: 20px;
|
||||
border-radius: 5px;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
/* 面包屑 */
|
||||
.breadcrumb {
|
||||
padding-left: 5px;
|
||||
font-size: 20px;
|
||||
background: unset;
|
||||
}
|
||||
|
||||
/* 内容表格 */
|
||||
table {
|
||||
table-layout: fixed;
|
||||
|
||||
td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
tr {
|
||||
&.no-data {
|
||||
&:hover {
|
||||
color: darkgrey;
|
||||
background: unset;
|
||||
}
|
||||
|
||||
& > td {
|
||||
text-align: center;
|
||||
height: 300px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.action-container {
|
||||
& > .action {
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
.more-action-dropdown {
|
||||
.dropdown-item {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 分页 */
|
||||
.paginate-container {
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.paginate-total {
|
||||
margin-bottom: 10px;
|
||||
color: darkgrey;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 搜索表单 */
|
||||
.search-form-container {
|
||||
display: flex;
|
||||
margin-bottom: 20px;
|
||||
|
||||
.search-form {
|
||||
flex: 1;
|
||||
|
||||
* { font-size: 14px; }
|
||||
|
||||
select, input {
|
||||
margin-right: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.global-error {
|
||||
color: grey;
|
||||
min-height: 300px;
|
||||
|
||||
&-code {
|
||||
font-size: 80px;
|
||||
}
|
||||
|
||||
&-text {
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-tabs {
|
||||
.nav-link {
|
||||
padding: 0.5rem 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.CodeMirror {
|
||||
border: 1px solid #ced4da;
|
||||
}
|
||||
|
||||
.batch-action-container {
|
||||
margin-bottom: -15px;
|
||||
padding: 10px 20px 0;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
.cooperative-laboratory-settings-edit-page, .cooperative-laboratory-settings-update-page {
|
||||
.edit-laboratory-setting-container {
|
||||
.logo-item {
|
||||
display: flex;
|
||||
|
||||
&-img {
|
||||
display: block;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
&-upload {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: #F5F5F5;
|
||||
border: 1px solid #E5E5E5;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 27px;
|
||||
left: 39px;
|
||||
width: 2px;
|
||||
height: 26px;
|
||||
background: #E5E5E5;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 39px;
|
||||
left: 27px;
|
||||
width: 26px;
|
||||
height: 2px;
|
||||
background: #E5E5E5;
|
||||
}
|
||||
}
|
||||
|
||||
&-left {
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
|
||||
&.has-img {
|
||||
.logo-item-upload {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.logo-item-upload {
|
||||
display: block;
|
||||
background: rgba(145, 145, 145, 0.8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
color: #777777;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
&-title {
|
||||
color: #23272B;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,235 @@
|
||||
#sidebar {
|
||||
min-width: 200px;
|
||||
max-width: 200px;
|
||||
background: #272822;
|
||||
color: #fff;
|
||||
transition: all 0.5s;
|
||||
overflow-y: scroll;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display:none
|
||||
}
|
||||
|
||||
&.active {
|
||||
min-width: 60px;
|
||||
max-width: 60px;
|
||||
text-align: center;
|
||||
|
||||
.sidebar-header {
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
&-logo {
|
||||
overflow: hidden;
|
||||
margin-bottom: 10px;
|
||||
|
||||
& > .logo-label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul li a {
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
font-size: 0.85em;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
span { display: none }
|
||||
|
||||
i {
|
||||
margin-right: 0;
|
||||
display: block;
|
||||
font-size: 1.8em;
|
||||
margin-bottom: 5px;
|
||||
width: 30px;
|
||||
height: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-toggle::after {
|
||||
top: auto;
|
||||
bottom: 10px;
|
||||
right: 50%;
|
||||
-webkit-transform: translateX(50%);
|
||||
-ms-transform: translateX(50%);
|
||||
transform: translateX(50%);
|
||||
}
|
||||
|
||||
ul ul a {
|
||||
padding: 10px !important;
|
||||
|
||||
span { display: none }
|
||||
|
||||
i {
|
||||
margin-left: 0px;
|
||||
display: block;
|
||||
font-size: 0.8em;
|
||||
width: 30px;
|
||||
height: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-header {
|
||||
padding: 20px;
|
||||
background: #272822;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
|
||||
&-logo {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
& > img {
|
||||
width: 40px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
& > .logo-label {
|
||||
font-size: 18px;
|
||||
color: darkgrey;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#sidebarCollapse {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
text-align: right;
|
||||
|
||||
&.active {
|
||||
width: 40px;
|
||||
height: 30px;
|
||||
background: #3f3f3f;
|
||||
border: 1px solid grey;
|
||||
border-radius: 3px;
|
||||
|
||||
i.fold { display: none; }
|
||||
i.unfold { display: block; }
|
||||
}
|
||||
|
||||
i.fold {
|
||||
display: block;
|
||||
}
|
||||
i.unfold { display: none; }
|
||||
}
|
||||
|
||||
a, a:hover, a:focus {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
& > ul > li > a > i {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
ul {
|
||||
&.components {
|
||||
padding: 20px 0;
|
||||
border-bottom: 1px solid #3f3f3f;
|
||||
}
|
||||
|
||||
p {
|
||||
color: #fff;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
li > a {
|
||||
padding: 10px;
|
||||
font-size: 1em;
|
||||
display: block;
|
||||
text-align: left;
|
||||
|
||||
i {
|
||||
margin-right: 10px;
|
||||
font-size: 1em;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
li a {
|
||||
&:hover, &.active {
|
||||
color: #fff;
|
||||
background: #276891;
|
||||
}
|
||||
}
|
||||
|
||||
li.active > a, a[aria-expanded="true"] {
|
||||
color: #fff;
|
||||
//background: #276891;
|
||||
}
|
||||
|
||||
ul a {
|
||||
font-size: 0.9em !important;
|
||||
padding-left: 30px !important;
|
||||
background: #3f3f3f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
#sidebar {
|
||||
&.active {
|
||||
padding: 10px 5px;
|
||||
min-width: 40px;
|
||||
max-width: 40px;
|
||||
text-align: center;
|
||||
margin-left: 0;
|
||||
transform: none;
|
||||
|
||||
.sidebar-header {
|
||||
padding: 0px;
|
||||
|
||||
.sidebar-header-logo {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#sidebarCollapse {
|
||||
width: 30px;
|
||||
height: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
ul li a {
|
||||
padding: 10px;
|
||||
font-size: 0.85em;
|
||||
|
||||
i {
|
||||
margin-right: 0;
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
& > ul > li > a > i {
|
||||
font-size: 1.8em;
|
||||
}
|
||||
|
||||
ul ul a {
|
||||
padding: 10px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-header {
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-toggle::after {
|
||||
top: auto;
|
||||
bottom: 10px;
|
||||
right: 50%;
|
||||
-webkit-transform: translateX(50%);
|
||||
-ms-transform: translateX(50%);
|
||||
transform: translateX(50%);
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the course_stages controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the subject_lists controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
@ -0,0 +1,58 @@
|
||||
class Admins::AuthSchoolsController < Admins::BaseController
|
||||
|
||||
def index
|
||||
schools = School.where(ec_auth: 1).includes(:users).order("updated_at desc")
|
||||
@params_page = params[:page] || 1
|
||||
@schools = paginate schools
|
||||
end
|
||||
|
||||
def destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
school = School.where(id: params[:id]).first
|
||||
school.destroy
|
||||
render_success_js
|
||||
end
|
||||
end
|
||||
|
||||
# 工程认证单位列表搜索学校
|
||||
def search_school
|
||||
@schools = School.where("ec_auth != 1 and name like '%#{params[:name]}%'").limit(10)
|
||||
end
|
||||
|
||||
# 添加认证学校
|
||||
def add_school
|
||||
all_schools = School.all
|
||||
all_schools.where(id: params[:school_id]).update_all(ec_auth: 1)
|
||||
schools = all_schools.where(ec_auth: 1).order("updated_at desc")
|
||||
@params_page = params[:page] || 1
|
||||
@schools = paginate schools
|
||||
end
|
||||
|
||||
# 搜索用户
|
||||
def search_manager
|
||||
school = School.find_by(id: params[:school_id])
|
||||
user_ids = school&.ec_school_users&.pluck(:user_id)
|
||||
@users = User.where.not(id: user_ids).where("concat(lastname, firstname) like ?", "%#{params[:name].strip.to_s}%").limit(10)
|
||||
end
|
||||
|
||||
# 添加认证学校管理员
|
||||
def add_manager
|
||||
ActiveRecord::Base.transaction do
|
||||
user_ids = params[:user_id]
|
||||
@school_id = params[:school_id]
|
||||
user_ids.each do |id|
|
||||
EcSchoolUser.create(user_id: id, school_id: @school_id)
|
||||
end
|
||||
@school_users = User.where(id: user_ids)
|
||||
end
|
||||
end
|
||||
|
||||
# 删除学校管理员
|
||||
def remove_manager
|
||||
ActiveRecord::Base.transaction do
|
||||
manager = EcSchoolUser.where(school_id: params[:school_id], user_id: params[:user_id]).first
|
||||
manager&.destroy
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,86 @@
|
||||
class Admins::CarouselsController < Admins::BaseController
|
||||
before_action :convert_file!, only: [:create]
|
||||
|
||||
helper_method :current_laboratory
|
||||
|
||||
def index
|
||||
@images = current_laboratory.portal_images.order(position: :asc)
|
||||
end
|
||||
|
||||
def create
|
||||
position = current_laboratory.portal_images.count + 1
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
image = current_laboratory.portal_images.create!(create_params.merge(position: position))
|
||||
|
||||
file_path = Util::FileManage.disk_filename('PortalImage', image.id)
|
||||
File.delete(file_path) if File.exist?(file_path) # 删除之前的文件
|
||||
Util.write_file(@file, file_path)
|
||||
end
|
||||
|
||||
flash[:success] = '保存成功'
|
||||
redirect_to admins_laboratory_carousels_path(current_laboratory)
|
||||
end
|
||||
|
||||
def update
|
||||
current_image.update!(update_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
current_image.destroy!
|
||||
# 前移
|
||||
current_laboratory.portal_images.where('position > ?', current_image.position)
|
||||
.update_all('position = position - 1')
|
||||
|
||||
file_path = Util::FileManage.disk_filename('PortalImage', current_image.id)
|
||||
File.delete(file_path) if File.exist?(file_path)
|
||||
end
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
def drag
|
||||
move = current_laboratory.portal_images.find_by(id: params[:move_id])
|
||||
after = current_laboratory.portal_images.find_by(id: params[:after_id])
|
||||
|
||||
Admins::DragPortalImageService.call(current_laboratory, move, after)
|
||||
render_ok
|
||||
rescue Admins::DragPortalImageService::Error => e
|
||||
render_error(e.message)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_laboratory
|
||||
@_current_laboratory ||= Laboratory.find(params[:laboratory_id])
|
||||
end
|
||||
|
||||
def current_image
|
||||
@_current_image ||= current_laboratory.portal_images.find(params[:id])
|
||||
end
|
||||
|
||||
def create_params
|
||||
params.require(:portal_image).permit(:name, :link)
|
||||
end
|
||||
|
||||
def update_params
|
||||
params.permit(:name, :link, :status)
|
||||
end
|
||||
|
||||
def convert_file!
|
||||
max_size = 10 * 1024 * 1024 # 10M
|
||||
file = params.dig('portal_image', 'image')
|
||||
if file.class == ActionDispatch::Http::UploadedFile
|
||||
@file = file
|
||||
render_error('请上传文件') if @file.size.zero?
|
||||
render_error('文件大小超过限制') if @file.size > max_size
|
||||
else
|
||||
file = file.to_s.strip
|
||||
return render_error('请上传正确的图片') if file.blank?
|
||||
@file = Util.convert_base64_image(file, max_size: max_size)
|
||||
end
|
||||
rescue Base64ImageConverter::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
end
|
@ -0,0 +1,41 @@
|
||||
class Admins::CompetitionPrizeUsersController < Admins::BaseController
|
||||
def index
|
||||
@competition = current_competition
|
||||
|
||||
prize_users = Admins::CompetitionPrizeUserQuery.call(params.merge(competition_id: current_competition.id))
|
||||
include_class = [:competition_team, :competition_prize, :approver,
|
||||
user: [:process_real_name_apply, :process_professional_apply, user_extension: :school]]
|
||||
@prize_users = paginate(prize_users.preload(include_class))
|
||||
end
|
||||
|
||||
def create
|
||||
Admins::CreateCompetitionPrizeUsersService.call(current_competition)
|
||||
render_ok
|
||||
rescue ApplicationService::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
|
||||
def approve
|
||||
Admins::ApproveCompetitionPrizeUserService.call(current_prize_user, current_user)
|
||||
@prize_user = current_prize_user
|
||||
rescue ApplicationService::Error => ex
|
||||
render_js_error(ex.message, type: :notify)
|
||||
end
|
||||
|
||||
def unapprove
|
||||
Admins::UnapproveCompetitionPrizeUserService.call(current_prize_user, current_user)
|
||||
@prize_user = current_prize_user
|
||||
rescue ApplicationService::Error => ex
|
||||
render_js_error(ex.message, type: :notify)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_prize_user
|
||||
@_current_prize_user ||= current_competition.competition_prize_users.find(params[:id])
|
||||
end
|
||||
|
||||
def current_competition
|
||||
@_current_competition ||= Competition.find(params[:competition_id])
|
||||
end
|
||||
end
|
@ -0,0 +1,43 @@
|
||||
class Admins::CompetitionPrizesController < Admins::BaseController
|
||||
def index
|
||||
@competition = current_competition
|
||||
end
|
||||
|
||||
def new
|
||||
@prize = current_competition.competition_prizes.new
|
||||
end
|
||||
|
||||
def create
|
||||
@prize = current_competition.competition_prizes.create!(save_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def edit
|
||||
@prize = current_competition_prize
|
||||
end
|
||||
|
||||
def update
|
||||
current_competition_prize.update!(save_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
current_competition_prize.destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_competition_prize
|
||||
@_current_competition_prize ||= current_competition.competition_prizes.find(params[:id])
|
||||
end
|
||||
|
||||
def current_competition
|
||||
@_current_competition ||= Competition.find(params[:competition_id])
|
||||
end
|
||||
|
||||
def save_params
|
||||
params.require(:competition_prize).permit(:name, :category, :num)
|
||||
end
|
||||
end
|
@ -0,0 +1,33 @@
|
||||
class Admins::CompetitionSettingsController < Admins::BaseController
|
||||
def index
|
||||
@competition = current_competition
|
||||
end
|
||||
|
||||
def basic_setting
|
||||
Admins::CompetitionBasicSettingService.call(current_competition, basic_form_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def nav_setting
|
||||
Admins::CompetitionNavSettingService.call(current_competition, nav_form_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_competition
|
||||
@_current_competition ||= Competition.find(params[:competition_id])
|
||||
end
|
||||
|
||||
def basic_form_params
|
||||
params.permit(:identifier, :name, :sub_title, :start_time, :end_time, :mode,
|
||||
:identifier, :bonus, :awards_count, :description, :course_id, :teach_start_time,
|
||||
:teach_end_time, sponsor_schools: [], region_schools: [], manager_ids: [])
|
||||
end
|
||||
|
||||
def nav_form_params
|
||||
params.permit(:enroll_end_time,
|
||||
competition_staffs: %i[category minimum maximum mutiple_limited],
|
||||
navbar: %i[module_type module_id name hidden position url])
|
||||
end
|
||||
end
|
@ -0,0 +1,57 @@
|
||||
class Admins::CompetitionsController < Admins::BaseController
|
||||
before_action :find_competition, except: [:index]
|
||||
|
||||
def index
|
||||
# params[:sort_by] = params[:sort_by].presence || 'created_at'
|
||||
# params[:sort_direction] = params[:sort_direction].presence || 'desc'
|
||||
@competitions = Competition.all.order("created_at desc")
|
||||
@params_page = params[:page] || 1
|
||||
@competitions = paginate @competitions
|
||||
ids = @competitions.map(&:id)
|
||||
@member_count_map = TeamMember.where(competition_id: ids).group(:competition_id).count
|
||||
|
||||
@competition_hot = ModuleSetting.exists?(module_type: "Competition", property: "hot")
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
name = params[:competition_name].to_s.strip
|
||||
Competition.create!(name: name)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def hot_setting
|
||||
if params[:hot].to_i == 1 && !ModuleSetting.exists?(module_type: "Competition", property: "hot")
|
||||
ModuleSetting.create!(module_type: "Competition", property: "hot")
|
||||
elsif params[:hot].to_i == 0 && ModuleSetting.exists?(module_type: "Competition", property: "hot")
|
||||
ModuleSetting.where(module_type: "Competition", property: "hot").destroy_all
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
|
||||
def publish
|
||||
@competition.update_attributes!(published_at: Time.now)
|
||||
end
|
||||
|
||||
def unpublish
|
||||
@competition.update_attributes!(published_at: nil)
|
||||
end
|
||||
|
||||
def online_switch
|
||||
if @competition.status
|
||||
@competition.update_attributes!(status: false)
|
||||
else
|
||||
@competition.update_attributes!(status: true, online_time: Time.now)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_competition
|
||||
@competition = Competition.find_by(id: params[:id])
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,41 @@
|
||||
class Admins::EcTemplatesController < Admins::BaseController
|
||||
|
||||
def index
|
||||
@params_page = params[:page] || 1
|
||||
templates = EcTemplate.where(nil).includes(:attachments).order("updated_at desc")
|
||||
@templates = paginate templates
|
||||
end
|
||||
|
||||
def create_template
|
||||
ActiveRecord::Base.transaction do
|
||||
if params[:template_id] == "-1"
|
||||
ec_template = EcTemplate.new(name: params[:name])
|
||||
ec_template.save
|
||||
else
|
||||
ec_template = EcTemplate.find_by(id: params[:template_id])
|
||||
end
|
||||
|
||||
if params[:attachment_id] != "-1"
|
||||
attachment_id = params[:attachment_id]
|
||||
attachment_tem = Attachment.find_by(id: attachment_id)
|
||||
|
||||
unless attachment_tem.container_id.present? && attachment_tem.container_id == ec_template&.id
|
||||
attachment_tem.update_attributes(container_id: ec_template&.id, container_type: "EcTemplate")
|
||||
end
|
||||
end
|
||||
|
||||
@params_page = params[:page] || 1
|
||||
templates = EcTemplate.where(nil).includes(:attachments).order("updated_at desc")
|
||||
@templates = paginate templates
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
template = EcTemplate.find_by(id: params[:id])
|
||||
template.destroy
|
||||
render_success_js
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,37 @@
|
||||
class Admins::EnrollListsController < Admins::BaseController
|
||||
|
||||
def index
|
||||
@competition = current_competition
|
||||
default_sort('created_at', 'desc')
|
||||
enroll_lists = Admins::CompetitionEnrollListQuery.call(@competition, params)
|
||||
|
||||
@params_page = params[:page] || 1
|
||||
@enroll_lists = paginate enroll_lists.preload(competition_team: [:user, :teachers], user: { user_extension: :school })
|
||||
@personal = @competition.personal?
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
format.xls{
|
||||
filename = "#{@competition.name}竞赛报名列表_#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}.xls"
|
||||
send_data(shixun_list_xls(shixuns), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def export
|
||||
default_sort('created_at', 'desc')
|
||||
@enroll_lists = Admins::CompetitionEnrollListQuery.call(current_competition, params)
|
||||
@enroll_lists = @enroll_lists.preload(competition_team: [:user, :teachers], user: { user_extension: :school })
|
||||
@competition_scores = current_competition.competition_scores.where(competition_stage_id: 0).order("score desc, cost_time desc").pluck(:competition_team_id)
|
||||
@personal = current_competition.personal?
|
||||
filename = ["#{current_competition.name}竞赛报名列表", Time.zone.now.strftime('%Y-%m-%d%H:%M:%S')].join('-') << '.xlsx'
|
||||
render xlsx: 'export', filename: filename
|
||||
end
|
||||
|
||||
private
|
||||
def current_competition
|
||||
@_current_competition ||= Competition.find(params[:competition_id])
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,33 @@
|
||||
class Admins::GraduationStandardsController < Admins::BaseController
|
||||
|
||||
def index
|
||||
standards = EcGraduationStandard.all.order("updated_at desc")
|
||||
@params_page = params[:page] || 1
|
||||
@standards = paginate standards
|
||||
end
|
||||
|
||||
def create_standard
|
||||
ActiveRecord::Base.transaction do
|
||||
if params[:graduation_id] == "-1"
|
||||
content = params[:content]
|
||||
EcGraduationStandard.create(:content => content)
|
||||
else
|
||||
graduation = EcGraduationStandard.find_by(id: params[:graduation_id])
|
||||
graduation.update_attribute(:content, params[:content])
|
||||
end
|
||||
|
||||
standards = EcGraduationStandard.all.order("updated_at desc")
|
||||
@params_page = params[:page] || 1
|
||||
@standards = paginate standards
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
@graduation = EcGraduationStandard.find_by(id: params[:id])
|
||||
@graduation.destroy
|
||||
render_success_js
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,32 @@
|
||||
class Admins::LaboratoriesController < Admins::BaseController
|
||||
def index
|
||||
params[:sort_by] = params[:sort_by].presence || 'id'
|
||||
params[:sort_direction] = params[:sort_direction].presence || 'desc'
|
||||
|
||||
laboratories = Admins::LaboratoryQuery.call(params)
|
||||
@laboratories = paginate laboratories.preload(:school, :laboratory_users)
|
||||
end
|
||||
|
||||
def create
|
||||
Admins::CreateLaboratoryService.call(create_params)
|
||||
render_ok
|
||||
rescue Admins::CreateLaboratoryService::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
|
||||
def destroy
|
||||
current_laboratory.destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_laboratory
|
||||
@_current_laboratory ||= Laboratory.find(params[:id])
|
||||
end
|
||||
|
||||
def create_params
|
||||
params.permit(:school_id)
|
||||
end
|
||||
end
|
@ -0,0 +1,20 @@
|
||||
class Admins::LaboratorySettingsController < Admins::BaseController
|
||||
def show
|
||||
@laboratory = current_laboratory
|
||||
end
|
||||
|
||||
def update
|
||||
Admins::SaveLaboratorySettingService.call(current_laboratory, form_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_laboratory
|
||||
@_current_laboratory ||= Laboratory.find(params[:laboratory_id])
|
||||
end
|
||||
|
||||
def form_params
|
||||
params.permit(:identifier, :name, :nav_logo, :login_logo, :tab_logo, :footer, navbar: %i[name link hidden])
|
||||
end
|
||||
end
|
@ -0,0 +1,19 @@
|
||||
class Admins::LaboratoryUsersController < Admins::BaseController
|
||||
helper_method :current_laboratory
|
||||
|
||||
def create
|
||||
Admins::AddLaboratoryUserService.call(current_laboratory, params.permit(user_ids: []))
|
||||
current_laboratory.reload
|
||||
end
|
||||
|
||||
def destroy
|
||||
@laboratory_user = current_laboratory.laboratory_users.find_by(user_id: params[:user_id])
|
||||
@laboratory_user.destroy! if @laboratory_user.present?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_laboratory
|
||||
@_current_laboratory ||= Laboratory.find(params[:laboratory_id])
|
||||
end
|
||||
end
|
@ -0,0 +1,8 @@
|
||||
class Admins::MajorInformationsController < Admins::BaseController
|
||||
|
||||
def index
|
||||
disciplines = EcDiscipline.includes(ec_discipline_firsts: {ec_majors: :schools}).order("ec_disciplines.code asc")
|
||||
@disciplines = paginate disciplines
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,30 @@
|
||||
class Admins::SchoolsController < Admins::BaseController
|
||||
def index
|
||||
params[:sort_by] ||= 'created_at'
|
||||
params[:sort_direction] ||= 'desc'
|
||||
|
||||
schools = Admins::SchoolQuery.call(params)
|
||||
|
||||
@schools = paginate schools
|
||||
|
||||
school_ids = @schools.map(&:id)
|
||||
@department_count = Department.where(school_id: school_ids).group(:school_id).count
|
||||
end
|
||||
|
||||
def destroy
|
||||
users = User.joins(:user_extension).where(user_extensions: { school_id: current_school.id })
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
users.update_all(profile_completed: false)
|
||||
current_school.destroy!
|
||||
end
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_school
|
||||
@_current_school ||= School.find(params[:id])
|
||||
end
|
||||
end
|
@ -0,0 +1,71 @@
|
||||
class Admins::SubjectsController < Admins::BaseController
|
||||
def index
|
||||
default_sort('created_at', 'desc')
|
||||
|
||||
subjects = Admins::SubjectQuery.call(params)
|
||||
@subjects = paginate subjects.includes(:repertoire, :subject_level_system, user: { user_extension: :school })
|
||||
end
|
||||
|
||||
def edit
|
||||
@subject = current_subject
|
||||
end
|
||||
|
||||
def update
|
||||
current_subject.update!(update_params)
|
||||
|
||||
flash[:success] = '保存成功'
|
||||
redirect_to admins_subjects_path
|
||||
end
|
||||
|
||||
def destroy
|
||||
current_subject.destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
# 隐藏
|
||||
def hide
|
||||
current_subject.update!(hidden: true)
|
||||
render_ok
|
||||
end
|
||||
|
||||
# 展示
|
||||
def cancel_hide
|
||||
current_subject.update!(hidden: false)
|
||||
render_ok
|
||||
end
|
||||
|
||||
# 设为主页展示
|
||||
def homepage_show
|
||||
current_subject.update!(homepage_show: true)
|
||||
render_ok
|
||||
end
|
||||
|
||||
# 取消主页展示
|
||||
def cancel_homepage_show
|
||||
current_subject.update!(homepage_show: false)
|
||||
render_ok
|
||||
end
|
||||
|
||||
# 设为金课
|
||||
def excellent
|
||||
current_subject.update!(excellent: true)
|
||||
render_ok
|
||||
end
|
||||
|
||||
# 取消金课
|
||||
def cancel_excellent
|
||||
current_subject.update!(excellent: false)
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_subject
|
||||
@_current_subject ||= Subject.find(params[:id])
|
||||
end
|
||||
|
||||
def update_params
|
||||
params.require(:subject).permit(:repertoire_id, :subject_level_system_id, :student_count)
|
||||
end
|
||||
end
|
@ -0,0 +1,19 @@
|
||||
class Admins::UserStatisticsController < Admins::BaseController
|
||||
def index
|
||||
default_sort('finish_shixun_count', 'desc')
|
||||
|
||||
total_count, users = Admins::UserStatisticQuery.call(params)
|
||||
|
||||
@users = paginate users, total_count: total_count
|
||||
end
|
||||
|
||||
def export
|
||||
default_sort('finish_shixun_count', 'desc')
|
||||
|
||||
params[:per_page] = 10000
|
||||
_count, @users = Admins::UserStatisticQuery.call(params)
|
||||
|
||||
filename = ['用户实训情况', Time.zone.now.strftime('%Y%m%d%H%M%S')].join('-') << '.xlsx'
|
||||
render xlsx: 'export', filename: filename
|
||||
end
|
||||
end
|
@ -0,0 +1,79 @@
|
||||
class Admins::WeappAdvertsController < Admins::BaseController
|
||||
before_action :convert_file!, only: [:create]
|
||||
def index
|
||||
@adverts = WeappSettings::Advert.all
|
||||
end
|
||||
|
||||
def create
|
||||
position = WeappSettings::Advert.count + 1
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
advert = WeappSettings::Advert.create!(create_params.merge(position: position))
|
||||
|
||||
file_path = Util::FileManage.source_disk_filename(advert)
|
||||
File.delete(file_path) if File.exist?(file_path) # 删除之前的文件
|
||||
Util.write_file(@file, file_path)
|
||||
end
|
||||
|
||||
flash[:success] = '保存成功'
|
||||
redirect_to admins_weapp_adverts_path
|
||||
end
|
||||
|
||||
def update
|
||||
current_advert.update!(update_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
current_advert.destroy!
|
||||
# 前移
|
||||
WeappSettings::Advert.where('position > ?', current_advert.position)
|
||||
.update_all('position = position - 1')
|
||||
|
||||
file_path = Util::FileManage.source_disk_filename(current_advert)
|
||||
File.delete(file_path) if File.exist?(file_path)
|
||||
end
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
def drag
|
||||
move = WeappSettings::Advert.find_by(id: params[:move_id])
|
||||
after = WeappSettings::Advert.find_by(id: params[:after_id])
|
||||
|
||||
Admins::DragWeappAdvertService.call(move, after)
|
||||
render_ok
|
||||
rescue ApplicationService::Error => e
|
||||
render_error(e.message)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_advert
|
||||
@_current_advert ||= WeappSettings::Advert.find(params[:id])
|
||||
end
|
||||
|
||||
def create_params
|
||||
params.require(:weapp_settings_advert).permit(:link)
|
||||
end
|
||||
|
||||
def update_params
|
||||
params.permit(:link, :online)
|
||||
end
|
||||
|
||||
def convert_file!
|
||||
max_size = 10 * 1024 * 1024 # 10M
|
||||
file = params.dig('weapp_settings_advert', 'image')
|
||||
if file.class == ActionDispatch::Http::UploadedFile
|
||||
@file = file
|
||||
render_error('请上传文件') if @file.size.zero?
|
||||
render_error('文件大小超过限制') if @file.size > max_size
|
||||
else
|
||||
file = file.to_s.strip
|
||||
return render_error('请上传正确的图片') if file.blank?
|
||||
@file = Util.convert_base64_image(file, max_size: max_size)
|
||||
end
|
||||
rescue Base64ImageConverter::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
end
|
@ -0,0 +1,80 @@
|
||||
class Admins::WeappCarouselsController < Admins::BaseController
|
||||
before_action :convert_file!, only: [:create]
|
||||
|
||||
def index
|
||||
@carousels = WeappSettings::Carousel.all
|
||||
end
|
||||
|
||||
def create
|
||||
position = WeappSettings::Carousel.count + 1
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
carousel = WeappSettings::Carousel.create!(create_params.merge(position: position))
|
||||
|
||||
file_path = Util::FileManage.source_disk_filename(carousel)
|
||||
File.delete(file_path) if File.exist?(file_path) # 删除之前的文件
|
||||
Util.write_file(@file, file_path)
|
||||
end
|
||||
|
||||
flash[:success] = '保存成功'
|
||||
redirect_to admins_weapp_carousels_path
|
||||
end
|
||||
|
||||
def update
|
||||
current_carousel.update!(update_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
current_carousel.destroy!
|
||||
# 前移
|
||||
WeappSettings::Carousel.where('position > ?', current_carousel.position)
|
||||
.update_all('position = position - 1')
|
||||
|
||||
file_path = Util::FileManage.source_disk_filename(current_carousel)
|
||||
File.delete(file_path) if File.exist?(file_path)
|
||||
end
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
def drag
|
||||
move = WeappSettings::Carousel.find_by(id: params[:move_id])
|
||||
after = WeappSettings::Carousel.find_by(id: params[:after_id])
|
||||
|
||||
Admins::DragWeappCarouselService.call(move, after)
|
||||
render_ok
|
||||
rescue ApplicationService::Error => e
|
||||
render_error(e.message)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_carousel
|
||||
@_current_carousel ||= WeappSettings::Carousel.find(params[:id])
|
||||
end
|
||||
|
||||
def create_params
|
||||
params.require(:weapp_settings_carousel).permit(:link)
|
||||
end
|
||||
|
||||
def update_params
|
||||
params.permit(:link, :online)
|
||||
end
|
||||
|
||||
def convert_file!
|
||||
max_size = 10 * 1024 * 1024 # 10M
|
||||
file = params.dig('weapp_settings_carousel', 'image')
|
||||
if file.class == ActionDispatch::Http::UploadedFile
|
||||
@file = file
|
||||
render_error('请上传文件') if @file.size.zero?
|
||||
render_error('文件大小超过限制') if @file.size > max_size
|
||||
else
|
||||
file = file.to_s.strip
|
||||
return render_error('请上传正确的图片') if file.blank?
|
||||
@file = Util.convert_base64_image(file, max_size: max_size)
|
||||
end
|
||||
rescue Base64ImageConverter::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
end
|
@ -0,0 +1,22 @@
|
||||
class BindUsersController < ApplicationController
|
||||
before_action :require_login
|
||||
|
||||
def create
|
||||
user = CreateBindUserService.call(current_user, create_params)
|
||||
successful_authentication(user) if user.id != current_user.id
|
||||
|
||||
render_ok
|
||||
rescue ApplicationService::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
|
||||
def new_user
|
||||
current_user
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_params
|
||||
params.permit(:username, :password, :type, :not_bind)
|
||||
end
|
||||
end
|
@ -0,0 +1,23 @@
|
||||
class Competitions::CertificatesController < Competitions::BaseController
|
||||
def personal
|
||||
prize_user = CompetitionPrizeUser.find_by!(user: current_user, id: params[:id])
|
||||
return render_not_found unless prize_user.certificate_exist?
|
||||
|
||||
team = prize_user.competition_team
|
||||
prize = prize_user.competition_prize
|
||||
filename = "#{current_competition.name}-#{prize.name}-#{team.name}-#{prize_user.user.real_name}.pdf"
|
||||
|
||||
send_file prize_user.certificate_path, filename: filename
|
||||
end
|
||||
|
||||
def team
|
||||
team = CompetitionTeam.find(params[:id])
|
||||
return render_forbidden unless team.team_members.exists?(user_id: current_user.id)
|
||||
return render_not_found unless team.certificate_exists?
|
||||
|
||||
prize = team.competition_prize_users.first.competition_prize
|
||||
filename = "#{current_competition.name}-#{prize.name}-#{team.name}.pdf"
|
||||
|
||||
send_file team.certificate_path, filename: filename
|
||||
end
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue