commit
53053d7813
@ -0,0 +1,6 @@
|
||||
|
||||
function show_add_manager(id) {
|
||||
$(".auth-schools-user-add").modal("show");
|
||||
|
||||
$(".auth-schools-user-add").find("#school_id_input").val(id)
|
||||
}
|
@ -0,0 +1,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,13 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-major-informations-index-page').length > 0) {
|
||||
var box_contain = $(".major-informations-list-container");
|
||||
box_contain.on("click",".collapse-item",function () {
|
||||
var a_fa = $(this).find("i");
|
||||
if(a_fa.hasClass("fa-caret-right")){
|
||||
a_fa.removeClass("fa-caret-right").addClass("fa-caret-down");
|
||||
}else{
|
||||
a_fa.removeClass("fa-caret-down").addClass("fa-caret-right");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,2 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
@ -0,0 +1,66 @@
|
||||
.admins-auth-schools-index-page{
|
||||
.list-item-title{
|
||||
padding-bottom:5px;
|
||||
padding-left: 33px;
|
||||
color: #555;
|
||||
}
|
||||
.list-item-title-1{
|
||||
width: 100px;
|
||||
display: inline-block;
|
||||
}
|
||||
.list-item-title-2{
|
||||
width: 200px;
|
||||
display: inline-block;
|
||||
}
|
||||
.collegeManage{
|
||||
float: left;
|
||||
padding: 0px 8px;
|
||||
border-radius: 6px;
|
||||
background-color: #f5f5f5;
|
||||
margin: 3px 0px 3px 10px;
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
a{
|
||||
color: #05101a;
|
||||
}
|
||||
a:hover{
|
||||
color: #007bff;
|
||||
}
|
||||
}
|
||||
i:hover{
|
||||
color: #333;
|
||||
}
|
||||
.add-manager-i{
|
||||
float: left;
|
||||
i{
|
||||
padding: 10px 5px;
|
||||
}
|
||||
}
|
||||
.auth-schools-new-add, .auth-schools-user-add{
|
||||
.flex-column{
|
||||
input{
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
.search-school{
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
}
|
||||
.school-search-list{
|
||||
background: #F4FAFF;
|
||||
height: 280px;
|
||||
overflow-y: scroll;
|
||||
padding: 10px 0;
|
||||
}
|
||||
.school-list-item{
|
||||
padding: 2px 10px;
|
||||
input{
|
||||
font-size: 20px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,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,37 @@
|
||||
.admins-major-informations-index-page{
|
||||
.fr{
|
||||
float:right;
|
||||
}
|
||||
.panel-default{
|
||||
margin-bottom: 10px;
|
||||
background-color: rgb(245, 245, 245);
|
||||
.panel-heading{
|
||||
i{
|
||||
margin-right:15px;
|
||||
font-size:16px;
|
||||
color:rgb(204, 204, 204);
|
||||
}
|
||||
a{
|
||||
padding: 8px 10px;
|
||||
display: inline-block;
|
||||
width:100%;
|
||||
color:rgb(102, 102, 102);
|
||||
}
|
||||
}
|
||||
.panel-collapse{
|
||||
padding-top: 10px;
|
||||
background: #fff;
|
||||
table{
|
||||
text-align:center;
|
||||
th,td{
|
||||
padding: 8px;
|
||||
}
|
||||
td{
|
||||
color:#888;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the course_stages controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
@ -0,0 +1,58 @@
|
||||
class Admins::AuthSchoolsController < Admins::BaseController
|
||||
|
||||
def index
|
||||
schools = School.where(ec_auth: 1).includes(:users).order("updated_at desc")
|
||||
@params_page = params[:page] || 1
|
||||
@schools = paginate schools
|
||||
end
|
||||
|
||||
def destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
school = School.where(id: params[:id]).first
|
||||
school.destroy
|
||||
render_success_js
|
||||
end
|
||||
end
|
||||
|
||||
# 工程认证单位列表搜索学校
|
||||
def search_school
|
||||
@schools = School.where("ec_auth != 1 and name like '%#{params[:name]}%'").limit(10)
|
||||
end
|
||||
|
||||
# 添加认证学校
|
||||
def add_school
|
||||
all_schools = School.all
|
||||
all_schools.where(id: params[:school_id]).update_all(ec_auth: 1)
|
||||
schools = all_schools.where(ec_auth: 1).order("updated_at desc")
|
||||
@params_page = params[:page] || 1
|
||||
@schools = paginate schools
|
||||
end
|
||||
|
||||
# 搜索用户
|
||||
def search_manager
|
||||
school = School.find_by(id: params[:school_id])
|
||||
user_ids = school&.ec_school_users&.pluck(:user_id)
|
||||
@users = User.where.not(id: user_ids).where("concat(lastname, firstname) like ?", "%#{params[:name].strip.to_s}%").limit(10)
|
||||
end
|
||||
|
||||
# 添加认证学校管理员
|
||||
def add_manager
|
||||
ActiveRecord::Base.transaction do
|
||||
user_ids = params[:user_id]
|
||||
@school_id = params[:school_id]
|
||||
user_ids.each do |id|
|
||||
EcSchoolUser.create(user_id: id, school_id: @school_id)
|
||||
end
|
||||
@school_users = User.where(id: user_ids)
|
||||
end
|
||||
end
|
||||
|
||||
# 删除学校管理员
|
||||
def remove_manager
|
||||
ActiveRecord::Base.transaction do
|
||||
manager = EcSchoolUser.where(school_id: params[:school_id], user_id: params[:user_id]).first
|
||||
manager&.destroy
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,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,8 @@
|
||||
class Admins::MajorInformationsController < Admins::BaseController
|
||||
|
||||
def index
|
||||
disciplines = EcDiscipline.includes(ec_discipline_firsts: {ec_majors: :schools}).order("ec_disciplines.code asc")
|
||||
@disciplines = paginate disciplines
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,105 @@
|
||||
class CourseStagesController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :find_course, only: [:create]
|
||||
before_action :find_course_stage, only: [:update, :destroy, :edit, :up_position, :down_position]
|
||||
before_action :user_course_identity, :teacher_allowed
|
||||
|
||||
def create
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
@stage = CourseStage.new(stage_params)
|
||||
@stage.course_id = @course.id
|
||||
@stage.position = @course.course_stages.count + 1
|
||||
@stage.save!
|
||||
unless params[:shixun_id].blank?
|
||||
shixuns = Shixun.where(id: params[:shixun_id]).order("field(id, #{params[:shixun_id].join(",")})")
|
||||
shixuns.each do |shixun|
|
||||
CourseStageShixun.create!(course_stage_id: @stage.id, course_id: @course.id, shixun_id: shixun.id, position: @stage.course_stage_shixuns.count + 1)
|
||||
end
|
||||
end
|
||||
normal_status("创建成功")
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
@stage.update_attributes!(stage_params)
|
||||
@stage.course_stage_shixuns.destroy_all
|
||||
unless params[:shixun_id].blank?
|
||||
params[:shixun_id].each do |shixun_id|
|
||||
shixun = Shixun.where(id: shixun_id).first
|
||||
@stage.course_stage_shixuns.create!(course_id: @course.id, shixun_id: shixun.id, position: @stage.course_stage_shixuns.count + 1) if shixun.present?
|
||||
end
|
||||
end
|
||||
normal_status("更新成功")
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
@course.course_stages.where("position > ?", @stage.position).update_all("position = position - 1")
|
||||
@stage.destroy!
|
||||
normal_status("删除成功")
|
||||
end
|
||||
end
|
||||
|
||||
def up_position
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
position = @stage.position
|
||||
tip_exception("第一章不能向上移动") if @stage.position == 1
|
||||
pre_stage = @course.course_stages.where(position: position - 1).first
|
||||
pre_stage.update_attributes(position: position)
|
||||
@stage.update_attributes(position: position - 1)
|
||||
normal_status("更新成功")
|
||||
rescue Exception => e
|
||||
uid_logger("stage up failed: #{e.message}")
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down_position
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
position = @stage.position
|
||||
rails "最后一章不能向下移动" if @stage.position == @course.course_stages.count
|
||||
next_stage = @course.course_stages.where(position: position + 1).first
|
||||
next_stage.update_attributes(position: position)
|
||||
@stage.update_attributes(position: position + 1)
|
||||
normal_status("更新成功")
|
||||
rescue Exception => e
|
||||
uid_logger("stage up failed: #{e.message}")
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_course_stage
|
||||
@stage = CourseStage.find_by!(id: params[:id])
|
||||
@course = @stage.course
|
||||
end
|
||||
|
||||
def stage_params
|
||||
tip_exception("章节名称不能为空") if params[:name].blank?
|
||||
params.permit(:name, :description)
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,44 @@
|
||||
class HelpsController < ApplicationController
|
||||
before_action :require_login, only: [:feedback]
|
||||
|
||||
helper_method :current_help
|
||||
|
||||
def about
|
||||
render_ok(content: current_help&.about_us)
|
||||
end
|
||||
|
||||
def contact
|
||||
@cooperations = Cooperation.all.group(:user_type)
|
||||
end
|
||||
|
||||
def cooperatives
|
||||
@data = { 'alliance_coop' => [], 'com_coop' => [], 'edu_coop' => [] }
|
||||
@data = @data.merge CooImg.all.group_by(&:img_type)
|
||||
end
|
||||
|
||||
def agreement
|
||||
render_ok(content: current_help&.agreement)
|
||||
end
|
||||
|
||||
def help_center
|
||||
render_ok(content: current_help&.help_center)
|
||||
end
|
||||
|
||||
def feedback
|
||||
content = "<p>[#{params[:question_kind]}]</p><p>问题页面网址:#{params[:url]}</p>#{params[:description]}"
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
attr = { sender_id: User.current.id, receiver_id: 1, content: content, send_time: Time.now }
|
||||
PrivateMessage.create!(attr.merge(user_id: User.current.id, target_id: 1, status: 1))
|
||||
PrivateMessage.create!(attr.merge(user_id: 1, target_id: User.current.id, status: 0))
|
||||
end
|
||||
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_help
|
||||
@_current_help ||= Help.first
|
||||
end
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
module CourseStagesHelper
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
class CourseStage < ApplicationRecord
|
||||
belongs_to :course
|
||||
|
||||
has_many :course_stage_shixuns, -> { order("course_stage_shixuns.position ASC") }, dependent: :destroy
|
||||
has_many :shixuns, :through => :course_stage_shixuns
|
||||
|
||||
validates :name, length: { maximum: 60 }
|
||||
validates :description, length: { maximum: 300 }
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class CourseStageShixun < ApplicationRecord
|
||||
belongs_to :course
|
||||
belongs_to :course_stage, counter_cache: :shixuns_count
|
||||
belongs_to :shixun
|
||||
end
|
@ -0,0 +1,12 @@
|
||||
class EcDiscipline < ActiveRecord::Base
|
||||
validates_presence_of :code, :name
|
||||
|
||||
has_many :ec_discipline_firsts
|
||||
|
||||
# 专业数目
|
||||
def major_count
|
||||
count = 0
|
||||
self.ec_discipline_firsts.map{|f| count += f.ec_majors.count}
|
||||
count
|
||||
end
|
||||
end
|
@ -0,0 +1,6 @@
|
||||
class EcDisciplineFirst < ActiveRecord::Base
|
||||
validates_presence_of :code, :name
|
||||
|
||||
has_many :ec_majors
|
||||
belongs_to :ec_discipline
|
||||
end
|
@ -1,7 +1,10 @@
|
||||
class EcMajor < ApplicationRecord
|
||||
# 主页对应的学校,不同学校可以选用同样的专业,而每个专业又各具特色
|
||||
has_many :schools, through: :ec_major_schools
|
||||
has_many :ec_major_schools, dependent: :destroy
|
||||
has_many :schools, through: :ec_major_schools
|
||||
|
||||
# 一级专业
|
||||
belongs_to :ec_discipline_first
|
||||
|
||||
scope :search_name_or_code, -> (keyword) { where('name LIKE :keyword OR code LIKE :keyword', keyword: "%#{keyword.strip}%") }
|
||||
end
|
||||
|
@ -0,0 +1,6 @@
|
||||
class EcTemplate < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
# acts_as_attachable
|
||||
has_many :attachments, as: :container
|
||||
|
||||
end
|
@ -0,0 +1,11 @@
|
||||
class ShixunSecretRepository < ApplicationRecord
|
||||
# repo_name: 仓库名
|
||||
# secret_dir_name: 在tpm仓库的那个目录下
|
||||
|
||||
belongs_to :shixun
|
||||
|
||||
def repo_path
|
||||
"#{repo_name}.git"
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class ShixunWorkComment < ApplicationRecord
|
||||
belongs_to :student_work
|
||||
belongs_to :user
|
||||
belongs_to :challenge, optional: true
|
||||
end
|
@ -0,0 +1,8 @@
|
||||
if($(".auth-schools-user-add").length > 0){
|
||||
$(".auth-schools-user-add").modal("hide")
|
||||
}
|
||||
<% if @school_users.size > 0 %>
|
||||
$("#table-school-<%= @school_id %>").find(".school_user_list").html("<%= j render partial: "admins/auth_schools/shared/school_user_list", locals: {users: @school_users, school_id: @school_id} %> ")
|
||||
<% end %>
|
||||
|
||||
show_success_flash()
|
@ -0,0 +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()
|
@ -0,0 +1,14 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('认证单位列表') %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container auth-schools-list-form">
|
||||
<%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.auth-schools-new-add' } %>
|
||||
</div>
|
||||
|
||||
<div class="box auth-schools-list-container">
|
||||
<%= render(partial: 'admins/auth_schools/shared/list', locals: { schools: @schools }) %>
|
||||
</div>
|
||||
|
||||
<%= render partial: "admins/auth_schools/shared/new_modal" %>
|
||||
<%= render partial: "admins/auth_schools/shared/user_add_modal" %>
|
@ -0,0 +1 @@
|
||||
$(".auth-schools-list-container").html("<%= j render partial: "admins/auth_schools/shared/list", locals: {schools: @schools} %>")
|
@ -0,0 +1,3 @@
|
||||
|
||||
$("#table-school-<%= params[:school_id] %>").find("#manager-<%= params[:user_id] %>").remove()
|
||||
show_success_flash()
|
@ -0,0 +1,4 @@
|
||||
|
||||
if($("#add-users-list").length > 0){
|
||||
$("#add-users-list").html("<%= j render partial: "admins/auth_schools/shared/add_users_list", locals: {users: @users, school_id: params[:school_id]} %>")
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
if($("#add-schools-list").length > 0){
|
||||
$("#add-schools-list").html("<%= j render partial: "admins/auth_schools/shared/add_schools_list", locals: {schools: @schools} %>")
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
|
||||
<%= form_tag(add_school_admins_auth_schools_path, method: :post, remote: true) do %>
|
||||
<div class="add-school-list-item">
|
||||
<div class="list-item-title">单位名称</div>
|
||||
<div class="school-search-list">
|
||||
<% if schools.size > 0 %>
|
||||
<% schools.each do |school| %>
|
||||
<div class="school-list-item">
|
||||
<%= check_box_tag("school_id[]", school.id, false, id: "check_school_#{school.id}") %>
|
||||
<label for="check_school_<%= school.id %>">
|
||||
<%= school.try(:name) %>
|
||||
</label>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="padding10-5 color-grey-c">没有相关的单位</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right mt10">
|
||||
<%= submit_tag("确认",class: "btn btn-primary submit-btn") %>
|
||||
</div>
|
||||
<% end %>
|
@ -0,0 +1,31 @@
|
||||
<%= form_tag(add_manager_admins_auth_schools_path, method: :post, remote: true) do %>
|
||||
<%= hidden_field_tag("school_id",school_id) %>
|
||||
<div class="add-school-list-item">
|
||||
<div class="list-item-title">
|
||||
<span class="list-item-title-1">姓名</span>
|
||||
<span class="list-item-title-2">单位</span>
|
||||
</div>
|
||||
<div class="school-search-list">
|
||||
<% if users.size > 0 %>
|
||||
<% users.each do |user| %>
|
||||
<div class="school-list-item">
|
||||
<%= check_box_tag("user_id[]", user.id, false, id: "check_user_#{user.id}") %>
|
||||
<label for="check_user_<%= user.id %>">
|
||||
<span class="list-item-title-1">
|
||||
<%= user.try(:show_real_name) %>
|
||||
</span>
|
||||
<span class="list-item-title-2">
|
||||
<%= user.try(:school_name) %>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="padding10-5 color-grey-c">没有相关的单位</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right mt10">
|
||||
<%= submit_tag("确认",class: "btn btn-primary submit-btn") %>
|
||||
</div>
|
||||
<% end %>
|
@ -0,0 +1,38 @@
|
||||
|
||||
<table class="table" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<th width="10%">序号</th>
|
||||
<th width="30%">学校名称</th>
|
||||
<th width="50%">学校管理员</th>
|
||||
<th width="10%">操作</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if schools.size > 0 %>
|
||||
<% schools.each_with_index do |school, index| %>
|
||||
<tr id="table-school-<%= school.id %>">
|
||||
<td><%= list_index_no(@params_page.to_i, index) %></td>
|
||||
<td>
|
||||
<%= link_to "#{school.name}", "/ecs/department?school_id=#{school.id}", target: "_blank" %>
|
||||
</td>
|
||||
<td>
|
||||
<div class="add-manager-i">
|
||||
<%= link_to "<i class='fa fa-plus-circle font-18 color-grey-c'></i>".html_safe, "javascript:void(0)", class: "action", onclick: "show_add_manager('#{school.id}')" %>
|
||||
</div>
|
||||
<div class="inline-block school_user_list">
|
||||
<% if school.users.size > 0 %>
|
||||
<%= render partial: "admins/auth_schools/shared/school_user_list", locals: {users: school.users, school_id: school.id} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to "<i class='fa fa-trash-o color-grey-c font-18 padding10-5'></i>".html_safe, admins_auth_school_path(school), method: :delete, data: {confirm: "确认删除吗?"}, remote: true %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: schools } %>
|
@ -0,0 +1,32 @@
|
||||
<div class="modal fade auth-schools-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">新增认证单位</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<%= form_tag(search_school_admins_auth_schools_path,method: :get ,remote: true) do %>
|
||||
<div class="form-group d-flex mbt10">
|
||||
<div class="w-75 d-flex flex-column">
|
||||
<%= text_field_tag(:name, nil, class: 'form-control', placeholder: '请输入单位名称搜索') %>
|
||||
</div>
|
||||
<%= submit_tag("搜索",class:"btn btn-primary search-school", 'data-disable-with': "搜索中...") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div id="add-schools-list">
|
||||
<div class="add-school-list-item">
|
||||
<div class="list-item-title">单位名称</div>
|
||||
<div class="school-search-list">
|
||||
<div class="school-list-item">
|
||||
<span class="color-grey-c">请输入单位名称</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,36 @@
|
||||
<div class="modal fade auth-schools-user-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">添加管理员</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<%= form_tag(search_manager_admins_auth_schools_path, method: :get ,remote: true) do %>
|
||||
<%= hidden_field("school_id","",id:"school_id_input") %>
|
||||
<div class="form-group d-flex mbt10">
|
||||
<div class="w-75 d-flex flex-column">
|
||||
<%= text_field_tag(:name, nil, class: 'form-control', placeholder: '请输入用户姓名搜索') %>
|
||||
</div>
|
||||
<%= submit_tag("搜索",class:"btn btn-primary search-school", 'data-disable-with': "搜索中...") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div id="add-users-list">
|
||||
<div class="add-school-list-item">
|
||||
<div class="list-item-title">
|
||||
<span class="list-item-title-1">姓名</span>
|
||||
<span class="list-item-title-2">单位</span>
|
||||
</div>
|
||||
<div class="school-search-list">
|
||||
<div class="school-list-item">
|
||||
<span class="color-grey-c">请输入用户姓名搜索</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -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" %>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue