diff --git a/app/assets/javascripts/admins/department_applies/index.js b/app/assets/javascripts/admins/department_applies/index.js deleted file mode 100644 index 7ecf0be75..000000000 --- a/app/assets/javascripts/admins/department_applies/index.js +++ /dev/null @@ -1,22 +0,0 @@ -$(document).on('turbolinks:load', function() { - var $editModal = $('.department-apply-edit-modal'); - if($editModal.length > 0){ - var $form = $editModal.find('form.department-apply-form'); - var $applyIdInput = $form.find('input[name="id"]'); - $editModal.on('show.bs.modal', function (event) { - var $link = $(event.relatedTarget); - var applyId = $link.data('id'); - $applyIdInput.val(applyId); - }); - $editModal.on('click', '.submit-btn', function(){ - $.ajax({ - method: "PUT", - dataType: 'script', - url: "/admins/department_applies/"+ $applyIdInput.val(), - data: $form.serialize(), - }).done(function(){ - $editModal.modal('hide'); - }); - }); - } -}); \ No newline at end of file diff --git a/app/assets/javascripts/admins/modals/admin-merge-department-modal.js b/app/assets/javascripts/admins/modals/admin-merge-department-modal.js index aead3f485..f5f2dceeb 100644 --- a/app/assets/javascripts/admins/modals/admin-merge-department-modal.js +++ b/app/assets/javascripts/admins/modals/admin-merge-department-modal.js @@ -66,10 +66,11 @@ $(document).on('turbolinks:load', function() { var $link = $(event.relatedTarget); var schoolId = $link.data('schoolId'); + var url = $link.data('url'); $schoolIdInput.val(schoolId); $originDepartmentIdInput.val($link.data('departmentId')); - + $form.data('url', url); $.ajax({ url: '/api/schools/' + schoolId + '/departments/for_option.json', dataType: 'json', diff --git a/app/controllers/admins/department_applies_controller.rb b/app/controllers/admins/department_applies_controller.rb index 6c26e67af..b6dece1de 100644 --- a/app/controllers/admins/department_applies_controller.rb +++ b/app/controllers/admins/department_applies_controller.rb @@ -1,6 +1,7 @@ class Admins::DepartmentAppliesController < Admins::BaseController - before_action :get_apply,only:[:agree,:edit,:update,:destroy] + before_action :get_apply,only:[:agree,:destroy] + def index params[:status] ||= 0 params[:sort_by] = params[:sort_by].presence || 'created_at' @@ -19,46 +20,77 @@ class Admins::DepartmentAppliesController < Admins::BaseController end end - def update - depart_name = params[:name] + def merge + apply_id = params[:origin_department_id] + apply_add =ApplyAddDepartment.find(apply_id) + origin_id = apply_add&.department_id + new_id = params[:department_id] + + return render_error('请选择其它部门') if origin_id.to_s == new_id.to_s + + origin_department = apply_add&.department + to_department = Department.find(new_id) + + return render_error('部门所属单位不相同') if origin_department&.school_id != to_department&.school_id + ActiveRecord::Base.transaction do - @depart_apply.update_attribute("name",depart_name) - @depart_apply&.department&.update_attribute("name",depart_name) - extra = depart_name + "(#{@depart_apply&.department&.school&.try(:name)})" + applied_message = AppliedMessage.where(applied_id: origin_id, applied_type: "ApplyAddDepartment") + + applied_message.update_all(:status => 4) + apply_add.update_attribute(:status, 2) + apply_add.tidings.update_all(:status => 1) + + extra = to_department&.name + "(#{apply_add&.department&.school&.try(:name)})" tiding_params = { - user_id: @depart_apply.user_id, + user_id: apply_add.user_id, trigger_user_id: 0, - container_id: @depart_apply.id, + container_id: apply_add.id, container_type: 'ApplyAddDepartment', - belong_container_id: @depart_apply.department.school_id, + belong_container_id: apply_add&.department&.school_id, belong_container_type: "School", tiding_type: "System", status: 3, extra: extra } Tiding.create(tiding_params) - render_success_js + + origin_department.apply_add_departments.delete_all + + origin_department.user_extensions.update_all(department_id: new_id) + + if to_department.identifier.blank? && origin_department.identifier.present? + to_department.update!(identifier: origin_department.identifier) + end + + origin_department.destroy! + apply_add.destroy! end + render_ok end def destroy ActiveRecord::Base.transaction do @depart_apply.update_attribute("status",3) @depart_apply&.applied_messages&.update_all(status:3) + + if params[:tip] == 'unapplied' #未审批时候删除 + UserExtension.where(department_id: @depart_apply.department_id).update_all(department_id:nil) + tiding_params = { + user_id: @depart_apply.user_id, + trigger_user_id: 0, + container_id: @depart_apply.id, + container_type: 'ApplyAddDepartment', + belong_container_id: @depart_apply&.department&.school_id, + belong_container_type: "School", + tiding_type: "System", + status: 2, + extra: params[:reason] + } + Tiding.create(tiding_params) + end + @depart_apply&.department&.destroy - @depart_apply&.user&.user_extension&.update_attribute("department_id", nil) - tiding_params = { - user_id: @depart_apply.user_id, - trigger_user_id: 0, - container_id: @depart_apply.id, - container_type: 'ApplyAddDepartment', - belong_container_id: @depart_apply.department.school_id, - belong_container_type: "School", - tiding_type: "System", - status: 2, - extra: params[:reason] - } - Tiding.create(tiding_params) + @depart_apply.destroy render_success_js end end diff --git a/app/controllers/admins/unit_applies_controller.rb b/app/controllers/admins/unit_applies_controller.rb new file mode 100644 index 000000000..deb231f16 --- /dev/null +++ b/app/controllers/admins/unit_applies_controller.rb @@ -0,0 +1,122 @@ +class Admins::UnitAppliesController < Admins::BaseController + before_action :get_apply,only: [:agree,:destroy,:edit,:update] + + def index + params[:sort_by] ||= 'created_at' + params[:sort_direction] ||= 'desc' + unit_applies = Admins::UnitApplyQuery.call(params) + @unit_applies = paginate unit_applies.preload(:school, :user) + end + + def agree + ActiveRecord::Base.transaction do + begin + @unit_apply.update_attribute("status",1) + @unit_apply&.applied_messages&.update_all(status:1) + @unit_apply&.school&.update_attribute("province",@unit_apply.province) + + # #申请信息的创建 + apply_message_params = { + user_id: @unit_apply&.user_id, + status: 1, + viewed: 0, + applied_id: @unit_apply.school_id, + applied_type: "ApplyAddSchools", + name: @unit_apply.name, + } + AppliedMessage.new(apply_message_params).save(validate: false) + + Tiding.where(user_id: 1, trigger_user_id: @unit_apply.user_id, container_id: @unit_apply.id, + container_type: 'ApplyAddSchools', status: 0, tiding_type: "Apply").update_all(status: 1) + #消息的创建 + tiding_params = { + user_id: @unit_apply.user_id, + trigger_user_id: 0, + container_id: @unit_apply.id, + container_type: 'ApplyAddSchools', + belong_container_id: @unit_apply.school_id, + belong_container_type: "School", + tiding_type: "System", + status: 1 + } + Tiding.create(tiding_params) + render_success_js + rescue Exception => e + Rails.logger.info("############_________________#########{e}") + end + end + end + + def destroy + Admins::DeleteUnitApplyService.call(@unit_apply, params) + render_success_js + end + + def edit + @all_schools = School.where.not(id: @unit_apply.school_id).pluck("name","id") + + end + + def update + school = School.find_by(id: params[:school_id]) + ActiveRecord::Base.transaction do + @unit_apply&.applied_messages&.update_all(status:4) + Tiding.where(user_id: 1, trigger_user_id: @unit_apply.user_id, container_id: @unit_apply.id, + container_type: 'ApplyAddSchools', status: 0, tiding_type: "Apply").update_all(status: 1) + + #消息的创建 + tiding_params = { + user_id: @unit_apply.user_id, + trigger_user_id: 0, + container_id: @unit_apply.id, + container_type: 'ApplyAddSchools', + belong_container_id: params[:school_id], + belong_container_type: "School", + tiding_type: "System", + status: 3, + extra: school.try(:name).to_s + } + Tiding.create(tiding_params) + + UserExtension.where(school_id: @unit_apply.school_id).update_all(school_id: params[:school_id].to_i) + ApplyAddDepartment.where(:school_id => @unit_apply.school_id).update_all(school_id: params[:school_id].to_i) + + # 判断重复 + before_apply_departments = Department.where(school_id: @unit_apply.school_id) + before_apply_departments.each do |department| + after_dep = Department.where(school_id: params[:school_id].to_i, name: department.name)&.first + if after_dep.present? + UserExtension.where(school_id: @unit_apply.school_id, department_id: department.id).update_all(department_id: after_dep.id) + department.destroy + department.apply_add_departments.destroy_all + else + department.apply_add_departments.update_all(school_id: school.id) + department.update_attribute(:school_id, school.id) + end + end + + @unit_apply&.school&.destroy + apply_params = { + status: 2, + name: school&.name.to_s, + school_id: params[:school_id], + province: params[:province], + city: params[:city], + address: params[:address] + } + @unit_apply.update_attributes(apply_params) + # render_success_js + end + end + + private + + def get_apply + @unit_apply = ApplyAddSchool.find_by(id:params[:id]) + end + + def disk_auth_filename(source_type, source_id, type) + File.join(storage_path, "#{source_type}", "#{source_id}#{type}") + end +end + diff --git a/app/controllers/graduation_topics_controller.rb b/app/controllers/graduation_topics_controller.rb index bd93401f3..0242bff21 100644 --- a/app/controllers/graduation_topics_controller.rb +++ b/app/controllers/graduation_topics_controller.rb @@ -230,6 +230,7 @@ class GraduationTopicsController < ApplicationController topic_repeat: topic.topic_repeat, province: topic.province, city: topic.city, + topic_type: topic.topic_type, course_list_id: @course.course_list_id) topic_bank.attachments.destroy_all else @@ -241,6 +242,7 @@ class GraduationTopicsController < ApplicationController topic_repeat: topic.topic_repeat, province: topic.province, city: topic.city, + topic_type: topic.topic_type, course_list_id: @course.course_list_id, user_id: current_user.id, graduation_topic_id: topic.id) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 8c8d121d1..b62840200 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -930,6 +930,7 @@ class HomeworkCommonsController < ApplicationController shixuns.each do |shixun| homework = HomeworksService.new.create_homework shixun, @course, @category, current_user @homework_ids << homework.id + CreateStudentWorkJob.perform_later(homework.id) end rescue Exception => e uid_logger(e.message) @@ -1031,6 +1032,7 @@ class HomeworkCommonsController < ApplicationController stage.shixuns.where.not(shixuns: {id: none_shixun_ids}).unhidden.each do |shixun| homework = HomeworksService.new.create_homework shixun, @course, category, current_user @homework_ids << homework.id + CreateStudentWorkJob.perform_later(homework.id) end end end diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 74d1d05e2..b47a9a346 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -8,11 +8,11 @@ class ShixunsController < ApplicationController before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :propaedeutics, :departments, :apply_shixun_mirror, - :get_mirror_script, :download_file] + :get_mirror_script, :download_file, :shixun_list] before_action :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :propaedeutics, :departments, :apply_shixun_mirror, - :get_mirror_script, :download_file] + :get_mirror_script, :download_file, :shixun_list] before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, :add_file] before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, @@ -98,6 +98,50 @@ class ShixunsController < ApplicationController .each_with_object({}) { |r, obj| obj[r.shixun_id] = r.name } end + def shixun_list + # 全部实训/我的实训 + type = params[:type] || "all" + # 状态:已发布/未发布 + status = params[:status] || "all" + + # 超级管理员用户显示所有未隐藏的实训、非管理员显示所有已发布的实训(对本单位公开且未隐藏未关闭) + if type == "mine" + @shixuns = current_user.shixuns.none_closed + else + if current_user.admin? + @shixuns = Shixun.none_closed.where(hidden: 0) + else + none_shixun_ids = ShixunSchool.where("school_id != #{current_user.school_id}").pluck(:shixun_id) + + @shixuns = Shixun.where.not(id: none_shixun_ids).none_closed.where(hidden: 0) + end + end + + unless status == "all" + @shixuns = status == "published" ? @shixuns.where(status: 2) : @shixuns.where(status: [0, 1]) + end + + ## 搜索关键字创建者、实训名称、院校名称 + unless params[:search].blank? + keyword = params[:search].strip + @shixuns = @shixuns.joins(user: [user_extension: :school]). + where("schools.name like '%#{keyword}%' + or concat(lastname, firstname) like '%#{keyword}%' + or shixuns.name like '%#{keyword.split(" ").join("%")}%'").distinct + end + + ## 筛选 难度 + if params[:diff].present? && params[:diff].to_i != 0 + @shixuns = @shixuns.where(trainee: params[:diff]) + end + + @total_count = @shixuns.count + page = params[:page] || 1 + limit = params[:limit] || 15 + + @shixuns = @shixuns.order("myshixuns_count desc").page(page).per(limit).includes(:shixun_info, :subjects, user: [user_extension: :school]) + end + ## 获取顶部菜单 def menus @repertoires = Repertoire.includes(sub_repertoires: [:tag_repertoires]).order("updated_at asc") @@ -865,6 +909,7 @@ class ShixunsController < ApplicationController def send_to_course @course = Course.find(params[:course_id]) homework = HomeworksService.new.create_homework @shixun, @course, nil, current_user + CreateStudentWorkJob.perform_later(homework.id) end # 二维码扫描下载 diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index d97b7172c..7c76748b1 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -214,6 +214,7 @@ class SubjectsController < ApplicationController stage.shixuns.where(id: params[:shixun_ids], status: 2).each do |shixun| homework = HomeworksService.new.create_homework shixun, @course, category, current_user + CreateStudentWorkJob.perform_later(homework.id) end end rescue Exception => e diff --git a/app/models/apply_add_school.rb b/app/models/apply_add_school.rb index c303283ca..ac7c880cd 100644 --- a/app/models/apply_add_school.rb +++ b/app/models/apply_add_school.rb @@ -1,10 +1,12 @@ class ApplyAddSchool < ApplicationRecord belongs_to :school + belongs_to :user has_many :applied_messages, as: :applied has_many :tidings, as: :container, dependent: :destroy after_create :send_notify + # after_destroy :after_delete_apply private @@ -12,4 +14,9 @@ class ApplyAddSchool < ApplicationRecord Tiding.create!(user_id: 1, status: 0, container_id: id, container_type: 'ApplyAddSchools', trigger_user_id: user_id, belong_container: school, tiding_type: 'Apply') end + + # def after_delete_apply + # + # end + end \ No newline at end of file diff --git a/app/models/school.rb b/app/models/school.rb index 1034fd997..24de02496 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -16,6 +16,8 @@ class School < ApplicationRecord has_many :customers, dependent: :destroy has_many :partners, dependent: :destroy + has_many :apply_add_departments, dependent: :destroy + # 学校管理员 def manager?(user) ec_school_users.exists?(user_id: user.id) diff --git a/app/models/shixun.rb b/app/models/shixun.rb index db6bca43e..33d36d026 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -59,6 +59,7 @@ class Shixun < ApplicationRecord scope :visible, -> { where.not(status: -1) } scope :published, lambda{ where(status: 2) } scope :published_closed, lambda{ where(status: [2, 3]) } + scope :none_closed, lambda{ where(status: [0, 1, 2]) } scope :unhidden, lambda{ where(hidden: 0, status: 2) } scope :field_for_recommend, lambda{ select([:id, :name, :identifier, :myshixuns_count]) } scope :find_by_ids,lambda{|k| where(id:k)} diff --git a/app/queries/admins/unit_apply_query.rb b/app/queries/admins/unit_apply_query.rb new file mode 100644 index 000000000..5df9c8ebb --- /dev/null +++ b/app/queries/admins/unit_apply_query.rb @@ -0,0 +1,24 @@ +class Admins::UnitApplyQuery < 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 + unit_applies = ApplyAddSchool.where(status:0) + + # 关键字模糊查询 + keyword = params[:keyword].to_s.strip + if keyword.present? + unit_applies = unit_applies.where("name like ?","%#{keyword}%") + end + + custom_sort(unit_applies, params[:sort_by], params[:sort_direction]) + end +end + diff --git a/app/services/admins/delete_unit_apply_service.rb b/app/services/admins/delete_unit_apply_service.rb new file mode 100644 index 000000000..a64c8d64d --- /dev/null +++ b/app/services/admins/delete_unit_apply_service.rb @@ -0,0 +1,56 @@ +class Admins::DeleteUnitApplyService < ApplicationService + + attr_reader :department, :params + + def initialize(unit_apply, params) + @unit_apply = unit_apply + @params = params + end + + def call + ActiveRecord::Base.transaction do + @unit_apply.update_attribute("status",3) + @unit_apply&.applied_messages&.update_all(status:3) + @unit_apply&.school&.apply_add_departments&.update_all(status:3) + + applied_departments = ApplyAddDepartment.where(school_id: @unit_apply.school_id) + applied_departments.update_all(status: 3) + + use_extensions = UserExtension&.where(school_id: @unit_apply.school_id) + user_ids = UserExtension&.where(school_id: @unit_apply.school_id)&.pluck(:user_id) + User.where(id: user_ids).update_all(profile_completed: false) + use_extensions.update_all(school_id: nil,department_id: nil) + + @unit_apply&.user&.user_extension&.update_attribute("department_id", nil) + + # 申请了职业认证的用户撤销申请 + apply_user_auth = ApplyUserAuthentication.where(user_id: user_ids, auth_type: 2, status: 0) + apply_user_auth.each do |apply| + apply.tidings.destroy_all + apply.update_attribute('status', 3) + diskfile2 = disk_auth_filename('UserAuthentication', apply.user_id, 'PRO') + diskfilePRO = diskfile2 + 'temp' + File.delete(diskfilePRO) if File.exist?(diskfilePRO) + File.delete(diskfile2) if File.exist?(diskfile2) + end + + # 未审批删除 + if params[:tip] == "unapplied" + Tiding.where(:user_id => 1, :trigger_user_id => @unit_apply.user_id, :container_id => @unit_apply.id, :container_type => 'ApplyAddSchools', :status => 0, :tiding_type => "Apply").update_all(status: 1) + Tiding.create(:user_id => @unit_apply.user_id, :trigger_user_id => 0, :container_id => @unit_apply.id, :container_type =>'ApplyAddSchools', :belong_container_id => @unit_apply.school_id, :belong_container_type=> 'School', :tiding_type => "System", :status => 2, :extra => params[:reason]) + + Tiding.where(:user_id => 1, :container_id => applied_departments.pluck(:id), :container_type => 'ApplyAddDepartment', :status => 0, :tiding_type => "Apply").update_all(status: 1) + if applied_departments&.first.present? + Tiding.create(:user_id => applied_departments.first.user_id, :trigger_user_id => 0, :container_id => applied_departments.first.id, :container_type =>'ApplyAddDepartment', :belong_container_id => @unit_apply.school_id, :belong_container_type=> 'School', :tiding_type => "System", :status => 2) + AppliedMessage.create(:user_id => applied_departments.first.user_id, :status => 3, :viewed => 0, :applied_id => applied_departments.first.id, :applied_type => "ApplyAddDepartment", :name => applied_departments.first.name ) + end + @unit_apply&.school&.destroy + @unit_apply&.school&.departments&.destroy_all + elsif params[:tip] == "applied" + applied_departments.destroy_all + @unit_apply.destroy + end + end + + end +end \ No newline at end of file diff --git a/app/services/homeworks_service.rb b/app/services/homeworks_service.rb index f6868afba..0dc814c89 100644 --- a/app/services/homeworks_service.rb +++ b/app/services/homeworks_service.rb @@ -15,7 +15,6 @@ class HomeworksService homework_detail_manual.save! if homework_detail_manual HomeworkCommonsShixun.create!(homework_common_id: homework.id, shixun_id: shixun.id) HomeworksService.new.create_shixun_homework_cha_setting(homework, shixun) - CreateStudentWorkJob.perform_later(homework.id) # HomeworksService.new.create_works_list(homework, course) end homework diff --git a/app/views/admins/department_applies/agree.js.erb b/app/views/admins/department_applies/agree.js.erb deleted file mode 100644 index d6a9f078a..000000000 --- a/app/views/admins/department_applies/agree.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -//$("#apply-id-<%= @depart_apply.id %>").remove() -//pop_box_new("批准成功", 400, 248); \ 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 index 72e0e42fc..49b38e31a 100644 --- a/app/views/admins/department_applies/index.html.erb +++ b/app/views/admins/department_applies/index.html.erb @@ -15,4 +15,4 @@ <%= render(partial: 'admins/shared/admin_common_refuse_modal') %> -<%= render partial: 'admins/department_applies/shared/edit_modal' %> \ No newline at end of file +<%= render 'admins/departments/shared/merge_department_modal' %> \ No newline at end of file diff --git a/app/views/admins/department_applies/shared/_edit_modal.html.erb b/app/views/admins/department_applies/shared/_edit_modal.html.erb deleted file mode 100644 index 44c38ac28..000000000 --- a/app/views/admins/department_applies/shared/_edit_modal.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -
\ 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 index a31e39a37..bdd518a8f 100644 --- a/app/views/admins/department_applies/shared/_list.html.erb +++ b/app/views/admins/department_applies/shared/_list.html.erb @@ -1,12 +1,12 @@ID | -部门名称 | -单位名称 | +ID | +部门名称 | +单位名称 | 创建者 | <%= sort_tag('创建于', name: 'created_at', path: admins_department_applies_path) %> | -操作 | +操作 |
---|---|---|---|---|---|---|---|---|---|
<%= apply.id %> | -<%= apply.name %> | -<%= apply.school.try(:name) %> | +<%= apply.name %> | +<%= apply.school.try(:name) %> | <%= apply.user.show_real_name %> | <%= format_time apply.created_at %> | @@ -23,17 +23,16 @@ <%= 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, element: ".department-apply-#{apply.id}") + url: admins_department_apply_path(apply,tip:"unapplied", element: ".department-apply-#{apply.id}") }) %> - - <%= javascript_void_link('修改', class: 'action department-apply-action', data: { toggle: 'modal', target: '.department-apply-edit-modal', id: 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 } %> |
ID | +单位名称 | +地区 | +详细地址 | +申请者 | +<%= sort_tag('创建于', name: 'created_at', path: admins_unit_applies_path) %> | +操作 | +
---|---|---|---|---|---|---|
"+(escaped?code:escape(code,true))+"\n
"}return''+(escaped?code:escape(code,true))+"\n
\n"};Renderer.prototype.blockquote=function(quote){return"\n"+quote+"\n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"
"+text+"
\n"};Renderer.prototype.table=function(header,body){return""+text+"
"};Renderer.prototype.br=function(){return this.options.xhtml?""+escape(e.message+"",true)+""}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else{if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); \ No newline at end of file diff --git a/public/react/public/js/editormd/editormd.min.js b/public/react/public/js/editormd/editormd.min.js index 79c072919..ac3deac1a 100755 --- a/public/react/public/js/editormd/editormd.min.js +++ b/public/react/public/js/editormd/editormd.min.js @@ -3601,9 +3601,9 @@ return text; }; - markedRenderer.em = function (text) { - if (text && text.indexOf('$$') != -1) { - return text; + markedRenderer.em = function (text, capInput) { + if (text && text.indexOf('$$') != -1 || (capInput && capInput.indexOf('$$') != -1)) { + return '_' + text + '_'; } else { return '' + text + ''; } diff --git a/public/react/public/js/js_min_all.js b/public/react/public/js/js_min_all.js index 6d0838c59..57606faa6 100755 --- a/public/react/public/js/js_min_all.js +++ b/public/react/public/js/js_min_all.js @@ -83,7 +83,7 @@ function AssertException(message){this.message=message}function assert(exp,messa * {@link https://github.com/pandao/editor.md} * @updateTime 2015-06-09 */ -function initEditormdPasteUpload(e,t,i){e.cm.getInputField().addEventListener("paste",function(i){_whenPasterDoUpload(i,t,function(t){t.id&&e.cm.replaceSelection("![](/api/attachments/"+t.id+")")})})}!function(e){"use strict";"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?module.exports=e:"function"==typeof define?define.amd||define(["../../../../editormd/examples/js/jquery.min"],e):window.editormd=e()}(function(){"use strict";var e="undefined"!=typeof jQuery?jQuery:Zepto;if(void 0!==e){var t,i,o,r=function(e,t){return new r.fn.init(e,t)};r.title=r.$name="Editor.md",r.version="1.5.0",r.homePage="https://pandao.github.io/editor.md/",r.classPrefix="editormd-",r.toolbarModes={full:["undo","redo","|","bold","del","italic","quote","ucwords","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","link","reference-link","image","code","preformatted-text","code-block","table","datetime","emoji","html-entities","pagebreak","|","goto-line","watch","preview","fullscreen","clear","search","|","help","info"],simple:["undo","redo","|","bold","del","italic","quote","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","|","watch","preview","fullscreen","|","help","info"],mini:["undo","redo","|","watch","preview","|","help","info"]},r.defaults={mode:"gfm",name:"",value:"",theme:"",editorTheme:"default",previewTheme:"",markdown:"",appendMarkdown:"",width:"100%",height:"100%",path:"./lib/",pluginPath:"",delay:300,autoLoadModules:!0,watch:!0,placeholder:"Enjoy Markdown! coding now...",gotoLine:!0,codeFold:!1,autoHeight:!1,autoFocus:!0,autoCloseTags:!0,searchReplace:!0,syncScrolling:!0,readOnly:!1,tabSize:4,indentUnit:4,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,showTrailingSpace:!0,matchBrackets:!0,indentWithTabs:!0,styleSelectedText:!0,matchWordHighlight:!0,styleActiveLine:!0,dialogLockScreen:!0,dialogShowMask:!0,dialogDraggable:!0,dialogMaskBgColor:"#fff",dialogMaskOpacity:.1,fontSize:"13px",saveHTMLToTextarea:!1,disabledKeyMaps:[],onload:function(){},onresize:function(){},onchange:function(){},onwatch:null,onunwatch:null,onpreviewing:function(){},onpreviewed:function(){},onfullscreen:function(){},onfullscreenExit:function(){},onscroll:function(){},onpreviewscroll:function(){},imageUpload:!1,imageFormats:["jpg","jpeg","gif","png","bmp","webp"],imageUploadURL:"",crossDomainUpload:!1,uploadCallbackURL:"",toc:!0,tocm:!1,tocTitle:"",tocDropdown:!1,tocContainer:"",tocStartLevel:1,htmlDecode:"style,iframe|on*",pageBreak:!0,atLink:!0,emailLink:!0,taskList:!1,emoji:!1,tex:!1,flowChart:!1,sequenceDiagram:!1,previewCodeHighlight:!0,toolbar:!0,toolbarAutoFixed:!0,toolbarIcons:"full",toolbarTitles:{},toolbarHandlers:{ucwords:function(){return r.toolbarHandlers.ucwords},lowercase:function(){return r.toolbarHandlers.lowercase}},toolbarCustomIcons:{lowercase:'a',ucwords:'Aa'},toolbarIconsClass:{undo:"fa-undo",redo:"fa-repeat",bold:"fa-bold",del:"fa-strikethrough",italic:"fa-italic",quote:"fa-quote-left",uppercase:"fa-font",h1:r.classPrefix+"bold",h2:r.classPrefix+"bold",h3:r.classPrefix+"bold",h4:r.classPrefix+"bold",h5:r.classPrefix+"bold",h6:r.classPrefix+"bold","list-ul":"fa-list-ul","list-ol":"fa-list-ol",hr:"fa-minus",link:"fa-link","reference-link":"fa-anchor",image:"fa-picture-o",code:"fa-code","preformatted-text":"fa-file-code-o","code-block":"fa-file-code-o",table:"fa-table",datetime:"fa-clock-o",emoji:"fa-smile-o","html-entities":"fa-copyright",pagebreak:"fa-newspaper-o","goto-line":"fa-terminal",watch:"fa-eye-slash",unwatch:"fa-eye",preview:"fa-desktop",search:"fa-search",fullscreen:"fa-arrows-alt",clear:"fa-eraser",help:"fa-question-circle",info:"fa-info-circle"},toolbarIconTexts:{},lang:{name:"zh-cn",description:"开源在线Markdown编辑器
"+this.atLink(this.emoji(e))+"
\n"},s.code=function(e,t,i){return"seq"===t||"sequence"===t?''+e+"
":n.Renderer.prototype.code.apply(this,arguments)},s.tablecell=function(e,t){var i=t.header?"th":"td";return(t.align?"<"+i+' style="text-align:'+t.align+'">':"<"+i+">")+this.atLink(this.emoji(e))+""+i+">\n"},s.listitem=function(e){return o.taskList&&/^\s*\[[x\s]\]\s*/.test(e)?(e=e.replace(/^\s*\[\s\]\s*/,' ').replace(/^\s*\[x\]\s*/,' '),'"+this.atLink(this.emoji(e))+"
\n"},s.code=function(e,t,i){return"seq"===t||"sequence"===t?''+e+"
":n.Renderer.prototype.code.apply(this,arguments)},s.tablecell=function(e,t){var i=t.header?"th":"td";return(t.align?"<"+i+' style="text-align:'+t.align+'">':"<"+i+">")+this.atLink(this.emoji(e))+""+i+">\n"},s.listitem=function(e){return o.taskList&&/^\s*\[[x\s]\]\s*/.test(e)?(e=e.replace(/^\s*\[\s\]\s*/,' ').replace(/^\s*\[x\]\s*/,' '),'