commit
ba608c56bc
Before Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 2.8 KiB |
File diff suppressed because one or more lines are too long
@ -0,0 +1,90 @@
|
||||
//= 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.viewer
|
||||
//= require jquery.mloading
|
||||
//= 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 ./admins
|
||||
|
||||
|
||||
$.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($('.admin-alert-container .alert').length > 0){
|
||||
setTimeout(function(){
|
||||
$('.admin-alert-container .alert:not(.alert-danger)').alert('close');
|
||||
}, 2000);
|
||||
setTimeout(function(){
|
||||
$('.admin-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,5 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-abouts-edit-page, body.admins-abouts-update-page').length > 0) {
|
||||
createMDEditor('about-us-editor', {});
|
||||
}
|
||||
})
|
@ -0,0 +1,5 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-agreements-edit-page, body.admins-agreements-update-page').length > 0) {
|
||||
createMDEditor('agreement-editor', {});
|
||||
}
|
||||
})
|
@ -0,0 +1,67 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
var $refuseModal = $('.admin-common-refuse-modal');
|
||||
if ($refuseModal.length > 0) {
|
||||
var $form = $refuseModal.find('form.admin-common-refuse-form');
|
||||
var $applyIdInput = $refuseModal.find('.modal-body input[name="apply_id"]');
|
||||
var $applyTitle = $refuseModal.find('.modal-title');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
reason: {
|
||||
required: true,
|
||||
maxlength: 200
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$refuseModal.on('show.bs.modal', function (event) {
|
||||
var $link = $(event.relatedTarget);
|
||||
|
||||
var applyId = $link.data('id');
|
||||
var url = $link.data('url');
|
||||
var title = $link.data('title');
|
||||
var type = $link.data('type');
|
||||
var form_method = "POST";
|
||||
if(typeof title !== 'undefined'){
|
||||
$applyTitle.html(title)
|
||||
}
|
||||
if(typeof type !== 'undefined'){
|
||||
form_method = type;
|
||||
}
|
||||
|
||||
$applyIdInput.val(applyId);
|
||||
$form.data('url', url);
|
||||
$form.data('type', form_method);
|
||||
});
|
||||
// modal visited fire
|
||||
$refuseModal.on('shown.bs.modal', function(){
|
||||
$refuseModal.find('.modal-body textarea[name="reason"]').focus();
|
||||
});
|
||||
$refuseModal.on('hide.bs.modal', function () {
|
||||
$applyIdInput.val('');
|
||||
$refuseModal.find('.modal-body textarea[name="reason"]').val('');
|
||||
$form.data('url', '');
|
||||
})
|
||||
|
||||
$refuseModal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
var form_method = $form.data('type');
|
||||
|
||||
$.ajax({
|
||||
method: form_method,
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
}).done(function(){
|
||||
$refuseModal.modal('hide');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,96 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-cooperatives-index-page').length > 0) {
|
||||
// ------------ 保存链接 -----------
|
||||
$('.coo-img-card').on('click', '.save-url-btn', function(){
|
||||
var $link = $(this);
|
||||
var cooId = $link.data('id');
|
||||
var url = $('.coo-img-item-' + cooId).find('.url-input').val();
|
||||
$link.attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/cooperatives/' + cooId,
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
data: { url: url },
|
||||
success: function(data){
|
||||
$.notify({ message: '保存成功' });
|
||||
},
|
||||
error: ajaxErrorNotifyHandler,
|
||||
complete: function(){
|
||||
$link.removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// ------------ 拖拽 -------------
|
||||
var onDropFunc = function(el, _target, _source, sibling){
|
||||
var moveId = $(el).data('id');
|
||||
var insertId = $(sibling).data('id') || '';
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/cooperatives/drag',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: { move_id: moveId, after_id: insertId },
|
||||
success: function(data){
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$.notify({message: '移动失败,原因:' + data.message}, {type: 'danger'});
|
||||
}
|
||||
})
|
||||
};
|
||||
var ele1 = document.getElementById('coo-img-container-alliance_coop');
|
||||
dragula([ele1], { mirrorContainer: ele1 }).on('drop', onDropFunc);
|
||||
var ele2 = document.getElementById('coo-img-container-com_coop');
|
||||
dragula([ele2], { mirrorContainer: ele2 }).on('drop', onDropFunc);
|
||||
var ele3 = document.getElementById('coo-img-container-edu_coop');
|
||||
dragula([ele3], { mirrorContainer: ele3 }).on('drop', onDropFunc);
|
||||
|
||||
|
||||
// ----------- 新增 --------------
|
||||
var $createModal = $('.modal.admin-add-cooperative-modal');
|
||||
var $createForm = $createModal.find('form.admin-add-cooperative-form');
|
||||
|
||||
$createForm.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
"coo_img[image]": {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$createModal.on('show.bs.modal', function(event){
|
||||
resetFileInputFunc($createModal.find('.img-file-input'));
|
||||
$createModal.find('.file-names').html('选择文件');
|
||||
|
||||
var $link = $(event.relatedTarget);
|
||||
var imgType = $link.data('imgType');
|
||||
$createForm.find('input[name="coo_img[img_type]"]').val(imgType);
|
||||
});
|
||||
|
||||
$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 $cooImgItem = $('.coo-img-item-' + data.source_id);
|
||||
$.post('/admins/cooperatives/'+ data.source_id + '/replace_image_url');
|
||||
$cooImgItem.find('.coo-img-item-img img').attr('src', data.url);
|
||||
})
|
||||
}
|
||||
})
|
@ -0,0 +1,12 @@
|
||||
$(document).on('turbolinks:load', function(){
|
||||
if ($('body.admins-daily-school-statistics-index-page').length > 0) {
|
||||
$('.export-action').on('click', function(){
|
||||
var form = $(".daily-school-statistic-list-form .search-form")
|
||||
var exportLink = $(this);
|
||||
var keyword = form.find("input[name='keyword']").val();
|
||||
|
||||
var url = exportLink.data("url").split('?')[0] + "?keyword=" + keyword;
|
||||
window.open(url);
|
||||
});
|
||||
}
|
||||
})
|
@ -0,0 +1,66 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-dashboards-index-page').length > 0) {
|
||||
// 月新增用户
|
||||
var monthChart = echarts.init(document.getElementById('month-active-user'));
|
||||
monthChart.setOption({
|
||||
tooltip: {
|
||||
show: "true",
|
||||
trigger: 'item',
|
||||
formatter: '{c0}',
|
||||
backgroundColor: 'rgba(0,0,0,0.7)', // 背景
|
||||
padding: [8, 10], //内边距
|
||||
extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', //添加阴影
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
series : [
|
||||
{
|
||||
name: '访问来源',
|
||||
type: 'pie',
|
||||
radius: '55%',
|
||||
data: []
|
||||
}
|
||||
]
|
||||
});
|
||||
monthChart.showLoading();
|
||||
$.get('/admins/dashboards/month_active_user.json').done(function(data){
|
||||
monthChart.setOption({
|
||||
series: [
|
||||
{ data: data.data }
|
||||
]
|
||||
});
|
||||
|
||||
monthChart.hideLoading();
|
||||
});
|
||||
|
||||
|
||||
// 近七天评测次数
|
||||
// var evaluateChart = echarts.init(document.getElementById('evaluate-pie'));
|
||||
// evaluateChart.setOption({
|
||||
// tooltip: {
|
||||
// show: "true",
|
||||
// trigger: 'item',
|
||||
// formatter: '{c0}',
|
||||
// backgroundColor: 'rgba(0,0,0,0.7)', // 背景
|
||||
// padding: [8, 10], //内边距
|
||||
// extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', //添加阴影
|
||||
// axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
// type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
// }
|
||||
// },
|
||||
// xAxis: { type: 'category', boundaryGap: false, data: [] },
|
||||
// yAxis: { type: 'value' },
|
||||
// series: [{ data: [], type: 'line', areaStyle: {} }]
|
||||
// });
|
||||
// evaluateChart.showLoading();
|
||||
// $.get('/admins/dashboards/evaluate.json').done(function(data){
|
||||
// evaluateChart.setOption({
|
||||
// xAxis: { data: data.names },
|
||||
// series: [{ data: data.data }]
|
||||
// });
|
||||
//
|
||||
// evaluateChart.hideLoading();
|
||||
// });
|
||||
}
|
||||
});
|
@ -0,0 +1,173 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-departments-index-page').length > 0) {
|
||||
var $searchContainer = $('.department-list-form');
|
||||
var $searchForm = $searchContainer.find('form.search-form');
|
||||
var $list = $('.department-list-container');
|
||||
|
||||
$searchContainer.on('change', '.form-check-input', function(){
|
||||
$searchForm.find('input[type="submit"]').trigger('click');
|
||||
});
|
||||
|
||||
// ============== 新建部门 ===============
|
||||
var $modal = $('.modal.admin-create-department-modal');
|
||||
var $form = $modal.find('form.admin-create-department-form');
|
||||
var $departmentNameInput = $form.find('input[name="department_name"]');
|
||||
var $schoolSelect = $modal.find('.school-select');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
school_id: {
|
||||
required: true
|
||||
},
|
||||
department_name: {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
school_id: {
|
||||
required: '请选择所属单位'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$departmentNameInput.val('');
|
||||
$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-department-member-modal');
|
||||
var $addMemberForm = $addMemberModal.find('.admin-add-department-member-form');
|
||||
var $memberSelect = $addMemberModal.find('.department-member-select');
|
||||
var $departmentIdInput = $addMemberForm.find('input[name="department_id"]')
|
||||
|
||||
$addMemberModal.on('show.bs.modal', function(event){
|
||||
var $link = $(event.relatedTarget);
|
||||
var departmentId = $link.data('department-id');
|
||||
$departmentIdInput.val(departmentId);
|
||||
|
||||
$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 item.real_name;
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
}
|
||||
return item.real_name || item.text;
|
||||
}
|
||||
});
|
||||
|
||||
$addMemberModal.on('click', '.submit-btn', function(){
|
||||
$addMemberForm.find('.error').html('');
|
||||
|
||||
var departmentId = $departmentIdInput.val();
|
||||
var memberIds = $memberSelect.val();
|
||||
if (departmentId && memberIds && memberIds.length > 0) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'script',
|
||||
url: '/admins/departments/' + departmentId + '/department_member',
|
||||
data: { user_ids: memberIds }
|
||||
});
|
||||
} else {
|
||||
$addMemberModal.modal('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,5 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-help-centers-edit-page, body.admins-help-centers-update-page').length > 0) {
|
||||
createMDEditor('help-center-editor', {});
|
||||
}
|
||||
})
|
@ -0,0 +1,20 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-identity-authentications-index-page').length > 0) {
|
||||
var $searchFrom = $('.identity-authentication-list-form');
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
|
||||
$searchFrom.on('click', '.search-form-tab', function(){
|
||||
var $link = $(this);
|
||||
|
||||
$searchFrom.find('input[name="keyword"]').val('');
|
||||
$searchFrom.find('select[name="status"]').val('processed');
|
||||
|
||||
if($link.data('value') === 'processed'){
|
||||
$searchFrom.find('.status-filter').show();
|
||||
} else {
|
||||
$searchFrom.find('.status-filter').hide();
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
@ -0,0 +1,20 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-library-applies-index-page').length > 0) {
|
||||
var $searchFrom = $('.library-applies-list-form');
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
|
||||
$searchFrom.on('click', '.search-form-tab', function(){
|
||||
var $link = $(this);
|
||||
|
||||
$searchFrom.find('input[name="keyword"]').val('');
|
||||
$searchFrom.find('select[name="status"]').val('processed');
|
||||
|
||||
if($link.data('value') === 'processed'){
|
||||
$searchFrom.find('.status-filter').show();
|
||||
} else {
|
||||
$searchFrom.find('.status-filter').hide();
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
@ -0,0 +1,22 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
var $modal = $('.modal.admin-message-modal');
|
||||
var $submitBtn = $modal.find('.submit-btn');
|
||||
if ($modal.length > 0) {
|
||||
$modal.on('hide.bs.modal', function(){
|
||||
$modal.find('.modal-body').html('');
|
||||
$submitBtn.unbind();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function showMessageModal(html, callback) {
|
||||
var $modal = $('.modal.admin-message-modal');
|
||||
var $submitBtn = $modal.find('.submit-btn');
|
||||
$submitBtn.unbind();
|
||||
if(callback !== undefined && typeof callback === 'function'){
|
||||
$submitBtn.on('click', callback);
|
||||
}
|
||||
|
||||
$modal.find('.modal-body').html(html);
|
||||
$modal.modal('show');
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-mirror-repositories-edit-page, body.admins-mirror-repositories-update-page').length > 0) {
|
||||
var $form = $('form.edit-mirror');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
"mirror_repository[type_name]": {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$form.submit(function(e){
|
||||
if(!$form.valid()){ e.preventDefault(); }
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,4 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-mirror-repositories-index-page').length > 0) {
|
||||
}
|
||||
});
|
@ -0,0 +1,33 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-mirror-scripts-edit-page, body.admins-mirror-scripts-update-page, body.admins-mirror-scripts-new-page, body.admins-mirror-scripts-create-page').length > 0) {
|
||||
var $form = $('form.script-form');
|
||||
|
||||
// codemirror编辑器
|
||||
var scriptEditor = CodeMirror.fromTextArea(document.getElementById('mirror_script_script'), {
|
||||
lineNumbers: true,
|
||||
mode: 'shell',
|
||||
theme: "default",
|
||||
indentUnit: 4, //代码缩进为一个tab的距离
|
||||
matchBrackets: true,
|
||||
autoRefresh: true,
|
||||
smartIndent: true,//智能换行
|
||||
styleActiveLine: true,
|
||||
lint: true
|
||||
});
|
||||
scriptEditor.setSize('auto', '600px');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
"mirror_script[script_type]": {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$form.submit(function(e){
|
||||
if(!$form.valid()){ e.preventDefault(); }
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,32 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-choose-mirror-modal', function(){
|
||||
var $modal = $('.modal.admin-choose-mirror-modal');
|
||||
var $form = $modal.find('form.admin-choose-mirror-form');
|
||||
|
||||
var validateForm = function(){
|
||||
var checkedValue = $form.find('input[name="mirror_number"]:checked').val();
|
||||
|
||||
if(checkedValue == undefined){
|
||||
$modal.find('.error').html('必须选择一种镜像保存!');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
if (validateForm()) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
}).done(function(){
|
||||
$modal.modal('hide');
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
@ -0,0 +1,34 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-department-modal', function(){
|
||||
var $modal = $('.modal.admin-edit-department-modal');
|
||||
var $form = $modal.find('form.admin-edit-department-form');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
'department[name]': {
|
||||
required: true,
|
||||
maxlength: 20
|
||||
},
|
||||
'department[host_count]': {
|
||||
digits: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
@ -0,0 +1,78 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
var $modal = $('.modal.admin-import-course-member-modal');
|
||||
if ($modal.length > 0) {
|
||||
var $form = $modal.find('form.admin-import-course-member-form');
|
||||
|
||||
var resetFileInputFunc = function(file){
|
||||
file.after(file.clone().val(""));
|
||||
file.remove();
|
||||
}
|
||||
|
||||
$modal.on('show.bs.modal', function(){
|
||||
$modal.find('.file-names').html('选择文件');
|
||||
$modal.find('.upload-file-input').trigger('click');
|
||||
});
|
||||
$modal.on('hide.bs.modal', function(){
|
||||
resetFileInputFunc($modal.find('.upload-file-input'));
|
||||
});
|
||||
$modal.on('change', '.upload-file-input', function(e){
|
||||
var file = $(this)[0].files[0];
|
||||
$modal.find('.file-names').html(file ? file.name : '请选择文件');
|
||||
})
|
||||
|
||||
var importFormValid = 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;
|
||||
};
|
||||
|
||||
var buildResultMessage = function(data){
|
||||
var messageHtml = "<div>导入结果:成功" + data.success + "条,失败"+ data.fail.length + "条</div>";
|
||||
|
||||
if(data.fail.length > 0){
|
||||
messageHtml += '<table class="table"><thead class="thead-light"><tr><th>数据</th><th>失败原因</th></tr></thead><tbody>';
|
||||
|
||||
data.fail.forEach(function(item){
|
||||
messageHtml += '<tr><td>' + item.data + '</td><td>' + item.message + '</td></tr>';
|
||||
});
|
||||
|
||||
messageHtml += '</tbody></table>'
|
||||
}
|
||||
|
||||
return messageHtml;
|
||||
}
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if (importFormValid()) {
|
||||
$('body').mLoading({ text: '正在导入...' });
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: '/admins/import_course_members',
|
||||
data: new FormData($form[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data){
|
||||
$('body').mLoading('destroy');
|
||||
$modal.modal('hide');
|
||||
|
||||
showMessageModal(buildResultMessage(data), function(){
|
||||
window.location.reload();
|
||||
});
|
||||
},
|
||||
error: function(res){
|
||||
$('body').mLoading('destroy');
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,111 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
var $modal = $('.modal.admin-merge-department-modal');
|
||||
if ($modal.length > 0) {
|
||||
var $form = $modal.find('form.admin-merge-department-form');
|
||||
var $schoolIdInput = $form.find('input[name="school_id"]');
|
||||
var $originDepartmentIdInput = $form.find('input[name="origin_department_id"]');
|
||||
var $departmentSelect = $modal.find('.department-select');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
department_id: {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
department_id: {
|
||||
required: '请选择部门'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// ************** 学校选择 *************
|
||||
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 defineDepartmentSelect = function(departments) {
|
||||
$departmentSelect.empty();
|
||||
|
||||
$departmentSelect.select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请选择所属部门',
|
||||
data: departments,
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
return item.name;
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
$form.find('#department_id').val(item.id);
|
||||
}
|
||||
return item.name || item.text;
|
||||
},
|
||||
matcher: matcherFunc
|
||||
});
|
||||
$departmentSelect.select2('val', ' ');
|
||||
};
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function (event) {
|
||||
var $link = $(event.relatedTarget);
|
||||
|
||||
var schoolId = $link.data('schoolId');
|
||||
var url = $link.data('url');
|
||||
|
||||
$schoolIdInput.val(schoolId);
|
||||
$originDepartmentIdInput.val($link.data('departmentId'));
|
||||
$form.data('url', url);
|
||||
$.ajax({
|
||||
url: '/api/schools/' + schoolId + '/departments/for_option.json',
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
defineDepartmentSelect(data.departments);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$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,89 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
var $modal = $('.modal.admin-replace-mirror-modal');
|
||||
if ($modal.length > 0) {
|
||||
var $form = $modal.find('form.admin-replace-mirror-form');
|
||||
var $mirrorIdInput = $modal.find('.modal-body input[name="mirror_id"]');
|
||||
var $mirrorSelect = $modal.find('.new-mirror-select');
|
||||
|
||||
var setMirror = function(id, name){
|
||||
$mirrorIdInput.val(id);
|
||||
$form.find('.mirror-id-container').html(id);
|
||||
$form.find('.mirror-name-container').html(name);
|
||||
}
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
new_mirror_id: {
|
||||
required: true
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
new_mirror_id: {
|
||||
required: '请选择新镜像'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function (event) {
|
||||
var $link = $(event.relatedTarget);
|
||||
|
||||
var mirrorId = $link.data('id');
|
||||
var mirrorName = $link.data('name');
|
||||
|
||||
setMirror(mirrorId, mirrorName);
|
||||
$mirrorSelect.select2('val', ' ');
|
||||
});
|
||||
$modal.on('hide.bs.modal', function () {
|
||||
setMirror('', '');
|
||||
$mirrorSelect.select2('val', ' ');
|
||||
$('#new_mirror_id-error').remove();
|
||||
});
|
||||
|
||||
$mirrorSelect.select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '输入要合并的镜像名',
|
||||
minimumInputLength: 1,
|
||||
ajax: {
|
||||
url: '/admins/mirror_repositories/for_select',
|
||||
dataType: 'json',
|
||||
data: function(params){
|
||||
return { keyword: params.term };
|
||||
},
|
||||
processResults: function(data){
|
||||
return { results: data.mirrors }
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
return item.name;
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
$('#new_mirror_id-error').remove();
|
||||
$('#new_mirror_id').val(item.id);
|
||||
}
|
||||
return item.name || item.text;
|
||||
}
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
}).done(function(){
|
||||
$modal.modal('hide');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,62 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
var $modal = $('.modal.admin-upload-file-modal');
|
||||
if ($modal.length > 0) {
|
||||
var $form = $modal.find('form.admin-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: '/admins/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,20 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-professional-authentications-index-page').length > 0) {
|
||||
var $searchFrom = $('.professional-authentication-list-form');
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
|
||||
$searchFrom.on('click', '.search-form-tab', function(){
|
||||
var $link = $(this);
|
||||
|
||||
$searchFrom.find('input[name="keyword"]').val('');
|
||||
$searchFrom.find('select[name="status"]').val('processed');
|
||||
|
||||
if($link.data('value') === 'processed'){
|
||||
$searchFrom.find('.status-filter').show();
|
||||
} else {
|
||||
$searchFrom.find('.status-filter').hide();
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
@ -0,0 +1,20 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-project-package-applies-index-page').length > 0) {
|
||||
var $searchFrom = $('.project-package-applies-form');
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
|
||||
$searchFrom.on('click', '.search-form-tab', function(){
|
||||
var $link = $(this);
|
||||
|
||||
$searchFrom.find('input[name="keyword"]').val('');
|
||||
$searchFrom.find('select[name="status"]').val('all');
|
||||
|
||||
if($link.data('value') === 'all'){
|
||||
$searchFrom.find('.status-filter').show();
|
||||
} else {
|
||||
$searchFrom.find('.status-filter').hide();
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
@ -0,0 +1,135 @@
|
||||
$(document).on('turbolinks:load', function(){
|
||||
if ($('body.admins-school-statistics-index-page').length > 0) {
|
||||
var searchForm = $(".school-statistic-list-form .search-form");
|
||||
var growFormUrl = searchForm.data('grow-form-url');
|
||||
var contrastFormUrl = searchForm.data('contrast-form-url');
|
||||
|
||||
var dataTypeInput = searchForm.find("input[name='data_type']");
|
||||
var keywordInput = searchForm.find("input[name='keyword']");
|
||||
var contrastBtn = searchForm.find(".contrast-btn");
|
||||
var growBtn = searchForm.find(".grow-btn");
|
||||
var contrastDateContainer = searchForm.find('.contrast-date-container');
|
||||
var growDateContainer = searchForm.find('.grow-date-container');
|
||||
|
||||
// 数据对比日期输入框
|
||||
var beginDateInput = searchForm.find("input[name='begin_date']");
|
||||
var endDateInput = searchForm.find("input[name='end_date']");
|
||||
var otherBeginDateInput = searchForm.find("input[name='other_begin_date']");
|
||||
var otherEndDateInput = searchForm.find("input[name='other_end_date']");
|
||||
|
||||
// 新增数据日期输入框
|
||||
var growBeginDateInput = searchForm.find("input[name='grow_begin_date']");
|
||||
var growEndDateInput = searchForm.find("input[name='grow_end_date']");
|
||||
|
||||
// 数据展示切换: 数据对比、新增数据
|
||||
searchForm.on('click', ".contrast-btn", function(){
|
||||
if(contrastBtn.hasClass("active")) { return }
|
||||
changeDataType("contrast");
|
||||
submitForm();
|
||||
});
|
||||
searchForm.on('click', ".grow-btn", function(){
|
||||
if(growBtn.hasClass("active")) { return }
|
||||
changeDataType("grow");
|
||||
submitForm();
|
||||
});
|
||||
|
||||
// 搜索按钮
|
||||
searchForm.on('click', ".search-btn", function(){
|
||||
console.log('submit');
|
||||
submitForm();
|
||||
});
|
||||
|
||||
$('.school-statistic-list-container').on('change', '.contrast-column-select', function() {
|
||||
searchForm.find("input[name='contrast_column']").val($('.contrast-column-select').val());
|
||||
submitForm();
|
||||
});
|
||||
|
||||
var submitForm = function(){
|
||||
if(!validateFrom()) { return }
|
||||
|
||||
var form = searchForm;
|
||||
var url = dataTypeInput.val() == "contrast" ? contrastFormUrl : growFormUrl;
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: form.serialize(),
|
||||
dataType: "script"
|
||||
})
|
||||
};
|
||||
|
||||
var validateFrom = function(){
|
||||
if (dataTypeInput.val() != "contrast") { return true; }
|
||||
|
||||
// 全部为空时,需要展示空数据页
|
||||
if (beginDateInput.val() == "" && endDateInput.val() == "" &&
|
||||
otherBeginDateInput.val() == "" && otherBeginDateInput.val() == "") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (beginDateInput.val() != "" && endDateInput.val() != "" &&
|
||||
otherBeginDateInput.val() != "" && otherBeginDateInput.val() != "") {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
var changeDataType = function(dataType){
|
||||
if (dataTypeInput.val() == dataType) { return }
|
||||
|
||||
if (dataType == "contrast") {
|
||||
contrastBtn.addClass("active");
|
||||
growBtn.removeClass("active");
|
||||
dataTypeInput.val('contrast');
|
||||
growDateContainer.hide();
|
||||
contrastDateContainer.show();
|
||||
|
||||
clearGrowDateInput();
|
||||
} else {
|
||||
contrastBtn.removeClass("active");
|
||||
growBtn.addClass("active");
|
||||
dataTypeInput.val('grow');
|
||||
growDateContainer.show();
|
||||
contrastDateContainer.hide();
|
||||
|
||||
clearContrastDateInput();
|
||||
}
|
||||
};
|
||||
|
||||
var clearGrowDateInput = function() {
|
||||
searchForm.find("input[name='grow_begin_date']").val('');
|
||||
searchForm.find("input[name='grow_end_date']").val('');
|
||||
searchForm.find("input[name='grow_date_input']").val('');
|
||||
};
|
||||
|
||||
var clearContrastDateInput = function(){
|
||||
searchForm.find("input[name='begin_date']").val('');
|
||||
searchForm.find("input[name='end_date']").val('');
|
||||
searchForm.find("input[name='other_begin_date']").val('');
|
||||
searchForm.find("input[name='other_end_date']").val('');
|
||||
searchForm.find("input[name='date_input']").val('');
|
||||
searchForm.find("input[name='other_date_input']").val('');
|
||||
};
|
||||
|
||||
var baseOptions = {
|
||||
autoclose: true,
|
||||
language: 'zh-CN',
|
||||
format: 'yyyy-mm-dd',
|
||||
startDate: '2017-04-01',
|
||||
endDate: '-1d'
|
||||
}
|
||||
|
||||
var defineDateRangeSelect = function(element){
|
||||
var options = $.extend({inputs: $(element).find('.start-date, .end-date')}, baseOptions);
|
||||
$(element).datepicker(options);
|
||||
|
||||
$(element).find('.start-date').datepicker().on('changeDate', function(e){
|
||||
$(element).find('.end-date').datepicker('setStartDate', e.date);
|
||||
})
|
||||
};
|
||||
|
||||
defineDateRangeSelect('.grow-date-input-daterange');
|
||||
defineDateRangeSelect('.date-input-daterange');
|
||||
defineDateRangeSelect('.other-date-input-daterange');
|
||||
}
|
||||
})
|
@ -0,0 +1,10 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
var $tabs = $('.search-form-container .search-form-tabs');
|
||||
if ($tabs.length > 0) {
|
||||
$tabs.on('click', '.search-form-tab', function(){
|
||||
var $activeTab = $(this);
|
||||
$tabs.find('.search-form-tab').removeClass('active');
|
||||
$activeTab.addClass('active');
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-shixun-authorizations-index-page').length > 0) {
|
||||
var $searchFrom = $('.shixun-authorization-list-form');
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
|
||||
$searchFrom.on('click', '.search-form-tab', function(){
|
||||
var $link = $(this);
|
||||
|
||||
$searchFrom.find('input[name="keyword"]').val('');
|
||||
$searchFrom.find('select[name="status"]').val('processed');
|
||||
|
||||
if($link.data('value') === 'processed'){
|
||||
$searchFrom.find('.status-filter').show();
|
||||
} else {
|
||||
$searchFrom.find('.status-filter').hide();
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
@ -0,0 +1,44 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-shixun-settings-index-page').length > 0) {
|
||||
let searchContainer = $(".shixun-settings-list-form");
|
||||
let searchForm = $("form.search-form",searchContainer);
|
||||
|
||||
searchContainer.on('change', '.shixun-settings-select', function(){
|
||||
searchForm.find('input[type="submit"]').trigger('click');
|
||||
});
|
||||
|
||||
//导出
|
||||
searchContainer.on('click',"#shixun-settings-export",function () {
|
||||
window.location.href = "/admins/shixun_settings.xls?" + searchForm.serialize();
|
||||
});
|
||||
|
||||
$(".shixun-settings-list-container").on("change", '.shixun-setting-form', function () {
|
||||
var s_id = $(this).attr("data-id");
|
||||
var s_value = $(this).val();
|
||||
var s_name = $(this).attr("name");
|
||||
var json = {};
|
||||
var s_index = $(this).parent("td").siblings(".shixun-line-no").text();
|
||||
json[s_name] = s_value;
|
||||
json["page_no"] = s_index;
|
||||
$.ajax({
|
||||
url: "/admins/shixun_settings/" + s_id,
|
||||
type: "PUT",
|
||||
dataType:'script',
|
||||
data: json
|
||||
})
|
||||
});
|
||||
|
||||
$("select#settings-tag-choosed").select2({
|
||||
placeholder: "请选择分类",
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
|
||||
var $imageElement = $('.shixun-image-' + data.source_id);
|
||||
$imageElement.attr('src', data.url);
|
||||
$imageElement.show();
|
||||
$imageElement.next().html('重新上传');
|
||||
})
|
||||
}
|
||||
});
|
||||
|
@ -0,0 +1,14 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if($('body.admins-shixuns-index-page').length > 0){
|
||||
$('select#tag-choosed').select2({
|
||||
placeholder: "请选择分类",
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
let search_form = $(".search-form");
|
||||
//导出
|
||||
$(".shixuns-list-form").on("click","#shixuns-export",function () {
|
||||
window.location.href = "/admins/shixuns.xls?" + search_form.serialize();
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,16 @@
|
||||
$(document).on('turbolinks:load', function(){
|
||||
$('#sidebarCollapse').on('click', function () {
|
||||
$(this).toggleClass('active');
|
||||
$('#sidebar').toggleClass('active');
|
||||
$.cookie('admin_sidebar_collapse', $(this).hasClass('active'), {path: '/admins'});
|
||||
});
|
||||
|
||||
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,20 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-subject-authorizations-index-page').length > 0) {
|
||||
var $searchFrom = $('.subject-authorization-list-form');
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
|
||||
$searchFrom.on('click', '.search-form-tab', function(){
|
||||
var $link = $(this);
|
||||
|
||||
$searchFrom.find('input[name="keyword"]').val('');
|
||||
$searchFrom.find('select[name="status"]').val('processed');
|
||||
|
||||
if($link.data('value') === 'processed'){
|
||||
$searchFrom.find('.status-filter').show();
|
||||
} else {
|
||||
$searchFrom.find('.status-filter').hide();
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
@ -0,0 +1,156 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-users-edit-page, body.admins-users-update-page').length > 0) {
|
||||
var initDepartmentSelect = true;
|
||||
|
||||
// ************** 学校选择 *************
|
||||
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) {
|
||||
$('.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) {
|
||||
$('#user_school_id').val(item.id);
|
||||
getDepartmentsData(item.id, defineDepartmentSelect2);
|
||||
}
|
||||
return item.name || item.text;
|
||||
},
|
||||
matcher: matcherFunc
|
||||
});
|
||||
};
|
||||
|
||||
var defineDepartmentSelect2 = function(departments){
|
||||
departments.unshift({ id: '-1', name: '未选择' }); // 可不选
|
||||
|
||||
if (!initDepartmentSelect) { $('.department-select').empty(); } // 为了能够回填部门
|
||||
initDepartmentSelect = false;
|
||||
|
||||
$('.department-select').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '查询学院/部门',
|
||||
minimumInputLength: 0,
|
||||
data: departments,
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
return item.name;
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
$('#user_department_id').val(item.id);
|
||||
}
|
||||
return item.name || item.text;
|
||||
},
|
||||
matcher: matcherFunc
|
||||
});
|
||||
};
|
||||
|
||||
var getDepartmentsData = function(school_id, callback){
|
||||
$.ajax({
|
||||
url: '/api/schools/' + school_id + '/departments/for_option.json',
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
callback(data.departments);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 初始化学校选择器
|
||||
$.ajax({
|
||||
url: '/api/schools/for_option.json',
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
defineSchoolSelect(data.schools);
|
||||
}
|
||||
});
|
||||
|
||||
// **************** 地区选择 ****************
|
||||
$('.province-city-select').cxSelect({
|
||||
url: '/javascripts/educoder/province-data.json',
|
||||
selects: ['province-select', 'city-select']
|
||||
});
|
||||
|
||||
// *********** 职业选择 ************
|
||||
var identityData = [
|
||||
{
|
||||
"v": "teacher",
|
||||
"n": "教师",
|
||||
"s": [{"n": "教授", "v": "教授"},{"n": "副教授", "v": "副教授"},{"n": "讲师", "v": "讲师"},{"n": "助教", "v": "助教"}]
|
||||
},
|
||||
{
|
||||
"v": "student",
|
||||
"n": "学生",
|
||||
"s": []
|
||||
},
|
||||
{
|
||||
"v": "professional",
|
||||
"n": "专业人士",
|
||||
"s": [{"n": "企业管理者", "v": "企业管理者"},{"n": "部门管理者", "v": "部门管理者"},{"n": "高级工程师", "v": "高级工程师"},{"n": "工程师", "v": "工程师"},{"n": "助理工程师", "v": "助理工程师"}]
|
||||
}
|
||||
];
|
||||
$('.user-identity-select').cxSelect({
|
||||
data: identityData,
|
||||
jsonValue: 'v',
|
||||
selects: ['identity-select', 'technical-title-select']
|
||||
});
|
||||
$('.identity-select').on('change', function(){
|
||||
if($(this).val() === 'student'){
|
||||
$('.technical-title-select-wrapper').hide();
|
||||
$('.form-group.user_student_id').show();
|
||||
} else {
|
||||
$('.technical-title-select-wrapper').show();
|
||||
$('.form-group.user_student_id').hide();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
var $form = $('form.edit_user')
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
"user[password]": {
|
||||
required: false,
|
||||
minlength: 5
|
||||
},
|
||||
"user[password_confirmation]": {
|
||||
required: false,
|
||||
minlength: 5,
|
||||
equalTo: "#user_password"
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
"user[password_confirmation]": {
|
||||
equalTo: "两次密码输入不一致"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$form.submit(function(e){
|
||||
if(!$form.valid()){ e.preventDefault(); }
|
||||
})
|
||||
}
|
||||
});
|
@ -0,0 +1,191 @@
|
||||
$(document).on('turbolinks:load', function(){
|
||||
if ($('body.admins-users-index-page').length > 0) {
|
||||
|
||||
var showSuccessNotify = function() {
|
||||
$.notify({
|
||||
message: '操作成功'
|
||||
},{
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
|
||||
// lock user
|
||||
$('.users-list-container').on('click', '.lock-action', function(){
|
||||
var $lockAction = $(this);
|
||||
var $unlockAction = $lockAction.siblings('.unlock-action');
|
||||
|
||||
var userId = $lockAction.data('id');
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/users/' + userId + '/lock',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function() {
|
||||
showSuccessNotify();
|
||||
$lockAction.hide();
|
||||
$unlockAction.show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// unlock user
|
||||
$('.users-list-container').on('click', '.unlock-action', function(){
|
||||
var $unlockAction = $(this);
|
||||
var $lockAction = $unlockAction.siblings('.lock-action');
|
||||
|
||||
var userId = $unlockAction.data('id');
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/users/' + userId + '/unlock',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function() {
|
||||
showSuccessNotify();
|
||||
$lockAction.show();
|
||||
$unlockAction.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// active user
|
||||
$('.users-list-container').on('click', '.active-action', function(){
|
||||
var $activeAction = $(this);
|
||||
var $unlockAction = $activeAction.siblings('.unlock-action');
|
||||
var $lockAction = $activeAction.siblings('.lock-action');
|
||||
|
||||
var userId = $activeAction.data('id');
|
||||
|
||||
$.ajax({
|
||||
url: '/admins/users/' + userId + '/unlock',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function() {
|
||||
showSuccessNotify();
|
||||
$activeAction.hide();
|
||||
$lockAction.show();
|
||||
$unlockAction.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ***************** reward grade modal *****************
|
||||
var $rewardGradeModal = $('.admin-users-reward-grade-modal');
|
||||
var $form = $rewardGradeModal.find('form.admin-users-reward-grade-form');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
grade: {
|
||||
required: true,
|
||||
digits: true
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$rewardGradeModal.on('show.bs.modal', function (event) {
|
||||
var $link = $(event.relatedTarget);
|
||||
|
||||
var userId = $link.data('id');
|
||||
$rewardGradeModal.find('.modal-body input[name="user_id"]').val(userId);
|
||||
});
|
||||
// modal visited fire
|
||||
$rewardGradeModal.on('shown.bs.modal', function(){
|
||||
$rewardGradeModal.find('.modal-body input[name="grade"]').focus();
|
||||
});
|
||||
|
||||
$('.admin-users-reward-grade-modal .submit-btn').on('click', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if ($form.valid()) {
|
||||
var userId = $form.find('input[name="user_id"]').val();
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: "/admins/users/" + userId + "/reward_grade",
|
||||
data: $form.serialize(),
|
||||
success: function(data) {
|
||||
showSuccessNotify();
|
||||
$('.users-list-container .user-item-' + userId + ' td.grade-content').html(data.grade);
|
||||
$rewardGradeModal.modal('hide');
|
||||
},
|
||||
error: function(res) {
|
||||
$rewardGradeModal.find('.error').html(res.responseJSON.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 导入学生
|
||||
var $importUserModal = $('.modal.admin-import-user-modal');
|
||||
var $importUserForm = $importUserModal.find('form.admin-import-user-form')
|
||||
|
||||
$importUserModal.on('show.bs.modal', function(){
|
||||
resetFileInputFunc($importUserModal.find('.upload-file-input'));
|
||||
$importUserModal.find('.file-names').html('选择文件');
|
||||
$importUserModal.find('.upload-file-input').trigger('click');
|
||||
});
|
||||
$importUserModal.on('change', '.upload-file-input', function(e){
|
||||
var file = $(this)[0].files[0];
|
||||
$importUserModal.find('.file-names').html(file ? file.name : '请选择文件');
|
||||
})
|
||||
|
||||
var importUserFormValid = function(){
|
||||
if($importUserForm.find('input[name="file"]').val() == undefined || $importUserForm.find('input[name="file"]').val().length == 0){
|
||||
$importUserForm.find('.error').html('请选择文件');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
var buildResultMessage = function(data){
|
||||
var messageHtml = "<div>导入结果:成功" + data.success + "条,失败"+ data.fail.length + "条</div>";
|
||||
|
||||
if(data.fail.length > 0){
|
||||
messageHtml += '<table class="table"><thead class="thead-light"><tr><th>数据</th><th>失败原因</th></tr></thead><tbody>';
|
||||
|
||||
data.fail.forEach(function(item){
|
||||
messageHtml += '<tr><td>' + item.data + '</td><td>' + item.message + '</td></tr>';
|
||||
});
|
||||
|
||||
messageHtml += '</tbody></table>'
|
||||
}
|
||||
|
||||
return messageHtml;
|
||||
}
|
||||
|
||||
$importUserModal.on('click', '.submit-btn', function(){
|
||||
$importUserForm.find('.error').html('');
|
||||
|
||||
if (importUserFormValid()) {
|
||||
$('body').mLoading({ text: '正在导入...' });
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: '/admins/import_users',
|
||||
data: new FormData($importUserForm[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data){
|
||||
$('body').mLoading('destroy');
|
||||
$importUserModal.modal('hide');
|
||||
|
||||
showMessageModal(buildResultMessage(data), function(){
|
||||
window.location.reload();
|
||||
});
|
||||
},
|
||||
error: function(res){
|
||||
$('body').mLoading('destroy');
|
||||
var data = res.responseJSON;
|
||||
$importUserForm.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-video-applies-index-page').length > 0) {
|
||||
var $searchFrom = $('.video-applies-form');
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
|
||||
$searchFrom.on('click', '.search-form-tab', function(){
|
||||
var $link = $(this);
|
||||
|
||||
$searchFrom.find('input[name="keyword"]').val('');
|
||||
$searchFrom.find('select[name="status"]').val('all');
|
||||
|
||||
if($link.data('value') === 'all'){
|
||||
$searchFrom.find('.status-filter').show();
|
||||
} else {
|
||||
$searchFrom.find('.status-filter').hide();
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,350 @@
|
||||
/*
|
||||
* Project: Bootstrap Notify = v3.1.3
|
||||
* Description: Turns standard Bootstrap alerts into "Growl-like" notifications.
|
||||
* Author: Mouse0270 aka Robert McIntosh
|
||||
* License: MIT License
|
||||
* Website: https://github.com/mouse0270/bootstrap-growl
|
||||
*/
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
// Create the defaults once
|
||||
var defaults = {
|
||||
element: 'body',
|
||||
position: null,
|
||||
type: "info",
|
||||
allow_dismiss: true,
|
||||
newest_on_top: false,
|
||||
showProgressbar: false,
|
||||
placement: {
|
||||
from: "top",
|
||||
align: "right"
|
||||
},
|
||||
offset: 20,
|
||||
spacing: 10,
|
||||
z_index: 1031,
|
||||
delay: 1000,
|
||||
timer: 1000,
|
||||
url_target: '_blank',
|
||||
mouse_over: null,
|
||||
animate: {
|
||||
enter: 'animated fadeInDown',
|
||||
exit: 'animated fadeOutUp'
|
||||
},
|
||||
onShow: null,
|
||||
onShown: null,
|
||||
onClose: null,
|
||||
onClosed: null,
|
||||
icon_type: 'class',
|
||||
template: '<div data-notify="container" class="col-xs-4 col-sm-2 alert alert-{0}" role="alert"><button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button><span data-notify="icon"></span> <span data-notify="title">{1}</span> <span data-notify="message">{2}</span><div class="progress" data-notify="progressbar"><div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div></div><a href="{3}" target="{4}" data-notify="url"></a></div>'
|
||||
};
|
||||
|
||||
String.format = function() {
|
||||
var str = arguments[0];
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
str = str.replace(RegExp("\\{" + (i - 1) + "\\}", "gm"), arguments[i]);
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
function Notify ( element, content, options ) {
|
||||
// Setup Content of Notify
|
||||
var content = {
|
||||
content: {
|
||||
message: typeof content == 'object' ? content.message : content,
|
||||
title: content.title ? content.title : '',
|
||||
icon: content.icon ? content.icon : '',
|
||||
url: content.url ? content.url : '#',
|
||||
target: content.target ? content.target : '-'
|
||||
}
|
||||
};
|
||||
|
||||
options = $.extend(true, {}, content, options);
|
||||
this.settings = $.extend(true, {}, defaults, options);
|
||||
this._defaults = defaults;
|
||||
if (this.settings.content.target == "-") {
|
||||
this.settings.content.target = this.settings.url_target;
|
||||
}
|
||||
this.animations = {
|
||||
start: 'webkitAnimationStart oanimationstart MSAnimationStart animationstart',
|
||||
end: 'webkitAnimationEnd oanimationend MSAnimationEnd animationend'
|
||||
}
|
||||
|
||||
if (typeof this.settings.offset == 'number') {
|
||||
this.settings.offset = {
|
||||
x: this.settings.offset,
|
||||
y: this.settings.offset
|
||||
};
|
||||
}
|
||||
|
||||
this.init();
|
||||
};
|
||||
|
||||
$.extend(Notify.prototype, {
|
||||
init: function () {
|
||||
var self = this;
|
||||
|
||||
this.buildNotify();
|
||||
if (this.settings.content.icon) {
|
||||
this.setIcon();
|
||||
}
|
||||
if (this.settings.content.url != "#") {
|
||||
this.styleURL();
|
||||
}
|
||||
this.placement();
|
||||
this.bind();
|
||||
|
||||
this.notify = {
|
||||
$ele: this.$ele,
|
||||
update: function(command, update) {
|
||||
var commands = {};
|
||||
if (typeof command == "string") {
|
||||
commands[command] = update;
|
||||
}else{
|
||||
commands = command;
|
||||
}
|
||||
for (var command in commands) {
|
||||
switch (command) {
|
||||
case "type":
|
||||
this.$ele.removeClass('alert-' + self.settings.type);
|
||||
this.$ele.find('[data-notify="progressbar"] > .progress-bar').removeClass('progress-bar-' + self.settings.type);
|
||||
self.settings.type = commands[command];
|
||||
this.$ele.addClass('alert-' + commands[command]).find('[data-notify="progressbar"] > .progress-bar').addClass('progress-bar-' + commands[command]);
|
||||
break;
|
||||
case "icon":
|
||||
var $icon = this.$ele.find('[data-notify="icon"]');
|
||||
if (self.settings.icon_type.toLowerCase() == 'class') {
|
||||
$icon.removeClass(self.settings.content.icon).addClass(commands[command]);
|
||||
}else{
|
||||
if (!$icon.is('img')) {
|
||||
$icon.find('img');
|
||||
}
|
||||
$icon.attr('src', commands[command]);
|
||||
}
|
||||
break;
|
||||
case "progress":
|
||||
var newDelay = self.settings.delay - (self.settings.delay * (commands[command] / 100));
|
||||
this.$ele.data('notify-delay', newDelay);
|
||||
this.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', commands[command]).css('width', commands[command] + '%');
|
||||
break;
|
||||
case "url":
|
||||
this.$ele.find('[data-notify="url"]').attr('href', commands[command]);
|
||||
break;
|
||||
case "target":
|
||||
this.$ele.find('[data-notify="url"]').attr('target', commands[command]);
|
||||
break;
|
||||
default:
|
||||
this.$ele.find('[data-notify="' + command +'"]').html(commands[command]);
|
||||
};
|
||||
}
|
||||
var posX = this.$ele.outerHeight() + parseInt(self.settings.spacing) + parseInt(self.settings.offset.y);
|
||||
self.reposition(posX);
|
||||
},
|
||||
close: function() {
|
||||
self.close();
|
||||
}
|
||||
};
|
||||
},
|
||||
buildNotify: function () {
|
||||
var content = this.settings.content;
|
||||
this.$ele = $(String.format(this.settings.template, this.settings.type, content.title, content.message, content.url, content.target));
|
||||
this.$ele.attr('data-notify-position', this.settings.placement.from + '-' + this.settings.placement.align);
|
||||
if (!this.settings.allow_dismiss) {
|
||||
this.$ele.find('[data-notify="dismiss"]').css('display', 'none');
|
||||
}
|
||||
if ((this.settings.delay <= 0 && !this.settings.showProgressbar) || !this.settings.showProgressbar) {
|
||||
this.$ele.find('[data-notify="progressbar"]').remove();
|
||||
}
|
||||
},
|
||||
setIcon: function() {
|
||||
if (this.settings.icon_type.toLowerCase() == 'class') {
|
||||
this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon);
|
||||
}else{
|
||||
if (this.$ele.find('[data-notify="icon"]').is('img')) {
|
||||
this.$ele.find('[data-notify="icon"]').attr('src', this.settings.content.icon);
|
||||
}else{
|
||||
this.$ele.find('[data-notify="icon"]').append('<img src="'+this.settings.content.icon+'" alt="Notify Icon" />');
|
||||
}
|
||||
}
|
||||
},
|
||||
styleURL: function() {
|
||||
this.$ele.find('[data-notify="url"]').css({
|
||||
backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)',
|
||||
height: '100%',
|
||||
left: '0px',
|
||||
position: 'absolute',
|
||||
top: '0px',
|
||||
width: '100%',
|
||||
zIndex: this.settings.z_index + 1
|
||||
});
|
||||
this.$ele.find('[data-notify="dismiss"]').css({
|
||||
position: 'absolute',
|
||||
right: '10px',
|
||||
top: '5px',
|
||||
zIndex: this.settings.z_index + 2
|
||||
});
|
||||
},
|
||||
placement: function() {
|
||||
var self = this,
|
||||
offsetAmt = this.settings.offset.y,
|
||||
css = {
|
||||
display: 'inline-block',
|
||||
margin: '0px auto',
|
||||
position: this.settings.position ? this.settings.position : (this.settings.element === 'body' ? 'fixed' : 'absolute'),
|
||||
transition: 'all .5s ease-in-out',
|
||||
zIndex: this.settings.z_index
|
||||
},
|
||||
hasAnimation = false,
|
||||
settings = this.settings;
|
||||
|
||||
$('[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])').each(function() {
|
||||
return offsetAmt = Math.max(offsetAmt, parseInt($(this).css(settings.placement.from)) + parseInt($(this).outerHeight()) + parseInt(settings.spacing));
|
||||
});
|
||||
if (this.settings.newest_on_top == true) {
|
||||
offsetAmt = this.settings.offset.y;
|
||||
}
|
||||
css[this.settings.placement.from] = offsetAmt+'px';
|
||||
|
||||
switch (this.settings.placement.align) {
|
||||
case "left":
|
||||
case "right":
|
||||
css[this.settings.placement.align] = this.settings.offset.x+'px';
|
||||
break;
|
||||
case "center":
|
||||
css.left = 0;
|
||||
css.right = 0;
|
||||
break;
|
||||
}
|
||||
this.$ele.css(css).addClass(this.settings.animate.enter);
|
||||
$.each(Array('webkit', 'moz', 'o', 'ms', ''), function(index, prefix) {
|
||||
self.$ele[0].style[prefix+'AnimationIterationCount'] = 1;
|
||||
});
|
||||
|
||||
$(this.settings.element).append(this.$ele);
|
||||
|
||||
if (this.settings.newest_on_top == true) {
|
||||
offsetAmt = (parseInt(offsetAmt)+parseInt(this.settings.spacing)) + this.$ele.outerHeight();
|
||||
this.reposition(offsetAmt);
|
||||
}
|
||||
|
||||
if ($.isFunction(self.settings.onShow)) {
|
||||
self.settings.onShow.call(this.$ele);
|
||||
}
|
||||
|
||||
this.$ele.one(this.animations.start, function(event) {
|
||||
hasAnimation = true;
|
||||
}).one(this.animations.end, function(event) {
|
||||
if ($.isFunction(self.settings.onShown)) {
|
||||
self.settings.onShown.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
if (!hasAnimation) {
|
||||
if ($.isFunction(self.settings.onShown)) {
|
||||
self.settings.onShown.call(this);
|
||||
}
|
||||
}
|
||||
}, 600);
|
||||
},
|
||||
bind: function() {
|
||||
var self = this;
|
||||
|
||||
this.$ele.find('[data-notify="dismiss"]').on('click', function() {
|
||||
self.close();
|
||||
})
|
||||
|
||||
this.$ele.mouseover(function(e) {
|
||||
$(this).data('data-hover', "true");
|
||||
}).mouseout(function(e) {
|
||||
$(this).data('data-hover', "false");
|
||||
});
|
||||
this.$ele.data('data-hover', "false");
|
||||
|
||||
if (this.settings.delay > 0) {
|
||||
self.$ele.data('notify-delay', self.settings.delay);
|
||||
var timer = setInterval(function() {
|
||||
var delay = parseInt(self.$ele.data('notify-delay')) - self.settings.timer;
|
||||
if ((self.$ele.data('data-hover') === 'false' && self.settings.mouse_over == "pause") || self.settings.mouse_over != "pause") {
|
||||
var percent = ((self.settings.delay - delay) / self.settings.delay) * 100;
|
||||
self.$ele.data('notify-delay', delay);
|
||||
self.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', percent).css('width', percent + '%');
|
||||
}
|
||||
if (delay <= -(self.settings.timer)) {
|
||||
clearInterval(timer);
|
||||
self.close();
|
||||
}
|
||||
}, self.settings.timer);
|
||||
}
|
||||
},
|
||||
close: function() {
|
||||
var self = this,
|
||||
$successors = null,
|
||||
posX = parseInt(this.$ele.css(this.settings.placement.from)),
|
||||
hasAnimation = false;
|
||||
|
||||
this.$ele.data('closing', 'true').addClass(this.settings.animate.exit);
|
||||
self.reposition(posX);
|
||||
|
||||
if ($.isFunction(self.settings.onClose)) {
|
||||
self.settings.onClose.call(this.$ele);
|
||||
}
|
||||
|
||||
this.$ele.one(this.animations.start, function(event) {
|
||||
hasAnimation = true;
|
||||
}).one(this.animations.end, function(event) {
|
||||
$(this).remove();
|
||||
if ($.isFunction(self.settings.onClosed)) {
|
||||
self.settings.onClosed.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
if (!hasAnimation) {
|
||||
self.$ele.remove();
|
||||
if (self.settings.onClosed) {
|
||||
self.settings.onClosed(self.$ele);
|
||||
}
|
||||
}
|
||||
}, 600);
|
||||
},
|
||||
reposition: function(posX) {
|
||||
var self = this,
|
||||
notifies = '[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])',
|
||||
$elements = this.$ele.nextAll(notifies);
|
||||
if (this.settings.newest_on_top == true) {
|
||||
$elements = this.$ele.prevAll(notifies);
|
||||
}
|
||||
$elements.each(function() {
|
||||
$(this).css(self.settings.placement.from, posX);
|
||||
posX = (parseInt(posX)+parseInt(self.settings.spacing)) + $(this).outerHeight();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$.notify = function ( content, options ) {
|
||||
var plugin = new Notify( this, content, options );
|
||||
return plugin.notify;
|
||||
};
|
||||
$.notifyDefaults = function( options ) {
|
||||
defaults = $.extend(true, {}, defaults, options);
|
||||
return defaults;
|
||||
};
|
||||
$.notifyClose = function( command ) {
|
||||
if (typeof command === "undefined" || command == "all") {
|
||||
$('[data-notify]').find('[data-notify="dismiss"]').trigger('click');
|
||||
}else{
|
||||
$('[data-notify-position="'+command+'"]').find('[data-notify="dismiss"]').trigger('click');
|
||||
}
|
||||
};
|
||||
|
||||
}));
|
File diff suppressed because one or more lines are too long
@ -1,13 +0,0 @@
|
||||
// Action Cable provides the framework to deal with WebSockets in Rails.
|
||||
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
||||
//
|
||||
//= require action_cable
|
||||
//= require_self
|
||||
//= require_tree ./channels
|
||||
|
||||
(function() {
|
||||
this.App || (this.App = {});
|
||||
|
||||
App.cable = ActionCable.createConsumer();
|
||||
|
||||
}).call(this);
|
@ -1,4 +0,0 @@
|
||||
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -0,0 +1,21 @@
|
||||
//= require rails-ujs
|
||||
//= require turbolinks
|
||||
//= require jquery3
|
||||
//= require popper
|
||||
//= require bootstrap-sprockets
|
||||
|
||||
//= require echarts
|
||||
|
||||
//= require_tree ./colleges
|
||||
|
||||
Turbolinks.setProgressBarDelay(200);
|
||||
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
$('[data-toggle="popover"]').popover();
|
||||
})
|
||||
|
||||
$(document).on("turbolinks:before-cache", function () {
|
||||
$('[data-toggle="tooltip"]').tooltip('hide');
|
||||
$('[data-toggle="popover"]').popover('hide');
|
||||
});
|
@ -0,0 +1,156 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if($('body.colleges-statistics-page').length > 0) {
|
||||
var $statisticBody = $('.statistics-body');
|
||||
var $statisticBase = $('.statistic-base');
|
||||
var schoolId = $statisticBody.data('id');
|
||||
var $statisticCourse = $statisticBody.find('.statistic-course')
|
||||
var $shixunChart = $statisticBody.find('.shixun-chart');
|
||||
|
||||
$.get('/colleges/' + schoolId + '/shixun_time', function(data){
|
||||
$statisticBase.find('.shixun-time').html("<span>" + data.shixun_time + "</span>天");
|
||||
});
|
||||
$.get('/colleges/' + schoolId + '/shixun_report_count', function(data){
|
||||
$statisticBase.find('.shixun-report-count').html("<span>" + data.shixun_report_count + "</span>个");
|
||||
});
|
||||
|
||||
$.ajax({ url: '/colleges/' + schoolId + '/course_statistics', method: 'GET', dataType: 'script' });
|
||||
$.ajax({ url: '/colleges/' + schoolId + '/teachers', method: 'GET', dataType: 'script' });
|
||||
|
||||
var initShixunChart = function(names, data){
|
||||
var shixunChart = echarts.init(document.getElementById('shixun-chart'));
|
||||
var options = {
|
||||
series : [
|
||||
{
|
||||
name: '访问来源',
|
||||
type: 'pie',
|
||||
radius: '55%',
|
||||
data: data
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
shixunChart.setOption(options);
|
||||
};
|
||||
$.get('/colleges/' + schoolId + '/shixun_chart_data', function(data){
|
||||
$statisticBody.find('.shixun-chart-loading').hide();
|
||||
if (data.data.length > 0) {
|
||||
$shixunChart.css('height', '400px').css('width', '100%');
|
||||
initShixunChart(data.names, data.data);
|
||||
} else {
|
||||
$statisticBody.find('.shixun-chart-empty').show();
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({ url: '/colleges/' + schoolId + '/student_shixun', method: 'GET', dataType: 'script' });
|
||||
|
||||
var initHotEvaluating = function(names, values){
|
||||
var Color = ['#962e66', '#623363', '#CCCCCC', '#9A9A9A', '#FF8080', '#FF80C2', '#B980FF', '#80B9FF', '#6FE9FF', '#4DE8B4', '#F8EF63', '#FFB967'];
|
||||
|
||||
var option = {
|
||||
backgroundColor: '#fff',
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '10%',
|
||||
containLabel: true
|
||||
},
|
||||
|
||||
tooltip: {
|
||||
show: "true",
|
||||
trigger: 'item',
|
||||
formatter: '{c0}',
|
||||
backgroundColor: 'rgba(0,0,0,0.7)', // 背景
|
||||
padding: [8, 10], //内边距
|
||||
extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', //添加阴影
|
||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: '#CCCCCC'
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
show: false,
|
||||
lineStyle: {
|
||||
color: '#CCCCCC'
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
textStyle: {
|
||||
color: '#656565',
|
||||
fontWeight: 'normal',
|
||||
fontSize: '12'
|
||||
},
|
||||
formatter: '{value}'
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#cccccc'
|
||||
}
|
||||
},
|
||||
splitLine: {
|
||||
show: false
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
splitArea: {
|
||||
show: false
|
||||
},
|
||||
axisLabel: {
|
||||
inside: false,
|
||||
textStyle: {
|
||||
color: '#656565',
|
||||
fontWeight: 'normal',
|
||||
fontSize: '12'
|
||||
}
|
||||
},
|
||||
data: names
|
||||
},
|
||||
series: [{
|
||||
name: '',
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
show: true,
|
||||
color: function(params) {
|
||||
return Color[params.dataIndex]
|
||||
},
|
||||
barBorderRadius: 50,
|
||||
borderWidth: 0,
|
||||
borderColor: '#333'
|
||||
}
|
||||
},
|
||||
barGap: '0%',
|
||||
barCategoryGap: '50%',
|
||||
data: values
|
||||
}
|
||||
|
||||
]
|
||||
};
|
||||
var myChart = echarts.init(document.getElementById('hot-chart'));
|
||||
myChart.setOption(option);
|
||||
}
|
||||
|
||||
$.get('/colleges/' + schoolId + '/student_hot_evaluations', function(data){
|
||||
$statisticBody.find('.hot-chart-loading').hide();
|
||||
if (data.names.length > 0) {
|
||||
$statisticBody.find('.hot-chart').css('height', '400px').css('width', '100%');
|
||||
initHotEvaluating(data.names.reverse(), data.values.reverse());
|
||||
} else {
|
||||
$statisticBody.find('.hot-chart-empty').show();
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,2 +0,0 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -0,0 +1 @@
|
||||
!function(a){a.fn.datepicker.dates["zh-CN"]={days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],daysShort:["周日","周一","周二","周三","周四","周五","周六"],daysMin:["日","一","二","三","四","五","六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthsShort:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],today:"今天",monthsTitle:"选择月份",clear:"清除",format:"yyyy-mm-dd",titleFormat:"yyyy年mm月",weekStart:1}}(jQuery);
|
@ -0,0 +1,33 @@
|
||||
(function( factory ) {
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
define( ["jquery", "../jquery.validate"], factory );
|
||||
} else {
|
||||
factory( jQuery );
|
||||
}
|
||||
}(function( $ ) {
|
||||
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: ZH (Chinese, 中文 (Zhōngwén), 汉语, 漢語)
|
||||
*/
|
||||
$.extend($.validator.messages, {
|
||||
required: "这是必填字段",
|
||||
remote: "请修正此字段",
|
||||
email: "请输入有效的电子邮件地址",
|
||||
url: "请输入有效的网址",
|
||||
date: "请输入有效的日期",
|
||||
dateISO: "请输入有效的日期 (YYYY-MM-DD)",
|
||||
number: "请输入有效的数字",
|
||||
digits: "只能输入数字",
|
||||
creditcard: "请输入有效的信用卡号码",
|
||||
equalTo: "你的输入不相同",
|
||||
extension: "请输入有效的后缀",
|
||||
maxlength: $.validator.format("最多可以输入 {0} 个字符"),
|
||||
minlength: $.validator.format("最少要输入 {0} 个字符"),
|
||||
rangelength: $.validator.format("请输入长度在 {0} 到 {1} 之间的字符串"),
|
||||
range: $.validator.format("请输入范围在 {0} 到 {1} 之间的数值"),
|
||||
max: $.validator.format("请输入不大于 {0} 的数值"),
|
||||
min: $.validator.format("请输入不小于 {0} 的数值")
|
||||
});
|
||||
|
||||
}));
|
@ -0,0 +1,3 @@
|
||||
/*! Select2 4.0.8 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
||||
|
||||
!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(n){return"请删除"+(n.input.length-n.maximum)+"个字符"},inputTooShort:function(n){return"请再输入至少"+(n.minimum-n.input.length)+"个字符"},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(n){return"最多只能选择"+n.maximum+"个项目"},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"},removeAllItems:function(){return"删除所有项目"}}}),n.define,n.require}();
|
@ -0,0 +1,2 @@
|
||||
/*! jquery.cookie v1.4.1 | MIT */
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,2 +0,0 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,2 +0,0 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -1,3 +0,0 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
@ -0,0 +1,53 @@
|
||||
@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 "codemirror/lib/codemirror";
|
||||
@import "editormd/css/editormd.min";
|
||||
@import "dragula/dragula";
|
||||
|
||||
@import "common";
|
||||
@import "admins/*";
|
||||
|
||||
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;
|
||||
}
|
||||
.position-r{position:relative;}
|
@ -0,0 +1,114 @@
|
||||
.admin-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;
|
||||
}
|
||||
}
|
||||
|
||||
/* 分页 */
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
.admins-cooperatives-index-page {
|
||||
.coo-img-card {
|
||||
.coo-img-item {
|
||||
& > .drag {
|
||||
cursor: move;
|
||||
background: #fff;
|
||||
box-shadow: 1px 2px 5px 3px #f0f0f0;
|
||||
}
|
||||
|
||||
&-img {
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
& > img {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
right: 20px;
|
||||
color: red;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.save-url-btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
.admins-daily-school-statistics-index-page {
|
||||
.daily-school-statistic-list-container {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
.admins-dashboards-index-page {
|
||||
.pie-statistic {
|
||||
.pie {
|
||||
height: 300px;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
.admins-departments-index-page {
|
||||
.department-list-table {
|
||||
.member-container {
|
||||
.member-user {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.member-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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
.admins-identity-authentications-index-page {
|
||||
.identity-authentication-list-container {
|
||||
span {
|
||||
&.apply-status-1 { color: #28a745; }
|
||||
&.apply-status-2 { color: #dc3545; }
|
||||
&.apply-status-3 { color: #6c757d; }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
.admins-library-applies-index-page {
|
||||
.library-applies-list-container {
|
||||
span {
|
||||
&.apply-status-agreed { color: #28a745; }
|
||||
&.apply-status-refused { color: #dc3545; }
|
||||
&.apply-status-processed { color: #6c757d; }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
.admins-professional-authentications-index-page {
|
||||
.professional-authentication-list-container {
|
||||
span {
|
||||
&.apply-status-1 { color: #28a745; }
|
||||
&.apply-status-2 { color: #dc3545; }
|
||||
&.apply-status-3 { color: #6c757d; }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
.admins-project-package-applies-index-page {
|
||||
.project-package-applies-list-container {
|
||||
span {
|
||||
&.apply-status-agreed { color: #28a745; }
|
||||
&.apply-status-refused { color: #dc3545; }
|
||||
&.apply-status-processed { color: #6c757d; }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
.admins-school-statistics-index-page {
|
||||
.school-statistic-list-form {
|
||||
.time-select {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.type-box {
|
||||
.btn { margin: 0 5px; }
|
||||
}
|
||||
|
||||
.search-input {
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.contrast-date-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.school-statistic-list-container {
|
||||
.contrast-column-select {
|
||||
position: absolute;
|
||||
right: 30px;
|
||||
top: 15px;
|
||||
width: 130px;
|
||||
}
|
||||
|
||||
.relative {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.right-border::after {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 0;
|
||||
content: '';
|
||||
width: 0;
|
||||
height: 20px;
|
||||
border-right: 1px solid #000;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
.admins-shixuns-index-page{
|
||||
.shixuns-list-container{
|
||||
.shixuns-status-1 { color: #6c757d; }
|
||||
.shixuns-status-2 { color: #28a745; }
|
||||
.shixuns-status-3 { color: #dc3545; }
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
.admins-shixun-authorizations-index-page {
|
||||
.shixun-authorization-list-container {
|
||||
span {
|
||||
&.apply-status-1 { color: #28a745; }
|
||||
&.apply-status-2 { color: #dc3545; }
|
||||
&.apply-status-3 { color: #6c757d; }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
.admins-shixun-settings-index-page {
|
||||
input[type="checkbox"]{
|
||||
font-size:18px;
|
||||
}
|
||||
.select2 input::-webkit-input-placeholder{
|
||||
color:#ccc;
|
||||
}
|
||||
.select2 .select2-selection__choice{
|
||||
border: 1px solid #eee !important;
|
||||
}
|
||||
.setting-chosen{
|
||||
font-weight: 400;
|
||||
font-size: 10px;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.shixun-setting-image {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue