Merge branches 'dev_aliyun' and 'dev_newshixunModel' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_newshixunModel
commit
0781bdea43
@ -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,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,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,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,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,6 @@
|
||||
class EcTemplate < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
# acts_as_attachable
|
||||
has_many :attachments, as: :container
|
||||
|
||||
end
|
@ -1,2 +1,4 @@
|
||||
$(".auth-schools-list-container").html("<%= j render partial: "admins/auth_schools/shared/list", locals: {schools: @schools} %>")
|
||||
$(".auth-schools-new-add").modal("hide")
|
||||
|
||||
show_success_flash()
|
@ -1 +0,0 @@
|
||||
$("#table-school-<%= params[:id] %>").remove()
|
@ -1,2 +1,3 @@
|
||||
|
||||
$("#table-school-<%= params[:school_id] %>").find("#manager-<%= params[:user_id] %>").remove()
|
||||
show_success_flash()
|
@ -0,0 +1,3 @@
|
||||
$(".ec-templates-new-add").modal("hide")
|
||||
$(".ec-templates-list-container").html("<%= j render partial: "admins/ec_templates/shared/list", locals: {templates: @templates} %>")
|
||||
show_success_flash()
|
@ -0,0 +1,15 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('导入模板管理') %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container ec-templates-list-form">
|
||||
<%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.ec-templates-new-add' } %>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="box ec-templates-list-container">
|
||||
<%= render(partial: 'admins/ec_templates/shared/list', locals: { templates: @templates }) %>
|
||||
</div>
|
||||
|
||||
<%= render partial: "admins/ec_templates/shared/templates_add_modal" %>
|
||||
<%#= render partial: "admins/auth_schools/shared/user_add_modal" %>
|
@ -0,0 +1 @@
|
||||
$(".ec-templates-list-container").html("<%= j render partial: "admins/ec_templates/shared/list", locals: {templates: @templates} %>")
|
@ -0,0 +1,35 @@
|
||||
<table class="table" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<th width="8%">序号</th>
|
||||
<th width="40%">模板名称</th>
|
||||
<th width="40%">上传模板</th>
|
||||
<th width="10%">操作</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if templates.size > 0 %>
|
||||
<% templates.each_with_index do |t, index| %>
|
||||
<% attachment = t.attachments.first %>
|
||||
<tr id="template-item-<%= t.id %>">
|
||||
<td><%= list_index_no(@params_page.to_i, index) %></td>
|
||||
<td><%= t.name %></td>
|
||||
<td>
|
||||
<% if attachment.present? %>
|
||||
<%= link_to "#{attachment.try(:filename)}",attachment_path(attachment), target: "_blank" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to "<i class='fa fa-edit color-grey-c fa-fw font-18 padding10-5'></i>".html_safe,
|
||||
"javascript:void(0)", data: {"id": "#{t.id}", "template-id": "#{attachment.present? ? attachment.id : "-1"}",
|
||||
msg: "编辑", name: "#{t.name}", "template_name": "#{attachment.try(:filename)}"}, class: "edit-template-content" %>
|
||||
|
||||
<%= link_to "<i class='fa fa-trash-o color-grey-c fa-fw font-18 padding10-5'></i>".html_safe, admins_ec_template_path(t.id), method: :delete, data: {confirm: "确认删除吗?"}, remote: true, title: "删除" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: templates } %>
|
@ -0,0 +1,44 @@
|
||||
<div class="modal fade ec-templates-new-add" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><span class="template_add_title">新建</span>导入模版</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<%= form_tag(create_template_admins_ec_templates_path, method: :post, remote: true ) do %>
|
||||
<%= hidden_field_tag(:attachment_id,"-1",class:"template_attachment_id") %>
|
||||
<%= hidden_field_tag(:template_id,"-1",class:"template_show_id") %>
|
||||
<div class="modal-body">
|
||||
<div class="form-group d-flex">
|
||||
<label for="template_name" class="col-form-label mr10">模板名称:</label>
|
||||
<div class="d-flex flex-column-reverse w-75">
|
||||
<%= text_field_tag("name","",class: "form-control", placeholder: "请输入模版名称", id: 'template_name') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group d-flex">
|
||||
<label for="template_name" class="col-form-label mr10">上传文件:</label>
|
||||
<div class="d-flex flex-column-reverse w-75">
|
||||
<div class="template-file-upload">
|
||||
<span class="template_file_show hide">
|
||||
<span class="template_file_show_title">
|
||||
</span>
|
||||
<i class="fa fa-trash-o color-grey padding5-10 ml-5 delete-template-icon" title="删除"></i>
|
||||
</span>
|
||||
<span class="template-file-input">
|
||||
<%= file_field_tag(:file, id: "upload_template_file") %>
|
||||
<i class="fa fa-plus-circle font-20"></i> 上传文件
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<%= submit_tag("提交",class:"btn btn-primary", 'data-disable-with': "提交中...") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,3 @@
|
||||
$(".graduation-standards-add").removeClass("show").modal("hide")
|
||||
$(".graduation-standards-list-container").html("<%= j render partial: "admins/graduation_standards/shared/list", locals: { standards: @standards } %>")
|
||||
show_success_flash()
|
@ -0,0 +1,14 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('毕业要求通用标准') %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container graduation-standards-list-form">
|
||||
<%= javascript_void_link '新增', class: 'btn btn-primary standard-create-modal', data: { toggle: 'modal', target: '.graduation-standards-add',
|
||||
id: "-1", content: "", msg: "添加" } %>
|
||||
</div>
|
||||
|
||||
<div class="box graduation-standards-list-container">
|
||||
<%= render(partial: 'admins/graduation_standards/shared/list', locals: { standards: @standards }) %>
|
||||
</div>
|
||||
|
||||
<%= render partial: "admins/graduation_standards/shared/add_standard_modal" %>
|
@ -0,0 +1 @@
|
||||
$(".graduation-standards-list-container").html("<%= j render partial: "admins/graduation_standards/shared/list", locals: { standards: @standards } %>")
|
@ -0,0 +1,22 @@
|
||||
<div class="modal fade graduation-standards-add" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><span id="graduation-modal-type">添加</span>通用标准</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<%= form_tag(create_standard_admins_graduation_standards_path, method: :post ,remote: true) do %>
|
||||
<%= hidden_field_tag(:graduation_id, "", id: "graduation_standard_id") %>
|
||||
<div class="modal-body">
|
||||
<%= text_area_tag(:content,"",placeholder: "请输入通用标准内容", rows: "3", class: "textarea-width-100") %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<%= submit_tag("提交",class:"btn btn-primary", 'data-disable-with': "提交中...") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,27 @@
|
||||
<table class="table" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<th width="8%">序号</th>
|
||||
<th width="82%">通用标准</th>
|
||||
<th width="10%">操作</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if standards.size > 0 %>
|
||||
<% standards.each_with_index do |standard, index| %>
|
||||
<tr id="standard-item-<%= standard.id %>">
|
||||
<td><%= list_index_no(@params_page.to_i, index) %></td>
|
||||
<td><%= standard.content %></td>
|
||||
<td>
|
||||
<%= javascript_void_link "<i class='fa fa-edit color-grey-c fa-fw font-18 padding10-5'></i>".html_safe, class: 'standard-create-modal',
|
||||
data: { toggle: 'modal', target: '.graduation-standards-add', id: "#{standard.id}", content: "#{standard.content}", msg: "编辑" }, title: "编辑" %>
|
||||
|
||||
<%= link_to "<i class='fa fa-trash-o color-grey-c fa-fw font-18 padding10-5'></i>".html_safe, admins_graduation_standard_path(standard), method: :delete, data: {confirm: "确认删除吗?"}, remote: true, title: "删除" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: standards } %>
|
@ -0,0 +1,6 @@
|
||||
class AddCodeEditPermissionForShixun < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
|
||||
add_column :shixuns, :code_edit_permission, :boolean, default: false
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class MigrateGradeIndex < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
remove_index :grades, [:user_id, :container_id]
|
||||
add_index :grades, [:container_id, :container_type]
|
||||
add_index :grades, [:user_id]
|
||||
end
|
||||
end
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -0,0 +1,34 @@
|
||||
.yslcheckbox{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.yslcheckbox2{
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
|
||||
}
|
||||
.heigth459px{
|
||||
max-height:459px;
|
||||
}
|
||||
.private-listtwo{
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
/*滚动条*/
|
||||
.private-listtwo::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
|
||||
.private-listtwo::-webkit-scrollbar-thumb {
|
||||
background-color: #E3EBF4;
|
||||
box-shadow: 0px 0px black;
|
||||
}
|
||||
|
||||
|
||||
.private-listtwo::-webkit-scrollbar-track {
|
||||
border-radius:3px;
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
|
||||
background-color: white;
|
||||
}
|
Loading…
Reference in new issue