diff --git a/app/controllers/admins/project_categories_controller.rb b/app/controllers/admins/project_categories_controller.rb index 8b1dd1f7..72cb833f 100644 --- a/app/controllers/admins/project_categories_controller.rb +++ b/app/controllers/admins/project_categories_controller.rb @@ -33,12 +33,13 @@ class Admins::ProjectCategoriesController < Admins::BaseController end def update - if @project_category.update_attributes({name: @name, pinned_index: params[:project_category][:pinned_index].to_i}) && save_image_file(params[:logo], 'logo') + if @project_category.update_attributes({name: @name, pinned_index: params[:project_category][:pinned_index].to_i}) + save_image_file(params[:logo], 'logo') redirect_to admins_project_categories_path flash[:success] = '更新成功' else redirect_to admins_project_categories_path - flash[:success] = '更新失败' + flash[:danger] = '更新失败' end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1aff1c09..d7707391 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -102,7 +102,7 @@ class ApplicationController < ActionController::Base when 1, 2, 4, 9 # 手机类型的发送 sigle_para = {phone: value} - status = Educoder::Sms.send(mobile: value, code: code) + status = Gitlink::Sms.send(mobile: value, code: code) tip_exception(-2, code_msg(status)) if status != 0 when 8, 3, 5 # 邮箱类型的发送 @@ -183,7 +183,7 @@ class ApplicationController < ActionController::Base # 异常提醒 def tip_exception(status = -1, message) - raise Educoder::TipException.new(status, message) + raise Gitlink::TipException.new(status, message) end def missing_template @@ -192,7 +192,7 @@ class ApplicationController < ActionController::Base # 弹框提醒 def tip_show_exception(status = -2, message) - raise Educoder::TipException.new(status, message) + raise Gitlink::TipException.new(status, message) end def normal_status(status = 0, message) @@ -272,18 +272,18 @@ class ApplicationController < ActionController::Base # 测试版前端需求 logger.info("subdomain:#{request.subdomain}") - if request.subdomain != "www" - if params[:debug] == 'teacher' #todo 为了测试,记得讲debug删除 - User.current = User.find 81403 - elsif params[:debug] == 'student' - User.current = User.find 8686 - elsif params[:debug] == 'admin' - logger.info "@@@@@@@@@@@@@@@@@@@@@@ debug mode....." - user = User.find 36480 - User.current = user - cookies.signed[:user_id] = user.id - end - end + # if request.subdomain != "www" + # if params[:debug] == 'teacher' #todo 为了测试,记得讲debug删除 + # User.current = User.find 81403 + # elsif params[:debug] == 'student' + # User.current = User.find 8686 + # elsif params[:debug] == 'admin' + # logger.info "@@@@@@@@@@@@@@@@@@@@@@ debug mode....." + # user = User.find 36480 + # User.current = user + # cookies.signed[:user_id] = user.id + # end + # end # User.current = User.find 81403 end @@ -373,7 +373,7 @@ class ApplicationController < ActionController::Base JSON.parse(res) rescue Exception => e uid_logger_error("--uri_exec: exception #{e.message}") - raise Educoder::TipException.new("实训平台繁忙(繁忙等级:84)") + raise Gitlink::TipException.new("实训平台繁忙(繁忙等级:84)") end end @@ -392,7 +392,7 @@ class ApplicationController < ActionController::Base end rescue Exception => e uid_logger("--uri_exec: exception #{e.message}") - raise Educoder::TipException.new(message) + raise Gitlink::TipException.new(message) end end @@ -416,7 +416,7 @@ class ApplicationController < ActionController::Base end rescue Exception => e uid_logger("--uri_exec: exception #{e.message}") - raise Educoder::TipException.new("服务器繁忙") + raise Gitlink::TipException.new("服务器繁忙") end end @@ -588,8 +588,8 @@ class ApplicationController < ActionController::Base # 获取Oauth Client def get_client(site) - client_id = Rails.configuration.educoder['client_id'] - client_secret = Rails.configuration.educoder['client_secret'] + client_id = Rails.configuration.Gitlink['client_id'] + client_secret = Rails.configuration.Gitlink['client_secret'] OAuth2::Client.new(client_id, client_secret, site: site) end diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 1f3bd97f..de5e0a8c 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -196,7 +196,7 @@ class AttachmentsController < ApplicationController end def file_save_to_ucloud(path, file, content_type) - ufile = Educoder::Ufile.new( + ufile = Gitlink::Ufile.new( ucloud_public_key: edu_setting('public_key'), ucloud_private_key: edu_setting('private_key'), ucloud_public_read: true, diff --git a/app/controllers/concerns/controller_rescue_handler.rb b/app/controllers/concerns/controller_rescue_handler.rb index 6ff15cfb..acd9aa2e 100644 --- a/app/controllers/concerns/controller_rescue_handler.rb +++ b/app/controllers/concerns/controller_rescue_handler.rb @@ -20,7 +20,7 @@ module ControllerRescueHandler end # rescue_from ActionView::MissingTemplate, with: :object_not_found # rescue_from ActiveRecord::RecordNotFound, with: :object_not_found - rescue_from Educoder::TipException, with: :tip_show + rescue_from Gitlink::TipException, with: :tip_show rescue_from ::ActionView::MissingTemplate, with: :missing_template rescue_from ActiveRecord::RecordNotFound, with: :object_not_found rescue_from ActionController::ParameterMissing, with: :render_parameter_missing diff --git a/app/controllers/concerns/git_common.rb b/app/controllers/concerns/git_common.rb index eab069b8..fbda95f5 100644 --- a/app/controllers/concerns/git_common.rb +++ b/app/controllers/concerns/git_common.rb @@ -36,10 +36,10 @@ module GitCommon begin @commits = GitService.commits(repo_path: @repo_path) logger.info("git first commit is #{@commits.try(:first)}") - raise Educoder::TipException.new("请先创建版本库") if @commits.nil? + raise Gitlink::TipException.new("请先创建版本库") if @commits.nil? rescue Exception => e uid_logger_error(e.message) - raise Educoder::TipException.new("提交记录异常") + raise Gitlink::TipException.new("提交记录异常") end end diff --git a/app/controllers/concerns/git_helper.rb b/app/controllers/concerns/git_helper.rb index d8479d45..ede90dc6 100644 --- a/app/controllers/concerns/git_helper.rb +++ b/app/controllers/concerns/git_helper.rb @@ -34,7 +34,7 @@ module GitHelper rescue Exception => e Rails.logger.error(e.message) - raise Educoder::TipException.new("文档内容获取异常") + raise Gitlink::TipException.new("文档内容获取异常") end end @@ -64,7 +64,7 @@ module GitHelper # 版本库Fork功能 def project_fork(container, original_rep_path, username) - raise Educoder::TipException.new("fork源路径为空,fork失败!") if original_rep_path.blank? + raise Gitlink::TipException.new("fork源路径为空,fork失败!") if original_rep_path.blank? # 将要生成的仓库名字 new_repo_name = "#{username.try(:strip)}/#{container.try(:identifier)}#{ Time.now.strftime("%Y%m%d%H%M%S")}" # uid_logger("start fork container: repo_name is #{new_repo_name}") diff --git a/app/decorators/course_decorator.rb b/app/decorators/course_decorator.rb deleted file mode 100644 index 9c3340bb..00000000 --- a/app/decorators/course_decorator.rb +++ /dev/null @@ -1,5 +0,0 @@ -module CourseDecorator - def can_visited? - is_public == 1 || User.current.admin_or_business? || User.current.member_of_course?(self) - end -end \ No newline at end of file diff --git a/app/decorators/ec_course_target_decorator.rb b/app/decorators/ec_course_target_decorator.rb deleted file mode 100644 index 2965a838..00000000 --- a/app/decorators/ec_course_target_decorator.rb +++ /dev/null @@ -1,2 +0,0 @@ -module EcCourseTargetDecorator -end \ No newline at end of file diff --git a/app/decorators/experience_decorator.rb b/app/decorators/experience_decorator.rb deleted file mode 100644 index f50f479d..00000000 --- a/app/decorators/experience_decorator.rb +++ /dev/null @@ -1,16 +0,0 @@ -module ExperienceDecorator - def container_type_text - I18n.t("experience.container_type.#{container_type.to_s.underscore}") - end - - def content - case container_type.to_s.underscore - when 'game' then - game = Game.find_by(id: container_id) - game.present? ? "通过实训“#{game.challenge.shixun.name}”的第#{game.challenge.position}关获得的奖励" : '' - when 'shixun_publish' then - shixun = Shixun.find_by(id: container_id) - shixun.present? ? "发布实训“#{shixun.name}”获得的奖励" : '' - end - end -end \ No newline at end of file diff --git a/app/decorators/grade_decorator.rb b/app/decorators/grade_decorator.rb deleted file mode 100644 index 5e2b9dee..00000000 --- a/app/decorators/grade_decorator.rb +++ /dev/null @@ -1,39 +0,0 @@ -module GradeDecorator - def container_type_text - I18n.t("grade.container_type.#{container_type.to_s.underscore}") - end - - def content - case container_type.to_s.underscore - when 'avatar' then '用户首次上传头像获得的奖励' - when 'phone' then '用户首次绑定手机号码获得的奖励' - when 'mail' then '用户首次绑定邮箱获得的奖励' - when 'attendance' then '用户每天签到获得的奖励' - when 'account' then '新用户首次填写基本资料获得的奖励' - when 'memo' then '发布的评论或者帖子获得平台奖励' - when 'discusses' then '发布的评论获得平台奖励' - when 'star' then '用户给实训评分获得的随机奖励' - when 'feedback' then '反馈的问题获得平台奖励' - when 'authentication' then '用户首次完成实名认证获得的奖励' - when 'professional' then '用户首次完成职业认证获得的奖励' - when 'answer' then - game = Game.find_by(id: container_id) - game.present? ? "查看实训“#{game.challenge.shixun.name}”第#{game.challenge.position}关的参考答案消耗的金币" : '' - when 'game' then - game = Game.find_by(id: container_id) - game.present? ? "通过实训“#{game.challenge.shixun.name}”的第#{game.challenge.position}关获得的奖励" : '' - when 'test_set' then - game = Game.find_by(id: container_id) - game.present? ? "查看实训“#{game.challenge.shixun.name}”的第#{game.challenge.position}关的隐藏测试集消耗的金币" : '' - when 'shixun_publish' then - shixun = Shixun.find_by(id: container_id) - shixun.present? ? "发布实训“#{shixun.name}”获得的奖励" : '' - when 'check_ta_answer' then - game = Game.find_by(id: container_id) - game.present? ? "查看实训“#{game.challenge.shixun.name}”第#{game.challenge.position}关的TA人解答消耗的金币" : '' - when 'hack' then - hack = Hack.find_by(id: container_id) - hack.present? ? "完成了题目解答“#{hack.name}”,获得金币奖励:#{hack.score}" : '' - end - end -end \ No newline at end of file diff --git a/app/decorators/library_decorator.rb b/app/decorators/library_decorator.rb deleted file mode 100644 index 2768ad03..00000000 --- a/app/decorators/library_decorator.rb +++ /dev/null @@ -1,5 +0,0 @@ -module LibraryDecorator - extend ApplicationDecorator - - display_time_method :published_at, :created_at, :updated_at -end \ No newline at end of file diff --git a/app/decorators/shixun_decorator.rb b/app/decorators/shixun_decorator.rb deleted file mode 100644 index 4b7a0714..00000000 --- a/app/decorators/shixun_decorator.rb +++ /dev/null @@ -1,5 +0,0 @@ -module ShixunDecorator - def human_status - I18n.t("shixun.status.#{status}") - end -end diff --git a/app/decorators/subject_decorator.rb b/app/decorators/subject_decorator.rb deleted file mode 100644 index 7ba3277f..00000000 --- a/app/decorators/subject_decorator.rb +++ /dev/null @@ -1,5 +0,0 @@ -module SubjectDecorator - def can_visited? - published? || User.current.admin? || member?(User.current) - end -end \ No newline at end of file diff --git a/app/decorators/video_decorator.rb b/app/decorators/video_decorator.rb deleted file mode 100644 index 904e78db..00000000 --- a/app/decorators/video_decorator.rb +++ /dev/null @@ -1,5 +0,0 @@ -module VideoDecorator - extend ApplicationDecorator - - display_time_method :published_at, :created_at, :updated_at -end \ No newline at end of file diff --git a/app/forms/add_school_apply_form.rb b/app/forms/add_school_apply_form.rb deleted file mode 100644 index f98e8b05..00000000 --- a/app/forms/add_school_apply_form.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddSchoolApplyForm - include ActiveModel::Model - - attr_accessor :name, :province, :city, :address, :remarks - - validates :name, presence: true - # validates :province, presence: true - # validates :city, presence: true - # validates :address, presence: true -end \ No newline at end of file diff --git a/app/forms/apply_shixun_mirror_form.rb b/app/forms/apply_shixun_mirror_form.rb deleted file mode 100644 index 4f6b738e..00000000 --- a/app/forms/apply_shixun_mirror_form.rb +++ /dev/null @@ -1,27 +0,0 @@ -class ApplyShixunMirrorForm - include ActiveModel::Model - - attr_accessor :language, :runtime, :run_method, :attachment_id - - validates :language, presence: true - validates :runtime, presence: true - validates :run_method, presence: true - validates :attachment_id, presence: true, numericality: { only_integer: true } - - validate :ensure_attachment_presence - def ensure_attachment_presence - return unless attachment_id - - if attachment.blank? - errors.add(:attachment_id, :attachment_not_exist) - end - end - - def attachment - @attachment ||= Attachment.find_by_id(attachment_id) - end - - def to_json - { language: language, runtime: runtime, run_method: run_method, attachment_id: attachment_id }.to_json - end -end \ No newline at end of file diff --git a/app/forms/examination_banks/save_exam_form.rb b/app/forms/examination_banks/save_exam_form.rb deleted file mode 100644 index d066300b..00000000 --- a/app/forms/examination_banks/save_exam_form.rb +++ /dev/null @@ -1,15 +0,0 @@ -class ExaminationBanks::SaveExamForm - include ActiveModel::Model - - attr_accessor :discipline_id, :sub_discipline_id, :difficulty, :name, :duration, :tag_discipline_id - - validates :discipline_id, presence: true - validates :sub_discipline_id, presence: true - validates :difficulty, presence: true, inclusion: {in: 1..3}, numericality: { only_integer: true } - validates :name, presence: true, length: { maximum: 60, too_long: "不能超过60个字符" } - validate :validate_duration - - def validate_duration - raise '时长应为大于0的整数' if duration.present? && duration.to_i < 1 - end -end \ No newline at end of file diff --git a/app/forms/examination_intelligent_settings/save_exam_form.rb b/app/forms/examination_intelligent_settings/save_exam_form.rb deleted file mode 100644 index ec4f17ad..00000000 --- a/app/forms/examination_intelligent_settings/save_exam_form.rb +++ /dev/null @@ -1,12 +0,0 @@ -class ExaminationIntelligentSettings::SaveExamForm - include ActiveModel::Model - - attr_accessor :name, :duration - - validates :name, presence: true, length: { maximum: 60 } - validate :validate_duration - - def validate_duration - raise '时长应为大于0的整数' if duration.present? && duration.to_i < 1 - end -end \ No newline at end of file diff --git a/app/forms/examination_intelligent_settings/save_exam_setting_form.rb b/app/forms/examination_intelligent_settings/save_exam_setting_form.rb deleted file mode 100644 index bbfb9eee..00000000 --- a/app/forms/examination_intelligent_settings/save_exam_setting_form.rb +++ /dev/null @@ -1,11 +0,0 @@ -class ExaminationIntelligentSettings::SaveExamSettingForm - include ActiveModel::Model - - attr_accessor :discipline_id, :sub_discipline_id, :source, :difficulty, :tag_discipline_id, :question_settings - - validates :discipline_id, presence: true - validates :sub_discipline_id, presence: true - validates :source, presence: true - validates :difficulty, presence: true, inclusion: {in: 1..3}, numericality: { only_integer: true } - validates :question_settings, presence: true -end \ No newline at end of file diff --git a/app/forms/weapps/create_course_form.rb b/app/forms/weapps/create_course_form.rb deleted file mode 100644 index 64d0a506..00000000 --- a/app/forms/weapps/create_course_form.rb +++ /dev/null @@ -1,20 +0,0 @@ -class Weapps::CreateCourseForm - include ActiveModel::Model - - attr_accessor :course - attr_accessor :name, :course_list_name, :credit, :course_module_types, :end_date - - validates :name, presence: true - validates :course_list_name, presence: true - - validate :course_name_prefix - validate :check_course_modules - - def course_name_prefix - raise '课堂名称应以课程名称开头' unless name.index(course_list_name) && name.index(course_list_name) == 0 - end - - def check_course_modules - raise '请至少添加一个课堂模块' if course_module_types.blank? - end -end \ No newline at end of file diff --git a/app/forms/weapps/update_course_form.rb b/app/forms/weapps/update_course_form.rb deleted file mode 100644 index 60509dd1..00000000 --- a/app/forms/weapps/update_course_form.rb +++ /dev/null @@ -1,15 +0,0 @@ -class Weapps::UpdateCourseForm - include ActiveModel::Model - - attr_accessor :course - attr_accessor :name, :course_list_name, :credit, :end_date - - validates :name, presence: true - validates :course_list_name, presence: true - - validate :course_name_prefix - - def course_name_prefix - raise '课堂名称应以课程名称开头' unless name.index(course_list_name) && name.index(course_list_name) == 0 - end -end \ No newline at end of file diff --git a/app/helpers/admins/projects_helper.rb b/app/helpers/admins/projects_helper.rb index c6d94c4c..36d9d6f5 100644 --- a/app/helpers/admins/projects_helper.rb +++ b/app/helpers/admins/projects_helper.rb @@ -4,7 +4,7 @@ module Admins::ProjectsHelper owner = project.owner if owner.is_a?(User) - link_to(project.owner&.real_name, "/users/#{project&.owner&.login}", target: '_blank') + link_to(project.owner&.real_name, "/#{project&.owner&.login}", target: '_blank') elsif owner.is_a?(Organization) link_to(project.owner&.real_name, "/organize/#{project&.owner&.login}", target: '_blank') else diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f5843628..f2a9f93b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,6 @@ # 所有的方法请按首字母的顺序依次列出 module ApplicationHelper - include Educoder::I18n + include Gitlink::I18n include GitHelper ONE_MINUTE = 60 * 1000 diff --git a/app/helpers/boards_helper.rb b/app/helpers/boards_helper.rb deleted file mode 100644 index e66bdaf6..00000000 --- a/app/helpers/boards_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module BoardsHelper -end diff --git a/app/helpers/challenges_helper.rb b/app/helpers/challenges_helper.rb deleted file mode 100644 index fc0101df..00000000 --- a/app/helpers/challenges_helper.rb +++ /dev/null @@ -1,10 +0,0 @@ -module ChallengesHelper - - def match_begin_symbol str - str.gsub(/\A\r/, "\r\r") - end - - - - -end diff --git a/app/helpers/course_groups_helper.rb b/app/helpers/course_groups_helper.rb deleted file mode 100644 index 061c39dd..00000000 --- a/app/helpers/course_groups_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module CourseGroupsHelper -end diff --git a/app/helpers/course_modules_helper.rb b/app/helpers/course_modules_helper.rb deleted file mode 100644 index 4de7a382..00000000 --- a/app/helpers/course_modules_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module CourseModulesHelper -end diff --git a/app/helpers/course_second_categories_helper.rb b/app/helpers/course_second_categories_helper.rb deleted file mode 100644 index 7ed9aa1e..00000000 --- a/app/helpers/course_second_categories_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module CourseSecondCategoriesHelper -end diff --git a/app/helpers/course_stages_helper.rb b/app/helpers/course_stages_helper.rb deleted file mode 100644 index 7ebb68d9..00000000 --- a/app/helpers/course_stages_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module CourseStagesHelper -end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb deleted file mode 100644 index f0d58adb..00000000 --- a/app/helpers/courses_helper.rb +++ /dev/null @@ -1,298 +0,0 @@ -module CoursesHelper - - def member_manager group, teachers - str = "" - members = teachers.select{|teacher| teacher.teacher_course_groups.pluck(:course_group_id).include?(group.id) || teacher.teacher_course_groups.size == 0} - str = members.uniq.size == teachers.size ? "全部教师" : members.map{|member| member.user.real_name}.join("、") - str - # teachers.each do |member| - # if member.teacher_course_groups.exists?(course_group_id: group.id) || member.teacher_course_groups.size == 0 - # str << member.user.real_name - # end - # end - end - - def edit_auth group, teachers - User.current.admin_or_business? || - teachers.select{|teacher| teacher.user_id == User.current.id && - (teacher.teacher_course_groups.pluck(:course_group_id).include?(group.id) || teacher.teacher_course_groups.size == 0)}.size > 0 - end - - # 是否有切换为学生的入口 - def switch_student_role is_teacher, course, user - is_teacher && course.course_members.where(user_id: user.id, role: %i(STUDENT)).exists? - end - - # 是否有切换为教师的入口 - def switch_teacher_role is_student, course, user - is_student && course.course_members.where(user_id: user.id, role: %i(CREATOR PROFESSOR)).exists? - end - - # 是否有切换为助教的入口 - def switch_assistant_role is_student, course, user - is_student && course.course_members.where(user_id: user.id, role: %i(ASSISTANT_PROFESSOR)).exists? - end - - # 课堂结束天数 - def course_end_date end_date - if end_date.present? - curr = Time.new - date = ((Date.parse(end_date.to_s) - Date.parse(curr.to_s)).to_i) - date > 0 ? "#{date}天后" : "" - end - end - - # 课堂模块的url - def module_url mod, course - return nil if mod.blank? or course.blank? - case mod.module_type - when "announcement" - "/courses/#{course.id}/informs" - when "online_learning" - "/courses/#{course.id}/online_learning" - when "shixun_homework" - "/courses/#{course.id}/shixun_homeworks/#{mod.id}" - when "common_homework" - "/courses/#{course.id}/common_homeworks/#{mod.id}" - when "group_homework" - "/courses/#{course.id}/group_homeworks/#{mod.id}" - when "graduation" - "/courses/#{course.id}/graduation_topics/#{mod.id}" - when "exercise" - "/courses/#{course.id}/exercises/#{mod.id}" - when "poll" - "/courses/#{course.id}/polls/#{mod.id}" - when "attachment" - "/courses/#{course.id}/files/#{mod.id}" - when "board" - course_board = course.course_board - "/courses/#{course.id}/boards/#{course_board.id}" - when "course_group" - "/courses/#{course.id}/course_groups" - when "statistics" - "/courses/#{course.id}/statistics" - when "video" - "/courses/#{course.id}/course_videos" - end - end - - # 子目录对应的url - def category_url category, course - case category.category_type - when "shixun_homework" - "/courses/#{course.id}/shixun_homework/#{category.id}" - when "graduation" - if category.name == "毕设选题" - "/courses/#{course.id}/graduation_topics/#{category.course_module_id}" - else - "/courses/#{course.id}/graduation_tasks/#{category.course_module_id}" - end - when "attachment" - "/courses/#{course.id}/file/#{category.id}" - end - end - - # 子目录下的任务数 - def category_task_count course, category, user - case category.category_type - when "shixun_homework" - get_homework_commons_count(course, 4, category.id) - when "graduation" - if category.name == "毕设选题" - course.graduation_topics_count - else - course.graduation_tasks_count - end - when "attachment" - get_attachment_count(course, category.id) - end - end - - # 课堂模块的任务数 - def course_task_count(course, module_type) - case module_type - when "shixun_homework" - get_homework_commons_count(course, 4, 0) - when "common_homework" - get_homework_commons_count(course, 1, 0) - when "group_homework" - get_homework_commons_count(course, 3, 0) - when "graduation" - 0 - when "exercise" - course.exercises_count - when "poll" - course.polls_count - when "attachment" - get_attachment_count(course, 0) - when "board" - course_board = course.course_board - course_board.present? ? course_board.messages.size : 0 - when "course_group" - course.course_groups_count - when "announcement" - course.informs.count - when "online_learning" - course.shixuns.count - when "video" - course.course_videos.count + course.live_links.count - end - end - - # 当前用户可见的课堂作业,type指定作业类型, category_id指定二级目录 - def visible_homework course, user, type, category_id=0 - if user.teacher_of_course?(course) - homeworks = course.homework_commons.where("homework_type = #{type} and course_second_category_id = #{category_id}") - elsif user.member_of_course?(course) - member = course.course_members.find_by(user_id: user.id, role: 4) - if member.try(:course_group_id).to_i == 0 - homeworks = course.homework_commons.where("homework_commons.homework_type = #{type} and publish_time <= '#{Time.now}' - and unified_setting = 1 and course_second_category_id = #{category_id}") - else - not_homework_ids = course.homework_group_settings.where("course_group_id = #{member.try(:course_group_id)} and - (publish_time > '#{Time.now}' or publish_time is null)").pluck(:homework_common_id) - # not_homework_ids = not_homework_ids.blank? ? "(-1)" : "(" + not_homework_ids.map(&:homework_common_id).join(",") + ")" - homeworks = course.homework_commons.where.not(id: not_homework_ids).where("homework_commons.homework_type = #{type} and publish_time <= '#{Time.now}' - and course_second_category_id = #{category_id}") - end - else - homeworks = course.homework_commons.where("homework_type = #{type} and publish_time <= '#{Time.now}' and unified_setting = 1 - and course_second_category_id = #{category_id}") - end - homeworks - end - - # 当前用户可见的课堂试卷 - def visible_exercise course, user - if user.teacher_of_course?(course) - exercises = course.exercises - elsif user.member_of_course?(course) - member = course.course_members.find_by(user_id: user.id, role: 4) - if member.try(:course_group_id).to_i == 0 - exercises = course.exercises.where("publish_time <= '#{Time.now}' and unified_setting = 1") - else - not_exercise_ids = course.exercise_group_settings.where("course_group_id = #{member.try(:course_group_id)} and - (publish_time > '#{Time.now}' or publish_time is null)").pluck(:exercise_id) - exercises = course.exercises.where.not(id: not_exercise_ids).where("publish_time <= '#{Time.now}'") - end - else - exercises = course.exercises.where("publish_time <= '#{Time.now}' and unified_setting = 1") - end - exercises - end - - # 当前用户可见的课堂问卷 - def visible_poll course, user - if user.teacher_of_course?(course) - polls = course.polls - elsif user.member_of_course?(course) - member = course.course_members.find_by(user_id: user.id, role: 4) - if member.try(:course_group_id).to_i == 0 - polls = course.polls.where("publish_time <= '#{Time.now}' and unified_setting = 1") - else - not_poll_ids = course.poll_group_settings.where("course_group_id = #{member.try(:course_group_id)} and - (publish_time > '#{Time.now}' or publish_time is null)").pluck(:poll_id) - polls = course.polls.where.not(id: not_poll_ids).where("publish_time <= '#{Time.now}'") - end - else - polls = course.polls.where("publish_time <= '#{Time.now}' and unified_setting = 1") - end - polls - end - - # 当前用户可见的课堂资源,category_id指定资源的目录 - def visible_attachment course, user, category_id=0 - result = [] - course.attachments.where(course_second_category_id: category_id).each do |attachment| - if attachment.unified_setting - if attachment.is_public == 1 && attachment.is_publish == 1 || user == attachment.author || user.teacher_of_course?(course) || (user.member_of_course?(course) && attachment.is_publish == 1) - result << attachment - end - else - if attachment.is_public == 1 && attachment.is_publish == 1 && !user.member_of_course?(course) || user == attachment.author || user.teacher_of_course?(course) - result << attachment - elsif user.member_of_course?(course) && attachment.is_publish == 1 - member = course.course_members.find_by(user_id: user.id, role: 4) - if member.try(:course_group_id).to_i == 0 && attachment.unified_setting - result << attachment - elsif attachment.attachment_group_settings.where("course_group_id = #{member.try(:course_group_id)} and publish_time > '#{Time.now}'").count == 0 - result << attachment - end - end - end - end - result - end - - # 获取课堂的资源数 - def get_attachment_count(course, category_id) - category_id.to_i == 0 ? course.attachments.size : course.attachments.where(course_second_category_id: category_id).size - end - - # 获取课堂的作业数 - def get_homework_commons_count(course, type, category_id) - category_id == 0 ? HomeworkCommon.where(course_id: course.id, homework_type: type).size : - HomeworkCommon.where(course_id: course.id, homework_type: type, course_second_category_id: category_id).size - end - - - # 获取课堂的任务数(作业数+试卷数+问卷数) - def get_tasks_count(course) - course.homework_commons_count + course.exercises_count + course.polls_count - end - - # 当前用户可见的毕设任务 - def visible_graduation_task course, user - if user.teacher_of_course?(course) - tasks = course.graduation_tasks - else - tasks = course.graduation_tasks.where("publish_time <= '#{Time.now}'") - end - tasks - end - - # 分班情况 - def course_group_info course, user_id - course_group_ids = course.group_course_power(user_id) - course_groups = - if course_group_ids.present? - course.course_groups.where(id: course_group_ids).includes(:course_members) - else - course.course_groups.includes(:course_members) - end - group_info = [] - if !course_groups.blank? - course_groups.each do |group| - group_info << {course_group_id: group.id, group_group_name: group.name, count: group.course_members_count} - end - - none_group_count = course.students.where(course_group_id: 0).size - group_info << {course_group_id: 0, group_group_name: "未分班", count: none_group_count} if none_group_count > 0 && !course_group_ids.present? - end - - return group_info - end - - def left_group_info course - group_info = [] - if course.course_groups_count > 0 - none_group_count = course.students.where(course_group_id: 0).size - group_info << {category_id: 0, category_name: "未分班", position: course.course_groups.pluck(:position).max.to_i + 1, - category_count: none_group_count, category_type: false, - second_category_url: "/courses/#{@course.id}/course_groups/0"} - course.course_groups.each do |course_group| - group_info << {category_id: course_group.id, category_name: course_group.name, position: course_group.position, - category_count: course_group.course_members_count, category_type: false, - second_category_url: "/courses/#{@course.id}/course_groups/#{course_group.id}"} - end - end - group_info - end - - def last_subject_shixun course, myshixuns - myshixun = myshixuns.sort{|x,y| y[:updated_at] <=> x[:updated_at] }.first - return "" unless myshixun - stage_shixun = course.course_stage_shixuns.where(shixun_id: myshixun.shixun_id).take - progress = stage_shixun&.course_stage&.position.to_s + "-" + stage_shixun&.position.to_s + " " + myshixun.shixun&.name - end -end diff --git a/app/helpers/discusses_helper.rb b/app/helpers/discusses_helper.rb deleted file mode 100644 index c686fcad..00000000 --- a/app/helpers/discusses_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module DiscussesHelper -end diff --git a/app/helpers/edu_datas_helper.rb b/app/helpers/edu_datas_helper.rb deleted file mode 100644 index 1a8584d1..00000000 --- a/app/helpers/edu_datas_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module EduDatasHelper -end diff --git a/app/helpers/graduation_tasks_helper.rb b/app/helpers/graduation_tasks_helper.rb deleted file mode 100644 index 2bc059a5..00000000 --- a/app/helpers/graduation_tasks_helper.rb +++ /dev/null @@ -1,150 +0,0 @@ -module GraduationTasksHelper - include CoursesHelper - # 教师评阅 - def teacher_comment task, user_id - [{ id: 0 ,name: "未评", count: task.uncomment_count(user_id)}, {id: 1, name: "已评", count: task.comment_count(user_id)}] - end - - # 作品状态 - def task_status task, user_id - [{id: 0, name: "未提交", count: task.unfinished_count(user_id)}, - {id: 1, name: "按时提交", count: task.finished_count(user_id)}, - {id: 2, name: "延时提交", count: task.delay_finished_count(user_id)}] - end - - # 交叉评阅 - def cross_comment task, user_id - if task.cross_comment && task.status >= 3 - [{id: 1, name: "只看我的交叉评阅", count: task.graduation_work_comment_assignations.myself(user_id).count}] - else - [] - end - end - - def task_curr_status task, course - result = {} - status = [] - time = "" - - if course.try(:is_end) - status << "已结束" - time = course.end_date.present? ? course.end_date.strftime("%Y-%m-%d") : "" - else - if task.status > 1 && task.allow_late && (task.late_time.nil? || task.late_time > Time.now) - status << "补交中" - end - - case task.status - when 0 - status << "未发布" - time = task.publish_time.present? ? "将于 #{format_time(task.publish_time)} 发布" : "创建于#{time_from_now(task.created_at)}" - when 1 - if task.end_time && task.end_time >= Time.now - status << "提交中" - time = how_much_time(task.end_time) - end - when 2 - status << "评阅中" - time = task.comment_time.present? ? how_much_time(task.comment_time) : course.end_date.present? ? how_much_time(course.end_date.end_of_day) : "" - when 3 - status << "交叉评阅中" - time = course.end_date.present? ? how_much_time(course.end_date.end_of_day) : "" - end - - status << "未开启补交" if (!task.allow_late && task.status != 0) #6.11 -hs 新增status不等于0 - - # 如果还在补交阶段则显示补交结束时间 - if task.status > 1 && task.allow_late && task.late_time && task.late_time > Time.now - time = how_much_time(task.late_time) - end - end - - result[:status] = status - result[:time] = time - result - end - - # 作品数统计:type: 1 已提交 0 未提交 - def grduationwork_count task, type - works = task.graduation_works - type == 1 ? works.select{|work| work.work_status != 0}.size : works.select{|work| work.work_status == 0}.size - end - - # 普通/分组 作业作品状态数组 - def graduation_work_status task, user_id, course - status = [] - work = task.graduation_works.find_by(user_id: user_id) - - work = work || GraduationWork.create(graduation_task_id: task.id, user_id: user_id) - late_time = task.late_time || course.end_date - - if course.is_end && work && work.work_status > 0 - status << "查看作品" - elsif !course.is_end - if task.publish_time && task.publish_time < Time.now - # 作业未截止时 - if task.end_time > Time.now - if task.task_type == 2 && task.base_on_project - if work.project_id.nil? || work.project_id == 0 - status << "创建项目" - status << "关联项目" - elsif work.work_status == 0 - status << "取消关联" - status << "提交作品" - else - status << "修改作品" - end - else - if work.work_status == 0 - status << "提交作品" - else - status << "修改作品" - end - end - - # 补交阶段 - elsif task.allow_late && (late_time.nil? || late_time > Time.now) - if task.task_type == 2 && task.base_on_project - if work.project_id.nil? || work.project_id == 0 - status << "创建项目" - status << "关联项目" - elsif work.work_status == 0 - status << "取消关联" - status << "补交作品" - else - status << "补交附件" - status << "查看作品" - end - else - if work.work_status == 0 - status << "补交作品" - else - status << "补交附件" - status << "查看作品" - end - end - - # 匿评阶段 - elsif work.work_status != 0 - status << "查看作品" - end - end - end - end - - # 阶段剩余时间 - def task_left_time task - if task.publish_time && task.publish_time < Time.now - if task.end_time > Time.now - status = "剩余提交时间" - time = "#{how_much_time(task.end_time)}" - else - if task.allow_late && task.late_time && task.late_time >= Time.now - status = "剩余补交时间" - time = "#{how_much_time(task.late_time)}" - end - end - end - {status: status, time: time} - end -end diff --git a/app/helpers/graduation_topics_helper.rb b/app/helpers/graduation_topics_helper.rb deleted file mode 100644 index ae15d201..00000000 --- a/app/helpers/graduation_topics_helper.rb +++ /dev/null @@ -1,30 +0,0 @@ -module GraduationTopicsHelper - - # 课题类型 - def topic_type - [{id: 1, name: "设计"}, {id: 2, name: "论文"}, {id: 3, name: "创作"}] - end - - # 课程来源 - def topic_source - [{id: 1, name: "生产/社会实际"}, {id: 2, name:"结合科研"}, {id: 3, name: "其它"}] - end - - # 课题性质1 - def topic_property_first - [{id: 1, name: "真题"}, {id: 2, name:"模拟题"}] - end - - # 课题性质2 - def topic_property_second - [{id: 1, name: "纵向课题"}, {id: 2, name:"横向课题"}, {id: 3, name: "自选"}] - end - - # 课题重复 - def topic_repeat - [{id: 1, name: "新题"}, {id: 2, name:"往届题,有新要求"}, {id: 3, name: "往届题,无新要求"}] - end - - - -end diff --git a/app/helpers/graduation_works_helper.rb b/app/helpers/graduation_works_helper.rb deleted file mode 100644 index 577efa79..00000000 --- a/app/helpers/graduation_works_helper.rb +++ /dev/null @@ -1,20 +0,0 @@ -module GraduationWorksHelper - include GraduationTasksHelper - - # 作品最终成绩 - # 参数: work作品, current_user用户,course_identity用户在课堂的身份 - def work_final_score work, current_user, course_identity - work_score = - if work.work_score.nil? - "--" - else - if work.check_score_power? current_user, course_identity - format("%.1f", work.work_score < 0 ? 0 : work.work_score.round(1)) - else - "**" - end - end - # work_score 最终成绩; late_penalty 迟交扣分; final_score 最终评分 - {username: work.user.full_name, login: work.user.login, work_score: work_score, final_score: work.final_score} - end -end diff --git a/app/helpers/hack_user_lastest_codes_helper.rb b/app/helpers/hack_user_lastest_codes_helper.rb deleted file mode 100644 index 13350a8f..00000000 --- a/app/helpers/hack_user_lastest_codes_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module HackUserLastestCodesHelper -end diff --git a/app/helpers/hacks_helper.rb b/app/helpers/hacks_helper.rb deleted file mode 100644 index 13f5ac76..00000000 --- a/app/helpers/hacks_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module HacksHelper -end diff --git a/app/helpers/trustie_hacks_helper.rb b/app/helpers/trustie_hacks_helper.rb deleted file mode 100644 index 3ebe3a9c..00000000 --- a/app/helpers/trustie_hacks_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module TrustieHacksHelper -end diff --git a/app/helpers/weapps/courses_helper.rb b/app/helpers/weapps/courses_helper.rb deleted file mode 100644 index 580536ec..00000000 --- a/app/helpers/weapps/courses_helper.rb +++ /dev/null @@ -1,69 +0,0 @@ -module Weapps::CoursesHelper - require 'chinese_pinyin' - - def teacher_list teachers, user_course_identity - data = [] - teachers.each do |teacher| - if teacher.user.present? - teacher_user = teacher.user - name = teacher_user.real_name - role = teacher.role == "CREATOR" ? "管理员" : teacher.role == "PROFESSOR" ? "教师" : "助教" - member_roles = user_course_identity < Course::ASSISTANT_PROFESSOR ? teacher_user.course_role(teacher.course) : [] - item = {name: name, course_member_id: teacher.id, login: teacher_user.login, user_id: teacher.user_id, role: role, - school: teacher_user.school_name, image_url: url_to_avatar(teacher_user), member_roles: member_roles} - pinyin = Pinyin.t(name.strip, splitter: '') - first_char = pinyin[0] - letter = first_letter first_char - if data.pluck(:letter).include?(letter) - data.select{|a|a[:letter]==letter}.first[:items] << item - else - data << {letter: letter, items: [item]} - end - end - end - # data = data.sort do |a, b| - # [a[:letter]] <=> [b[:letter]] - # end - # data.push(data.shift) if data.select{|a|a[:letter]=='#'}.first.present? # '#'排在最后 - return data - end - - - def student_list students, excellent, user_course_identity - data = [] - students.each do |student| - if student.user.present? - student_user = student.user - name = student_user.real_name - phone = excellent ? "" : student_user.hidden_phone - member_roles = user_course_identity < Course::ASSISTANT_PROFESSOR ? student_user.course_role(student.course) : [] - item = {name: name, course_member_id: student.id, login: student_user.login, user_id: student.user_id, - student_id: student_user.student_id, image_url: url_to_avatar(student_user), phone: phone, member_roles: member_roles} - pinyin = Pinyin.t(name.strip, splitter: '') - first_char = pinyin[0] - letter = first_letter first_char - if data.pluck(:letter).include?(letter) - data.select{|a|a[:letter]==letter}.first[:items] << item - else - data << {letter: letter, items: [item]} - end - end - end - # data = data.sort do |a, b| - # [a[:letter]] <=> [b[:letter]] - # end - # data.push(data.shift) if data.select{|a|a[:letter]=='#'}.first.present? # '#'排在最后 - return data - end - - def first_letter char - if char.ord >= 97 && char.ord <= 122 - letter = (char.ord - 32).chr.to_s - elsif char.ord >= 65 && char.ord <= 90 - letter = char - else - letter = '#' - end - letter - end -end \ No newline at end of file diff --git a/app/imports/admins/import_course_member_excel.rb b/app/imports/admins/import_course_member_excel.rb deleted file mode 100644 index ddd3b01a..00000000 --- a/app/imports/admins/import_course_member_excel.rb +++ /dev/null @@ -1,20 +0,0 @@ -class Admins::ImportCourseMemberExcel < BaseImportXlsx - Data = Struct.new(:student_id, :name, :course_id, :role, :course_group_name, :school_id) - - def read_each(&block) - sheet.each_row_streaming(pad_cells: true, offset: 1) do |row| - data = row.map(&method(:cell_value))[0..5] - block.call Data.new(*data) - end - end - - private - - def check_sheet_valid! - raise_import_error('请按照模板格式导入') if sheet.row(1).size != 6 - end - - def cell_value(obj) - obj&.cell_value&.to_s&.strip - end -end diff --git a/app/jobs/batch_publish_video_notify_job.rb b/app/jobs/batch_publish_video_notify_job.rb deleted file mode 100644 index 01390dc2..00000000 --- a/app/jobs/batch_publish_video_notify_job.rb +++ /dev/null @@ -1,23 +0,0 @@ -# 批量发布视频 消息任务 -class BatchPublishVideoNotifyJob < ApplicationJob - queue_as :notify - - def perform(user_id, video_ids) - user = User.find_by(id: user_id) - return if user.blank? - - attrs = %i[user_id trigger_user_id container_id container_type tiding_type status created_at updated_at] - - same_attrs = { - user_id: 1, - trigger_user_id: user.id, - container_type: 'Video', - tiding_type: 'Apply', status: 0 - } - Tiding.bulk_insert(*attrs) do |worker| - user.videos.where(id: video_ids).each do |video| - worker.add same_attrs.merge(container_id: video.id) - end - end - end -end diff --git a/app/jobs/course_add_student_create_works_job.rb b/app/jobs/course_add_student_create_works_job.rb deleted file mode 100644 index fec28f39..00000000 --- a/app/jobs/course_add_student_create_works_job.rb +++ /dev/null @@ -1,67 +0,0 @@ -# 学生加入课堂时创建相关任务作品 -class CourseAddStudentCreateWorksJob < ApplicationJob - queue_as :default - - def perform(course_id, student_ids) - course = Course.find_by(id: course_id) - return if course.blank? - - # 如果之前存在相关作品,则更新is_delete字段 - student_works = StudentWork.joins(:homework_common).where(user_id: student_ids, homework_commons: {course_id: course.id}) - student_works.update_all(is_delete: 0) - - exercise_users = ExerciseUser.joins(:exercise).where(user_id: student_ids, exercises: {course_id: course.id}) - exercise_users.update_all(is_delete: 0) - - poll_users = PollUser.joins(:poll).where(user_id: student_ids, polls: {course_id: course.id}) - poll_users.update_all(is_delete: 0) - - graduation_works = course.graduation_works.where(user_id: student_ids) - graduation_works.update_all(is_delete: 0) - - attrs = %i[homework_common_id user_id created_at updated_at] - - StudentWork.bulk_insert(*attrs) do |worker| - student_ids.each do |user_id| - same_attrs = {user_id: user_id} - course.homework_commons.where(homework_type: %i[normal group practice]).each do |homework| - next if StudentWork.where(user_id: user_id, homework_common_id: homework.id).any? - worker.add same_attrs.merge(homework_common_id: homework.id) - end - end - end - - attrs = %i[exercise_id user_id created_at updated_at] - ExerciseUser.bulk_insert(*attrs) do |worker| - student_ids.each do |user_id| - same_attrs = {user_id: user_id} - course.exercises.each do |exercise| - next if ExerciseUser.where(user_id: user_id, exercise_id: exercise.id).any? - worker.add same_attrs.merge(exercise_id: exercise.id) - end - end - end - - attrs = %i[poll_id user_id created_at updated_at] - PollUser.bulk_insert(*attrs) do |worker| - student_ids.each do |user_id| - same_attrs = {user_id: user_id} - course.polls.each do |poll| - next if PollUser.where(user_id: user_id, poll_id: poll.id).any? - worker.add same_attrs.merge(poll_id: poll.id) - end - end - end - - attrs = %i[graduation_task_id user_id course_id created_at updated_at] - GraduationWork.bulk_insert(*attrs) do |worker| - student_ids.each do |user_id| - same_attrs = {user_id: user_id, course_id: course.id} - course.graduation_tasks.each do |task| - next if GraduationWork.where(user_id: user_id, graduation_task_id: task.id).any? - worker.add same_attrs.merge(graduation_task_id: task.id) - end - end - end - end -end diff --git a/app/jobs/course_delete_student_delete_works_job.rb b/app/jobs/course_delete_student_delete_works_job.rb deleted file mode 100644 index a84608b2..00000000 --- a/app/jobs/course_delete_student_delete_works_job.rb +++ /dev/null @@ -1,19 +0,0 @@ -class CourseDeleteStudentDeleteWorksJob < ApplicationJob - queue_as :default - - def perform(course_id, student_ids) - course = Course.find_by(id: course_id) - return if course.blank? - - student_works = StudentWork.joins(:homework_common).where(user_id: student_ids, homework_commons: {course_id: course.id}) - student_works.update_all(is_delete: 1) - - exercise_users = ExerciseUser.joins(:exercise).where(user_id: student_ids, exercises: {course_id: course.id}) - exercise_users.update_all(is_delete: 1) - - poll_users = PollUser.joins(:poll).where(user_id: student_ids, polls: {course_id: course.id}) - poll_users.update_all(is_delete: 1) - - course.graduation_works.where(user_id: student_ids).update_all(is_delete: 1) - end -end diff --git a/app/jobs/course_delete_student_notify_job.rb b/app/jobs/course_delete_student_notify_job.rb deleted file mode 100644 index 898fc97c..00000000 --- a/app/jobs/course_delete_student_notify_job.rb +++ /dev/null @@ -1,22 +0,0 @@ -# 删除课堂用户 -class CourseDeleteStudentNotifyJob < ApplicationJob - queue_as :notify - - def perform(course_id, student_ids, trigger_user_id) - course = Course.find_by(id: course_id) - return if course.blank? - - attrs = %i[user_id trigger_user_id container_id container_type belong_container_id - belong_container_type tiding_type created_at updated_at] - - same_attrs = { - trigger_user_id: trigger_user_id, container_id: course.id, container_type: 'DeleteCourseMember', - belong_container_id: course.id, belong_container_type: 'Course', tiding_type: 'System' - } - Tiding.bulk_insert(*attrs) do |worker| - student_ids.each do |user_id| - worker.add same_attrs.merge(user_id: user_id) - end - end - end -end diff --git a/app/jobs/create_diff_record_job.rb b/app/jobs/create_diff_record_job.rb deleted file mode 100644 index fbe8cbff..00000000 --- a/app/jobs/create_diff_record_job.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateDiffRecordJob < ApplicationJob - queue_as :default - - def perform(user_id, obj_id, obj_klass, column_name, before, after) - user = User.find_by(id: user_id) - obj = obj_klass.constantize.find_by(id: obj_id) - - return if user.blank? || obj.blank? - - CreateDiffRecordService.call(user, obj, column_name, before, after) - end -end \ No newline at end of file diff --git a/app/jobs/delete_department_notify_job.rb b/app/jobs/delete_department_notify_job.rb deleted file mode 100644 index 1da5e2e8..00000000 --- a/app/jobs/delete_department_notify_job.rb +++ /dev/null @@ -1,21 +0,0 @@ -# 删除部门 消息通知 -class DeleteDepartmentNotifyJob < ApplicationJob - queue_as :notify - - def perform(department_id, operator_id, user_ids) - department = Department.unscoped.find_by(id: department_id) - return if department.blank? || user_ids.blank? - - attrs = %i[ user_id trigger_user_id container_id container_type tiding_type status created_at updated_at] - - same_attrs = { - trigger_user_id: operator_id, container_id: department.id, container_type: 'Department', - status: 4, tiding_type: 'System' - } - Tiding.bulk_insert(*attrs) do |worker| - user_ids.each do |user_id| - worker.add same_attrs.merge(user_id: user_id) - end - end - end -end diff --git a/app/jobs/exercise_publish_notify_job.rb b/app/jobs/exercise_publish_notify_job.rb deleted file mode 100644 index 9c43b197..00000000 --- a/app/jobs/exercise_publish_notify_job.rb +++ /dev/null @@ -1,44 +0,0 @@ -# 试卷发布 消息通知 -class ExercisePublishNotifyJob < ApplicationJob - queue_as :notify - - def perform(exercise_id, group_ids) - exercise = Exercise.find_by(id: exercise_id) - return if exercise.blank? - user = exercise.user - course = exercise.course - - if group_ids.present? - students = course.students.where(course_group_id: group_ids) - subquery = course.teacher_course_groups.where(course_group_id: group_ids).select(:course_member_id) - teachers = course.teachers.where(id: subquery) - else - students = course.students - teachers = course.teachers - end - - attrs = %i[ - user_id trigger_user_id container_id container_type parent_container_id parent_container_type - belong_container_id belong_container_type viewed tiding_type created_at updated_at - ] - - same_attrs = { - trigger_user_id: user.id, container_id: exercise.id, container_type: 'Exercise', - parent_container_id: exercise.id, parent_container_type: 'ExercisePublish', - belong_container_id: exercise.course_id, belong_container_type: 'Course', - viewed: 0, tiding_type: 'Exercise' - } - Tiding.bulk_insert(*attrs) do |worker| - teacher_ids = teachers.pluck(:user_id) - unless exercise.tidings.exists?(parent_container_type: 'ExercisePublish', user_id: teacher_ids) - teacher_ids.each do |user_id| - worker.add same_attrs.merge(user_id: user_id) - end - end - - students.pluck(:user_id).each do |user_id| - worker.add same_attrs.merge(user_id: user_id) - end - end - end -end diff --git a/app/jobs/get_aliyun_video_info_job.rb b/app/jobs/get_aliyun_video_info_job.rb deleted file mode 100644 index d9318645..00000000 --- a/app/jobs/get_aliyun_video_info_job.rb +++ /dev/null @@ -1,17 +0,0 @@ -# 获取阿里云视频信息 -class GetAliyunVideoInfoJob < ApplicationJob - queue_as :default - - def perform(vod_video_id) - video = Video.find_by(uuid: vod_video_id) - return if video.blank? || video.vod_uploading? - - result = AliyunVod::Service.get_play_info(video.uuid) - cover_url = result.dig('VideoBase', 'CoverURL') - file_url = (result.dig('PlayInfoList', 'PlayInfo') || []).first&.[]('PlayURL') - - video.cover_url = cover_url if cover_url.present? && video.cover_url.blank? - video.file_url = file_url if file_url.present? - video.save! - end -end \ No newline at end of file diff --git a/app/jobs/graduation_task_cross_comment_job.rb b/app/jobs/graduation_task_cross_comment_job.rb deleted file mode 100644 index a2d181b5..00000000 --- a/app/jobs/graduation_task_cross_comment_job.rb +++ /dev/null @@ -1,22 +0,0 @@ -# 毕设任务的交叉评阅分配 -class GraduationTaskCrossCommentJob < ApplicationJob - queue_as :default - - def perform(graduation_task_id) - task = GraduationTask.find_by(id: graduation_task_id) - return if task.blank? - - task.graduation_task_group_assignations.includes(:graduation_group, :graduation_work).each do |assignation| - graduation_group = assignation.graduation_group - work = assignation.graduation_work - if graduation_group.present? && work.present? - member_ids = graduation_group.course_members.pluck(:user_id).uniq - member_ids.each do |user_id| - unless work.graduation_work_comment_assignations.exists?(user_id: user_id) - work.graduation_work_comment_assignations << GraduationWorkCommentAssignation.new(user_id: user_id, graduation_task_id: task.id) - end - end - end - end - end -end diff --git a/app/jobs/graduation_task_publish_notify_job.rb b/app/jobs/graduation_task_publish_notify_job.rb deleted file mode 100644 index 84049fe9..00000000 --- a/app/jobs/graduation_task_publish_notify_job.rb +++ /dev/null @@ -1,28 +0,0 @@ -# 任务发布 消息通知 -class GraduationTaskPublishNotifyJob < ApplicationJob - queue_as :notify - - def perform(graduation_task_id) - task = GraduationTask.find_by(id: graduation_task_id) - return if task.blank? - course = task.course - return if course.blank? - - attrs = %i[ - user_id trigger_user_id container_id container_type parent_container_id parent_container_type - belong_container_id belong_container_type viewed tiding_type created_at updated_at - ] - - same_attrs = { - trigger_user_id: task.user_id, container_id: task.id, container_type: 'GraduationTask', - parent_container_id: task.id, parent_container_type: 'TaskPublish', - belong_container_id: task.course_id, belong_container_type: 'Course', - viewed: 0, tiding_type: 'GraduationTask' - } - Tiding.bulk_insert(*attrs) do |worker| - course.course_members.pluck(:user_id).uniq.each do |user_id| - worker.add same_attrs.merge(user_id: user_id) - end - end - end -end diff --git a/app/jobs/resubmit_student_work_notify_job.rb b/app/jobs/resubmit_student_work_notify_job.rb deleted file mode 100644 index 1a67aa3a..00000000 --- a/app/jobs/resubmit_student_work_notify_job.rb +++ /dev/null @@ -1,33 +0,0 @@ -class ResubmitStudentWorkNotifyJob < ApplicationJob - queue_as :notify - - def perform(homework_id, student_ids) - homework = HomeworkCommon.find_by(id: homework_id) - return if homework.blank? || student_ids.blank? - course = homework.course - - attrs = %i[user_id trigger_user_id container_id container_type parent_container_id parent_container_type - belong_container_id belong_container_type tiding_type viewed created_at updated_at] - - same_attrs = { - container_type: 'ResubmitStudentWork', parent_container_id: homework.id, parent_container_type: 'HomeworkCommon', - belong_container_id: course.id, belong_container_type: 'Course', tiding_type: 'HomeworkCommon', viewed: 0 - } - Tiding.bulk_insert(*attrs) do |worker| - student_ids.each do |user_id| - next unless User.exists?(id: user_id) - - work = homework.student_works.find_by(user_id: user_id) - next if work.blank? - score_user_ids = work.student_works_scores.where.not(score: nil).where(reviewer_role: [1, 2]).pluck(user_id).uniq - next if score_user_ids.blank? - - attrs = same_attrs.merge(trigger_user_id: user_id, container_id: work.id) - - score_user_ids.each do |user_id| - worker.add attrs.merge(user_id: user_id) - end - end - end - end -end diff --git a/app/models/laboratory.rb b/app/models/laboratory.rb index 9d3ca07d..9b409c17 100644 --- a/app/models/laboratory.rb +++ b/app/models/laboratory.rb @@ -44,7 +44,7 @@ class Laboratory < ApplicationRecord def site rails_env = EduSetting.get('rails_env') - suffix = rails_env && rails_env != 'production' ? ".#{rails_env}.trustie.net" : '.trustie.net' + suffix = rails_env && rails_env != 'production' ? ".#{rails_env}.gitlink.org.cn" : '.gitlink.org.cn' identifier ? "#{identifier}#{suffix}" : '' end @@ -74,74 +74,6 @@ class Laboratory < ApplicationRecord RequestStore.store[:current_laboratory] ||= User.anonymous end - def shixuns - if main_site? - not_shixun_ids = Shixun.joins(:laboratory_shixuns).where("laboratory_shixuns.laboratory_id != #{Laboratory.current.id}") - Shixun.where.not(id: not_shixun_ids.pluck(:shixun_id)) - elsif sync_shixun - laboratory_shixun_ids = laboratory_shixuns.pluck(:shixun_id) - school_shixun_ids = Shixun.joins("join user_extensions on shixuns.user_id=user_extensions.user_id").where(user_extensions: { school_id: school_id }).pluck(:id) - shixun_ids = laboratory_shixun_ids + school_shixun_ids - Shixun.where(id: shixun_ids.uniq) - else - Shixun.joins(:laboratory_shixuns).where(laboratory_shixuns: { laboratory_id: id }) - end - end - - def subjects - if main_site? - not_subject_ids = Subject.joins(:laboratory_subjects).where("laboratory_subjects.laboratory_id != #{Laboratory.current.id}") - Subject.where.not(id: not_subject_ids.pluck(:subject_id)) - elsif sync_subject - laboratory_subject_ids = laboratory_subjects.pluck(:subject_id) - school_subject_ids = Subject.joins("join user_extensions on subjects.user_id=user_extensions.user_id").where(user_extensions: { school_id: school_id }).pluck(:id) - subject_ids = laboratory_subject_ids + school_subject_ids - Subject.where(id: subject_ids.uniq) - else - Subject.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: id }) - end - end - - def all_courses - main_site? || !sync_course ? courses : courses.or(Course.where(school_id: school_id)) - end - - def shixun_repertoires - where_sql = ShixunTagRepertoire.where("shixun_tag_repertoires.tag_repertoire_id = tag_repertoires.id") - - # 云上实验室过滤 - unless main_site? - where_sql = where_sql.joins("JOIN laboratory_shixuns ls ON ls.shixun_id = shixun_tag_repertoires.shixun_id "\ - "AND ls.laboratory_id = #{id}") - end - where_sql = where_sql.select('1').to_sql - tags = TagRepertoire.where("EXISTS(#{where_sql})").distinct.includes(sub_repertoire: :repertoire) - - tags_map = tags.group_by(&:sub_repertoire) - sub_reps_map = tags_map.keys.group_by(&:repertoire) - - sub_reps_map.keys.sort_by(&:updated_at).reverse.map do |repertoire| - repertoire_hash = repertoire.as_json(only: %i[id name]) - repertoire_hash[:sub_repertoires] = - sub_reps_map[repertoire].sort_by(&:updated_at).reverse.map do |sub_repertoire| - sub_repertoire_hash = sub_repertoire.as_json(only: %i[id name]) - sub_repertoire_hash[:tags] = tags_map[sub_repertoire].sort_by(&:updated_at).reverse.map { |tag| tag.as_json(only: %i[id name]) } - sub_repertoire_hash - end - repertoire_hash - end - end - - def subject_repertoires - exist_sql = Subject.where('subjects.repertoire_id = repertoires.id') - - unless main_site? - exist_sql = exist_sql.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: id }) - end - - Repertoire.where("EXISTS(#{exist_sql.select('1').to_sql})").order(updated_at: :desc).distinct - end - # 是否为主站 def main_site? id == 1 diff --git a/app/models/token.rb b/app/models/token.rb index c71a860a..d1158c7e 100644 --- a/app/models/token.rb +++ b/app/models/token.rb @@ -1,19 +1,19 @@ -# == Schema Information -# -# Table name: tokens -# -# id :integer not null, primary key -# user_id :integer default("0"), not null -# action :string(30) default(""), not null -# value :string(40) default(""), not null -# created_on :datetime not null -# -# Indexes -# -# index_tokens_on_user_id (user_id) -# tokens_value (value) UNIQUE -# - +# == Schema Information +# +# Table name: tokens +# +# id :integer not null, primary key +# user_id :integer default("0"), not null +# action :string(30) default(""), not null +# value :string(40) default(""), not null +# created_on :datetime not null +# +# Indexes +# +# index_tokens_on_user_id (user_id) +# tokens_value (value) UNIQUE +# + # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -105,7 +105,7 @@ class Token < ActiveRecord::Base end def self.generate_token_value - Educoder::Utils.random_hex(20) + Gitlink::Utils.random_hex(20) end def self.delete_user_all_tokens(user) diff --git a/app/models/user.rb b/app/models/user.rb index 8613b68a..3f37ab1e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -690,7 +690,7 @@ class User < Owner end def self.generate_salt - Educoder::Utils.random_hex(16) + Gitlink::Utils.random_hex(16) end # 全部已认证 diff --git a/app/queries/admins/course_list_query.rb b/app/queries/admins/course_list_query.rb deleted file mode 100644 index 84868b7d..00000000 --- a/app/queries/admins/course_list_query.rb +++ /dev/null @@ -1,30 +0,0 @@ -class Admins::CourseListQuery < ApplicationQuery - include CustomSortable - - attr_reader :params - - sort_columns :created_at, default_by: :created_at, default_direction: :desc - - def initialize(params) - @params = params - end - - def call - course_lists = CourseList.all - - # 关键字模糊查询 - keyword = params[:keyword].to_s.strip - if keyword.present? - search_type = params[:search_type] || "0" - case search_type - when "0" - course_lists = course_lists.joins(:user) - .where('CONCAT(lastname, firstname) like :keyword OR users.nickname like :keyword', keyword: "%#{keyword}%") - when "1" - course_lists = course_lists.where('name like :keyword', keyword: "%#{keyword}%") - end - end - - custom_sort(course_lists, params[:sort_by], params[:sort_direction]) - end -end \ No newline at end of file diff --git a/app/queries/admins/course_query.rb b/app/queries/admins/course_query.rb deleted file mode 100644 index 6fbbc002..00000000 --- a/app/queries/admins/course_query.rb +++ /dev/null @@ -1,44 +0,0 @@ -class Admins::CourseQuery < ApplicationQuery - include CustomSortable - - attr_reader :params - - sort_columns :created_at, default_by: :created_at, default_direction: :desc, default_table: 'courses' - - def initialize(params) - @params = params - end - - def call - courses = Course.all - - courses = courses.where(id: params[:id]) if params[:id].present? - - # 状态过滤 - status = - case params[:status].to_s.strip - when 'processing' then 0 - when 'ended' then 1 - end - courses = courses.where(is_end: status) if status - - # 单位 - if params[:school_id].present? - courses = courses.where(school_id: params[:school_id]) - end - - # 首页展示 - if params[:homepage_show].present? && params[:homepage_show].to_s == 'true' - courses = courses.where(homepage_show: true) - end - - # 关键字 - keyword = params[:keyword].to_s.strip - if keyword - sql = 'CONCAT(lastname, firstname) LIKE :keyword OR users.nickname LIKE :keyword OR courses.name LIKE :keyword OR course_lists.name LIKE :keyword' - courses = courses.joins(:teacher, :course_list).where(sql, keyword: "%#{keyword}%") - end - - custom_sort(courses, params[:sort_by], params[:sort_direction]) - end -end \ No newline at end of file diff --git a/app/queries/admins/department_apply_query.rb b/app/queries/admins/department_apply_query.rb deleted file mode 100644 index 500536dd..00000000 --- a/app/queries/admins/department_apply_query.rb +++ /dev/null @@ -1,25 +0,0 @@ -class Admins::DepartmentApplyQuery < ApplicationQuery - include CustomSortable - - attr_reader :params - - sort_columns :created_at, default_by: :created_at, default_direction: :desc - - def initialize(params) - @params = params - end - - def call - status = params[:status] - - applies = ApplyAddDepartment.where(status: status) if status.present? - - # 关键字模糊查询 - keyword = params[:keyword].to_s.strip - if keyword.present? - applies = applies.where('name LIKE :keyword', keyword: "%#{keyword}%") - end - - custom_sort(applies, params[:sort_by], params[:sort_direction]) - end -end \ No newline at end of file diff --git a/app/queries/admins/department_query.rb b/app/queries/admins/department_query.rb deleted file mode 100644 index f0b8c5d2..00000000 --- a/app/queries/admins/department_query.rb +++ /dev/null @@ -1,32 +0,0 @@ -class Admins::DepartmentQuery < ApplicationQuery - include CustomSortable - - attr_reader :params - - sort_columns :created_at, default_by: :created_at, default_direction: :desc - - def initialize(params) - @params = params - end - - def call - departments = Department.where(is_auth: true).without_deleted - - keyword = params[:keyword].to_s.strip - if keyword.present? - departments = departments.joins(:school) - .where('schools.name LIKE :keyword OR departments.name LIKE :keyword', keyword: "%#{keyword}%") - end - - if params[:with_member].to_s == 'true' - subquery = DepartmentMember.where('department_id = departments.id').select('1 AS one').to_sql - departments = departments.where("EXISTS(#{subquery})") - end - - if params[:with_identifier].to_s == 'true' - departments = departments.where.not(identifier: nil).where.not(identifier: '') - end - - custom_sort(departments, params[:sort_by], params[:sort_direction]) - end -end \ No newline at end of file diff --git a/app/queries/admins/laboratory_shixun_query.rb b/app/queries/admins/laboratory_shixun_query.rb deleted file mode 100644 index da786719..00000000 --- a/app/queries/admins/laboratory_shixun_query.rb +++ /dev/null @@ -1,36 +0,0 @@ -class Admins::LaboratoryShixunQuery < ApplicationQuery - attr_reader :laboratory, :params - - def initialize(laboratory, params) - @laboratory = laboratory - @params = params - end - - def call - laboratory_shixuns = laboratory.laboratory_shixuns.joins(:shixun) - - keyword = params[:keyword].to_s.strip - if keyword.present? - like_sql = 'shixuns.name LIKE :keyword OR CONCAT(users.lastname, users.firstname) LIKE :keyword OR users.nickname LIKE :keyword' - laboratory_shixuns = laboratory_shixuns.joins(shixun: :user).where(like_sql, keyword: "%#{keyword}%") - end - - # 实训状态 - laboratory_shixuns = laboratory_shixuns.where(shixuns: { status: params[:status] }) if params[:status].present? - - # 技术平台 - if params[:tag_id].present? - laboratory_shixuns = laboratory_shixuns.joins(shixun: :shixun_mirror_repositories) - .where(shixun_mirror_repositories: { mirror_repository_id: params[:tag_id] }) - end - - # 首页展示、单位自建 - %i[homepage ownership].each do |column| - if params[column].present? && params[column].to_s == 'true' - laboratory_shixuns = laboratory_shixuns.where(column => true) - end - end - - laboratory_shixuns - end -end \ No newline at end of file diff --git a/app/queries/admins/school_query.rb b/app/queries/admins/school_query.rb deleted file mode 100644 index 3206f085..00000000 --- a/app/queries/admins/school_query.rb +++ /dev/null @@ -1,23 +0,0 @@ -class Admins::SchoolQuery < ApplicationQuery - include CustomSortable - - attr_reader :params - - sort_columns :users_count, :created_at, default_by: :created_at, default_direction: :desc - - def initialize(params) - @params = params - end - - def call - schools = School.all - - keyword = strip_param(:keyword) - Rails.logger.info("###########{keyword}") - if keyword - schools = schools.where('schools.name LIKE ?', "%#{keyword}%") - end - schools = schools.left_joins(:user_extensions).select('schools.*, IFNULL(count(user_extensions.user_id),0) users_count').group('schools.id') - custom_sort schools, params[:sort_by], params[:sort_direction] - end -end \ No newline at end of file diff --git a/app/queries/admins/subject_query.rb b/app/queries/admins/subject_query.rb deleted file mode 100644 index 3596c771..00000000 --- a/app/queries/admins/subject_query.rb +++ /dev/null @@ -1,49 +0,0 @@ -class Admins::SubjectQuery < ApplicationQuery - include CustomSortable - - attr_reader :params - - sort_columns :created_at, default_by: :created_at, default_direction: :desc, default_table: 'subjects' - - def initialize(params) - @params = params - end - - def call - subjects = Subject.all - - subjects = subjects.where(id: params[:id]) if params[:id].present? - - # 状态过滤 - status = - case params[:status].to_s.strip - when "editing" then {status: 0} - when "applying" then {status: 2, public: [0, 1]} - when "pending" then {public: 1} - when "published" then {public: 2} - end - - subjects = subjects.where(status) if status - - # 创建者单位 - if params[:school_id].present? - subjects = subjects.joins(user: :user_extension).where(user_extensions: { school_id: params[:school_id] }) - end - - # 首页展示、金课 - %i[homepage_show excellent].each do |column| - if params[column].present? && params[column].to_s == 'true' - subjects = subjects.where(column => true) - end - end - - # 关键字 - keyword = params[:keyword].to_s.strip - if keyword - sql = 'CONCAT(lastname, firstname) LIKE :keyword OR users.nickname LIKE :keyword OR subjects.name LIKE :keyword' - subjects = subjects.joins(:user).where(sql, keyword: "%#{keyword}%") - end - - custom_sort(subjects, params[:sort_by], params[:sort_direction]) - end -end \ No newline at end of file diff --git a/app/queries/users/video_query.rb b/app/queries/users/video_query.rb deleted file mode 100644 index cfaa314c..00000000 --- a/app/queries/users/video_query.rb +++ /dev/null @@ -1,28 +0,0 @@ -class Users::VideoQuery < ApplicationQuery - include CustomSortable - - sort_columns :published_at, :title, default_by: :published_at, default_direction: :desc - - attr_reader :user, :params - - def initialize(user, params) - @user = user - @params = params - end - - def call - videos = user.videos - - videos = - case params[:status] - when 'published' then videos.published - when 'processing' then videos.processing - else videos.published - end - - keyword = params[:keyword].to_s.strip - videos = videos.where('title LIKE ?', "%#{keyword}%") if keyword.present? - - custom_sort(videos, params[:sort_by], params[:sort_direction]) - end -end \ No newline at end of file diff --git a/app/queries/weapps/search_query.rb b/app/queries/weapps/search_query.rb deleted file mode 100644 index 66548007..00000000 --- a/app/queries/weapps/search_query.rb +++ /dev/null @@ -1,37 +0,0 @@ -class Weapps::SearchQuery < ApplicationQuery - include ElasticsearchAble - - attr_reader :params - - def initialize(params) - @params = params - end - - def call - modal_name.search(keyword, search_options) - end - - private - - def search_options - hash = { - fields: [:name], - page: page, - per_page: per_page - } - hash.merge(where: { status: 2 }) if modal_name == Shixun - - hash - end - - def modal_name - @_modal_name ||= begin - case params[:type].to_s - when 'subject' then Subject - when 'shixun' then Shixun - when 'course' then Course - else Subject - end - end - end -end \ No newline at end of file diff --git a/app/queries/weapps/subject_query.rb b/app/queries/weapps/subject_query.rb deleted file mode 100644 index 73e70160..00000000 --- a/app/queries/weapps/subject_query.rb +++ /dev/null @@ -1,37 +0,0 @@ -class Weapps::SubjectQuery < ApplicationQuery - include CustomSortable - attr_reader :params - - def initialize(current_laboratory, params) - @current_laboratory = current_laboratory - @params = params - end - - def call - subjects = @current_laboratory.subjects.unhidden.publiced.show_moblied - - # 课程体系的过滤 - if params[:sub_discipline_id].present? - subjects = subjects.joins(:sub_disciplines).where(sub_disciplines: {id: params[:sub_discipline_id]}) - elsif params[:discipline_id].present? - subjects = subjects.joins(:sub_disciplines).where(sub_disciplines: {discipline_id: params[:discipline_id]}) - else - subjects = subjects.joins(:sub_discipline_containers).where(sub_discipline_containers: {container_type: "Subject"}) - end - - subjects = subjects.left_joins(:shixuns).select('subjects.id, subjects.name, subjects.excellent, subjects.stages_count, subjects.status, subjects.homepage_show, - subjects.shixuns_count, subjects.updated_at, IFNULL(sum(shixuns.myshixuns_count), 0) myshixuns_count') - .group('subjects.id').order("subjects.homepage_show #{sort_type}, #{order_type} #{sort_type}") - subjects - end - - private - - def order_type - Subject.column_names.include?(params[:order]) ? params[:order] : 'updated_at' - end - - def sort_type - %w(desc asc).include?(params[:sort]) ? params[:sort] : "desc" - end -end \ No newline at end of file diff --git a/app/services/admins/add_department_member_service.rb b/app/services/admins/add_department_member_service.rb deleted file mode 100644 index f8331cf4..00000000 --- a/app/services/admins/add_department_member_service.rb +++ /dev/null @@ -1,20 +0,0 @@ -class Admins::AddDepartmentMemberService < ApplicationService - - attr_reader :department, :params - - def initialize(department, params) - @department = department - @params = params - end - - def call - columns = %i[] - DepartmentMember.bulk_insert(*columns) do |worker| - Array.wrap(params[:user_ids]).compact.each do |user_id| - next if department.department_members.exists?(user_id: user_id) - - worker.add(department_id: department.id, user_id: user_id) - end - end - end -end \ No newline at end of file diff --git a/app/services/admins/check_shixun_mirrors_service.rb b/app/services/admins/check_shixun_mirrors_service.rb deleted file mode 100644 index 4aa0af4c..00000000 --- a/app/services/admins/check_shixun_mirrors_service.rb +++ /dev/null @@ -1,89 +0,0 @@ -class Admins::CheckShixunMirrorsService < ApplicationService - Error = Class.new(StandardError) - - def call - bridge_images - - ActiveRecord::Base.transaction do - check_sync_mirrors! - - check_mirrors! - end - end - - private - - def mirrors - bridge_images['images'] - end - - def sync_mirrors - bridge_images['imagesNotSync'] - end - - def check_mirrors! - return if mirrors.blank? - image_names = [] - - mirrors.each do |data| - mirror = JSON.parse(data) - - name_repository = MirrorRepository.find_by(name: mirror['imageName']) - id_repository = MirrorRepository.find_by(mirrorID: mirror['imageID']) - - image_names << mirror['imageName'] - - if name_repository.blank? && id_repository.present? # 镜像名称被修改 - id_repository.update_column(:status, 2) - MirrorOperationRecord.create!(mirror_repository_id: id_repository.id, mirror_id: mirror['imageID'], - mirror_name: mirror['imageName'], status: 2, user_id: -1) - elsif name_repository.blank? # 镜像不存在、创建镜像 - new_repository = MirrorRepository.create!(mirrorID: mirror['imageID'], name: mirror['imageName']) - MirrorOperationRecord.create!(mirror_repository_id: new_repository.id, mirror_id: mirror['imageID'], - mirror_name: mirror['imageName'], status: 0, user_id: -1) - elsif name_repository.mirrorID != mirror['imageID'] # 镜像ID被修改 - name_repository.update_column(:status, 2) - MirrorOperationRecord.create!(mirror_repository_id: name_repository.id, mirror_id: mirror['imageID'], - mirror_name: mirror['imageName'], status: 1, user_id: -1) - end - end - - # 判断中间层镜像是否被删除 - MirrorRepository.find_each do |mirror| - next if mirror&.name.blank? || image_names.index(mirror.name) - - mirror.update_column(:status, 4) - MirrorOperationRecord.create!(mirror_repository_id: mirror.id, mirror_id: mirror&.mirrorID, - mirror_name: mirror.name, status: 3, user_id: -1) - end - end - - def check_sync_mirrors! - return if sync_mirrors.blank? - - sync_mirrors.each do |data| - mirror = JSON.parse(data) - - repository = MirrorRepository.find_by(name: mirror['imageName']) - next if repository.blank? || repository.status != 1 - - repository.update_column(:status, 5) - MirrorOperationRecord.create!(mirror_repository_id: repository.id, mirror_id: mirror['imageID'], - mirror_name: mirror['imageName'], status: 4, user_id: -1) - end - end - - def bridge_images - @_bridge_images ||= begin - url = "#{EduSetting.get('cloud_bridge')}/bridge/docker/images" - res = Faraday.get(url) - res = JSON.parse(res.body) - raise Error, '拉取镜像信息异常' if res && res['code'] != 0 - - res - rescue => e - Rails.logger.error("get response failed ! #{e.message}") - raise Error, '实训云平台繁忙(繁忙等级:84)' - end - end -end \ No newline at end of file diff --git a/app/services/admins/drag_cooperative_service.rb b/app/services/admins/drag_cooperative_service.rb deleted file mode 100644 index 241b7eb1..00000000 --- a/app/services/admins/drag_cooperative_service.rb +++ /dev/null @@ -1,35 +0,0 @@ -class Admins::DragCooperativeService < ApplicationService - Error = Class.new(StandardError) - - attr_reader :move, :after - - def initialize(move, after) - @move = move - @after = after # 移动后下一个位置的元素 - end - - def call - return if move.position + 1 == after&.position # 未移动 - raise Error, '未知错误' if after && move.img_type != after.img_type - - coo_imgs = CooImg.where(img_type: move.img_type) - - ActiveRecord::Base.transaction do - if after.blank? # 移动至末尾 - total = coo_imgs.count - - coo_imgs.where('position > ?', move.position).update_all('position = position - 1') - move.update!(position: total) - return - end - - if move.position > after.position # 前移 - coo_imgs.where('position >= ? AND position < ?', after.position, move.position).update_all('position = position + 1') - move.update!(position: after.position) - else # 后移 - coo_imgs.where('position > ? AND position <= ?', move.position, after.position).update_all('position = position - 1') - move.update!(position: after.position) - end - end - end -end \ No newline at end of file diff --git a/app/services/admins/drag_portal_image_service.rb b/app/services/admins/drag_portal_image_service.rb deleted file mode 100644 index 5555c08b..00000000 --- a/app/services/admins/drag_portal_image_service.rb +++ /dev/null @@ -1,35 +0,0 @@ -class Admins::DragPortalImageService < ApplicationService - Error = Class.new(StandardError) - - attr_reader :laboratory, :move, :after - - def initialize(laboratory, move, after) - @laboratory = laboratory - @move = move - @after = after # 移动后下一个位置的元素 - end - - def call - return if move.position + 1 == after&.position # 未移动 - - images = laboratory.portal_images - - ActiveRecord::Base.transaction do - if after.blank? || move.id == after.id # 移动至末尾 - total = images.count - - images.where('position > ?', move.position).update_all('position = position - 1') - move.update!(position: total) - return - end - - if move.position > after.position # 前移 - images.where('position >= ? AND position < ?', after.position, move.position).update_all('position = position + 1') - move.update!(position: after.position) - else # 后移 - images.where('position > ? AND position < ?', move.position, after.position).update_all('position = position - 1') - move.update!(position: after.position - 1) - end - end - end -end \ No newline at end of file diff --git a/app/services/admins/drag_weapp_advert_service.rb b/app/services/admins/drag_weapp_advert_service.rb deleted file mode 100644 index 8bfb7c31..00000000 --- a/app/services/admins/drag_weapp_advert_service.rb +++ /dev/null @@ -1,32 +0,0 @@ -class Admins::DragWeappAdvertService < ApplicationService - attr_reader :move, :after - - def initialize(move, after) - @move = move - @after = after # 移动后下一个位置的元素 - end - - def call - return if move.position + 1 == after&.position # 未移动 - - adverts = WeappSettings::Advert.all - - ActiveRecord::Base.transaction do - if after.blank? || move.id == after.id # 移动至末尾 - total = adverts.count - - adverts.where('position > ?', move.position).update_all('position = position - 1') - move.update!(position: total) - return - end - - if move.position > after.position # 前移 - adverts.where('position >= ? AND position < ?', after.position, move.position).update_all('position = position + 1') - move.update!(position: after.position) - else # 后移 - adverts.where('position > ? AND position < ?', move.position, after.position).update_all('position = position - 1') - move.update!(position: after.position - 1) - end - end - end -end \ No newline at end of file diff --git a/app/services/admins/drag_weapp_carousel_service.rb b/app/services/admins/drag_weapp_carousel_service.rb deleted file mode 100644 index f0b3832b..00000000 --- a/app/services/admins/drag_weapp_carousel_service.rb +++ /dev/null @@ -1,32 +0,0 @@ -class Admins::DragWeappCarouselService < ApplicationService - attr_reader :move, :after - - def initialize(move, after) - @move = move - @after = after # 移动后下一个位置的元素 - end - - def call - return if move.position + 1 == after&.position # 未移动 - - carousels = WeappSettings::Carousel.all - - ActiveRecord::Base.transaction do - if after.blank? || move.id == after.id # 移动至末尾 - total = carousels.count - - carousels.where('position > ?', move.position).update_all('position = position - 1') - move.update!(position: total) - return - end - - if move.position > after.position # 前移 - carousels.where('position >= ? AND position < ?', after.position, move.position).update_all('position = position + 1') - move.update!(position: after.position) - else # 后移 - carousels.where('position > ? AND position < ?', move.position, after.position).update_all('position = position - 1') - move.update!(position: after.position - 1) - end - end - end -end \ No newline at end of file diff --git a/app/services/admins/import_course_member_service.rb b/app/services/admins/import_course_member_service.rb deleted file mode 100644 index 3ea55976..00000000 --- a/app/services/admins/import_course_member_service.rb +++ /dev/null @@ -1,63 +0,0 @@ -class Admins::ImportCourseMemberService < ApplicationService - Error = Class.new(StandardError) - - attr_reader :file, :result - - def initialize(file) - @file = file - @result = { success: 0, fail: [] } - end - - def call - raise Error, '文件不存在' if file.blank? - - excel = Admins::ImportCourseMemberExcel.new(file) - excel.read_each(&method(:create_course_member)) - - result - rescue ApplicationImport::Error => ex - raise Error, ex.message - end - - private - - def create_course_member(data) - raise '课堂角色必须为 2、3、4' unless [2, 3, 4].include?(data.role.to_i) - - user = User.joins(:user_extension).where(user_extensions: { student_id: data.student_id, school_id: data.school_id }).first - raise '该学号的用户不存在' if user.blank? - course = Course.find_by(id: data.course_id) - raise '该课堂不存在' if course.blank? - - course_group = nil - if data.course_group_name.present? - course_group = course.course_groups.find_or_create_by!(name: data.course_group_name) - end - - member = course.course_members.find_by(user_id: user.id, role: data.role.to_i) - # 如果已是课堂成员且是学生身份and不在指定的分班则移动到该分班 - if member.present? && member.role == 'STUDENT' && course_group && member.course_group_id != course_group&.id.to_i - member.update!(course_group_id: course_group&.id.to_i) - elsif member.blank? - course.course_members.create!(user_id: user.id, role: data.role.to_i, course_group_id: course_group&.id.to_i) - extra = - case data.role.to_i - when 2 then 9 - when 3 then 7 - else 10 - end - - Tiding.create!(user_id: user.id, trigger_user_id: course.tea_id, container_id: course.id, - container_type: 'TeacherJoinCourse', belong_container_id: course.id, - belong_container_type: 'Course', tiding_type: 'System', extra: extra) - end - - result[:success] += 1 - rescue Exception => ex - fail_data = data.as_json - fail_data[:data] = fail_data.values.join(',') - fail_data[:message] = ex.message - - result[:fail] << fail_data - end -end \ No newline at end of file diff --git a/app/services/admins/school_daily_statistic_service.rb b/app/services/admins/school_daily_statistic_service.rb deleted file mode 100644 index 64bb9786..00000000 --- a/app/services/admins/school_daily_statistic_service.rb +++ /dev/null @@ -1,123 +0,0 @@ -class Admins::SchoolDailyStatisticService < ApplicationService - include CustomSortable - - attr_reader :params - - sort_columns :student_count, :teacher_count, :homework_count, :other_homework_count, - :course_count, :active_course_count, :nearly_course_time, :shixun_count, :shixun_evaluate_count, - default_by: :teacher_count, default_direction: :desc - - def initialize(params) - @params = params - end - - def call - schools = School.group('schools.id') - - keyword = params[:keyword].try(:to_s).try(:strip) - if keyword.present? - schools = schools.where("schools.name LIKE :keyword OR schools.id LIKE :keyword", keyword: "%#{keyword}%") - end - - count = schools.count.count - - # 根据排序字段进行查询 - schools = query_by_sort_column(schools, params[:sort_by]) - schools = custom_sort(schools, params[:sort_by], params[:sort_direction]) - - schools = schools.limit(page_size).offset(offset) - # 查询并组装其它数据 - schools = package_other_data(schools) - - [count, schools] - end - - def package_other_data(schools) - ids = schools.map(&:id) - - student_map = UserExtension.where(school_id: ids, identity: :student).group(:school_id).count - teacher_map = UserExtension.where(school_id: ids, identity: :teacher).group(:school_id).count - - homeworks = HomeworkCommon.joins(:course) - shixun_homework_map = homeworks.where(homework_type: 4, courses: { school_id: ids }).group('school_id').count - other_homework_map = homeworks.where(homework_type: [1, 3], courses: { school_id: ids }).group('school_id').count - - courses = Course.where(is_delete: 0, school_id: ids).group('school_id') - course_map = courses.count - nearly_course_time_map = courses.joins(:course_acts).maximum('course_activities.updated_at') - active_course_map = courses.where(is_end: false).count - - shixun_map = Shixun.joins(user: :user_extension).where(user_extensions: { identity: :teacher, school_id: ids }) - .where(fork_from: nil).group('school_id').count - - reports = SchoolReport.where(school_id: ids) - evaluate_count_map = reports.each_with_object({}) { |report, obj| obj[report.school_id] = report.shixun_evaluate_count } - - schools.map do |school| - { - id: school.id, - name: school.name, - teacher_count: teacher_map[school.id], - student_count: student_map[school.id], - homework_count: shixun_homework_map[school.id], - other_homework_count: other_homework_map[school.id], - course_count: course_map[school.id], - nearly_course_time: nearly_course_time_map[school.id], - active_course_count: active_course_map[school.id], - shixun_count: shixun_map.fetch(school.id, 0), - shixun_evaluate_count: evaluate_count_map.fetch(school.id, 0) - } - end - end - - private - def query_by_sort_column(schools, sort_by_column) - base_query_column = 'schools.id, schools.name' - - case sort_by_column.to_s - when 'teacher_count' then - schools.joins('LEFT JOIN user_extensions ue ON ue.school_id = schools.id AND ue.identity = 0') - .select("#{base_query_column}, COUNT(*) teacher_count") - when 'student_count' then - schools.joins('LEFT JOIN user_extensions ue ON ue.school_id = schools.id AND ue.identity = 1') - .select("#{base_query_column}, COUNT(*) student_count") - when 'homework_count' then - schools.joins('LEFT JOIN courses ON courses.school_id = schools.id') - .joins('LEFT JOIN homework_commons hc ON hc.course_id = courses.id AND hc.homework_type = 4') - .select("#{base_query_column}, COUNT(*) homework_count") - when 'other_homework_count' then - schools.joins('LEFT JOIN courses ON courses.school_id = schools.id') - .joins('LEFT JOIN homework_commons hc ON hc.course_id = courses.id AND hc.homework_type IN (1, 3)') - .select("#{base_query_column}, COUNT(*) other_homework_count") - when 'course_count' then - schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0') - .select("#{base_query_column}, COUNT(*) course_count") - when 'shixun_count' then - schools.joins('LEFT JOIN user_extensions ue ON ue.school_id = schools.id AND ue.identity = 0') - .joins('LEFT JOIN users ON users.id = ue.user_id') - .joins('LEFT JOIN shixuns sx ON sx.user_id = users.id AND sx.fork_from IS NULL') - .select("#{base_query_column}, COUNT(*) shixun_count") - when 'shixun_evaluate_count' then - schools.joins('LEFT JOIN school_reports ON school_reports.school_id = schools.id') - .select("#{base_query_column}, shixun_evaluate_count") - when 'nearly_course_time' then - schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0') - .joins('LEFT JOIN course_activities acs ON acs.course_id = cs.id') - .select("#{base_query_column}, MAX(acs.updated_at) nearly_course_time") - when 'active_course_count' then - schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0 AND cs.is_end = false') - .select("#{base_query_column}, COUNT(*) active_course_count") - else - schools.joins('LEFT JOIN user_extensions ue ON ue.school_id = schools.id AND ue.identity = 0') - .select("#{base_query_column}, COUNT(*) teacher_count") - end - end - - def page_size - params[:per_page] || 20 - end - - def offset - (params[:page].to_i.zero? ? 0 : params[:page].to_i - 1) * page_size - end -end \ No newline at end of file diff --git a/app/services/admins/shixun_auths/agree_apply_service.rb b/app/services/admins/shixun_auths/agree_apply_service.rb deleted file mode 100644 index b8875cf0..00000000 --- a/app/services/admins/shixun_auths/agree_apply_service.rb +++ /dev/null @@ -1,43 +0,0 @@ -class Admins::ShixunAuths::AgreeApplyService < ApplicationService - attr_reader :apply, :user, :shixun - - def initialize(apply, user) - @apply = apply - @user = user - @shixun = Shixun.find(apply.container_id) - end - - def call - ActiveRecord::Base.transaction do - apply.update!(status: 1, dealer_id: user.id) - shixun.update!(public: 2, publish_time: Time.now) - - # 奖励金币、经验 - reward_grade_and_experience! - - deal_tiding! - end - end - - private - - def reward_grade_and_experience! - score = shixun.all_score - shixun_creator = shixun.user - - RewardGradeService.call(shixun_creator, container_id: shixun.id, container_type: 'shixunPublish', score: score) - - Experience.create!(user_id: shixun_creator.id, container_id: shixun.id, container_type: 'shixunPublish', score: score) - shixun_creator.update_column(:experience, shixun_creator.experience.to_i + score) - end - - def deal_tiding! - apply.tidings.where(tiding_type: 'Apply', status: 0).update_all(status: 1) - - Tiding.create!(user_id: apply.user_id, trigger_user_id: 0, - container_id: apply.id, container_type: 'ApplyAction', - parent_container_id: apply.container_id, parent_container_type: apply.container_type, - belong_container_id: apply.container_id, belong_container_type: 'Shixun', - status: 1, tiding_type: 'System') - end -end \ No newline at end of file diff --git a/app/services/admins/shixun_auths/refuse_apply_service.rb b/app/services/admins/shixun_auths/refuse_apply_service.rb deleted file mode 100644 index 76d420e5..00000000 --- a/app/services/admins/shixun_auths/refuse_apply_service.rb +++ /dev/null @@ -1,35 +0,0 @@ -class Admins::ShixunAuths::RefuseApplyService < ApplicationService - attr_reader :apply, :user, :shixun, :params - - def initialize(apply, user, params) - @apply = apply - @user = user - @shixun = Shixun.find(apply.container_id) - @params = params - end - - def call - ActiveRecord::Base.transaction do - shixun.update!(public: 0) - apply.update!(status: 2, reason: reason, dealer_id: user.id) - - deal_tiding! - end - end - - private - - def reason - params[:reason].to_s.strip - end - - def deal_tiding! - apply.tidings.where(tiding_type: 'Apply', status: 0).update_all(status: 1) - - Tiding.create!(user_id: apply.user_id, trigger_user_id: 0, - container_id: apply.id, container_type: 'ApplyAction', - parent_container_id: apply.container_id, parent_container_type: apply.container_type, - belong_container_id: apply.container_id, belong_container_type: 'Shixun', - status: 2, tiding_type: 'System') - end -end \ No newline at end of file diff --git a/app/services/admins/statistic_school_contrast_data_service.rb b/app/services/admins/statistic_school_contrast_data_service.rb deleted file mode 100644 index 0496b137..00000000 --- a/app/services/admins/statistic_school_contrast_data_service.rb +++ /dev/null @@ -1,80 +0,0 @@ -class Admins::StatisticSchoolContrastDataService < ApplicationService - ParameterError = Class.new(StandardError) - - PAGE_SIZE = 20 - CONTRAST_COLUMN_LIST = %w( - teacher_increase_count student_increase_count course_increase_count - shixun_increase_count active_user_count shixun_homework_count shixun_evaluate_count - ).freeze - - attr_reader :params, :sort_direction, :contrast_column - - def initialize(params) - @params = params - @sort_direction = params[:sort_direction].to_s - @contrast_column = params[:contrast_column].to_s - end - - def call - validate_parameter! - reports = School.joins(:school_daily_reports).select(select_columns) - - keyword = params[:keyword].try(:to_s).try(:strip) - if keyword.present? - reports = reports.where("schools.name LIKE :keyword OR schools.id LIKE :keyword", keyword: "%#{keyword}%") - end - - count = reports.count('distinct(schools.id)') - - sql = query_report_sql(reports.group('schools.id').to_sql) - reports = SchoolDailyReport.find_by_sql(sql) - - [count, reports] - end - - private - def validate_parameter! - if %i[begin_date end_date other_begin_date other_end_date].any? { |key| params[key].blank? } - raise ParameterError - end - - unless %w(desc asc).include?(sort_direction) - raise ParameterError - end - - unless CONTRAST_COLUMN_LIST.include?(contrast_column) - raise ParameterError - end - end - - def format_date(date) - Time.zone.parse(date).strftime("%Y-%m-%d") - end - - def offset - (params[:page].to_i.zero? ? 0 : params[:page].to_i - 1) * PAGE_SIZE - end - - def select_columns - if contrast_column != 'active_user_count' - "schools.id school_id, schools.name school_name,"\ - "(SUM(IF(date BETWEEN '#{format_date(params[:begin_date])}' AND '#{format_date(params[:end_date])}', #{contrast_column}, 0))) total,"\ - "(SUM(IF(date BETWEEN '#{format_date(params[:other_begin_date])}' AND '#{format_date(params[:other_end_date])}', #{contrast_column}, 0))) other_total" - else - # 活跃用户对比时处理方法不同 - relations = SchoolDailyActiveUser.select('COUNT(distinct user_id)').joins(:school_daily_report) - .where('school_id = schools.id') - total_subquery = relations.where("date BETWEEN '#{format_date(params[:begin_date])}' AND '#{format_date(params[:end_date])}'").to_sql - other_total_subquery = relations.where("date BETWEEN '#{format_date(params[:other_begin_date])}' AND '#{format_date(params[:other_end_date])}'").to_sql - - "schools.id school_id, schools.name school_name, (#{total_subquery}) AS total, (#{other_total_subquery}) AS other_total" - end - end - - def query_report_sql(from_sql) - order_by = "(total = 0 AND other_total != 0) #{sort_direction}, (percentage != 0) #{sort_direction}, percentage #{sort_direction}" - - "SELECT reports.*, (other_total - total) increase, (IF(other_total - total = 0, 0.0, round((other_total - total) / IF(total = 0, 1, total), 5))) percentage "\ - "FROM (#{from_sql}) reports ORDER BY #{order_by} LIMIT #{PAGE_SIZE} OFFSET #{offset}" - end -end \ No newline at end of file diff --git a/app/services/admins/statistic_school_data_grow_service.rb b/app/services/admins/statistic_school_data_grow_service.rb deleted file mode 100644 index 8df10666..00000000 --- a/app/services/admins/statistic_school_data_grow_service.rb +++ /dev/null @@ -1,107 +0,0 @@ -class Admins::StatisticSchoolDataGrowService < ApplicationService - include CustomSortable - - PAGE_SIZE = 20 - - attr_reader :params - - sort_columns :teacher_increase_count, :student_increase_count, - :course_increase_count, :shixun_increase_count, :uniq_active_user_count, - :shixun_homework_count, :shixun_evaluate_count, - default_by: :teacher_increase_count, default_direction: :desc - - def initialize(params) - @params = params - end - - def call - reports = School.where(nil) - - reports = search_filter(reports) - - count = reports.count - - subquery = SchoolDailyActiveUser.select('COUNT(distinct(user_id))').joins(:school_daily_report) - .where(date_condition_sql).where("school_id is not null and school_id = schools.id").to_sql - reports = reports.joins("LEFT JOIN school_daily_reports sdr ON sdr.school_id = schools.id AND #{date_condition_sql}") - reports = reports.select( - 'schools.id school_id, schools.name school_name,'\ - 'SUM(teacher_increase_count) teacher_increase_count,'\ - 'SUM(student_increase_count) student_increase_count,'\ - 'SUM(course_increase_count) course_increase_count,'\ - 'SUM(shixun_increase_count) shixun_increase_count,'\ - 'SUM(shixun_homework_count) shixun_homework_count,'\ - 'SUM(shixun_evaluate_count) shixun_evaluate_count,'\ - "(#{subquery}) uniq_active_user_count,"\ - 'SUM(active_user_count) active_user_count').group('schools.id') - - reports = custom_sort(reports, params[:sort_by], params[:sort_direction]) - reports = reports.order('school_id asc').limit(PAGE_SIZE).offset(offset) - - [count, reports] - end - - def grow_summary - @_grow_summary ||= begin - reports = School.joins("LEFT JOIN school_daily_reports sdr ON sdr.school_id = schools.id") - .where(date_condition_sql) - - subquery = SchoolDailyActiveUser.select('COUNT(distinct user_id)') - .joins('LEFT JOIN school_daily_reports sdr ON sdr.id = school_daily_active_users.school_daily_report_id') - .where(date_condition_sql).to_sql - reports = search_filter(reports) - reports.select( - 'SUM(teacher_increase_count) teacher_increase_count,'\ - 'SUM(student_increase_count) student_increase_count,'\ - 'SUM(course_increase_count) course_increase_count,'\ - 'SUM(shixun_increase_count) shixun_increase_count,'\ - 'SUM(shixun_homework_count) shixun_homework_count,'\ - 'SUM(shixun_evaluate_count) shixun_evaluate_count,'\ - "(#{subquery}) uniq_active_user_count,"\ - 'SUM(active_user_count) active_user_count' - ).first - end - end - - private - - def search_filter(relations) - keyword = params[:keyword].try(:to_s).try(:strip) - if keyword.present? - relations = relations.where("schools.name LIKE :keyword OR schools.id LIKE :keyword", keyword: "%#{keyword}%") - end - - relations - end - - def date_condition_sql - date = query_date - if date.is_a?(Range) - "date BETWEEN '#{date.min.strftime('%Y-%m-%d')}' AND '#{date.max.strftime('%Y-%m-%d')}'" - else - "date = '#{date.strftime('%Y-%m-%d')}'" - end - end - - def query_date - if params[:grow_begin_date].present? - begin_time = Time.zone.parse(params[:grow_begin_date]) - end_date = if params[:grow_end_date].present? - Time.zone.parse(params[:grow_end_date]) - end - - end_date.blank? || end_date == begin_time ? begin_time : begin_time..end_date - else - yesterday - end - end - - def yesterday - # 每日凌晨5点为节点, 25日凌晨4点、3点、2点等等,未到更新数据时间点,看到的数据是:23日-24日的统计数据 - (Time.zone.now - 5.hours).beginning_of_day - 1.days - end - - def offset - (params[:page].to_i.zero? ? 0 : params[:page].to_i - 1) * PAGE_SIZE - end -end \ No newline at end of file diff --git a/app/services/admins/subject_auths/agree_apply_service.rb b/app/services/admins/subject_auths/agree_apply_service.rb deleted file mode 100644 index ec5fec4b..00000000 --- a/app/services/admins/subject_auths/agree_apply_service.rb +++ /dev/null @@ -1,30 +0,0 @@ -class Admins::SubjectAuths::AgreeApplyService < ApplicationService - attr_reader :apply, :user, :subject - - def initialize(apply, user) - @apply = apply - @user = user - @subject = Subject.find(apply.container_id) - end - - def call - ActiveRecord::Base.transaction do - apply.update!(status: 1, dealer_id: user.id) - subject.update!(public: 2, publish_time: Time.now) - - deal_tiding! - end - end - - private - - def deal_tiding! - apply.tidings.where(tiding_type: 'Apply', status: 0).update_all(status: 1) - - Tiding.create!(user_id: apply.user_id, trigger_user_id: 0, - container_id: apply.id, container_type: 'ApplyAction', - parent_container_id: apply.container_id, parent_container_type: apply.container_type, - belong_container_id: apply.container_id, belong_container_type: 'Subject', - status: 1, tiding_type: 'System') - end -end \ No newline at end of file diff --git a/app/services/admins/subject_auths/refuse_apply_service.rb b/app/services/admins/subject_auths/refuse_apply_service.rb deleted file mode 100644 index 45f2d44d..00000000 --- a/app/services/admins/subject_auths/refuse_apply_service.rb +++ /dev/null @@ -1,35 +0,0 @@ -class Admins::SubjectAuths::RefuseApplyService < ApplicationService - attr_reader :apply, :user, :subject, :params - - def initialize(apply, user, params) - @apply = apply - @user = user - @subject = Subject.find(apply.container_id) - @params = params - end - - def call - ActiveRecord::Base.transaction do - subject.update!(public: 0) - apply.update!(status: 2, reason: reason, dealer_id: user.id) - - deal_tiding! - end - end - - private - - def reason - params[:reason].to_s.strip - end - - def deal_tiding! - apply.tidings.where(tiding_type: 'Apply', status: 0).update_all(status: 1) - - Tiding.create!(user_id: apply.user_id, trigger_user_id: 0, - container_id: apply.id, container_type: 'ApplyAction', - parent_container_id: apply.container_id, parent_container_type: apply.container_type, - belong_container_id: apply.container_id, belong_container_type: 'Subject', - status: 2, tiding_type: 'System') - end -end \ No newline at end of file diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb deleted file mode 100644 index 8229c7c3..00000000 --- a/app/services/courses_service.rb +++ /dev/null @@ -1,2 +0,0 @@ -class CoursesService -end \ No newline at end of file diff --git a/app/services/create_add_department_apply_service.rb b/app/services/create_add_department_apply_service.rb deleted file mode 100644 index e172b001..00000000 --- a/app/services/create_add_department_apply_service.rb +++ /dev/null @@ -1,44 +0,0 @@ -class CreateAddDepartmentApplyService < ApplicationService - Error = Class.new(StandardError) - - attr_reader :user, :params - - def initialize(user, params) - @user = user - @params = params - end - - def call - name = params[:name].to_s.strip - raise Error, '名称不能为空' if name.blank? - - school = School.find_by(id: params[:school_id]) - raise Error, '学校/单位不存在' if school.blank? - raise Error, '部门已存在' if school.departments.exists?(name: name) - - department = Department.new - department.name = name - department.school = school - - ActiveRecord::Base.transaction do - department.save! - - attrs = { - user_id: user.id, department: department, school: school, - name: department.name, remarks: params[:remarks], status: 0, - } - apply = ApplyAddDepartment.create!(attrs) - - unless user.professional_certification? - user.user_extension.update!(department_id: department.id) - end - - # 向管理员发送通知 - message = AppliedMessage.new(user_id: 1, status: 0, applied_user_id: user.id, viewed: 0, - applied_id: apply.id, applied_type: 'ApplyAddDepartment', name: department.name) - message.save(validate: false) - end - - department - end -end diff --git a/app/services/create_add_school_apply_service.rb b/app/services/create_add_school_apply_service.rb deleted file mode 100644 index 96619c68..00000000 --- a/app/services/create_add_school_apply_service.rb +++ /dev/null @@ -1,37 +0,0 @@ -class CreateAddSchoolApplyService < ApplicationService - Error = Class.new(StandardError) - - attr_reader :user, :params - - def initialize(user, params) - @user = user - @params = params - end - - def call - AddSchoolApplyForm.new(params).validate! - - name = params[:name].to_s.strip - raise Error, '学校/单位已经存在' if name.present? && School.exists?(name: name) - - school = School.new - school.name = name - school.province = params[:province].to_s.strip - school.city = params[:city].to_s.strip - school.address = params[:address].to_s.strip - - ActiveRecord::Base.transaction do - school.save! - - school_attrs = school.as_json(only: %i[name province city address]) - ApplyAddSchool.create!(school_attrs.merge(school: school, user_id: user.id, remarks: params[:remarks])) - - # 向管理员发送通知 - message = AppliedMessage.new(user_id: 1, status: 0, applied_user_id: user.id, viewed: 0, - applied_id: school.id, applied_type: 'ApplyAddSchools', name: school.name) - message.save(validate: false) - end - - school - end -end diff --git a/app/services/duplicate_course_service.rb b/app/services/duplicate_course_service.rb deleted file mode 100644 index fa57a890..00000000 --- a/app/services/duplicate_course_service.rb +++ /dev/null @@ -1,164 +0,0 @@ -class DuplicateCourseService < ApplicationService - attr_reader :origin_course, :user, :course - - def initialize(origin_course, user) - @user = user - @origin_course = origin_course - end - - def call - ActiveRecord::Base.transaction do - @course = copy_course! - - copy_course_modules! - - join_course! - - copy_homework_commons! - - copy_exercises! - - copy_polls! - - copy_attachments! - - course - end - end - - private - - def copy_course! - create_attrs = origin_course.as_json(only: %i[name class_period credit course_list_id]) - create_attrs.merge!(tea_id: user.id, school_id: user.school_id, is_public: 0, is_copy: 1) - - Course.create!(create_attrs) - end - - def copy_course_modules! - @second_category_list = {} - origin_course.course_modules.each do |course_module| - attrs = course_module.as_json(only: %i[module_type position hidden module_name]) - new_course_module = CourseModule.create!(attrs.merge(course_id: course.id)) - # 复制子目录 - course_module.course_second_categories.each do |second_category| - category_attr = second_category.as_json(only: %i[category_type name position]) - new_second_category = - CourseSecondCategory.create!(category_attr.merge(course_id: course.id, course_module_id: new_course_module.id)) - @second_category_list[second_category.id] = new_second_category.id - end - end - end - - def join_course! - CourseMember.create!(course_id: course.id, user_id: user.id, role: 1) - end - - def copy_homework_commons! - origin_course.homework_commons.where(homework_type: %i[normal group practice]).find_each do |origin_homework| - homework_attrs = origin_homework.as_json(only: %i[name description homework_type homework_bank_id reference_answer]) - - course_second_category_id = @second_category_list[origin_homework.course_second_category_id] - - homework = HomeworkCommon.create!(homework_attrs.merge(user_id: user.id, course_id: course.id, - course_second_category_id:course_second_category_id)) - - origin_homework.attachments.find_each do |origin_attachment| - attachment = origin_attachment.copy - attrs = { container: homework, author_id: origin_homework.user_id, copy_from: origin_attachment.id } - attachment.assign_attributes(attrs) - attachment.save! - - origin_attachment.increment!(:quotes) - end - - homework.create_homework_detail_manual! - - if homework.group_homework_type? - attrs = origin_homework.homework_detail_group.as_json(only: %i[min_num max_num base_on_project]) - homework.create_homework_detail_group!(attrs) - elsif homework.practice_homework_type? - HomeworkCommonsShixun.create!(homework_common_id: homework.id, shixun_id: origin_homework.homework_commons_shixun.shixun_id) - HomeworksService.new.create_shixun_homework_cha_setting(homework, origin_homework.shixuns.first) - end - - - origin_homework.increment!(:quotes) - origin_homework.homework_bank.increment!(:quotes) if origin_homework.homework_bank - end - end - - def copy_exercises! - origin_course.exercises.find_each do |origin_exercise| - attrs = origin_exercise.as_json(only: %i[exercise_name exercise_description exercise_bank_id]) - exercise = course.exercises.create!(attrs.merge(user_id: user.id)) - - origin_exercise.exercise_questions.find_each do |origin_question| - question_attrs = origin_question.as_json(only: %i[question_title question_type question_number question_score shixun_name shixun_id is_ordered level]) - # question_attrs[:question_type] ||= 1 - question = exercise.exercise_questions.create!(question_attrs) - - exercise_choice_map = {} - origin_question.exercise_choices.each_with_index do |origin_choice, index| - choice_attrs = { choice_position: index + 1, choice_text: origin_choice.choice_text } - choice = question.exercise_choices.create!(choice_attrs) - - # exercise_choice_map[origin_choice.id] = choice.id 标准答案中存的是choice_position, 直接取原题的exercise_choice_id就行 - end - - origin_question.exercise_standard_answers.find_each do |origin_answer| - question.exercise_standard_answers.create!( - exercise_choice_id: origin_answer.exercise_choice_id, - answer_text: origin_answer.answer_text - ) - end - - origin_question.exercise_shixun_challenges.each_with_index do |sc, index| - question.exercise_shixun_challenges.create!({position: index+1, challenge_id: sc.challenge_id, - shixun_id: sc.shixun_id, question_score: sc.question_score}) - end - end - - origin_exercise.exercise_bank.increment!(:quotes) if exercise.exercise_bank - end - end - - def copy_polls! - origin_course.polls.includes(poll_questions: :poll_answers).find_each do |origin_poll| - poll_attrs = origin_poll.as_json(only: %i[polls_name polls_description exercise_bank_id]) - poll = course.polls.create!(poll_attrs.merge(user_id: user.id)) - - origin_poll.poll_questions.each do |origin_question| - attr_names = %i[question_title question_type is_necessary question_number max_choices min_choices] - question_attrs = origin_question.as_json(only: attr_names) - question_attrs[:question_type] ||= 1 - - question = poll.poll_questions.create!(question_attrs) - - origin_question.poll_answers.each_with_index do |origin_answer, index| - question.poll_answers.create!(answer_position: index + 1, answer_text: origin_answer.answer_text) - end - end - - origin_poll.exercise_bank.increment!(:quotes) if origin_poll.exercise_bank - end - end - - def copy_attachments! - origin_course.attachments.each do |origin_attachment| - attachment = origin_attachment.copy - # attachment.tag_list.add(origin_attachment.tag_list) # tag关联 - attachment.container = course - attachment.created_on = Time.now - attachment.publish_time = nil - attachment.author_id = User.current.id - attachment.copy_from = origin_attachment.copy_from || origin_attachment.id - attachment.is_publish = 0 - attachment.attachtype ||= 4 - attachment.course_second_category_id = @second_category_list[origin_attachment.course_second_category_id] - - attachment.save! - origin_course.update_quotes(attachment) - end - end -end \ No newline at end of file diff --git a/app/services/projects/apply_join_service.rb b/app/services/projects/apply_join_service.rb index 677ee20c..958fd810 100644 --- a/app/services/projects/apply_join_service.rb +++ b/app/services/projects/apply_join_service.rb @@ -65,7 +65,7 @@ class Projects::ApplyJoinService < ApplicationService owner = project.user return if owner.phone.blank? - Educoder::Sms.send(mobile: owner.phone, send_type:'applied_project_info', + Gitlink::Sms.send(mobile: owner.phone, send_type:'applied_project_info', user_name: owner.show_name, name: project.name) rescue Exception => ex Rails.logger.error("发送短信失败 => #{ex.message}") diff --git a/app/services/reward_experience_service.rb b/app/services/reward_experience_service.rb deleted file mode 100644 index 70b47d1a..00000000 --- a/app/services/reward_experience_service.rb +++ /dev/null @@ -1,24 +0,0 @@ -class RewardExperienceService - attr_reader :user, :attrs - - def initialize(user, **attrs) - @user = user - @attrs = attrs.slice(*%i[container_id container_type score]) - end - - def call - return if user.experiences.exists?(attrs.except(:score)) - - ActiveRecord::Base.transaction do - experience = user.experiences.create!(attrs) - - user.increment!(:experience, experience.score) - - experience - end - end - - def self.call(user, **attrs) - new(user, attrs).call - end -end \ No newline at end of file diff --git a/app/services/users/apply_authentication_service.rb b/app/services/users/apply_authentication_service.rb index 5e256210..cd7b931a 100644 --- a/app/services/users/apply_authentication_service.rb +++ b/app/services/users/apply_authentication_service.rb @@ -52,7 +52,7 @@ class Users::ApplyAuthenticationService < ApplicationService end def sms_notify_admin - Educoder::Sms.notify_admin(send_type: 'apply_auth') + Gitlink::Sms.notify_admin(send_type: 'apply_auth') rescue => ex Util.logger_error(ex) end diff --git a/app/services/users/apply_professional_auth_service.rb b/app/services/users/apply_professional_auth_service.rb index 9f3057dd..2d487f3c 100644 --- a/app/services/users/apply_professional_auth_service.rb +++ b/app/services/users/apply_professional_auth_service.rb @@ -62,7 +62,7 @@ class Users::ApplyProfessionalAuthService < ApplicationService def sms_notify_admin sms_cache = Rails.cache.read('apply_pro_certification') if sms_cache.nil? - Educoder::Sms.notify_admin(send_type: 'apply_pro_certification') + Gitlink::Sms.notify_admin(send_type: 'apply_pro_certification') Rails.cache.write('apply_pro_certification', 1, expires_in: 5.minutes) end rescue => ex diff --git a/app/services/users/apply_trail_service.rb b/app/services/users/apply_trail_service.rb index 082a89c9..d058bb5d 100644 --- a/app/services/users/apply_trail_service.rb +++ b/app/services/users/apply_trail_service.rb @@ -51,7 +51,7 @@ class Users::ApplyTrailService < ApplicationService end def send_trial_apply_notify! - Educoder::Sms.notify_admin(send_type:'user_apply_auth') + Gitlink::Sms.notify_admin(send_type:'user_apply_auth') rescue => ex Rails.logger.error('发送通知管理员短信失败') Rails.logger.error(ex.message) diff --git a/app/services/users/course_service.rb b/app/services/users/course_service.rb deleted file mode 100644 index 6cc9669c..00000000 --- a/app/services/users/course_service.rb +++ /dev/null @@ -1,52 +0,0 @@ -class Users::CourseService - include CustomSortable - - sort_columns :created_at, :updated_at, default_by: :updated_at, default_direction: :desc - - attr_reader :user, :params - - def initialize(user, params) - @user = user - @params = params - end - - def call - courses = category_scope_courses.not_deleted.not_excellent - - courses = status_filter(courses) - - custom_sort(courses, params[:sort_by], params[:sort_direction]) - end - - private - - def category_scope_courses - case params[:category] - when 'study' then - user.as_student_courses.started - when 'manage' then - user.manage_courses - else - ids = user.as_student_courses.started.pluck(:id) + user.manage_courses.pluck(:id) - Course.where(id: ids) - end - end - - def status_filter(relations) - # 只有自己查看才有过滤 - return relations unless observed_logged_user? - - case params[:status] - when 'processing' then - relations.processing - when 'end' then - relations.ended - else - relations - end - end - - def observed_logged_user? - User.current.id == user.id - end -end diff --git a/app/services/users/question_bank_service.rb b/app/services/users/question_bank_service.rb deleted file mode 100644 index dbaa92e6..00000000 --- a/app/services/users/question_bank_service.rb +++ /dev/null @@ -1,99 +0,0 @@ -class Users::QuestionBankService - attr_reader :user, :params - - def initialize(user, params) - @user = user - @params = params - end - - def call - relations = class_name.classify.constantize.all - - relations = category_filter(relations) - relations = type_filter(relations) if params[:type].present? - - relations = relations.where(course_list_id: params[:course_list_id]) if params[:course_list_id].present? - - custom_sort(relations, params[:sort_by], params[:sort_direction]) - end - - def course_lists - relation_name = class_name.underscore.pluralize.to_sym - course_lists = CourseList.joins(relation_name).where.not(relation_name => { id: nil }) - - category_condition = - case params[:object_type] - when 'normal' then { homework_type: 1 } - when 'group' then { homework_type: 3 } - when 'exercise' then { container_type: 'Exercise' } - when 'poll' then { container_type: 'Poll' } - when 'gtask', 'gtopic' then {} - else raise ArgumentError - end - course_lists = course_lists.where(relation_name => category_condition) if category_condition.present? - - type_condition = - case params[:type] - when 'personal' then { user_id: user.id } - when 'publicly' then { is_public: true } - else {} - end - course_lists = course_lists.where(relation_name => type_condition) if type_condition.present? - - course_lists.distinct.select(:id, :name) - end - - private - - def class_name - @_class_name ||= begin - case params[:object_type] - when 'normal', 'group' then 'HomeworkBank' - when 'exercise', 'poll' then 'ExerciseBank' - when 'gtask' then 'GtaskBank' - when 'gtopic' then 'GtopicBank' - else raise ArgumentError - end - end - end - - def category_filter(relations) - case params[:object_type] - when 'normal' then - relations.where(homework_type: 1) - when 'group' then - relations.where(homework_type: 3) - when 'exercise' then - relations.where(container_type: 'Exercise') - when 'poll' then - relations.where(container_type: 'Poll') - when 'gtask', 'gtopic' then - relations.all - else - raise ArgumentError - end - end - - def type_filter(relations) - case params[:type] - when 'personal' then relations.where(user_id: user.id) - when 'publicly' then relations.where(is_public: true) - else relations - end - end - - def custom_sort(relations, sort_by, sort_direction) - case sort_by - when 'updated_at' then - relations.order("updated_at #{sort_direction}, id #{sort_direction}") - when 'name' then - relations.order("CONVERT(name USING gbk) COLLATE gbk_chinese_ci #{sort_direction}") - when 'contributor' then - order_sql = "CONVERT (users.lastname USING gbk) COLLATE gbk_chinese_ci #{sort_direction},"\ - " CONVERT (users.firstname USING gbk) COLLATE gbk_chinese_ci #{sort_direction}" - relations.joins(:user).where(users: { status: 1 }).order(order_sql) - else - relations - end - end -end diff --git a/app/services/users/update_account_service.rb b/app/services/users/update_account_service.rb index 8a0b1885..f8024ff1 100644 --- a/app/services/users/update_account_service.rb +++ b/app/services/users/update_account_service.rb @@ -71,7 +71,7 @@ class Users::UpdateAccountService < ApplicationService end def sms_notify_admin name - Educoder::Sms.send(mobile:'17680641960', send_type:'teacher_register', name: name, user_name:'管理员') + Gitlink::Sms.send(mobile:'17680641960', send_type:'teacher_register', name: name, user_name:'管理员') rescue => ex Util.logger_error(ex) end diff --git a/app/services/weapps/create_course_service.rb b/app/services/weapps/create_course_service.rb deleted file mode 100644 index 2e5cc5d2..00000000 --- a/app/services/weapps/create_course_service.rb +++ /dev/null @@ -1,40 +0,0 @@ -class Weapps::CreateCourseService < ApplicationService - attr_reader :course, :params - - def initialize(course, params) - @course = course - @params = params - end - - def call - Weapps::CreateCourseForm.new(form_params).validate! - - ActiveRecord::Base.transaction do - course.name = params[:name].to_s.strip - course.school_id = course.teacher&.school_id - course.is_public = 0 - course.credit = params[:credit].blank? ? nil : params[:credit] - course.end_date = params[:end_date].blank? ? nil : params[:end_date] - course_list = CourseList.find_by(name: params[:course_list_name].to_s.strip) - if course_list - course.course_list_id = course_list.id - else - new_course_list = CourseList.create!(name: params[:course_list_name].to_s.strip, user_id: course.tea_id, is_admin: 0) - course.course_list_id = new_course_list.id - end - course.is_end = course.end_date.present? && course.end_date < Date.today - - course.save! - - course.generate_invite_code - CourseMember.create!(course_id: course.id, user_id: course.tea_id, role: 1) - course.create_course_modules(params[:course_module_types]) - end - end - - private - - def form_params - params.merge(course: course) - end -end \ No newline at end of file diff --git a/app/services/weapps/update_course_service.rb b/app/services/weapps/update_course_service.rb deleted file mode 100644 index b6663bc7..00000000 --- a/app/services/weapps/update_course_service.rb +++ /dev/null @@ -1,34 +0,0 @@ -class Weapps::UpdateCourseService < ApplicationService - attr_reader :course, :params - - def initialize(course, params) - @course = course - @params = params - end - - def call - Weapps::UpdateCourseForm.new(form_params).validate! - - ActiveRecord::Base.transaction do - course.name = params[:name].to_s.strip - course.credit = params[:credit].blank? ? nil : params[:credit] - course.end_date = params[:end_date].blank? ? nil : params[:end_date] - course_list = CourseList.find_by(name: params[:course_list_name].to_s.strip) - if course_list - course.course_list_id = course_list.id - else - new_course_list = CourseList.create!(name: params[:course_list_name].to_s.strip, user_id: course.tea_id, is_admin: 0) - course.course_list_id = new_course_list.id - end - course.is_end = course.end_date.present? && course.end_date < Date.today - course.save! - end - course - end - - private - - def form_params - params.merge(course: course) - end -end \ No newline at end of file diff --git a/app/views/admins/course_lists/index.html.erb b/app/views/admins/course_lists/index.html.erb deleted file mode 100644 index cd814ed8..00000000 --- a/app/views/admins/course_lists/index.html.erb +++ /dev/null @@ -1,22 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('课程列表') %> -<% end %> - -
- <%= form_tag(admins_course_lists_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %> -
- - <% auto_trial_options = [['创建者姓名', 0], ['课程名称', 1]] %> - <%= select_tag(:search_type, options_for_select(auto_trial_options), class: 'form-control') %> -
- <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '输入关键字搜索') %> - <%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with': '搜索中...') %> - <%= link_to "清除",admins_course_lists_path,class: "btn btn-default",id:"course-lists-clear-search",'data-disable-with': '清除中...' %> - <% end %> -
- -
- <%= render partial: 'admins/course_lists/shared/list', locals: { courses: @course_lists } %> -
- -<%= render 'admins/course_lists/shared/merge_course_list_modal' %> \ No newline at end of file diff --git a/app/views/admins/course_lists/index.js.erb b/app/views/admins/course_lists/index.js.erb deleted file mode 100644 index e4bfead7..00000000 --- a/app/views/admins/course_lists/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$(".course-list-list-container").html("<%= j render partial: 'admins/course_lists/shared/list', locals: { courses: @course_lists }%>"); \ No newline at end of file diff --git a/app/views/admins/course_lists/shared/_list.html.erb b/app/views/admins/course_lists/shared/_list.html.erb deleted file mode 100644 index 228385b3..00000000 --- a/app/views/admins/course_lists/shared/_list.html.erb +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - <% if courses.present? %> - <% courses.each_with_index do |course_list,index| %> - - - - - <% course_count = course_list.courses.size %> - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号ID课程名称课堂数创建者<%= sort_tag('创建时间', name: 'created_at', path: admins_course_lists_path) %>操作
<%= list_index_no(@params_page.to_i, index) %><%= course_list.id %><%= course_list.name %><%= course_count %><%= link_to course_list.user.try(:real_name),"/users/#{course_list.user.try(:login)}",target:'_blank' %><%= format_time course_list.created_at %> - <% if course_count == 0 %> - <%= delete_link '删除', admins_course_list_path(course_list, element: ".course-list-item-#{course_list.id}"), class: 'delete-department-action' %> - <% end %> - <%= javascript_void_link '修改', class: 'action', data: { course_list_id: course_list.id, - toggle: 'modal', target: '.admin-merge-course-list-modal', url: merge_admins_course_lists_path } %> -
- -<%= render partial: 'admins/shared/paginate', locals: { objects: courses } %> \ No newline at end of file diff --git a/app/views/admins/course_lists/shared/_merge_course_list_modal.html.erb b/app/views/admins/course_lists/shared/_merge_course_list_modal.html.erb deleted file mode 100644 index 4858f537..00000000 --- a/app/views/admins/course_lists/shared/_merge_course_list_modal.html.erb +++ /dev/null @@ -1,29 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/courses/destroy.js.erb b/app/views/admins/courses/destroy.js.erb deleted file mode 100644 index 81103819..00000000 --- a/app/views/admins/courses/destroy.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -alert("删除成功"); -$(".course-item-<%= @course.id %>").find(".delete-course-action").remove(); \ No newline at end of file diff --git a/app/views/admins/courses/index.html.erb b/app/views/admins/courses/index.html.erb deleted file mode 100644 index 84ea9822..00000000 --- a/app/views/admins/courses/index.html.erb +++ /dev/null @@ -1,34 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('课堂列表') %> -<% end %> - -
- <%= form_tag(admins_courses_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %> -
- - <% status_options = [['全部', ''], ["正在进行(#{@processed_courses})", 'processing'], ["已结束#{@ended_courses}", 'ended']] %> - <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> -
- -
- - <%= select_tag :school_id, options_for_select([''], params[:school_id]), class: 'form-control school-select flex-1' %> -
- - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-12 col-md-2 mr-3', placeholder: '创建者/课堂名称/课程名称检索') %> - -
- <%= hidden_field_tag(:homepage_show, false, id:'') %> - <%= check_box_tag(:homepage_show, true, params[:homepage_show].to_s == 'true', class: 'form-check-input course-homepage-show') %> - -
- - <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> - - <% end %> - 导出 -
- -
- <%= render partial: 'admins/courses/shared/list', locals: { courses: @courses } %> -
\ No newline at end of file diff --git a/app/views/admins/courses/index.js.erb b/app/views/admins/courses/index.js.erb deleted file mode 100644 index 7073c2a8..00000000 --- a/app/views/admins/courses/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.course-list-container').html("<%= j( render partial: 'admins/courses/shared/list', locals: { courses: @courses } ) %>"); \ No newline at end of file diff --git a/app/views/admins/courses/index.xlsx.axlsx b/app/views/admins/courses/index.xlsx.axlsx deleted file mode 100644 index 7cab5448..00000000 --- a/app/views/admins/courses/index.xlsx.axlsx +++ /dev/null @@ -1,29 +0,0 @@ -wb = xlsx_package.workbook - -wb.styles do |s| - blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center} - wb.add_worksheet(name: "课堂列表") do |sheet| - sheet.add_row %w(ID 课堂名称 成员 资源 普通作业 分组作业 实训作业 试卷 评测次数 私有 状态 单位 创建者 创建时间 动态时间), :height => 25,:style => blue_cell - - @courses.each do |course| - data = [ - course.id, - course.name, - course.course_members_count, - get_attachment_count(course, 0), - course.course_homework_count(1), - course.course_homework_count(3), - course.course_homework_count(4), - course.exercises_count, - course.evaluate_count, - course.is_public == 1 ? "--" : "√", - course.is_end ? "已结束" : "正在进行", - course.school&.name, - course.teacher&.real_name, - course.created_at&.strftime('%Y-%m-%d %H:%M'), - course.max_activity_time ? course.max_activity_time&.strftime('%Y-%m-%d %H:%M') : "--" - ] - sheet.add_row(data) - end - end -end diff --git a/app/views/admins/courses/shared/_import_course_member_modal.html.erb b/app/views/admins/courses/shared/_import_course_member_modal.html.erb deleted file mode 100644 index d52a60b0..00000000 --- a/app/views/admins/courses/shared/_import_course_member_modal.html.erb +++ /dev/null @@ -1,30 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/courses/shared/_list.html.erb b/app/views/admins/courses/shared/_list.html.erb deleted file mode 100644 index 4105c815..00000000 --- a/app/views/admins/courses/shared/_list.html.erb +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - <% if courses.present? %> - <% courses.each_with_index do |course, index| %> - - <%= render partial: 'admins/courses/shared/td', locals: {course: course, no: index} %> - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号ID课堂名称成员资源普通作业分组作业实训作业试卷评测次数私有状态单位创建者<%= sort_tag('创建时间', name: 'created_at', path: admins_courses_path) %>首页邮件通知操作
- -<%= render partial: 'admins/shared/paginate', locals: { objects: courses } %> \ No newline at end of file diff --git a/app/views/admins/courses/shared/_td.html.erb b/app/views/admins/courses/shared/_td.html.erb deleted file mode 100644 index 51cc4b19..00000000 --- a/app/views/admins/courses/shared/_td.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -<%= list_index_no((params[:page] || 1).to_i, no) %> -<%= course.id %> - - <%= link_to(course.name, "/courses/#{course.id}", target: '_blank') %> - -<%= course.course_members_count %> -<%= get_attachment_count(course, 0) %> -<%= course.course_homework_count(1) %> -<%= course.course_homework_count(3) %> -<%= course.course_homework_count(4) %> -<%= course.exercises_count %> -<%= course.evaluate_count %> -<%= course.is_public == 1 ? "--" : "√" %> -<%= course.is_end ? "已结束" : "正在进行" %> -<%= course.school&.name %> -<%= course.teacher&.real_name %> -<%= course.created_at&.strftime('%Y-%m-%d %H:%M') %> - - <%= check_box_tag :homepage_show,!course.homepage_show,course.homepage_show,remote:true,data:{id:course.id},class:"course-setting-form" %> - - - <%= check_box_tag :email_notify,!course.email_notify,course.email_notify,remote:true,data:{id:course.id},class:"course-setting-form" %> - - - <% if course.is_delete == 0 %> - <%= delete_link '删除', admins_course_path(course, element: ".course-item-#{course.id}"), class: 'delete-course-action' %> - <% end %> - \ No newline at end of file diff --git a/app/views/admins/courses/update.js.erb b/app/views/admins/courses/update.js.erb deleted file mode 100644 index 983ac22f..00000000 --- a/app/views/admins/courses/update.js.erb +++ /dev/null @@ -1,3 +0,0 @@ -var index = $("#course-item-<%= @course.id %>").children(":first").html(); -$("#course-item-<%= @course.id %>").html("<%= j render partial: "admins/courses/shared/td",locals: {course: @course, no: 1} %>"); -$("#course-item-<%= @course.id %>").children(":first").html(index); \ No newline at end of file diff --git a/app/views/admins/customers/index.html.erb b/app/views/admins/customers/index.html.erb deleted file mode 100644 index b93a5c1e..00000000 --- a/app/views/admins/customers/index.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('合作伙伴', admins_partners_path) %> - <% add_admin_breadcrumb(current_partner.school&.name || current_partner.name) %> -<% end %> - -
- <%= form_tag(admins_partner_customers_path(current_partner), method: :get, class: 'form-inline search-form', remote: true) do %> - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-md-4 ml-3', placeholder: '客户名称检索') %> - <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> - <% end %> - - <%= javascript_void_link('添加', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-select-school-modal' }) %> -
- -
- <%= render 'admins/customers/shared/list', customers: @customers %> -
- -<%= render partial: 'admins/shared/modal/select_school_modal', locals: { title: '添加客户', multiple: true, url: admins_partner_customers_path(current_partner) } %> \ No newline at end of file diff --git a/app/views/admins/customers/index.js.erb b/app/views/admins/customers/index.js.erb deleted file mode 100644 index 8fa2e205..00000000 --- a/app/views/admins/customers/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.customer-list-container').html("<%= j(render partial: 'admins/customers/shared/list', locals: { customers: @customers }) %>"); \ No newline at end of file diff --git a/app/views/admins/customers/shared/_list.html.erb b/app/views/admins/customers/shared/_list.html.erb deleted file mode 100644 index 6f84db4e..00000000 --- a/app/views/admins/customers/shared/_list.html.erb +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - <% if customers.present? %> - <% customers.each_with_index do |customer, index| %> - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号客户名称<%= sort_tag('添加时间', name: 'created_at', path: admins_partner_customers_path(current_partner)) %>操作
<%= list_index_no((params[:page] || 1).to_i, index) %><%= customer.school&.name %><%= customer.created_at&.strftime('%Y-%m-%d %H:%M') %> - <%= delete_link '删除', admins_partner_customer_path(current_partner, customer, element: ".customer-item-#{customer.id}"), class: 'delete-customer-action' %> -
- -<%= render partial: 'admins/shared/paginate', locals: { objects: customers } %> \ No newline at end of file diff --git a/app/views/admins/daily_school_statistics/export.xlsx.axlsx b/app/views/admins/daily_school_statistics/export.xlsx.axlsx deleted file mode 100644 index 1757a8fe..00000000 --- a/app/views/admins/daily_school_statistics/export.xlsx.axlsx +++ /dev/null @@ -1,13 +0,0 @@ -wb = xlsx_package.workbook -wb.add_worksheet(name: '统计总表') do |sheet| - sheet.add_row %w(ID 单位名称 教师总人数 学生总人数 课堂总数 正在进行课堂数 总实训数 实训评测总数 实训作业总数 其它作业总数 动态时间) - - @schools.each do |school| - sheet.add_row([ - school[:id].to_s, school[:name].to_s, (school[:teacher_count] || 0).to_s, (school[:student_count] || 0).to_s, - (school[:course_count] || 0).to_s, (school[:active_course_count] || 0).to_s, - (school[:shixun_count] || 0).to_s,(school[:shixun_evaluate_count] || 0).to_s, (school[:homework_count] || 0).to_s, - (school[:other_homework_count] || 0).to_s, format_time(school[:nearly_course_time]) - ]) - end -end \ No newline at end of file diff --git a/app/views/admins/daily_school_statistics/index.html.erb b/app/views/admins/daily_school_statistics/index.html.erb deleted file mode 100644 index c3eb4369..00000000 --- a/app/views/admins/daily_school_statistics/index.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('统计总表', admins_daily_school_statistics_path) %> -<% end %> - -
- <%= form_tag(admins_daily_school_statistics_path, method: :get, class: 'form-inline search-form', remote: true) do %> - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: 'ID/单位名称搜索') %> - <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> - <% end %> - - <%#= link_to '导出Excel', export_admins_daily_school_statistics_path(format: :xlsx), class: 'btn btn-outline-primary export-action' %> - <%= javascript_void_link '导出Excel', class: 'btn btn-outline-primary export-action', 'data-url': export_admins_daily_school_statistics_path(format: :xlsx) %> -
- -
- 统计总计: - 教师总人数<%= @teacher_total %>人, - 学生总人数<%= @student_total %>人, - 课堂总数<%= @course_total %>个, - 正在进行课堂总数<%= @active_course_total %>个, - 实训总数<%= @shixun_total %>个, - 实训评测总数<%= @shixun_evaluate_total %>个, - 实训作业总数<%= @shixun_homework_total %>个, - 其它作业总数<%= @other_homework_total %>个 -
- -
- <%= render partial: 'admins/daily_school_statistics/shared/list', locals: { statistics: @statistics } %> -
\ No newline at end of file diff --git a/app/views/admins/daily_school_statistics/index.js.erb b/app/views/admins/daily_school_statistics/index.js.erb deleted file mode 100644 index d3e261f6..00000000 --- a/app/views/admins/daily_school_statistics/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$(".daily-school-statistic-list-container").html("<%= j(render partial: 'admins/daily_school_statistics/shared/list', locals: { statistics: @statistics }) %>") \ No newline at end of file diff --git a/app/views/admins/daily_school_statistics/shared/_list.html.erb b/app/views/admins/daily_school_statistics/shared/_list.html.erb deleted file mode 100644 index 6982891e..00000000 --- a/app/views/admins/daily_school_statistics/shared/_list.html.erb +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - <% if statistics.present? %> - <% statistics.each_with_index do |statistic, index| %> - - - - - - - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号单位名称<%= sort_tag('教师总数', name: 'teacher_count', path: admins_daily_school_statistics_path) %><%= sort_tag('学生总数', name: 'student_count', path: admins_daily_school_statistics_path) %><%= sort_tag('课堂总数', name: 'course_count', path: admins_daily_school_statistics_path) %><%= sort_tag('正在进行课堂数', name: 'active_course_count', path: admins_daily_school_statistics_path) %><%= sort_tag('实训总数', name: 'shixun_count', path: admins_daily_school_statistics_path) %> - <%= sort_tag(name: 'shixun_evaluate_count', path: admins_daily_school_statistics_path) do %> - 实训评测总数 - - <% end %> - <%= sort_tag('实训作业总数', name: 'homework_count', path: admins_daily_school_statistics_path) %><%= sort_tag('其它作业总数', name: 'other_homework_count', path: admins_daily_school_statistics_path) %><%= sort_tag('动态时间', name: 'nearly_course_time', path: admins_daily_school_statistics_path) %>
<%= list_index_no(@params_page.to_i, index) %> - <%= link_to statistic[:name], "/colleges/#{statistic[:id]}/statistics", - target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %> - <%= statistic[:teacher_count].to_i %><%= statistic[:student_count].to_i %><%= statistic[:course_count].to_i %><%= statistic[:active_course_count].to_i %><%= statistic[:shixun_count].to_i %><%= statistic[:shixun_evaluate_count].to_i %><%= statistic[:homework_count].to_i %><%= statistic[:other_homework_count].to_i %><%= statistic[:nearly_course_time]&.strftime('%Y-%m-%d %H:%M') %>
- -<%= render partial: 'admins/shared/paginate', locals: { objects: statistics } %> \ No newline at end of file diff --git a/app/views/admins/department_applies/index.html.erb b/app/views/admins/department_applies/index.html.erb deleted file mode 100644 index 8a8a41e4..00000000 --- a/app/views/admins/department_applies/index.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('部门审批') %> -<% end %> - -
- <%= form_tag(admins_department_applies_path(unsafe_params), method: :get, class: 'form-inline search-form mt-3', remote: true) do %> - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '部门名称检索') %> - <%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with':"搜索中...") %> - <%= link_to "清除",admins_department_applies_path(keyword:nil),class:"btn btn-default",remote:true %> - <% end %> -
- -
- <%= render(partial: 'admins/department_applies/shared/list', locals: { applies: @depart_applies }) %> -
- -<%= render(partial: 'admins/shared/admin_common_refuse_modal') %> -<%= render 'admins/departments/shared/merge_department_modal' %> \ No newline at end of file diff --git a/app/views/admins/department_applies/index.js.erb b/app/views/admins/department_applies/index.js.erb deleted file mode 100644 index 8e11b834..00000000 --- a/app/views/admins/department_applies/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$(".department-applies-list-container").html("<%= j render partial: "admins/department_applies/shared/list",locals: {applies:@depart_applies} %>") \ No newline at end of file diff --git a/app/views/admins/department_applies/shared/_list.html.erb b/app/views/admins/department_applies/shared/_list.html.erb deleted file mode 100644 index 87d5ab66..00000000 --- a/app/views/admins/department_applies/shared/_list.html.erb +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - <% if applies.present? %> - <% applies.each_with_index do |apply, index| %> - - - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号ID部门名称单位名称创建者<%= sort_tag('创建于', name: 'created_at', path: admins_department_applies_path) %>操作
<%= list_index_no((params[:page] || 1).to_i, index) %><%= apply.id %> <%= apply.name %> <%= apply.school.try(:name) %><%= apply&.user&.real_name %><%= format_time apply.created_at %> - <%= agree_link '批准', agree_admins_department_apply_path(apply, element: ".department-apply-#{apply.id}"), 'data-confirm': '确认批准通过?' %> - <%= javascript_void_link('删除', class: 'action refuse-action', - data: { - toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, title: "删除原因", type: "delete", - url: admins_department_apply_path(apply,tip:"unapplied", element: ".department-apply-#{apply.id}") - }) %> - <%= javascript_void_link '更改', class: 'action', data: { school_id: apply.school_id, department_id: apply.id, - toggle: 'modal', target: '.admin-merge-department-modal', url: merge_admins_department_applies_path } %> -
- -<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %> \ No newline at end of file diff --git a/app/views/admins/department_members/create.js.erb b/app/views/admins/department_members/create.js.erb deleted file mode 100644 index 6bf0a6ac..00000000 --- a/app/views/admins/department_members/create.js.erb +++ /dev/null @@ -1,6 +0,0 @@ -$('.modal.admin-add-department-member-modal').modal('hide'); -$.notify({ message: '操作成功' }); - -var index = $(".department-item-<%= current_department.id %>").children(":first").html(); -$('.department-list-table .department-item-<%= current_department.id %>').html("<%= j(render partial: 'admins/departments/shared/department_item', locals: { department: current_department, index: 1 }) %>"); -$(".department-item-<%= current_department.id %>").children(":first").html(index); \ No newline at end of file diff --git a/app/views/admins/department_members/destroy.js.erb b/app/views/admins/department_members/destroy.js.erb deleted file mode 100644 index d3eb3755..00000000 --- a/app/views/admins/department_members/destroy.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$.notify({ message: '操作成功' }); -$('.department-list-container .department-item-<%= current_department.id %> .member-user-item-<%= @member.user_id %>').remove(); \ No newline at end of file diff --git a/app/views/admins/departments/edit.js.erb b/app/views/admins/departments/edit.js.erb deleted file mode 100644 index dc86d3ae..00000000 --- a/app/views/admins/departments/edit.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('.admin-modal-container').html("<%= j( render partial: 'admins/departments/shared/edit_department_modal', locals: { department: current_department } ) %>"); -$('.modal.admin-edit-department-modal').modal('show'); \ No newline at end of file diff --git a/app/views/admins/departments/index.html.erb b/app/views/admins/departments/index.html.erb deleted file mode 100644 index b1a0fee3..00000000 --- a/app/views/admins/departments/index.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('部门列表') %> -<% end %> - -
- <%= form_tag(admins_departments_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %> -
- <%= hidden_field_tag(:with_member, false,id:'') %> - <%= check_box_tag(:with_member, true, params[:with_member].to_s == 'true', class: 'form-check-input') %> - -
- -
- <%= hidden_field_tag(:with_identifier, false,id:'') %> - <%= check_box_tag(:with_identifier, true, params[:with_identifier].to_s == 'true', class: 'form-check-input') %> - -
- - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '部门/单位名称检索') %> - <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> - <% end %> - - <%= javascript_void_link '新建部门', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-department-modal' } %> -
- -
- <%= render partial: 'admins/departments/shared/list', - locals: { departments: @departments, users_count: @users_count, professional_auth_count: @professional_auth_count } %> -
- -<%= render 'admins/departments/shared/create_department_modal' %> -<%= render 'admins/departments/shared/add_department_member_modal' %> -<%= render 'admins/departments/shared/merge_department_modal' %> \ No newline at end of file diff --git a/app/views/admins/departments/index.js.erb b/app/views/admins/departments/index.js.erb deleted file mode 100644 index bd2e4b25..00000000 --- a/app/views/admins/departments/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.department-list-container').html("<%= j(render partial: 'admins/departments/shared/list', locals: { departments: @departments, users_count: @users_count, professional_auth_count: @professional_auth_count }) %>"); \ No newline at end of file diff --git a/app/views/admins/departments/shared/_add_department_member_modal.html.erb b/app/views/admins/departments/shared/_add_department_member_modal.html.erb deleted file mode 100644 index 5d270722..00000000 --- a/app/views/admins/departments/shared/_add_department_member_modal.html.erb +++ /dev/null @@ -1,30 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/departments/shared/_create_department_modal.html.erb b/app/views/admins/departments/shared/_create_department_modal.html.erb deleted file mode 100644 index ae6605eb..00000000 --- a/app/views/admins/departments/shared/_create_department_modal.html.erb +++ /dev/null @@ -1,35 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/departments/shared/_department_item.html.erb b/app/views/admins/departments/shared/_department_item.html.erb deleted file mode 100644 index 6018686f..00000000 --- a/app/views/admins/departments/shared/_department_item.html.erb +++ /dev/null @@ -1,36 +0,0 @@ -<%= list_index_no((params[:page] || 1).to_i, index) %> -<% not_list = defined?(:users_count) %> - -<%= overflow_hidden_span department.name, width: 150 %> -<%= overflow_hidden_span department.school.name, width: 150 %> - -<% if not_list %> - <%= department.user_extensions.count %> - <%= department.user_extensions.joins(:user).where(users: { professional_certification: true }).count %> -<% else %> - <%= users_count.fetch(department.id, 0) %> - <%= professional_auth_count.fetch(department.id, 0) %> -<% end %> - - - <%= render partial: 'admins/departments/shared/member_users', locals: { department: department } %> - - - <% if department.identifier.present? %> - <%= link_to department.identifier.to_s, "/colleges/#{department.identifier}/statistics", target: '_blank' %> - <% else %> - -- - <% end %> - -<%= department.host_count %> -<%= department.created_at&.strftime('%Y-%m-%d %H:%M') %> - - <%= link_to '编辑', edit_admins_department_path(department), remote: true, class: 'action' %> - - <%= javascript_void_link '添加管理员', class: 'action', data: { department_id: department.id, toggle: 'modal', target: '.admin-add-department-member-modal' } %> - - <%= javascript_void_link '更改', class: 'action', data: { school_id: department.school_id, department_id: department.id, - toggle: 'modal', target: '.admin-merge-department-modal', url: merge_admins_departments_path } %> - - <%= delete_link '删除', admins_department_path(department, element: ".department-item-#{department.id}"), class: 'delete-department-action' %> - \ No newline at end of file diff --git a/app/views/admins/departments/shared/_edit_department_modal.html.erb b/app/views/admins/departments/shared/_edit_department_modal.html.erb deleted file mode 100644 index 38b43bbc..00000000 --- a/app/views/admins/departments/shared/_edit_department_modal.html.erb +++ /dev/null @@ -1,25 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/departments/shared/_list.html.erb b/app/views/admins/departments/shared/_list.html.erb deleted file mode 100644 index 09ba2a65..00000000 --- a/app/views/admins/departments/shared/_list.html.erb +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - <% if departments.present? %> - <% departments.each_with_index do |department, index| %> - - <%= render partial: 'admins/departments/shared/department_item', locals: {department: department, index: index} %> - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号部门名称单位名称用户数已职业认证部门管理员统计链接云主机数<%= sort_tag('创建时间', name: 'created_at', path: admins_departments_path) %>操作
- -<%= render partial: 'admins/shared/paginate', locals: { objects: departments } %> \ No newline at end of file diff --git a/app/views/admins/departments/shared/_member_users.html.erb b/app/views/admins/departments/shared/_member_users.html.erb deleted file mode 100644 index 8d4d466d..00000000 --- a/app/views/admins/departments/shared/_member_users.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -
- <% department.member_users.each do |user| %> - - <%= link_to user.real_name, "/users/#{user.login}", target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } %> - <%= link_to(admins_department_department_member_path(department, user_id: user.id), - method: :delete, remote: true, class: 'ml-1 delete-member-action', - data: { confirm: '确认删除吗?' }) do %> - - <% end %> - - <% end %> -
\ No newline at end of file diff --git a/app/views/admins/departments/shared/_merge_department_modal.html.erb b/app/views/admins/departments/shared/_merge_department_modal.html.erb deleted file mode 100644 index 5c1ca689..00000000 --- a/app/views/admins/departments/shared/_merge_department_modal.html.erb +++ /dev/null @@ -1,30 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/departments/update.js.erb b/app/views/admins/departments/update.js.erb deleted file mode 100644 index d20ca952..00000000 --- a/app/views/admins/departments/update.js.erb +++ /dev/null @@ -1,6 +0,0 @@ -$('.modal.admin-edit-department-modal').modal('hide'); -$.notify({ message: '操作成功' }); - -var index = $(".department-item-<%= current_department.id %>").children(":first").html(); -$('.department-list-table .department-item-<%= current_department.id %>').html("<%= j(render partial: 'admins/departments/shared/department_item', locals: {department: current_department, index: 1}) %>"); -$(".department-item-<%= current_department.id %>").children(":first").html(index); \ No newline at end of file diff --git a/app/views/admins/disciplines/adjust_position.js.erb b/app/views/admins/disciplines/adjust_position.js.erb deleted file mode 100644 index a0928056..00000000 --- a/app/views/admins/disciplines/adjust_position.js.erb +++ /dev/null @@ -1,5 +0,0 @@ -<% if @message.present? %> -$.notify({ message: "<%= @message %>" }); -<% else %> -$(".discipline-list-container").html("<%= j(render :partial => 'admins/disciplines/shared/list') %>"); -<% end %> \ No newline at end of file diff --git a/app/views/admins/disciplines/destroy.js.erb b/app/views/admins/disciplines/destroy.js.erb deleted file mode 100644 index ea9aedcd..00000000 --- a/app/views/admins/disciplines/destroy.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$.notify({ message: '删除成功' }); -$(".discipline-item-<%= @discipline_id %>").remove(); \ No newline at end of file diff --git a/app/views/admins/disciplines/edit.js.erb b/app/views/admins/disciplines/edit.js.erb deleted file mode 100644 index 48c5b789..00000000 --- a/app/views/admins/disciplines/edit.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('.admin-modal-container').html("<%= j( render partial: 'admins/disciplines/shared/edit_discipline_modal', locals: { discipline: @discipline } ) %>"); -$('.modal.admin-edit-discipline-modal').modal('show'); \ No newline at end of file diff --git a/app/views/admins/disciplines/index.html.erb b/app/views/admins/disciplines/index.html.erb deleted file mode 100644 index f4b116b9..00000000 --- a/app/views/admins/disciplines/index.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('课程方向', admins_disciplines_path) %> -<% end %> - -
-
- <%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-discipline-modal' } %> -
- <%= javascript_void_link '导入数据', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-import-discipline-modal'} %> -
- -
- <%= render(partial: 'admins/disciplines/shared/list') %> -
- -<%= render 'admins/disciplines/shared/create_discipline_modal' %> -<%= render partial: 'admins/disciplines/shared/import_discipline_modal' %> diff --git a/app/views/admins/disciplines/shared/_create_discipline_modal.html.erb b/app/views/admins/disciplines/shared/_create_discipline_modal.html.erb deleted file mode 100644 index 7eb5d898..00000000 --- a/app/views/admins/disciplines/shared/_create_discipline_modal.html.erb +++ /dev/null @@ -1,28 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/disciplines/shared/_edit_discipline_modal.html.erb b/app/views/admins/disciplines/shared/_edit_discipline_modal.html.erb deleted file mode 100644 index ce511e27..00000000 --- a/app/views/admins/disciplines/shared/_edit_discipline_modal.html.erb +++ /dev/null @@ -1,23 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/disciplines/shared/_import_discipline_modal.html.erb b/app/views/admins/disciplines/shared/_import_discipline_modal.html.erb deleted file mode 100644 index de54fd75..00000000 --- a/app/views/admins/disciplines/shared/_import_discipline_modal.html.erb +++ /dev/null @@ -1,30 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/disciplines/shared/_list.html.erb b/app/views/admins/disciplines/shared/_list.html.erb deleted file mode 100644 index 38cbe8c9..00000000 --- a/app/views/admins/disciplines/shared/_list.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<% max_position = @disciplines.pluck(:position).max %> - - - - - - - - - - - - - <% if @disciplines.present? %> - <% @disciplines.each do |discipline| %> - - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号课程方向实践课程实训题库操作
<%= discipline.position %> - <%= link_to discipline.name, admins_sub_disciplines_path(discipline_id: discipline), :title => discipline.name %> - <%= check_box_tag :subject,!discipline.subject,discipline.subject,remote:true,data:{id:discipline.id},class:"discipline-source-form" %><%= check_box_tag :shixun,!discipline.shixun,discipline.shixun,remote:true,data:{id:discipline.id},class:"discipline-source-form" %><%= check_box_tag :question,!discipline.question,discipline.question,remote:true,data:{id:discipline.id},class:"discipline-source-form" %> - <%= javascript_void_link('上移', class: 'move-action', data: { id: discipline.id, opr: "up" }, style: discipline.position == 1 ? 'display:none' : '') %> - <%= javascript_void_link('下移', class: 'move-action', data: { id: discipline.id, opr: "down" }, style: discipline.position == max_position ? 'display:none' : '') %> - - <%= link_to '编辑', edit_admins_discipline_path(discipline), remote: true, class: 'action' %> - <%= delete_link '删除', admins_discipline_path(discipline, element: ".discipline-item-#{discipline.id}"), class: 'delete-discipline-action' %> -
\ No newline at end of file diff --git a/app/views/admins/disciplines/update.js.erb b/app/views/admins/disciplines/update.js.erb deleted file mode 100644 index 0c051e1d..00000000 --- a/app/views/admins/disciplines/update.js.erb +++ /dev/null @@ -1,6 +0,0 @@ -<% if @message.present? %> -$.notify({ message: "<%= @message %>" }); -<% else %> -$('.modal.admin-edit-discipline-modal').modal("hide"); -$(".discipline-list-container").html("<%= j(render :partial => 'admins/disciplines/shared/list') %>"); -<% end %> \ No newline at end of file diff --git a/app/views/admins/examination_authentications/index.html.erb b/app/views/admins/examination_authentications/index.html.erb deleted file mode 100644 index c360a7a1..00000000 --- a/app/views/admins/examination_authentications/index.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('试卷审批') %> -<% end %> - -
- - - <%= form_tag(admins_examination_authentications_path(unsafe_params), method: :get, class: 'form-inline search-form justify-content-end mt-3', remote: true) do %> -
- - <% status_options = [['全部', 'processed'], ['已同意', 'agreed'], ['已拒绝', 'refused']] %> - <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> -
- <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '姓名/学校/单位检索') %> - <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> - <% end %> -
- -
- <%= render(partial: 'admins/examination_authentications/shared/list', locals: { applies: @applies }) %> -
\ No newline at end of file diff --git a/app/views/admins/examination_authentications/index.js.erb b/app/views/admins/examination_authentications/index.js.erb deleted file mode 100644 index 361059e7..00000000 --- a/app/views/admins/examination_authentications/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.examination-authentication-list-container').html("<%= j( render partial: 'admins/examination_authentications/shared/list', locals: { applies: @applies } ) %>"); \ No newline at end of file diff --git a/app/views/admins/examination_authentications/shared/_item_show_modal.html.erb b/app/views/admins/examination_authentications/shared/_item_show_modal.html.erb deleted file mode 100644 index 9a1c891f..00000000 --- a/app/views/admins/examination_authentications/shared/_item_show_modal.html.erb +++ /dev/null @@ -1,35 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/examination_authentications/shared/_list.html.erb b/app/views/admins/examination_authentications/shared/_list.html.erb deleted file mode 100644 index a751a7fa..00000000 --- a/app/views/admins/examination_authentications/shared/_list.html.erb +++ /dev/null @@ -1,54 +0,0 @@ -<% is_processed = params[:status].to_s != 'pending' %> - - - - - - - - - - <% if !is_processed %> - - <% else %> - - <% end %> - - - - <% if applies.present? %> - <% applies.each_with_index do |apply, index| %> - <% user = apply.user %> - <% exam = ExaminationBank.find apply.container_id %> - - - - - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号头像创建者学校试卷提交时间操作审批结果
<%= list_index_no((params[:page] || 1).to_i, index) %> - <%= link_to "/users/#{user.login}", class: 'examination-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %> - - <% end %> - <%= user.real_name %><%= raw [user.school_name.presence, user.department_name.presence].compact.join('
') %>
- <%= link_to exam.name, "/paperlibrary/see/#{exam.id}", target: "_blank" %> - <%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %> - <% if !is_processed %> - <%= agree_link '同意', agree_admins_examination_authentication_path(apply, element: ".examination-authentication-#{apply.id}"), 'data-confirm': '确认同意该审批?', 'data-disable-with': "提交中..." %> - <%= agree_link '拒绝', refuse_admins_examination_authentication_path(apply, element: ".examination-authentication-#{apply.id}"), 'data-confirm': '确认拒绝该审批?', 'data-disable-with': "拒绝中..." %> - <% else %> - <%= apply.status_text %> - <% end %> -
- -<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %> \ No newline at end of file diff --git a/app/views/admins/examination_authentications/show.js.erb b/app/views/admins/examination_authentications/show.js.erb deleted file mode 100644 index 70e44404..00000000 --- a/app/views/admins/examination_authentications/show.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('.admin-modal-container').html("<%= j( render partial: 'admins/item_authentications/shared/item_show_modal', locals: { item: @item } ) %>"); -$('.modal.admin-item-show-modal').modal('show'); \ No newline at end of file diff --git a/app/views/admins/laboratory_settings/show.html.erb b/app/views/admins/laboratory_settings/show.html.erb index 735f19f0..f30e92b8 100644 --- a/app/views/admins/laboratory_settings/show.html.erb +++ b/app/views/admins/laboratory_settings/show.html.erb @@ -21,7 +21,7 @@ style: 'text-transform:lowercase'%>
<% rails_env = EduSetting.get('rails_env') %> - <%= rails_env && rails_env != 'production' ? ".#{rails_env}.educoder.net" : '.educoder.net' %> + <%= rails_env && rails_env != 'production' ? ".#{rails_env}.gitlink.org.cn" : '.gitlink.org.cn' %>
<%# if @laboratory.errors && @laboratory.errors.key?(:identifier) %> diff --git a/app/views/admins/laboratory_shixuns/index.html.erb b/app/views/admins/laboratory_shixuns/index.html.erb deleted file mode 100644 index c91ddc60..00000000 --- a/app/views/admins/laboratory_shixuns/index.html.erb +++ /dev/null @@ -1,45 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('云上实验室', admins_laboratories_path) %> - <% add_admin_breadcrumb("#{current_laboratory.name} - 实训项目") %> -<% end %> - - -
- <%= form_tag(admins_laboratory_laboratory_shixuns_path(current_laboratory), method: :get, class: 'form-inline search-form', remote: true) do %> -
- - <% status_options = [['全部', ''], ['编辑中', 0], ['审核中', 1], ['已发布', 2], ['已关闭', 3]] %> - <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> -
- -
- - <%= select_tag(:tag_id, options_for_select(MirrorRepository.pluck(:type_name,:id).unshift(['']), params[:tag_id]), class: 'form-control') %> -
- - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-12 col-md-2 mr-3', placeholder: '创建者/实训名称检索') %> - -
- <%= hidden_field_tag(:homepage, false, id:'') %> - <%= check_box_tag(:homepage, true, params[:homepage].to_s == 'true', class: 'form-check-input') %> - -
- -
- <%= hidden_field_tag(:ownership, false, id:'') %> - <%= check_box_tag(:ownership, true, params[:ownership].to_s == 'true', class: 'form-check-input') %> - -
- - <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> - <%= link_to '清空', admins_laboratory_laboratory_shixuns_path(current_laboratory), class: 'btn btn-default','data-disable-with': '清空中...' %> - <% end %> - - <%= javascript_void_link('添加实训', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-add-laboratory-shixun-modal' }) %> -
- -
- <%= render partial: 'admins/laboratory_shixuns/shared/list', locals: { laboratory_shixuns: @laboratory_shixuns } %> -
- -<%= render partial: 'admins/laboratory_shixuns/shared/add_laboratory_shixun_modal' %> \ No newline at end of file diff --git a/app/views/admins/laboratory_shixuns/index.js.erb b/app/views/admins/laboratory_shixuns/index.js.erb deleted file mode 100644 index 0a51afa2..00000000 --- a/app/views/admins/laboratory_shixuns/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.laboratory-shixun-list-container').html("<%= j(render partial: 'admins/laboratory_shixuns/shared/list', locals: { laboratory_shixuns: @laboratory_shixuns }) %>"); \ No newline at end of file diff --git a/app/views/admins/laboratory_shixuns/shared/_add_laboratory_shixun_modal.html.erb b/app/views/admins/laboratory_shixuns/shared/_add_laboratory_shixun_modal.html.erb deleted file mode 100644 index 56d01d66..00000000 --- a/app/views/admins/laboratory_shixuns/shared/_add_laboratory_shixun_modal.html.erb +++ /dev/null @@ -1,28 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/laboratory_shixuns/shared/_list.html.erb b/app/views/admins/laboratory_shixuns/shared/_list.html.erb deleted file mode 100644 index 462486f4..00000000 --- a/app/views/admins/laboratory_shixuns/shared/_list.html.erb +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - <% if laboratory_shixuns.present? %> - <% laboratory_shixuns.each_with_index do |laboratory_shixun, index| %> - - <%= render partial: 'admins/laboratory_shixuns/shared/td', locals: { laboratory_shixun: laboratory_shixun, index: index } %> - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号实训名称技术平台技术体系封面创建者状态执行时间操作
- -<%= render partial: 'admins/shared/paginate', locals: { objects: laboratory_shixuns } %> \ No newline at end of file diff --git a/app/views/admins/laboratory_shixuns/shared/_td.html.erb b/app/views/admins/laboratory_shixuns/shared/_td.html.erb deleted file mode 100644 index d987b53b..00000000 --- a/app/views/admins/laboratory_shixuns/shared/_td.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -<%- shixun = laboratory_shixun.shixun -%> - -<%= list_index_no((params[:page] || 1).to_i, index) %> - - <%= link_to "/shixuns/#{shixun.identifier}", target: '_blank' do %> - <%= shixun.name %> - 首页 - 自建 - <% end %> - -<%= shixun.shixun_main_name %> - - <% shixun.tag_repertoires.each do |tag| %> - <%= tag.name %> - <% end %> - - - <% imageExists = Util::FileManage.exists?(shixun) %> - <% imageUrl = imageExists ? '/' + url_to_avatar(shixun) : '' %> - <%= image_tag(imageUrl, width: 60, height: 40, class: "preview-image shixun-image-#{shixun.id}", data: { toggle: 'tooltip', title: '点击预览' }, style: imageExists ? '' : 'display:none') %> - -<%= link_to shixun.user&.real_name, "/users/#{shixun.user&.login}", target:'_blank' %> -<%= t("shixun.status.#{shixun.status}") %> -<%= shixun.excute_time %> - - <%= link_to('去修改', admins_shixun_settings_path(id: laboratory_shixun.shixun_id)) %> - <%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? 'display:none' : '') %> - <%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? '' : 'display:none') %> - - <% unless laboratory_shixun.ownership? %> - <%= delete_link '删除', admins_laboratory_laboratory_shixun_path(current_laboratory, laboratory_shixun, element: ".laboratory-shixun-item-#{laboratory_shixun.id}") %> - <% end %> - \ No newline at end of file diff --git a/app/views/admins/laboratory_subjects/index.html.erb b/app/views/admins/laboratory_subjects/index.html.erb deleted file mode 100644 index 211bf24f..00000000 --- a/app/views/admins/laboratory_subjects/index.html.erb +++ /dev/null @@ -1,45 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('云上实验室', admins_laboratories_path) %> - <% add_admin_breadcrumb("#{current_laboratory.name} - 实践课程") %> -<% end %> - - -
- <%= form_tag(admins_laboratory_laboratory_subjects_path(current_laboratory), method: :get, class: 'form-inline search-form', remote: true) do %> -
- - <% status_options = [['全部', ''], ['编辑中', 0], ['审核中', 1], ['已发布', 2]] %> - <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> -
- -
- - <%= select_tag :school_id, options_for_select([''], params[:school_id]), class: 'form-control school-select flex-1' %> -
- - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-12 col-md-2 mr-3', placeholder: '创建者/课程名称检索') %> - -
- <%= hidden_field_tag(:homepage, false, id:'') %> - <%= check_box_tag(:homepage, true, params[:homepage].to_s == 'true', class: 'form-check-input') %> - -
- -
- <%= hidden_field_tag(:ownership, false, id:'') %> - <%= check_box_tag(:ownership, true, params[:ownership].to_s == 'true', class: 'form-check-input') %> - -
- - <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> - <%= link_to '清空', admins_laboratory_laboratory_subjects_path(current_laboratory), class: 'btn btn-default','data-disable-with': '清空中...' %> - <% end %> - - <%= javascript_void_link('添加课程', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-add-laboratory-subject-modal' }) %> -
- -
- <%= render partial: 'admins/laboratory_subjects/shared/list', locals: { laboratory_subjects: @laboratory_subjects } %> -
- -<%= render partial: 'admins/laboratory_subjects/shared/add_laboratory_subject_modal' %> \ No newline at end of file diff --git a/app/views/admins/laboratory_subjects/index.js.erb b/app/views/admins/laboratory_subjects/index.js.erb deleted file mode 100644 index 3ebc1286..00000000 --- a/app/views/admins/laboratory_subjects/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.laboratory-subject-list-container').html("<%= j(render partial: 'admins/laboratory_subjects/shared/list', locals: { laboratory_subjects: @laboratory_subjects }) %>"); \ No newline at end of file diff --git a/app/views/admins/laboratory_subjects/shared/_add_laboratory_subject_modal.html.erb b/app/views/admins/laboratory_subjects/shared/_add_laboratory_subject_modal.html.erb deleted file mode 100644 index 63ab3fdf..00000000 --- a/app/views/admins/laboratory_subjects/shared/_add_laboratory_subject_modal.html.erb +++ /dev/null @@ -1,28 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/laboratory_subjects/shared/_list.html.erb b/app/views/admins/laboratory_subjects/shared/_list.html.erb deleted file mode 100644 index c40d0226..00000000 --- a/app/views/admins/laboratory_subjects/shared/_list.html.erb +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - <% if laboratory_subjects.present? %> - <% laboratory_subjects.each_with_index do |laboratory_subject, index| %> - - <%- subject = laboratory_subject.subject -%> - - - - - - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号课程名称技术体系等级体系封面创建者单位状态操作
<%= list_index_no((params[:page] || 1).to_i, index) %> - <%= link_to(subject.name, "/paths/#{subject.id}", target: '_blank') %> - 首页 - 自建 - <%= display_text subject.repertoire&.name %><%= display_text subject.subject_level_system&.name %> - <% image_exists = Util::FileManage.exists?(subject) %> - <%= image_tag(image_exists ? Util::FileManage.source_disk_file_url(subject) : '', height: 40, class: "w-100 preview-image subject-image-#{subject.id}", style: image_exists ? '' : 'display:none') %> - <%= subject.user.real_name %><%= subject.user.school_name %><%= display_subject_status(subject) %> - <%= link_to('去修改', admins_subjects_path(id: laboratory_subject.subject_id)) %> - <%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? 'display:none' : '') %> - <%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? '' : 'display:none') %> - - <% unless laboratory_subject.ownership? %> - <%= delete_link '删除', admins_laboratory_laboratory_subject_path(current_laboratory, laboratory_subject, element: ".laboratory-subject-item-#{laboratory_subject.id}") %> - <% end %> -
- -<%= render partial: 'admins/shared/paginate', locals: { objects: laboratory_subjects } %> \ No newline at end of file diff --git a/app/views/admins/library_applies/index.html.erb b/app/views/admins/library_applies/index.html.erb deleted file mode 100644 index 9d2ae8e6..00000000 --- a/app/views/admins/library_applies/index.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('教学案例发布') %> -<% end %> - -
- - - <%= form_tag(admins_library_applies_path(unsafe_params), method: :get, class: 'form-inline search-form justify-content-end mt-3', remote: true) do %> -
- - <% status_options = [['全部', 'processed'], ['已同意', 'agreed'], ['已拒绝', 'refused']] %> - <%= select_tag(:status, options_for_select(status_options) ,class: 'form-control') %> -
- <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '编号/名称检索') %> - <%= submit_tag('搜索', class: 'btn btn-primary ml-3') %> - <% end %> -
- -
- <%= render(partial: 'admins/library_applies/shared/list', locals: { applies: @library_applies }) %> -
- -<%= render(partial: 'admins/shared/admin_common_refuse_modal') %> \ No newline at end of file diff --git a/app/views/admins/library_applies/index.js.erb b/app/views/admins/library_applies/index.js.erb deleted file mode 100644 index 6f4c3e71..00000000 --- a/app/views/admins/library_applies/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.library-applies-list-container').html("<%= j( render partial: 'admins/library_applies/shared/list', locals: { applies: @library_applies } ) %>"); \ No newline at end of file diff --git a/app/views/admins/library_applies/shared/_list.html.erb b/app/views/admins/library_applies/shared/_list.html.erb deleted file mode 100644 index fde3d1d1..00000000 --- a/app/views/admins/library_applies/shared/_list.html.erb +++ /dev/null @@ -1,58 +0,0 @@ -<% is_processed = params[:status].to_s != 'pending' %> - - - - - - - - - - - <% if is_processed %> - - - <% else %> - - <% end %> - - - - <% if applies.present? %> - <% applies.each_with_index do |apply, index| %> - <% user = apply.library.user %> - <% library = apply.library %> - - - - - - - - - <% if is_processed %> - - - <% else %> - - <% end %> - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号头像姓名教学案例案例描述时间拒绝原因状态操作
<%= list_index_no((params[:page] || 1).to_i, index) %> - <%= link_to "/users/#{user.login}", class: 'professional-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %> - - <% end %> - <%= link_to user&.real_name,"/users/#{user&.login}", target: "_blank" %><%= link_to library.title, library_path(library), :target => "_blank" %><%= overflow_hidden_span library.content[0..50]%><%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %><%= overflow_hidden_span apply.reason %><%= t("library_apply.status.#{apply.status}") %> - <%= agree_link '同意', agree_admins_library_apply_path(apply, element: ".library_applies-#{apply.id}"), 'data-confirm': '确认审核通过?' %> - <%= javascript_void_link('拒绝', class: 'action refuse-action', - data: { - toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, - url: refuse_admins_library_apply_path(apply, element: ".library_applies-#{apply.id}") - }) %> -
- -<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %> \ No newline at end of file diff --git a/app/views/admins/projects/shared/_list.html.erb b/app/views/admins/projects/shared/_list.html.erb index 96b85a98..c2d300c2 100644 --- a/app/views/admins/projects/shared/_list.html.erb +++ b/app/views/admins/projects/shared/_list.html.erb @@ -1,19 +1,18 @@ - + - - - - + + + + - - + - - + + @@ -25,15 +24,14 @@ - - + - - - - - - - - - \ No newline at end of file diff --git a/app/views/admins/subject_settings/update.js.erb b/app/views/admins/subject_settings/update.js.erb deleted file mode 100644 index c95a41ec..00000000 --- a/app/views/admins/subject_settings/update.js.erb +++ /dev/null @@ -1 +0,0 @@ -$.notify({ message: '更新成功' }); \ No newline at end of file diff --git a/app/views/admins/subject_settings/update_mobile_show.js.erb b/app/views/admins/subject_settings/update_mobile_show.js.erb deleted file mode 100644 index e69de29b..00000000 diff --git a/app/views/admins/subjects/edit.js.erb b/app/views/admins/subjects/edit.js.erb deleted file mode 100644 index b2e12f9b..00000000 --- a/app/views/admins/subjects/edit.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('.admin-modal-container').html("<%= j( render partial: 'admins/subjects/shared/edit_subject_modal', locals: { subject: @subject } ) %>"); -$('.modal.admin-edit-subject-modal').modal('show'); \ No newline at end of file diff --git a/app/views/admins/subjects/index.html.erb b/app/views/admins/subjects/index.html.erb deleted file mode 100644 index 39c4a349..00000000 --- a/app/views/admins/subjects/index.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('课程列表') %> -<% end %> - -
- <%= form_tag(admins_subjects_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %> -
- - <% status_options = [['全部', ''], ["编辑中", "editing"], ["已发布", 'processed'], ["待审核", 'pending'], ["已公开", 'publiced']] %> - <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> -
- -
- - <%= select_tag :school_id, options_for_select([''], params[:school_id]), class: 'form-control school-select flex-1' %> -
- - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-12 col-md-2 mr-3', placeholder: '创建者/课程名称检索') %> - -
- <%= hidden_field_tag(:homepage_show, false, id:'') %> - <%= check_box_tag(:homepage_show, true, params[:homepage_show].to_s == 'true', class: 'form-check-input') %> - -
- -
- <%= hidden_field_tag(:excellent, false, id:'') %> - <%= check_box_tag(:excellent, true, params[:excellent].to_s == 'true', class: 'form-check-input') %> - -
- - <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> - - <% end %> -
- -
- <%= render partial: 'admins/subjects/shared/list', locals: { subjects: @subjects } %> -
\ No newline at end of file diff --git a/app/views/admins/subjects/index.js.erb b/app/views/admins/subjects/index.js.erb deleted file mode 100644 index 20e07f13..00000000 --- a/app/views/admins/subjects/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.subject-list-container').html("<%= j( render partial: 'admins/subjects/shared/list', locals: { subjects: @subjects } ) %>"); \ No newline at end of file diff --git a/app/views/admins/subjects/shared/_edit_subject_modal.html.erb b/app/views/admins/subjects/shared/_edit_subject_modal.html.erb deleted file mode 100644 index 6e9aa871..00000000 --- a/app/views/admins/subjects/shared/_edit_subject_modal.html.erb +++ /dev/null @@ -1,33 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/subjects/shared/_list.html.erb b/app/views/admins/subjects/shared/_list.html.erb deleted file mode 100644 index ee136ddf..00000000 --- a/app/views/admins/subjects/shared/_list.html.erb +++ /dev/null @@ -1,60 +0,0 @@ -
序号序号 ID 项目名称公开精选推荐issue公开精选推荐Issues 资源版本库PullRequestPulls 里程碑成员管理员成员管理员 <%= sort_tag('创建时间', name: 'created_on', path: admins_projects_path) %> 操作
<%= list_index_no((params[:page] || 1).to_i, index) %> <%= project.id %> - <%= link_to(project.name, "/projects/#{project&.owner&.login}/#{project.identifier}", target: '_blank') %> + <%= link_to(project.name, "/#{project&.owner&.login}/#{project.identifier}", target: '_blank') %> <%= project.is_public ? '√' : '' %> <%= project.is_pinned ? '√' : '' %> <%= project.recommend ? '√' : '' %> <%= project.issues.size %> <%= project.attachments.size %><%= project&.project_score.try(:changeset_num).to_i %><%= project&.project_score.try(:pull_request_num).to_i %><%= project&.pull_requests_count %> <%= project.versions.size %> <%= project.members.size %> diff --git a/app/views/admins/salesman_channels/destroy.js.erb b/app/views/admins/salesman_channels/destroy.js.erb deleted file mode 100644 index d00e4fa0..00000000 --- a/app/views/admins/salesman_channels/destroy.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$.notify({ message: '操作成功' },{ type: 'success' }); -$("<%= params[:element]%>").remove(); \ No newline at end of file diff --git a/app/views/admins/salesman_channels/index.html.erb b/app/views/admins/salesman_channels/index.html.erb deleted file mode 100644 index 75847a54..00000000 --- a/app/views/admins/salesman_channels/index.html.erb +++ /dev/null @@ -1,36 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb("#{@salesman.name}的渠道", admins_salesmans_path) %> -<% end %> - -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('数据变化报表', admins_school_statistics_path) %> -<% end %> - -
-
-
-
-
- <%= text_field_tag :start_date, params[:start_date], class: 'form-control start-date mx-0', placeholder: '开始时间' %> -
- <%= text_field_tag :end_date, params[:end_date], class: 'form-control end-date mx-0', placeholder: '结束时间' %> -
-
- -
- <%= text_field_tag :keyword, params[:keyword], placeholder: 'ID/单位名称检索', class: 'form-control mx-3 search-input' %> - - <%= javascript_void_link '搜索', class: 'btn btn-primary search-btn', target: '' %> - -
-
- <%= javascript_void_link '新增渠道', class: 'btn btn-primary', data: {toggle: 'modal', target: '.admin-add-salesman-channel-user-modal' } %> -
-
- - -
- <%= render(partial: 'admins/salesman_channels/shared/list') %> -
- -<%= render 'admins/salesman_channels/shared/add_salesman_channels_user_modal' %> diff --git a/app/views/admins/salesman_channels/index.js.erb b/app/views/admins/salesman_channels/index.js.erb deleted file mode 100644 index 422cfe5c..00000000 --- a/app/views/admins/salesman_channels/index.js.erb +++ /dev/null @@ -1 +0,0 @@ - $(".salesman-channel-list-container").html("<%= j(render partial: 'admins/salesman_channels/shared/list') %>") \ No newline at end of file diff --git a/app/views/admins/salesman_channels/shared/_add_salesman_channels_user_modal.html.erb b/app/views/admins/salesman_channels/shared/_add_salesman_channels_user_modal.html.erb deleted file mode 100644 index 121e711b..00000000 --- a/app/views/admins/salesman_channels/shared/_add_salesman_channels_user_modal.html.erb +++ /dev/null @@ -1,29 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/salesman_channels/shared/_list.html.erb b/app/views/admins/salesman_channels/shared/_list.html.erb deleted file mode 100644 index 8116e6cf..00000000 --- a/app/views/admins/salesman_channels/shared/_list.html.erb +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - <% if @channels.present? %> - <% @channels.each_with_index do |channel, index| %> - - - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号名称教师数学生数课堂数实训数操作
<%= index + 1 %> - <%= channel.school_name %> - - <%= channel.teacher_count(@start_time, @end_time) %> - - <%= channel.student_count(@start_time, @end_time) %> - - <%= channel.course_count(@start_time, @end_time) %> - - <%= channel.shixuns_count(@start_time, @end_time) %> - - <%= delete_link '删除', admins_salesman_channel_path(channel, salesman_id: channel.salesman_id, element: ".salesman-channel-item-#{channel.id}"), class: 'delete-salesman-action' %> -
\ No newline at end of file diff --git a/app/views/admins/salesman_customers/destroy.js.erb b/app/views/admins/salesman_customers/destroy.js.erb deleted file mode 100644 index d00e4fa0..00000000 --- a/app/views/admins/salesman_customers/destroy.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$.notify({ message: '操作成功' },{ type: 'success' }); -$("<%= params[:element]%>").remove(); \ No newline at end of file diff --git a/app/views/admins/salesman_customers/index.html.erb b/app/views/admins/salesman_customers/index.html.erb deleted file mode 100644 index f7948b0f..00000000 --- a/app/views/admins/salesman_customers/index.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb("#{@salesman.name}的客户", admins_salesmans_path) %> -<% end %> - -
-
- <%= javascript_void_link '新增客户', class: 'btn btn-primary', data: {salesman_id: @salesman.id, toggle: 'modal', target: '.admin-add-salesman-customer-user-modal' } %> -
-
- -
- <%= render(partial: 'admins/salesman_customers/shared/list') %> -
- -<%= render 'admins/salesman_customers/shared/add_salesman_customers_user_modal' %> diff --git a/app/views/admins/salesman_customers/index.js.erb b/app/views/admins/salesman_customers/index.js.erb deleted file mode 100644 index ed90f539..00000000 --- a/app/views/admins/salesman_customers/index.js.erb +++ /dev/null @@ -1 +0,0 @@ - $(".salesman-customer-list-container").html("<%= j(render partial: 'admins/salesman_customers/shared/list') %>") \ No newline at end of file diff --git a/app/views/admins/salesman_customers/shared/_add_salesman_customers_user_modal.html.erb b/app/views/admins/salesman_customers/shared/_add_salesman_customers_user_modal.html.erb deleted file mode 100644 index f31499f5..00000000 --- a/app/views/admins/salesman_customers/shared/_add_salesman_customers_user_modal.html.erb +++ /dev/null @@ -1,30 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/salesman_customers/shared/_list.html.erb b/app/views/admins/salesman_customers/shared/_list.html.erb deleted file mode 100644 index 21e63986..00000000 --- a/app/views/admins/salesman_customers/shared/_list.html.erb +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - <% if @customers.present? %> - <% @customers.each_with_index do |customer, index| %> - - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号名称单位课堂数实训数操作
<%= index + 1 %> - <%= link_to customer.name, user_path(customer), :title => customer.name %> - - <%= customer.school_name %> - - <%= customer.courses_count %> - - <%= customer.shixuns_count %> - - <%= delete_link '删除', admins_salesman_customer_path(customer, salesman_id: customer.salesman_id, element: ".salesman-customer-item-#{customer.id}"), class: 'delete-salesman--action' %> -
\ No newline at end of file diff --git a/app/views/admins/salesmans/destroy.js.erb b/app/views/admins/salesmans/destroy.js.erb deleted file mode 100644 index 0a9fa851..00000000 --- a/app/views/admins/salesmans/destroy.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$.notify({ message: '操作成功' },{ type: 'success' }); -$(".salesman-item-<%= params[:id]%>").remove(); \ No newline at end of file diff --git a/app/views/admins/salesmans/index.html.erb b/app/views/admins/salesmans/index.html.erb deleted file mode 100644 index 2c5a095e..00000000 --- a/app/views/admins/salesmans/index.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('销售数据列表', admins_salesmans_path) %> -<% end %> - -
-
- <%= javascript_void_link '新增销售人员', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-add-salesman-user-modal' } %> -
-
- -
- <%= render(partial: 'admins/salesmans/shared/list') %> -
- -<%= render 'admins/salesmans/shared/add_salesman_user_modal' %> diff --git a/app/views/admins/salesmans/shared/_add_salesman_user_modal.html.erb b/app/views/admins/salesmans/shared/_add_salesman_user_modal.html.erb deleted file mode 100644 index 20e2befd..00000000 --- a/app/views/admins/salesmans/shared/_add_salesman_user_modal.html.erb +++ /dev/null @@ -1,30 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/salesmans/shared/_list.html.erb b/app/views/admins/salesmans/shared/_list.html.erb deleted file mode 100644 index 8293b457..00000000 --- a/app/views/admins/salesmans/shared/_list.html.erb +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - <% if @salesmans.present? %> - <% @salesmans.each_with_index do |salesman, index| %> - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号业务员重点跟踪客户(点击数字客户列表)重点跟踪院校(点击数字渠道列表)操作
<%= index + 1 %> - <%= link_to salesman.name, admins_salesman_path(salesman), :title => salesman.name %> - - <%= link_to salesman.salesman_customers_count.to_i, - admins_salesman_customers_path(salesman_id: salesman), :title => "点击进入客户列表" %> - - <%= link_to salesman.salesman_channels_count.to_i, admins_salesman_channels_path(salesman_id: salesman), - :title => "点击进入渠道列表" %> - - <%= delete_link '删除', admins_salesman_path(salesman, element: ".salesman-item-#{salesman.id}"), - class: 'delete-salesman-action' %> -
\ No newline at end of file diff --git a/app/views/admins/school_statistics/contrast.js.erb b/app/views/admins/school_statistics/contrast.js.erb deleted file mode 100644 index bc9916c1..00000000 --- a/app/views/admins/school_statistics/contrast.js.erb +++ /dev/null @@ -1 +0,0 @@ -$(".school-statistic-list-container").html("<%= j(render partial: 'admins/school_statistics/shared/contrast_list', locals: { statistics: @statistics, select_options: @select_options }) %>") \ No newline at end of file diff --git a/app/views/admins/school_statistics/index.html.erb b/app/views/admins/school_statistics/index.html.erb deleted file mode 100644 index d726adb2..00000000 --- a/app/views/admins/school_statistics/index.html.erb +++ /dev/null @@ -1,49 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('数据变化报表', admins_school_statistics_path) %> -<% end %> - -
-
-
- - <%= hidden_field_tag :contrast_column, params[:contrast_column] %> - -
-
- <%= text_field_tag :grow_begin_date, params[:grow_begin_date], class: 'form-control start-date mx-0', placeholder: '开始时间' %> -
- <%= text_field_tag :grow_end_date, params[:grow_end_date], class: 'form-control end-date mx-0', placeholder: '结束时间' %> -
-
-
-
- <%= text_field_tag :begin_date, params[:begin_date], class: 'form-control start-date mx-0', placeholder: '开始时间' %> -
- <%= text_field_tag :end_date, params[:end_date], class: 'form-control end-date mx-0', placeholder: '结束时间' %> -
-
VS
-
- <%= text_field_tag :other_begin_date, params[:other_begin_date], class: 'form-control start-date mx-0', placeholder: '开始时间' %> -
- <%= text_field_tag :other_end_date, params[:other_end_date], class: 'form-control end-date mx-0', placeholder: '结束时间' %> -
-
-
- -
- <%= hidden_field_tag :data_type, params[:data_type] || 'grow' %> - <%= javascript_void_link '时段对比', class: "btn btn-outline-info btn-sm contrast-btn #{params[:data_type] == 'contrast' ? 'active' : ''}", - data: { toggle: 'tooltip', trigger: 'hover', title: '请在左侧分别选择需进行对比的两个时段,具体从当日5:00开始计算,下表显示两时段选定指标两时段变化情况对比' } %> - <%= javascript_void_link '数据变化', class: "btn btn-outline-info btn-sm grow-btn #{params[:data_type] == 'contrast' ? '' : 'active'}", - data: { toggle: 'tooltip', trigger: 'hover', title: '请在左侧选择时间段,具体从当日5:00开始计算,下表显示选定时间段内各项指标数据变化情况' } %> -
- - <%= text_field_tag :keyword, params[:keyword], placeholder: 'ID/单位名称检索', class: 'form-control mx-3 search-input' %> - - <%= javascript_void_link '搜索', class: 'btn btn-primary search-btn' %> -
-
- -
- <%= render partial: 'admins/school_statistics/shared/list', locals: { statistics: @statistics } %> -
\ No newline at end of file diff --git a/app/views/admins/school_statistics/index.js.erb b/app/views/admins/school_statistics/index.js.erb deleted file mode 100644 index 3f5f7334..00000000 --- a/app/views/admins/school_statistics/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$(".school-statistic-list-container").html("<%= j(render partial: 'admins/school_statistics/shared/list', locals: { statistics: @statistics }) %>") \ No newline at end of file diff --git a/app/views/admins/school_statistics/shared/_contrast_list.html.erb b/app/views/admins/school_statistics/shared/_contrast_list.html.erb deleted file mode 100644 index 928340c8..00000000 --- a/app/views/admins/school_statistics/shared/_contrast_list.html.erb +++ /dev/null @@ -1,72 +0,0 @@ -
-
- 学校数据统计(<%= I18n.t("school_daily_report.#{params[:contrast_column]}") %>变化统计情况) -
- <%= select_tag :contrast_column, - options_for_select(select_options, params[:contrast_column]), - class: 'form-control contrast-column-select' %> - - <% if statistics.present? %> -
- 说明:新增数=时段二-时段一;新增百分比=(新增数/时段一)*100%(保留小数点后五位) -
- <% end %> -
- -<% if statistics.present? %> - - - - - - - - - - - <% statistics.each do |statistic| %> - - - - - <% - increase = statistic['other_total'] - statistic['total'] - percentage = statistic['total'].zero? ? increase.to_f * 100 : (increase / statistic['total'].to_f) * 100 - %> - <% if increase > 0 %> - - <% if statistic['total'].zero? %> - - <% else %> - - <% end %> - <% elsif increase.zero? %> - - - <% else %> - - - <% end %> - - <% end %> - -
单位名称时段一
<%= "(#{params[:begin_date]} 05:00至#{(Time.zone.parse(params[:end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00)" %>
时段二
<%= "(#{params[:other_begin_date]} 05:00至#{(Time.zone.parse(params[:other_end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00)" %>
- <%= sort_tag('变化情况', name: 'percentage', path: contrast_admins_school_statistics_path) %> -
( 新 增 数 | 新增百分比) -
- <%= link_to statistic.school_name, "/colleges/#{statistic.school_id}/statistics", - target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %> - <%= statistic['total'] %><%= statistic['other_total'] %> - +<%= increase %> - -+<%= percentage.round(5) %>% - <%= increase %> - <%= percentage.round(5) %>% - <%= increase %> - <%= percentage.round(5) %>%
- - <%= render partial: 'admins/shared/paginate', locals: { objects: statistics } %> -<% else %> -
- 暂无数据,请选择时间段对比 -
-<% end %> \ No newline at end of file diff --git a/app/views/admins/school_statistics/shared/_list.html.erb b/app/views/admins/school_statistics/shared/_list.html.erb deleted file mode 100644 index 9d2a1c20..00000000 --- a/app/views/admins/school_statistics/shared/_list.html.erb +++ /dev/null @@ -1,58 +0,0 @@ -
- 统计总计: - <% if params[:grow_begin_date].present? %> - <%= params[:grow_begin_date] %> 05:00至<%= (Time.zone.parse(params[:grow_end_date]) + 1.days).strftime('%Y-%m-%d') %> 05:00 - <% else %> - <%= (Time.current - 5.hour).beginning_of_day.ago(1.days).strftime('%Y-%m-%d') %> 05:00至 - <%= (Time.current - 5.hour).beginning_of_day.strftime('%Y-%m-%d') %> 05:00, - <% end %> - 新增教师<%= @grow_summary.teacher_increase_count || 0 %>人, - 新增学生<%= @grow_summary.student_increase_count || 0 %>人, - 新增课堂<%= @grow_summary.course_increase_count || 0 %>个, - 新增实训<%= @grow_summary.shixun_increase_count || 0 %>个, - 新增实训作业<%= @grow_summary.shixun_homework_count || 0 %>个, - 新增实训评测<%= @grow_summary.shixun_evaluate_count || 0 %>个, - 活跃用户 - <%= @grow_summary.uniq_active_user_count.to_i.zero? ? @grow_summary.active_user_count.to_i : @grow_summary.uniq_active_user_count.to_i %> - 个 -
- - - - - - - - - - - - - - - - - <% if statistics.present? %> - <% statistics.each_with_index do |statistic, index| %> - - - - - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号单位名称<%= sort_tag('新增教师', name: 'teacher_increase_count', path: admins_school_statistics_path) %><%= sort_tag('新增学生', name: 'student_increase_count', path: admins_school_statistics_path) %><%= sort_tag('新增课堂', name: 'course_increase_count', path: admins_school_statistics_path) %><%= sort_tag('新增实训', name: 'shixun_increase_count', path: admins_school_statistics_path) %><%= sort_tag('新增实训作业', name: 'shixun_homework_count', path: admins_school_statistics_path) %><%= sort_tag('新增实训评测', name: 'shixun_evaluate_count', path: admins_school_statistics_path) %><%= sort_tag('活跃用户', name: 'uniq_active_user_count', path: admins_school_statistics_path) %>
<%= list_index_no(@params_page.to_i, index) %> - <%= link_to statistic.school_name, "/colleges/#{statistic.school_id}/statistics", - target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %> - <%= statistic.teacher_increase_count.to_i %><%= statistic.student_increase_count.to_i %><%= statistic.course_increase_count.to_i %><%= statistic.shixun_increase_count.to_i %><%= statistic.shixun_homework_count.to_i %><%= statistic.shixun_evaluate_count.to_i %><%= statistic.uniq_active_user_count.to_i.zero? ? statistic.active_user_count.to_i : statistic.uniq_active_user_count.to_i %>
- -<%= render partial: 'admins/shared/paginate', locals: { objects: statistics } %> \ No newline at end of file diff --git a/app/views/admins/schools/index.html.erb b/app/views/admins/schools/index.html.erb deleted file mode 100644 index 56cbadd9..00000000 --- a/app/views/admins/schools/index.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('单位列表') %> -<% end %> - -
- <%= form_tag(admins_schools_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %> - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '单位名称检索') %> - <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> - <% end %> - - <%#= javascript_void_link '新建单位', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-school-modal' } %> -
- -
- <%= render partial: 'admins/schools/shared/list', locals: { schools: @schools } %> -
\ No newline at end of file diff --git a/app/views/admins/schools/index.js.erb b/app/views/admins/schools/index.js.erb deleted file mode 100644 index 41a2454b..00000000 --- a/app/views/admins/schools/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.school-list-container').html("<%= j(render partial: 'admins/schools/shared/list', locals: { schools: @schools }) %>"); \ No newline at end of file diff --git a/app/views/admins/schools/index.json.jbuilder b/app/views/admins/schools/index.json.jbuilder deleted file mode 100644 index 3f358191..00000000 --- a/app/views/admins/schools/index.json.jbuilder +++ /dev/null @@ -1,6 +0,0 @@ -json.count @total_count -json.schools do - json.array! @schools.each do |school| - json.extract! school, :id, :name - end -end \ No newline at end of file diff --git a/app/views/admins/schools/shared/_list.html.erb b/app/views/admins/schools/shared/_list.html.erb deleted file mode 100644 index dd0a054e..00000000 --- a/app/views/admins/schools/shared/_list.html.erb +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - <% if schools.present? %> - <% schools.each_with_index do |school, index| %> - - - - - - - - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
序号IDLOGO标识码单位名称地区城市详细地址<%= sort_tag('用户数', name: 'users_count', path: admins_schools_path) %>部门数<%= sort_tag('创建时间', name: 'created_at', path: admins_schools_path) %>操作
<%= list_index_no((params[:page] || 1).to_i, index) %><%= school.id %> - <% if Util::FileManage.exists?(school) %> - <%= image_tag(Util::FileManage.source_disk_file_url(school).to_s + "?#{Time.now.to_i}", width: 40, height: 40, class: 'preview-image') %> - <% else %> - <%= content_tag(:span, '--', class: 'text-secondary') %> - <% end %> - <%= display_text school.identifier %><%= school.name %><%= school.province %><%= school.city %><%= school.address %><%= school.users_count %><%= @department_count.fetch(school.id, 0) %><%= school.created_at&.strftime('%Y-%m-%d %H:%M') %> - <%= delete_link '删除', admins_school_path(school, element: ".school-item-#{school.id}"), class: 'delete-school-action' %> -
- -<%= render partial: 'admins/shared/paginate', locals: { objects: schools } %> \ No newline at end of file diff --git a/app/views/admins/shared/_sidebar.html.erb b/app/views/admins/shared/_sidebar.html.erb index 75abbc12..d757758e 100644 --- a/app/views/admins/shared/_sidebar.html.erb +++ b/app/views/admins/shared/_sidebar.html.erb @@ -34,11 +34,6 @@
  • <%= sidebar_item_group('#setting-submenu', '网站建设', icon: 'cogs') do %> -
  • <%= sidebar_item(edit_admins_about_path, '关于我们', icon: 'smile-o', controller: 'admins-abouts') %>
  • -
  • <%= sidebar_item(edit_admins_contact_us_path, '联系我们', icon: 'commenting-o', controller: 'admins-contact_us') %>
  • -
  • <%= sidebar_item(admins_cooperatives_path, '合作伙伴', icon: 'handshake-o', controller: 'admins-cooperatives') %>
  • -
  • <%= sidebar_item(edit_admins_agreement_path, '服务协议', icon: 'file-text-o', controller: 'admins-agreements') %>
  • -
  • <%= sidebar_item(edit_admins_help_center_path, '帮助中心', icon: 'question-circle-o', controller: 'admins-help_centers') %>
  • <%= sidebar_item(admins_faqs_path, 'FAQ', icon: 'question-circle', controller: 'admins-faqs') %>
  • <% end %> diff --git a/app/views/admins/sub_disciplines/adjust_position.js.erb b/app/views/admins/sub_disciplines/adjust_position.js.erb deleted file mode 100644 index 0dae991c..00000000 --- a/app/views/admins/sub_disciplines/adjust_position.js.erb +++ /dev/null @@ -1,5 +0,0 @@ -<% if @message.present? %> -$.notify({ message: "<%= @message %>" }); -<% else %> -$(".sub-discipline-list-container").html("<%= j(render :partial => 'admins/sub_disciplines/shared/list') %>"); -<% end %> \ No newline at end of file diff --git a/app/views/admins/sub_disciplines/destroy.js.erb b/app/views/admins/sub_disciplines/destroy.js.erb deleted file mode 100644 index bb03cdcf..00000000 --- a/app/views/admins/sub_disciplines/destroy.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$.notify({ message: '删除成功' }); -$(".sub-discipline-item-<%= @sub_discipline_id %>").remove(); \ No newline at end of file diff --git a/app/views/admins/sub_disciplines/edit.js.erb b/app/views/admins/sub_disciplines/edit.js.erb deleted file mode 100644 index aa7219de..00000000 --- a/app/views/admins/sub_disciplines/edit.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('.admin-modal-container').html("<%= j( render partial: 'admins/sub_disciplines/shared/edit_sub_discipline_modal', locals: { sub_discipline: @sub_discipline } ) %>"); -$('.modal.admin-edit-sub-discipline-modal').modal('show'); \ No newline at end of file diff --git a/app/views/admins/sub_disciplines/index.html.erb b/app/views/admins/sub_disciplines/index.html.erb deleted file mode 100644 index d782e00a..00000000 --- a/app/views/admins/sub_disciplines/index.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('课程方向', admins_disciplines_path) %> - <% add_admin_breadcrumb(@discipline.name) %> -<% end %> - -
    - <%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-sub-discipline-modal' } %> -
    - -
    - <%= render(partial: 'admins/sub_disciplines/shared/list') %> -
    - -<%= render 'admins/sub_disciplines/shared/create_sub_discipline_modal' %> diff --git a/app/views/admins/sub_disciplines/shared/_create_sub_discipline_modal.html.erb b/app/views/admins/sub_disciplines/shared/_create_sub_discipline_modal.html.erb deleted file mode 100644 index a8b00b05..00000000 --- a/app/views/admins/sub_disciplines/shared/_create_sub_discipline_modal.html.erb +++ /dev/null @@ -1,28 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/sub_disciplines/shared/_edit_sub_discipline_modal.html.erb b/app/views/admins/sub_disciplines/shared/_edit_sub_discipline_modal.html.erb deleted file mode 100644 index b51c267b..00000000 --- a/app/views/admins/sub_disciplines/shared/_edit_sub_discipline_modal.html.erb +++ /dev/null @@ -1,23 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/sub_disciplines/shared/_list.html.erb b/app/views/admins/sub_disciplines/shared/_list.html.erb deleted file mode 100644 index cd0b02f8..00000000 --- a/app/views/admins/sub_disciplines/shared/_list.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<% max_position = @sub_disciplines.pluck(:position).max %> - - - - - - - - - - - - - <% if @sub_disciplines.present? %> - <% @sub_disciplines.each do |sub| %> - - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
    序号课程实践课程实训题库操作
    <%= sub.position %> - <%= link_to sub.name, admins_tag_disciplines_path(sub_discipline_id: sub), :title => sub.name %> - <%= check_box_tag :subject,!sub.subject,sub.subject,disabled:!sub.discipline&.subject,remote:true,data:{id:sub.id},class:"sub-discipline-source-form" %><%= check_box_tag :shixun,!sub.shixun,sub.shixun,disabled:!sub.discipline&.shixun,remote:true,data:{id:sub.id},class:"sub-discipline-source-form" %><%= check_box_tag :question,!sub.question,sub.question,disabled:!sub.discipline&.question,remote:true,data:{id:sub.id},class:"sub-discipline-source-form" %> - <%= javascript_void_link('上移', class: 'move-action', data: { id: sub.id, opr: "up" }, style: sub.position == 1 ? 'display:none' : '') %> - <%= javascript_void_link('下移', class: 'move-action', data: { id: sub.id, opr: "down" }, style: sub.position == max_position ? 'display:none' : '') %> - - <%= link_to '编辑', edit_admins_sub_discipline_path(sub), remote: true, class: 'action' %> - <%= delete_link '删除', admins_sub_discipline_path(sub, element: ".sub-discipline-item-#{sub.id}"), class: 'delete-sub-discipline-action' %> -
    \ No newline at end of file diff --git a/app/views/admins/sub_disciplines/update.js.erb b/app/views/admins/sub_disciplines/update.js.erb deleted file mode 100644 index 395e0677..00000000 --- a/app/views/admins/sub_disciplines/update.js.erb +++ /dev/null @@ -1,6 +0,0 @@ -<% if @message.present? %> -$.notify({ message: "<%= @message %>" }); -<% else %> -$('.modal.admin-edit-sub-discipline-modal').modal("hide"); -$(".sub-discipline-list-container").html("<%= j(render :partial => 'admins/sub_disciplines/shared/list') %>"); -<% end %> \ No newline at end of file diff --git a/app/views/admins/sub_repertoires/destroy.js.erb b/app/views/admins/sub_repertoires/destroy.js.erb deleted file mode 100644 index 4575f811..00000000 --- a/app/views/admins/sub_repertoires/destroy.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$.notify({ message: '删除成功' }); -$(".sub-repertoire-item-<%= @sub_repertoire_id %>").remove(); \ No newline at end of file diff --git a/app/views/admins/sub_repertoires/edit.js.erb b/app/views/admins/sub_repertoires/edit.js.erb deleted file mode 100644 index 10fe1969..00000000 --- a/app/views/admins/sub_repertoires/edit.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('.admin-modal-container').html("<%= j( render partial: 'admins/sub_repertoires/shared/edit_sub_repertoire_modal', locals: { sub_repertoire: @sub_repertoire } ) %>"); -$('.modal.admin-edit-sub-repertoire-modal').modal('show'); \ No newline at end of file diff --git a/app/views/admins/sub_repertoires/index.html.erb b/app/views/admins/sub_repertoires/index.html.erb deleted file mode 100644 index be8ec98f..00000000 --- a/app/views/admins/sub_repertoires/index.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('技术体系', admins_repertoires_path) %> - <% add_admin_breadcrumb(@repertoire.name) %> -<% end %> - -
    - <%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-sub-repertoire-modal' } %> -
    - -
    - <%= render(partial: 'admins/sub_repertoires/shared/list') %> -
    - -<%= render 'admins/sub_repertoires/shared/create_sub_repertoire_modal' %> diff --git a/app/views/admins/sub_repertoires/shared/_create_sub_repertoire_modal.html.erb b/app/views/admins/sub_repertoires/shared/_create_sub_repertoire_modal.html.erb deleted file mode 100644 index 435f2fb3..00000000 --- a/app/views/admins/sub_repertoires/shared/_create_sub_repertoire_modal.html.erb +++ /dev/null @@ -1,28 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/sub_repertoires/shared/_edit_sub_repertoire_modal.html.erb b/app/views/admins/sub_repertoires/shared/_edit_sub_repertoire_modal.html.erb deleted file mode 100644 index 28ff8a16..00000000 --- a/app/views/admins/sub_repertoires/shared/_edit_sub_repertoire_modal.html.erb +++ /dev/null @@ -1,23 +0,0 @@ - diff --git a/app/views/admins/sub_repertoires/shared/_list.html.erb b/app/views/admins/sub_repertoires/shared/_list.html.erb deleted file mode 100644 index 77d20ef4..00000000 --- a/app/views/admins/sub_repertoires/shared/_list.html.erb +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - <% if @sub_repertoires.present? %> - <% @sub_repertoires.each_with_index do |sub, index| %> - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
    序号课程操作
    <%= index + 1 %> - <%= link_to sub.name, admins_tag_repertoires_path(sub_repertoire_id: sub), :title => sub.name %> - - <%= link_to '编辑', edit_admins_sub_repertoire_path(sub), remote: true, class: 'action' %> - <%= delete_link '删除', admins_sub_repertoire_path(sub, element: ".sub-repertoire-item-#{sub.id}"), class: 'delete-sub-repertoire-action' %> -
    \ No newline at end of file diff --git a/app/views/admins/sub_repertoires/update.js.erb b/app/views/admins/sub_repertoires/update.js.erb deleted file mode 100644 index 04d282c5..00000000 --- a/app/views/admins/sub_repertoires/update.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('.modal.admin-edit-sub-repertoire-modal').modal("hide"); -$(".sub-repertoire-list-container").html("<%= j(render :partial => 'admins/sub_repertoires/shared/list') %>"); \ No newline at end of file diff --git a/app/views/admins/subject_authorizations/index.html.erb b/app/views/admins/subject_authorizations/index.html.erb deleted file mode 100644 index f3ae7bf5..00000000 --- a/app/views/admins/subject_authorizations/index.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('实践课程发布') %> -<% end %> - -
    - - - <%= form_tag(admins_subject_authorizations_path(unsafe_params), method: :get, class: 'form-inline search-form justify-content-end mt-3', remote: true) do %> -
    - - <% status_options = [['全部', 'processed'], ['已同意', 'agreed'], ['已拒绝', 'refused']] %> - <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> -
    - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '实训课程名称检索') %> - <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> - <% end %> -
    - -
    - <%= render(partial: 'admins/subject_authorizations/shared/list', - locals: { applies: @applies, subject_map: @subject_map, challenge_count_map: @challenge_count_map }) %> -
    - -<%= render(partial: 'admins/shared/admin_common_refuse_modal') %> \ No newline at end of file diff --git a/app/views/admins/subject_authorizations/index.js.erb b/app/views/admins/subject_authorizations/index.js.erb deleted file mode 100644 index a2180904..00000000 --- a/app/views/admins/subject_authorizations/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.subject-authorization-list-container').html("<%= j( render partial: 'admins/subject_authorizations/shared/list', locals: { applies: @applies, subject_map: @subject_map, challenge_count_map: @challenge_count_map } ) %>"); \ No newline at end of file diff --git a/app/views/admins/subject_authorizations/shared/_list.html.erb b/app/views/admins/subject_authorizations/shared/_list.html.erb deleted file mode 100644 index 94503dad..00000000 --- a/app/views/admins/subject_authorizations/shared/_list.html.erb +++ /dev/null @@ -1,66 +0,0 @@ -<% is_processed = params[:status].to_s != 'pending' %> - - - - - - - - - - - - - <% if is_processed %> - - - <% else %> - - <% end %> - - - - <% if applies.present? %> - <% applies.each_with_index do |apply, index| %> - <% user = apply.user %> - <% subject = subject_map[apply.container_id] %> - - - - - - - - - - - <% if is_processed %> - - - <% else %> - - <% end %> - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
    序号头像创建者实践课程名称阶段数实训数关卡数时间拒绝原因状态操作
    <%= list_index_no((params[:page] || 1).to_i, index) %> - <%= link_to "/users/#{user.login}", class: 'subject-authorization-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %> - - <% end %> - <%= link_to user&.real_name,"/users/#{user&.login}", target: "_blank" %> - <%= link_to "/paths/#{subject.id}", target: '_blank' do %> - <%= overflow_hidden_span subject.name, width: 300 %> - <% end %> - <%= subject.stages_count %><%= subject.shixuns_count %><%= challenge_count_map.fetch(subject.id, 0) %><%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %><%= overflow_hidden_span apply.reason, width: 140 %><%= apply.status_text %> - <%= agree_link '同意', agree_admins_subject_authorization_path(apply, element: ".subject-authorization-#{apply.id}"), 'data-confirm': '确认审核通过?' %> - <%= javascript_void_link('拒绝', class: 'action refuse-action', - data: { - toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, - url: refuse_admins_subject_authorization_path(apply, element: ".subject-authorization-#{apply.id}") - }) %> -
    - -<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %> \ No newline at end of file diff --git a/app/views/admins/subject_settings/index.html.erb b/app/views/admins/subject_settings/index.html.erb deleted file mode 100644 index b46c1d90..00000000 --- a/app/views/admins/subject_settings/index.html.erb +++ /dev/null @@ -1,41 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('课程配置') %> -<% end %> - -
    - <%= form_tag(admins_subject_settings_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %> -
    - - <% status_options = [['全部', ''], ['编辑中', 'pending'], ['审核中', 'applying'], ['已公开', 'published']] %> - <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> -
    - -
    - - <%= select_tag :school_id, options_for_select([''], params[:school_id]), class: 'form-control school-select flex-1' %> -
    - - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-12 col-md-2 mr-3', placeholder: '创建者/课程名称检索') %> - -
    - <%= hidden_field_tag(:homepage_show, false, id:'') %> - <%= check_box_tag(:homepage_show, true, params[:homepage_show].to_s == 'true', class: 'form-check-input') %> - -
    - -
    - <%= hidden_field_tag(:excellent, false, id:'') %> - <%= check_box_tag(:excellent, true, params[:excellent].to_s == 'true', class: 'form-check-input') %> - -
    - - <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> - - <% end %> -
    - -
    - <%= render partial: 'admins/subject_settings/shared/list', locals: { subjects: @subjects } %> -
    - -<%= render partial: 'admins/shared/modal/upload_file_modal', locals: { title: '上传图片', accept: 'image/*' } %> \ No newline at end of file diff --git a/app/views/admins/subject_settings/index.js.erb b/app/views/admins/subject_settings/index.js.erb deleted file mode 100644 index c3f40346..00000000 --- a/app/views/admins/subject_settings/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.subject-setting-list-container').html("<%= j( render partial: 'admins/subject_settings/shared/list', locals: { subjects: @subjects } ) %>"); \ No newline at end of file diff --git a/app/views/admins/subject_settings/mobile.js.erb b/app/views/admins/subject_settings/mobile.js.erb deleted file mode 100644 index e69de29b..00000000 diff --git a/app/views/admins/subject_settings/shared/_edit_subject_modal.html.erb b/app/views/admins/subject_settings/shared/_edit_subject_modal.html.erb deleted file mode 100644 index 6e9aa871..00000000 --- a/app/views/admins/subject_settings/shared/_edit_subject_modal.html.erb +++ /dev/null @@ -1,33 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/subject_settings/shared/_list.html.erb b/app/views/admins/subject_settings/shared/_list.html.erb deleted file mode 100644 index 79411e89..00000000 --- a/app/views/admins/subject_settings/shared/_list.html.erb +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - <% if subjects.present? %> - <% subjects.each_with_index do |subject, index| %> - - <% page_no = ((params[:page] || 1).to_i - 1) * 20 + index + 1 %> - <%= render partial: "admins/subject_settings/shared/td",locals: {subject: subject,page_no:page_no} %> - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
    序号名称老版技术体系状态课程体系封面开课人数操作
    - -<%= render partial: 'admins/shared/paginate', locals: { objects: subjects } %> \ No newline at end of file diff --git a/app/views/admins/subject_settings/shared/_td.html.erb b/app/views/admins/subject_settings/shared/_td.html.erb deleted file mode 100644 index 94d34f42..00000000 --- a/app/views/admins/subject_settings/shared/_td.html.erb +++ /dev/null @@ -1,47 +0,0 @@ -
    <%= page_no %> - <%= link_to(subject.name, "/paths/#{subject.id}", target: '_blank') %> - 首页 - 金课 -<%= display_text subject.repertoire&.name %><%= display_text subject.public == 2 ? "已公开" : ((subject.public == 1 && subject.status == 2) ? "审核中" : "未发布") %> - <%= select_tag(:sub_disciplines, options_for_select(@sub_disciplines, subject.sub_disciplines.pluck(:id)),multiple:true,class:"form-control subject-setting-form",data:{id:subject.id},id:"tags-chosen-#{subject.id}") %> - - <% image_exists = Util::FileManage.exists?(subject) %> - <%= image_tag(image_exists ? Util::FileManage.source_disk_file_url(subject) : '', height: 40, class: "w-100 preview-image subject-image-#{subject.id}", style: image_exists ? '' : 'display:none') %> - <%= javascript_void_link image_exists ? '重新上传' : '上传图片', class: 'action upload-image-action', data: { source_id: subject.id, source_type: 'Subject', toggle: 'modal', target: '.admin-upload-file-modal' } %> -<%= subject.student_count %> - <%= check_box_tag :show_mobile, !subject.show_mobile, subject.show_mobile, remote: true, - data: {id: subject.id, toggle: "tooltip", placement: "top"}, class: "subject-mobile-form mr10", title: "小程序端显示" %> - <%= link_to('编辑', edit_admins_subject_path(subject), remote: true, class: 'edit-action') %> -
    - - - - - - - - - - - - - - - <% if subjects.present? %> - <% subjects.each_with_index do |subject, index| %> - - - - - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
    序号名称阶段数实训数创建者单位<%= sort_tag('创建时间', name: 'created_at', path: admins_subjects_path) %>状态操作
    <%= list_index_no((params[:page] || 1).to_i, index) %> - <%= link_to(subject.name, "/paths/#{subject.id}", target: '_blank') %> - 首页 - 金课 - <%= subject.stages_count %><%= subject.shixuns_count %><%= subject.user.real_name %><%= subject.user.school_name %><%= subject.created_at&.strftime('%Y-%m-%d %H:%M') %> - <%= display_subject_status(subject) %> - - <%= javascript_void_link('隐藏', class: 'hide-action', data: { id: subject.id }, style: subject.hidden? ? 'display:none' : '') %> - <%= javascript_void_link('取消隐藏', class: 'active-action', data: { id: subject.id }, style: subject.hidden? ? '' : 'display:none') %> - - <%= delete_link '删除', admins_subject_path(subject, element: ".subject-item-#{subject.id}"), class: 'delete-subject-action' %> - - <% if subject.published? %> -
    - <%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %> - -
    - <% end %> -
    - -<%= render partial: 'admins/shared/paginate', locals: { objects: subjects } %> \ No newline at end of file diff --git a/app/views/admins/tag_disciplines/adjust_position.js.erb b/app/views/admins/tag_disciplines/adjust_position.js.erb deleted file mode 100644 index 32e06669..00000000 --- a/app/views/admins/tag_disciplines/adjust_position.js.erb +++ /dev/null @@ -1,5 +0,0 @@ -<% if @message.present? %> -$.notify({ message: "<%= @message %>" }); -<% else %> -$(".tag-discipline-list-container").html("<%= j(render :partial => 'admins/tag_disciplines/shared/list') %>"); -<% end %> \ No newline at end of file diff --git a/app/views/admins/tag_disciplines/destroy.js.erb b/app/views/admins/tag_disciplines/destroy.js.erb deleted file mode 100644 index 0b61b7eb..00000000 --- a/app/views/admins/tag_disciplines/destroy.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$.notify({ message: '删除成功' }); -$(".tag-discipline-item-<%= @tag_discipline_id %>").remove(); \ No newline at end of file diff --git a/app/views/admins/tag_disciplines/edit.js.erb b/app/views/admins/tag_disciplines/edit.js.erb deleted file mode 100644 index 90a4d28d..00000000 --- a/app/views/admins/tag_disciplines/edit.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('.admin-modal-container').html("<%= j( render partial: 'admins/tag_disciplines/shared/edit_tag_discipline_modal', locals: { tag_discipline: @tag_discipline } ) %>"); -$('.modal.admin-edit-tag-discipline-modal').modal('show'); \ No newline at end of file diff --git a/app/views/admins/tag_disciplines/index.html.erb b/app/views/admins/tag_disciplines/index.html.erb deleted file mode 100644 index 19913761..00000000 --- a/app/views/admins/tag_disciplines/index.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('课程方向', admins_disciplines_path) %> - <% add_admin_breadcrumb(@sub_discipline&.discipline&.name, admins_sub_disciplines_path(discipline_id: @sub_discipline&.discipline_id)) %> - <% add_admin_breadcrumb(@sub_discipline.name) %> -<% end %> - -
    - <%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-tag-discipline-modal' } %> -
    - -
    - <%= render(partial: 'admins/tag_disciplines/shared/list') %> -
    - -<%= render 'admins/tag_disciplines/shared/create_tag_discipline_modal' %> diff --git a/app/views/admins/tag_disciplines/shared/_create_tag_discipline_modal.html.erb b/app/views/admins/tag_disciplines/shared/_create_tag_discipline_modal.html.erb deleted file mode 100644 index 33132285..00000000 --- a/app/views/admins/tag_disciplines/shared/_create_tag_discipline_modal.html.erb +++ /dev/null @@ -1,28 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/tag_disciplines/shared/_edit_tag_discipline_modal.html.erb b/app/views/admins/tag_disciplines/shared/_edit_tag_discipline_modal.html.erb deleted file mode 100644 index 9eb50658..00000000 --- a/app/views/admins/tag_disciplines/shared/_edit_tag_discipline_modal.html.erb +++ /dev/null @@ -1,23 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/tag_disciplines/shared/_list.html.erb b/app/views/admins/tag_disciplines/shared/_list.html.erb deleted file mode 100644 index 59420c42..00000000 --- a/app/views/admins/tag_disciplines/shared/_list.html.erb +++ /dev/null @@ -1,52 +0,0 @@ -<% max_position = @tag_disciplines.pluck(:position).max %> - - - - - - - - - - - - - - <% if @tag_disciplines.present? %> - <% @tag_disciplines.each do |tag| %> - - - - - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
    序号知识点创建者实践课程实训题库操作
    <%= tag.position %><%= tag.name %> - <% if tag.user.present? %> - <%= link_to tag.user.real_name, user_path(tag.user), :target => "_blank" %> - <% else %> - -- - <% end %> - - <% disabled = !(tag.sub_discipline&.subject && tag.discipline&.subject) %> - <%= check_box_tag :subject,!tag.subject,tag.subject,disabled:disabled,remote:true,data:{id:tag.id},class:"tag-discipline-source-form" %> - - <% disabled = !(tag.sub_discipline&.shixun && tag.discipline&.shixun) %> - <%= check_box_tag :shixun,!tag.shixun,tag.shixun,disabled:disabled,remote:true,data:{id:tag.id},class:"tag-discipline-source-form" %> - - <% disabled = !(tag.sub_discipline&.question && tag.discipline&.question) %> - <%= check_box_tag :question,!tag.question,tag.question,disabled:disabled,remote:true,data:{id:tag.id},class:"tag-discipline-source-form" %> - - <%= javascript_void_link('上移', class: 'move-action', data: { id: tag.id, opr: "up" }, style: tag.position == 1 ? 'display:none' : '') %> - <%= javascript_void_link('下移', class: 'move-action', data: { id: tag.id, opr: "down" }, style: tag.position == max_position ? 'display:none' : '') %> - - <%= link_to '编辑', edit_admins_tag_discipline_path(tag), remote: true, class: 'action' %> - <%= delete_link '删除', admins_tag_discipline_path(tag, element: ".tag-discipline-item-#{tag.id}"), class: 'delete-tag-discipline-action' %> -
    \ No newline at end of file diff --git a/app/views/admins/tag_disciplines/update.js.erb b/app/views/admins/tag_disciplines/update.js.erb deleted file mode 100644 index b03f1047..00000000 --- a/app/views/admins/tag_disciplines/update.js.erb +++ /dev/null @@ -1,6 +0,0 @@ -<% if @message.present? %> -$.notify({ message: "<%= @message %>" }); -<% else %> -$('.modal.admin-edit-tag-discipline-modal').modal("hide"); -$(".tag-discipline-list-container").html("<%= j(render :partial => 'admins/tag_disciplines/shared/list') %>"); -<% end %> \ No newline at end of file diff --git a/app/views/admins/tag_repertoires/destroy.js.erb b/app/views/admins/tag_repertoires/destroy.js.erb deleted file mode 100644 index 710f10ca..00000000 --- a/app/views/admins/tag_repertoires/destroy.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$.notify({ message: '删除成功' }); -$(".tag-repertoire-item-<%= @tag_repertoire_id %>").remove(); \ No newline at end of file diff --git a/app/views/admins/tag_repertoires/edit.js.erb b/app/views/admins/tag_repertoires/edit.js.erb deleted file mode 100644 index 5969eedf..00000000 --- a/app/views/admins/tag_repertoires/edit.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('.admin-modal-container').html("<%= j( render partial: 'admins/tag_repertoires/shared/edit_tag_repertoire_modal', locals: { tag_repertoire: @tag_repertoire } ) %>"); -$('.modal.admin-edit-tag-repertoire-modal').modal('show'); \ No newline at end of file diff --git a/app/views/admins/tag_repertoires/index.html.erb b/app/views/admins/tag_repertoires/index.html.erb deleted file mode 100644 index 122cfc6f..00000000 --- a/app/views/admins/tag_repertoires/index.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('技术体系', admins_repertoires_path) %> - <% add_admin_breadcrumb(@sub_repertoire&.repertoire&.name, admins_sub_repertoires_path(repertoire_id: @sub_repertoire&.repertoire_id)) %> - <% add_admin_breadcrumb(@sub_repertoire.name) %> -<% end %> - -
    - <%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-tag-repertoire-modal' } %> -
    - -
    - <%= render(partial: 'admins/tag_repertoires/shared/list') %> -
    - -<%= render 'admins/tag_repertoires/shared/create_tag_repertoire_modal' %> diff --git a/app/views/admins/tag_repertoires/shared/_create_tag_repertoire_modal.html.erb b/app/views/admins/tag_repertoires/shared/_create_tag_repertoire_modal.html.erb deleted file mode 100644 index f952762e..00000000 --- a/app/views/admins/tag_repertoires/shared/_create_tag_repertoire_modal.html.erb +++ /dev/null @@ -1,28 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/tag_repertoires/shared/_edit_tag_repertoire_modal.html.erb b/app/views/admins/tag_repertoires/shared/_edit_tag_repertoire_modal.html.erb deleted file mode 100644 index 3be94dd0..00000000 --- a/app/views/admins/tag_repertoires/shared/_edit_tag_repertoire_modal.html.erb +++ /dev/null @@ -1,23 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/tag_repertoires/shared/_list.html.erb b/app/views/admins/tag_repertoires/shared/_list.html.erb deleted file mode 100644 index 3d8047f8..00000000 --- a/app/views/admins/tag_repertoires/shared/_list.html.erb +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - <% if @tag_repertoires.present? %> - <% @tag_repertoires.each_with_index do |tag, index| %> - - - - - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
    序号知识标签操作
    <%= index + 1 %><%= tag.name %> - <%= link_to '编辑', edit_admins_tag_repertoire_path(tag), remote: true, class: 'action' %> - <%= delete_link '删除', admins_tag_repertoire_path(tag, element: ".tag-repertoire-item-#{tag.id}"), class: 'delete-tag-repertoire-action' %> -
    \ No newline at end of file diff --git a/app/views/admins/tag_repertoires/update.js.erb b/app/views/admins/tag_repertoires/update.js.erb deleted file mode 100644 index a55f7f3b..00000000 --- a/app/views/admins/tag_repertoires/update.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('.modal.admin-edit-tag-repertoire-modal').modal("hide"); -$(".tag-repertoire-list-container").html("<%= j(render :partial => 'admins/tag_repertoires/shared/list') %>"); \ No newline at end of file diff --git a/app/views/admins/unit_applies/edit.js.erb b/app/views/admins/unit_applies/edit.js.erb deleted file mode 100644 index 15fc1f4c..00000000 --- a/app/views/admins/unit_applies/edit.js.erb +++ /dev/null @@ -1,56 +0,0 @@ -$("body").append("<%= j render partial: "admins/unit_applies/shared/edit_modal",locals: {apply: @unit_apply, schools: @all_schools} %>") -var uni_edit_modal = $(".admin-unit-edit-modal") -uni_edit_modal.modal("show") - -uni_edit_modal.on("hidden.bs.modal",function () { - $(".admin-unit-edit-modal").remove() - $("body").removeClass("modal-open") -}) - -// 初始化学校选择器 -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; -} -$.ajax({ - url: '/api/schools/for_option.json', - dataType: 'json', - type: 'GET', - success: function(data) { - $("#all-schools").select2({ - theme: 'bootstrap4', - placeholder: '查询学校/单位', - minimumInputLength: 1, - data: data.schools, - templateResult: function (item) { - if(!item.id || item.id === '') return item.text; - return item.name; - }, - templateSelection: function(item){ - return item.name || item.text; - }, - matcher: matcherFunc - }) - } -}); - -$("#all-schools").select2({}) -$("#show-province-<%= @unit_apply.id %>").select2() -$("#schoolCity_<%= @unit_apply.id %>").select2() - -// **************** 地区选择 **************** -$('.province-city-select').cxSelect({ - url: '/javascripts/educoder/province-data.json', - selects: ['province-select', 'city-select'] -}); \ No newline at end of file diff --git a/app/views/admins/unit_applies/index.html.erb b/app/views/admins/unit_applies/index.html.erb deleted file mode 100644 index 2b715b87..00000000 --- a/app/views/admins/unit_applies/index.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('单位审批') %> -<% end %> - -
    - <%= form_tag(admins_unit_applies_path(unsafe_params), method: :get, class: 'form-inline search-form mt-3', remote: true) do %> - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '单位名称检索') %> - <%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with':"搜索中...") %> - <%= link_to "清除",admins_unit_applies_path(keyword:nil),class:"btn btn-default",remote:true %> - <% end %> -
    - -
    - <%= render(partial: 'admins/unit_applies/shared/list', locals: { applies: @unit_applies }) %> -
    - -<%= render(partial: 'admins/shared/admin_common_refuse_modal') %> diff --git a/app/views/admins/unit_applies/index.js.erb b/app/views/admins/unit_applies/index.js.erb deleted file mode 100644 index d9297d51..00000000 --- a/app/views/admins/unit_applies/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$(".unit-applies-list-container").html("<%= j render partial: "admins/unit_applies/shared/list", locals: {applies: @unit_applies} %>") diff --git a/app/views/admins/unit_applies/shared/_apply_item.html.erb b/app/views/admins/unit_applies/shared/_apply_item.html.erb deleted file mode 100644 index b7d38b77..00000000 --- a/app/views/admins/unit_applies/shared/_apply_item.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<%= list_index_no((params[:page] || 1).to_i, index) %> -<%= apply.id %> -<%= overflow_hidden_span apply.name %> - - <%= "#{apply&.province.to_s}"+"#{apply&.city.to_s}" %> - -<%= overflow_hidden_span apply.address %> -<%= link_to apply&.user&.real_name, "/users/#{apply&.user&.login}", target: "_blank" %> -<%= format_time apply.created_at %> - - <%= agree_link '批准', agree_admins_unit_apply_path(apply, element: ".unit-apply-#{apply.id}"), 'data-confirm': '确认批准通过?' %> - <%= javascript_void_link('删除', class: 'action refuse-action', - data: { - toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, title: "删除原因", type: "delete", - url: admins_unit_apply_path(apply, tip: "unapplied", element: ".unit-apply-#{apply.id}") - }) %> - <%= link_to "更改",edit_admins_unit_apply_path(apply), remote: true, class:"action",'data-disable-with': '打开中...' %> - \ No newline at end of file diff --git a/app/views/admins/unit_applies/shared/_edit_modal.html.erb b/app/views/admins/unit_applies/shared/_edit_modal.html.erb deleted file mode 100644 index 6f8995ae..00000000 --- a/app/views/admins/unit_applies/shared/_edit_modal.html.erb +++ /dev/null @@ -1,43 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/unit_applies/shared/_list.html.erb b/app/views/admins/unit_applies/shared/_list.html.erb deleted file mode 100644 index 75b9c720..00000000 --- a/app/views/admins/unit_applies/shared/_list.html.erb +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - <% if applies.present? %> - <% applies.each_with_index do |apply, index| %> - - <%= render partial: "admins/unit_applies/shared/apply_item", locals: {apply: apply, index: index} %> - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
    序号ID单位名称地区详细地址申请者<%= sort_tag('创建于', name: 'created_at', path: admins_unit_applies_path) %>操作
    - -<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %> \ No newline at end of file diff --git a/app/views/admins/unit_applies/update.js.erb b/app/views/admins/unit_applies/update.js.erb deleted file mode 100644 index c710f46b..00000000 --- a/app/views/admins/unit_applies/update.js.erb +++ /dev/null @@ -1,3 +0,0 @@ -$('.modal.admin-unit-edit-modal').modal('hide'); -$('.unit-applies-list-table .unit-apply-<%= @unit_apply.id %>').remove() -$.notify({ message: '操作成功' }); \ No newline at end of file diff --git a/app/views/admins/users/index.html.erb b/app/views/admins/users/index.html.erb index 37ca242e..e21a3d66 100644 --- a/app/views/admins/users/index.html.erb +++ b/app/views/admins/users/index.html.erb @@ -32,11 +32,7 @@ <% end %> <%= javascript_void_link '导入用户', class: 'btn btn-secondary btn-sm', data: { toggle: 'modal', target: '.admin-import-user-modal'} %> - <% -=begin%> - <%= javascript_void_link '导入课堂成员', class: 'btn btn-secondary btn-sm ml-2', data: { toggle: 'modal', target: '.admin-import-course-member-modal'} %> -<% -=end%> +
    @@ -45,6 +41,3 @@ <%= render partial: 'admins/users/shared/reward_grade_modal' %> <%= render partial: 'admins/users/shared/import_user_modal' %> - - -<%= render partial: 'admins/courses/shared/import_course_member_modal' %> \ No newline at end of file diff --git a/app/views/admins/video_applies/index.html.erb b/app/views/admins/video_applies/index.html.erb deleted file mode 100644 index f70f308f..00000000 --- a/app/views/admins/video_applies/index.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<% define_admin_breadcrumbs do %> - <% add_admin_breadcrumb('视频发布') %> -<% end %> - -
    - - - <%= form_tag(admins_video_applies_path(unsafe_params), method: :get, class: 'form-inline search-form justify-content-end mt-3', remote: true) do %> -
    - - <% status_options = [['全部', 'all'], ['已同意', 'agreed'], ['已拒绝', 'refused']] %> - <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %> -
    - <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '需求标题检索') %> - <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> - <% end %> -
    - -
    - <%= render(partial: 'admins/video_applies/shared/list', locals: { applies: @video_applies}) %> -
    - -<%= render(partial: 'admins/shared/admin_common_refuse_modal') %> \ No newline at end of file diff --git a/app/views/admins/video_applies/index.js.erb b/app/views/admins/video_applies/index.js.erb deleted file mode 100644 index 570f88c6..00000000 --- a/app/views/admins/video_applies/index.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.video-applies-list-container').html("<%= j( render partial: 'admins/video_applies/shared/list', locals: { applies: @video_applies } ) %>"); \ No newline at end of file diff --git a/app/views/admins/video_applies/shared/_list.html.erb b/app/views/admins/video_applies/shared/_list.html.erb deleted file mode 100644 index 3466d21b..00000000 --- a/app/views/admins/video_applies/shared/_list.html.erb +++ /dev/null @@ -1,59 +0,0 @@ -<% is_processed = params[:status].to_s != 'pending' %> - - - - - - - - - - - - <% if is_processed %> - - - <% else %> - - <% end %> - - - - <% if applies.present? %> - <% applies.each_with_index do |v, index| %> - <% video = v.video %> - <% user = video.user %> - - - - - - - - - <% if is_processed %> - - - <% else %> - - <% end %> - - <% end %> - <% else %> - <%= render 'admins/shared/no_data_for_table' %> - <% end %> - -
    序号头像姓名视频名称视频大小播放链接时间拒绝原因状态操作
    <%= list_index_no((params[:page] || 1).to_i, index) %> - <%= link_to "/users/#{user.login}", class: 'professional-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %> - - <% end %> - <%= link_to user&.real_name,"/users/#{user&.login}", target: "_blank" %><%= link_to video.title, video.file_url, :target => "_blank" %><%= video.filesize&.to_s(:human_size) %><%= link_to "播放视频",video.file_url, target: "_blank" %><%= v.updated_at.strftime('%Y-%m-%d %H:%M') %><%= overflow_hidden_span v.reason %><%= t("admins_apply_status.status.#{v.status}") %> - <%= agree_link '同意', agree_admins_video_apply_path(v, element: ".video_applies-#{v.id}"), 'data-confirm': '确认审核通过?' %> - <%= javascript_void_link('拒绝', class: 'action refuse-action', - data: { - toggle: 'modal', target: '.admin-common-refuse-modal', id: v.id, - url: refuse_admins_video_apply_path(v, element: ".video_applies-#{v.id}") - }) %> -
    - -<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %> \ No newline at end of file diff --git a/app/views/admins/weapp_adverts/index.html.erb b/app/views/admins/weapp_adverts/index.html.erb deleted file mode 100644 index c560fdb8..00000000 --- a/app/views/admins/weapp_adverts/index.html.erb +++ /dev/null @@ -1,42 +0,0 @@ -<% - define_admin_breadcrumbs do - add_admin_breadcrumb('广告栏') - end -%> - -
    -
    - 广告栏 - <%= javascript_void_link '添加', class: 'btn btn-primary btn-sm add-btn', data: { toggle: 'modal', target: '.admin-add-weapp-advert-modal' } %> -
    -
    - <% @adverts.each_with_index do |advert, index| %> - - <% end %> -
    -
    - - -<%= render partial: 'admins/weapp_adverts/shared/add_weapp_advert_modal' %> -<%= render partial: 'admins/shared/modal/upload_file_modal' %> \ No newline at end of file diff --git a/app/views/admins/weapp_adverts/shared/_add_weapp_advert_modal.html.erb b/app/views/admins/weapp_adverts/shared/_add_weapp_advert_modal.html.erb deleted file mode 100644 index 3937054b..00000000 --- a/app/views/admins/weapp_adverts/shared/_add_weapp_advert_modal.html.erb +++ /dev/null @@ -1,35 +0,0 @@ - \ No newline at end of file diff --git a/app/views/admins/weapp_carousels/index.html.erb b/app/views/admins/weapp_carousels/index.html.erb deleted file mode 100644 index ec6cfa57..00000000 --- a/app/views/admins/weapp_carousels/index.html.erb +++ /dev/null @@ -1,42 +0,0 @@ -<% - define_admin_breadcrumbs do - add_admin_breadcrumb('轮播图') - end -%> - -
    -
    - 顶部轮播图(拖动排序) - <%= javascript_void_link '添加', class: 'btn btn-primary btn-sm add-btn', data: { toggle: 'modal', target: '.admin-add-weapp-carousel-modal' } %> -
    -
    - <% @carousels.each_with_index do |carousel, index| %> - - <% end %> -
    -
    - - -<%= render partial: 'admins/weapp_carousels/shared/add_weapp_carousel_modal' %> -<%= render partial: 'admins/shared/modal/upload_file_modal' %> \ No newline at end of file diff --git a/app/views/admins/weapp_carousels/shared/_add_weapp_carousel_modal.html.erb b/app/views/admins/weapp_carousels/shared/_add_weapp_carousel_modal.html.erb deleted file mode 100644 index 123ce4a6..00000000 --- a/app/views/admins/weapp_carousels/shared/_add_weapp_carousel_modal.html.erb +++ /dev/null @@ -1,35 +0,0 @@ - \ No newline at end of file diff --git a/app/views/edu_datas/code_lines.json.jbuilder b/app/views/edu_datas/code_lines.json.jbuilder deleted file mode 100644 index d4cccf0a..00000000 --- a/app/views/edu_datas/code_lines.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.content @content \ No newline at end of file diff --git a/app/views/layouts/cooperative.html.erb b/app/views/layouts/cooperative.html.erb index b186c624..93be0470 100644 --- a/app/views/layouts/cooperative.html.erb +++ b/app/views/layouts/cooperative.html.erb @@ -1,7 +1,7 @@ - <%= current_laboratory.laboratory_setting&.name || 'EduCoder' %>-后台管理 + <%= current_laboratory.laboratory_setting&.name || 'GitLink' %>-后台管理 diff --git a/app/views/user_mailer/welcome_email.html.erb b/app/views/user_mailer/welcome_email.html.erb index 6f88177c..a6efe51c 100644 --- a/app/views/user_mailer/welcome_email.html.erb +++ b/app/views/user_mailer/welcome_email.html.erb @@ -27,8 +27,8 @@
    - - + +
    @@ -37,7 +37,7 @@ 您好!

    - 您正在注册Educoder,请在10分钟内在注册页输入此验证码,并进行下一步操作。 + 您正在注册GitLink,请在10分钟内在注册页输入此验证码,并进行下一步操作。 如非你本人操作,请忽略此邮件。

    @@ -46,7 +46,7 @@
    此邮件为系统所发,请勿直接回复。
    - 要解决问题或了解您的帐户详情,您可以访问 帮助中心。 + 要解决问题或了解您的帐户详情,您可以访问 帮助中心

    @@ -54,7 +54,7 @@

    - www.educoder.net + www.gitlink.org.cn
    diff --git a/config/application.rb b/config/application.rb index 62d95dbf..e1f4f22e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -6,7 +6,7 @@ require 'rails/all' # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) -module Educoderplus +module Gitlink class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.2 @@ -17,7 +17,7 @@ module Educoderplus # the framework and any gems in your application. # # - # config.educoder = config_for(:configuration) + # config.gitlink = config_for(:configuration) # Custom directories with classes and modules you want to be autoloadable. diff --git a/config/configuration.yml.example b/config/configuration.yml.example index 4671e416..b5653012 100644 --- a/config/configuration.yml.example +++ b/config/configuration.yml.example @@ -1,6 +1,6 @@ default: &default # 用户登入的时候设置/登出的时候清空 - autologin_cookie_name: 'autologin_trustie' + autologin_cookie_name: 'autologin_gitlink' platform_url: 'http://localhost:3000' @@ -8,7 +8,7 @@ default: &default attachment_folder: '/tmp' # webssh相关 - tomcat_webssh: 'https://testwebssh.educoder.net' + tomcat_webssh: 'https://testwebssh.gitlink.org.cn' webssh_username: '' webssh_password: '' @@ -70,11 +70,11 @@ production: cloud_bridge: '' cloud_tomcat_php: '' bridge_secret_key: '' - cookie_domain: '.educoder.net' + cookie_domain: '.gitlink.org.cn' attachment_folder: '' - host_name: 'https://testeduplus2.educoder.net' - old_edu_host: 'http://testbdweb.educoder.net' + host_name: 'https://testeduplus2.gitlink.org.cn' + old_edu_host: 'http://testbdweb.gitlink.org.cn' development: <<: *default @@ -86,5 +86,5 @@ development: test: <<: *default cloud_tomcat_php: 'http://10.9.63.225' - host_name: 'https://testeduplus2.educoder.net' - old_edu_host: 'http://testbdweb.educoder.net' + host_name: 'https://testeduplus2.gitlink.org.cn' + old_edu_host: 'http://testbdweb.gitlink.org.cn' diff --git a/config/environments/development.rb b/config/environments/development.rb index f0b3f177..1adbdde7 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -71,8 +71,8 @@ Rails.application.configure do address: 'smtp.exmail.qq.com', port: 25, domain: 'smtp.qq.com', - user_name: 'educoder@trustie.org', - password: 'mAZc9EWbe2Kawaqo2', + user_name: 'notification@trustie.org', + password: 'j4tFbs9eWdELiohb', authentication: 'login', enable_starttls_auto: true } end diff --git a/config/environments/development.rb.example b/config/environments/development.rb.example index 0b31f582..e8108bf2 100644 --- a/config/environments/development.rb.example +++ b/config/environments/development.rb.example @@ -66,11 +66,12 @@ Rails.application.configure do config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { - address: 'smtp.exmail.qq.com', - port: 25, - domain: 'smtp.qq.com', - user_name: 'educoder@trustie.org', - password: 'mAZc9EWbe2Kawaqo2', - authentication: 'login', - enable_starttls_auto: true } + address: 'smtp.exmail.qq.com', + port: 25, + domain: 'smtp.qq.com', + user_name: 'gitlink@gitlink.org.cn', + password: 'mAZc9EWbe2Kawaqo2', + authentication: 'login', + enable_starttls_auto: true + } end diff --git a/config/initializers/eudcoder_config.rb b/config/initializers/eudcoder_config.rb deleted file mode 100644 index 6c94a1f7..00000000 --- a/config/initializers/eudcoder_config.rb +++ /dev/null @@ -1 +0,0 @@ -require 'educoder' \ No newline at end of file diff --git a/config/initializers/gitlink_config.rb b/config/initializers/gitlink_config.rb new file mode 100644 index 00000000..684a282e --- /dev/null +++ b/config/initializers/gitlink_config.rb @@ -0,0 +1 @@ +require 'gitlink' \ No newline at end of file diff --git a/config/locales/competition_prizes/zh-CN.yml b/config/locales/competition_prizes/zh-CN.yml deleted file mode 100644 index 91d905e1..00000000 --- a/config/locales/competition_prizes/zh-CN.yml +++ /dev/null @@ -1,6 +0,0 @@ -zh-CN: - enumerize: - competition_prize: - category: - bonus: '奖金' - unset: '无' \ No newline at end of file diff --git a/config/locales/competitions/zh-CN.yml b/config/locales/competitions/zh-CN.yml deleted file mode 100644 index 9c3ff2f1..00000000 --- a/config/locales/competitions/zh-CN.yml +++ /dev/null @@ -1,8 +0,0 @@ -'zh-CN': - activerecord: - models: - competition_module_md_content: '' - attributes: - competition_module_md_content: - name: '标题' - content: '内容' diff --git a/config/locales/coo_imgs/zh-CN.yml b/config/locales/coo_imgs/zh-CN.yml deleted file mode 100644 index 737d3bed..00000000 --- a/config/locales/coo_imgs/zh-CN.yml +++ /dev/null @@ -1,7 +0,0 @@ -zh-CN: - enumerize: - coo_img: - img_type: - com_coop: '知名企业' - edu_coop: '各类院校' - alliance_coop: '产学联盟' \ No newline at end of file diff --git a/config/locales/ec_course_targets/zh-CN.yml b/config/locales/ec_course_targets/zh-CN.yml deleted file mode 100644 index f447da20..00000000 --- a/config/locales/ec_course_targets/zh-CN.yml +++ /dev/null @@ -1,9 +0,0 @@ -'zh-CN': - activerecord: - models: - ec_course_target: '课程目标' - attributes: - ec_course_target: - content: '内容' - standard_grade: '达成标准(分)' - weight: '权重' diff --git a/config/locales/experiences/zh-CN.yml b/config/locales/experiences/zh-CN.yml deleted file mode 100644 index 923ea7d8..00000000 --- a/config/locales/experiences/zh-CN.yml +++ /dev/null @@ -1,5 +0,0 @@ -'zh-CN': - experience: - container_type: - game: 闯关 - shixun_publish: 发布实训 \ No newline at end of file diff --git a/config/locales/question_banks/zh-CN.yml b/config/locales/question_banks/zh-CN.yml deleted file mode 100644 index c1a18781..00000000 --- a/config/locales/question_banks/zh-CN.yml +++ /dev/null @@ -1,10 +0,0 @@ -'zh-CN': - question_bank: - container_type: - Common: 普通作业 - Shixun: 实训作业 - Group: 分组作业 - Exercise: 试卷 - Poll: 问卷 - GraduationTask: 毕设任务 - GradutionTopic: 毕设选题 diff --git a/config/locales/school_daily_reports/zh-CN.yml b/config/locales/school_daily_reports/zh-CN.yml deleted file mode 100644 index d175ed11..00000000 --- a/config/locales/school_daily_reports/zh-CN.yml +++ /dev/null @@ -1,9 +0,0 @@ -zh-CN: - school_daily_report: - teacher_increase_count: 新增教师 - student_increase_count: 新增学生 - course_increase_count: 新增课堂 - shixun_increase_count: 新增实训 - shixun_homework_count: 新增实训作业 - shixun_evaluate_count: 新增实训评测 - active_user_count: 活跃用户 \ No newline at end of file diff --git a/config/locales/shixuns/en.yml b/config/locales/shixuns/en.yml deleted file mode 100644 index 10de1eae..00000000 --- a/config/locales/shixuns/en.yml +++ /dev/null @@ -1,7 +0,0 @@ -'en': - shixun: - status: - '0': editing - '1': applying - '2': published - '3': closed diff --git a/config/locales/shixuns/zh-CN.yml b/config/locales/shixuns/zh-CN.yml deleted file mode 100644 index d7ad5f7e..00000000 --- a/config/locales/shixuns/zh-CN.yml +++ /dev/null @@ -1,7 +0,0 @@ -'zh-CN': - shixun: - status: - '0': 编辑中 - '1': 审核中 - '2': 已发布 - '3': 已关闭 diff --git a/lib/educoder.rb b/lib/educoder.rb deleted file mode 100644 index 0a07701a..00000000 --- a/lib/educoder.rb +++ /dev/null @@ -1,11 +0,0 @@ -#coding=utf-8 -# -# -module Educoder - # 调用时才加载 - autoload :TipException, "educoder/tip_exception" - autoload :Utils, "educoder/units" - autoload :Sms, "educoder/sms" - autoload :I18n, "educoder/i18n" - autoload :Ufile, "educoder/ufile" -end \ No newline at end of file diff --git a/lib/gitlink.rb b/lib/gitlink.rb new file mode 100644 index 00000000..6f4f4b49 --- /dev/null +++ b/lib/gitlink.rb @@ -0,0 +1,11 @@ +#coding=utf-8 +# +# +module Gitlink + # 调用时才加载 + autoload :TipException, "gitlink/tip_exception" + autoload :Utils, "gitlink/units" + autoload :Sms, "gitlink/sms" + autoload :I18n, "gitlink/i18n" + autoload :Ufile, "gitlink/ufile" +end \ No newline at end of file diff --git a/lib/gitlink/http.rb b/lib/gitlink/http.rb new file mode 100644 index 00000000..88687b41 --- /dev/null +++ b/lib/gitlink/http.rb @@ -0,0 +1,43 @@ +#coding=utf-8 + +require 'net/http' +require 'uri' + +module Gitlink + module Http + + def get(url) + uri = URI(url) + res = Net::HTTP.start(uri.host, uri.port, use_ssl: url.start_with?('https')) do |http| + req = Net::HTTP::Get.new(uri) + #req['Content-Type'] = 'application/json' + # The body needs to be a JSON string, use whatever you know to parse Hash to JSON + #req.body = {a: 1}.to_json + http.request(req) + end + + res.body + end + + def post(url, data=nil) + uri = URI(url) + res = Net::HTTP.start(uri.host, uri.port, use_ssl: url.start_with?('https')) do |http| + req = Net::HTTP::Post.new(uri) + #req['Content-Type'] = 'application/json' + # The body needs to be a JSON string, use whatever you know to parse Hash to JSON + req.body = data if data + http.request(req) + end + + res.body + end + + def decode(res) + begin + obj = ActiveSupport::JSON.decode(res) + rescue ActiveSupport::JSON.parse_error + logger.error("Attempted to decode invalid JSON: #{res}") + end + end + end +end \ No newline at end of file diff --git a/lib/educoder/i18n.rb b/lib/gitlink/i18n.rb similarity index 96% rename from lib/educoder/i18n.rb rename to lib/gitlink/i18n.rb index 4675f953..1f2e84f2 100644 --- a/lib/educoder/i18n.rb +++ b/lib/gitlink/i18n.rb @@ -1,7 +1,7 @@ -module Educoder +module Gitlink module I18n def self.included(base) - base.extend Educoder::I18n + base.extend Gitlink::I18n end def l(*args) diff --git a/lib/educoder/sms.rb b/lib/gitlink/sms.rb similarity index 61% rename from lib/educoder/sms.rb rename to lib/gitlink/sms.rb index a98ebf49..8573142d 100644 --- a/lib/educoder/sms.rb +++ b/lib/gitlink/sms.rb @@ -3,7 +3,7 @@ require 'net/https' require 'uri' -module Educoder +module Gitlink module Sms def self.send(opt={}) Rails.logger.info "#{opt[:mobile]} - #{opt[:code]}" @@ -36,25 +36,25 @@ module Educoder params['mobile'] = mobile params['text'] = "" if send_type.nil? - params['text'] = "【Edu实训】" + code + "(手机验证码),有效期为10分钟。如非本人操作,请忽略。" + params['text'] = "【GitLink(确实开源)】" + code + "(手机验证码),有效期为10分钟。如非本人操作,请忽略。" elsif send_type == 'competition_start' - params['text'] = "【Edu实训】亲爱的#{user_name},你参与的#{name}将于#{result}开始,请及时参赛" + params['text'] = "【GitLink(确实开源)】亲爱的#{user_name},你参与的#{name}将于#{result}开始,请及时参赛" elsif send_type == "teacher_register" params['mobile'] = EduSetting.get('teacher_register_phone') || '17680641960' - params['text'] = "【Edu实训】亲爱的#{user_name},有新的老师#{name}注册啦,请尽快处理" + params['text'] = "【GitLink(确实开源)】亲爱的#{user_name},有新的老师#{name}注册啦,请尽快处理" elsif send_type == 'subject_authorization' || send_type == 'shixun_authorization' - params['text'] = "【Edu实训】亲爱的#{user_name},您提交的#{name}#{send_type=='subject_authorization'?'实训路径':'实训'}发布申请#{result},请登录平台查看详情" + params['text'] = "【GitLink(确实开源)】亲爱的#{user_name},您提交的#{name}#{send_type=='subject_authorization'?'实训路径':'实训'}发布申请#{result},请登录平台查看详情" elsif send_type == 'authentication_pro' || send_type == 'authentication'|| send_type == 'trial_authorization' || send_type == 'project_info' - params['text'] = "【Edu实训】亲爱的#{user_name},您提交的#{send_type == 'authentication_pro'?'职业认证':(send_type == 'authentication'? '实名认证' : (send_type == 'project_info'?'加入申请':'试用申请' ))}#{result},请登录平台查看详情" + params['text'] = "【GitLink(确实开源)】亲爱的#{user_name},您提交的#{send_type == 'authentication_pro'?'职业认证':(send_type == 'authentication'? '实名认证' : (send_type == 'project_info'?'加入申请':'试用申请' ))}#{result},请登录平台查看详情" elsif send_type == "apply_pro_certification" || send_type == "apply_auth" - params['text'] = "【Edu实训】亲爱的#{name},有新的#{send_type == 'apply_pro_certification'?'职业':'实名'}认证申请,请尽快处理" + params['text'] = "【GitLink(确实开源)】亲爱的#{name},有新的#{send_type == 'apply_pro_certification'?'职业':'实名'}认证申请,请尽快处理" elsif send_type == "publish_subject" ||send_type == "publish_shixun"|| send_type == "user_apply_auth" || send_type == "discuss" params['mobile'] = EduSetting.get('subject_shixun_notify_phone') || '18711011226' if send_type == "publish_subject" || send_type == "publish_shixun" - params['text'] = "【Edu实训】亲爱的#{name},有新的#{send_type == 'publish_subject'?'实训路径':(send_type == 'publish_shixun' ? '实训' : (send_type == 'discuss' ? '实训评论':'试用'))}申请发布,请尽快处理" + params['text'] = "【GitLink(确实开源)】亲爱的#{name},有新的#{send_type == 'publish_subject'?'实训路径':(send_type == 'publish_shixun' ? '实训' : (send_type == 'discuss' ? '实训评论':'试用'))}申请发布,请尽快处理" elsif send_type == 'join_course_multi_role' - params['text'] = "【Edu实训】亲爱的#{user_name},您的课堂#{name}有助教或者教师申请加入,请尽快审核" + params['text'] = "【GitLink(确实开源)】亲爱的#{user_name},您的课堂#{name}有助教或者教师申请加入,请尽快审核" elsif send_type == 'applied_project_info' - params['text'] = "【Edu实训】亲爱的#{user_name},您的项目#{name}有成员申请加入,请尽快审核" + params['text'] = "【GitLink(确实开源)】亲爱的#{user_name},您的项目#{name}有成员申请加入,请尽快审核" end http = Net::HTTP.new(send_tpl_sms_uri.host, send_tpl_sms_uri.port) diff --git a/lib/educoder/tip_exception.rb b/lib/gitlink/tip_exception.rb similarity index 92% rename from lib/educoder/tip_exception.rb rename to lib/gitlink/tip_exception.rb index 08fd53ed..b6b8302a 100644 --- a/lib/educoder/tip_exception.rb +++ b/lib/gitlink/tip_exception.rb @@ -1,4 +1,4 @@ -module Educoder +module Gitlink class TipException < StandardError attr_reader :status, :message diff --git a/lib/educoder/ufile.rb b/lib/gitlink/ufile.rb similarity index 96% rename from lib/educoder/ufile.rb rename to lib/gitlink/ufile.rb index 2a52b0af..67ce0038 100644 --- a/lib/educoder/ufile.rb +++ b/lib/gitlink/ufile.rb @@ -7,7 +7,7 @@ require 'base64' require 'openssl' require 'faraday' -module Educoder +module Gitlink class Ufile PATH_PREFIX = %r{^/} diff --git a/lib/educoder/units.rb b/lib/gitlink/units.rb similarity index 96% rename from lib/educoder/units.rb rename to lib/gitlink/units.rb index 8fca64a5..5ad60e6e 100644 --- a/lib/educoder/units.rb +++ b/lib/gitlink/units.rb @@ -1,6 +1,6 @@ require 'fileutils' -module Educoder +module Gitlink module Utils class << self # Returns the relative root url of the application diff --git a/lib/tasks/user.rake b/lib/tasks/user.rake index 14487600..8a641b6d 100644 --- a/lib/tasks/user.rake +++ b/lib/tasks/user.rake @@ -13,7 +13,7 @@ namespace :sync do no = sprintf("%04d", i) phone = "#{rand_chart}160731#{no}" - mail = "#{rand_chart}#{no}@educoder.net" + mail = "#{rand_chart}#{no}@gitlink.org.cn" code = generate_identifier User, 8 login = "m" + code diff --git a/public/500.html b/public/500.html index f885d05a..8d60f59c 100644 --- a/public/500.html +++ b/public/500.html @@ -3,7 +3,7 @@ - EduCoder 500 error + Gitlink 500 error