diff --git a/Gemfile b/Gemfile index 859090feb..e454889f6 100644 --- a/Gemfile +++ b/Gemfile @@ -49,6 +49,8 @@ gem 'rqrcode_png' gem 'acts-as-taggable-on', '~> 6.0' +gem 'omniauth-cas' + group :development, :test do gem 'rspec-rails', '~> 3.8' end diff --git a/app/assets/javascripts/admins/disciplines/index.js b/app/assets/javascripts/admins/disciplines/index.js index e5153516a..268dfb375 100644 --- a/app/assets/javascripts/admins/disciplines/index.js +++ b/app/assets/javascripts/admins/disciplines/index.js @@ -120,5 +120,19 @@ $(document).on('turbolinks:load', function() { }); } }); + + // ------------ 上移/下移 ------------- + $('.discipline-list-container').on('click', ".move-action", function () { + var $doAction = $(this); + + var disciplineId = $doAction.data('id'); + var opr = $doAction.data('opr'); + $.ajax({ + url: '/admins/disciplines/' + disciplineId + '/adjust_position', + method: 'POST', + dataType: 'script', + data: {opr: opr} + }); + }); } }); \ No newline at end of file diff --git a/app/assets/javascripts/admins/salesman_channels/index.js b/app/assets/javascripts/admins/salesman_channels/index.js index cc5109160..d621680d7 100644 --- a/app/assets/javascripts/admins/salesman_channels/index.js +++ b/app/assets/javascripts/admins/salesman_channels/index.js @@ -5,13 +5,13 @@ $(document).on('turbolinks:load', function() { var $addMemberModal = $('.admin-add-salesman-channel-user-modal'); var $addMemberForm = $addMemberModal.find('.admin-add-salesman-channel-user-form'); var $memberSelect = $addMemberModal.find('.salesman-channel-user-select'); - var $salesmanIdInput = $('.salesman-channel-list-form').find(".btn-primary"); + var $form = $addMemberModal.find('form.admin-add-salesman-user-form'); + + // 搜索 + var searchscForm = $(".saleman-channel-list-form .search-form"); - $addMemberModal.on('show.bs.modal', function(event){ - var $link = $(event.relatedTarget); - // var salesmanId = $link.data('salesman_id'); - // $salesmanIdInput.val(salesmanId); + $addMemberModal.on('show.bs.modal', function(event){ $memberSelect.select2('val', ' '); }); @@ -48,27 +48,72 @@ $(document).on('turbolinks:load', function() { // var salesmanId = $salesmanIdInput.val(); var memberIds = $memberSelect.val(); if (memberIds && memberIds.length > 0) { + var url = $form.data('url'); $.ajax({ method: 'POST', dataType: 'json', - url: '/admins/salesman_channels/batch_add', - data: { salesman_id: $salesmanIdInput.data("salesman-id"), school_ids: memberIds }, + url: url, + data: $form.serialize(), success: function(){ $.notify({ message: '创建成功' }); $addMemberModal.modal('hide'); + searchscForm.find('input[name="keyword"]').val(''); setTimeout(function(){ - window.location.reload(); + submitForm(); }, 500); }, error: function(res){ var data = res.responseJSON; - $form.find('.error').html(data.message); + $addMemberForm.find('.error').html(data.message); } }); } else { $addMemberModal.modal('hide'); } }); + + + // 清空 + searchscForm.on('click', '.clear-btn', function () { + searchscForm.find('.start_date').val(''); + searchscForm.find('.end_date').val('').trigger('change'); + searchscForm.find('input[name="keyword"]').val(''); + }); + + // 时间跨度 + var baseOptions = { + autoclose: true, + language: 'zh-CN', + format: 'yyyy-mm-dd', + startDate: '2017-04-01' + }; + + var defineDateRangeSelect = function(element){ + var options = $.extend({inputs: $(element).find('.start-date, .end-date')}, baseOptions); + $(element).datepicker(options); + + $(element).find('.start-date').datepicker().on('changeDate', function(e){ + $(element).find('.end-date').datepicker('setStartDate', e.date); + }); + }; + + defineDateRangeSelect('.grow-date-input-daterange'); + + + // 区间搜索 + searchscForm.on('click', ".search-btn", function(){ + submitForm(); + }); + + var submitForm = function(){ + var url = searchscForm.data('search-form-url'); + var form = searchscForm; + $.ajax({ + url: url, + data: form.serialize(), + dataType: "script" + }) + }; } }); \ No newline at end of file diff --git a/app/assets/javascripts/admins/salesman_customers/index.js b/app/assets/javascripts/admins/salesman_customers/index.js index 607e01f2e..f6ed67f12 100644 --- a/app/assets/javascripts/admins/salesman_customers/index.js +++ b/app/assets/javascripts/admins/salesman_customers/index.js @@ -58,7 +58,7 @@ $(document).on('turbolinks:load', function() { $addMemberModal.modal('hide'); setTimeout(function(){ - window.location.reload(); + listForm(); }, 500); }, error: function(res){ @@ -70,5 +70,13 @@ $(document).on('turbolinks:load', function() { $addMemberModal.modal('hide'); } }); + + + var listForm = function(){ + $.ajax({ + url: '/admins/salesman_customers?salesman_id='+ $salesmanIdInput.data("salesman-id"), + dataType: "script" + }); + }; } }); \ No newline at end of file diff --git a/app/assets/javascripts/admins/sub_disciplines/index.js b/app/assets/javascripts/admins/sub_disciplines/index.js index ad7f9fe87..a0ca6be56 100644 --- a/app/assets/javascripts/admins/sub_disciplines/index.js +++ b/app/assets/javascripts/admins/sub_disciplines/index.js @@ -72,5 +72,18 @@ $(document).on('turbolinks:load', function () { data: json }); }); + // ------------ 上移/下移 ------------- + $('.sub-discipline-list-container').on('click', ".move-action", function () { + var $doAction = $(this); + + var objectId = $doAction.data('id'); + var opr = $doAction.data('opr'); + $.ajax({ + url: '/admins/sub_disciplines/' + objectId + '/adjust_position', + method: 'POST', + dataType: 'script', + data: {opr: opr} + }); + }); } }); \ No newline at end of file diff --git a/app/assets/javascripts/admins/subject_settings/index.js b/app/assets/javascripts/admins/subject_settings/index.js index 63f76dd6e..cbd90f37b 100644 --- a/app/assets/javascripts/admins/subject_settings/index.js +++ b/app/assets/javascripts/admins/subject_settings/index.js @@ -29,6 +29,7 @@ $(document).on('turbolinks:load', function () { } }); + $(".subject-setting-list-container").on("change", '.subject-setting-form', function () { var s_id = $(this).attr("data-id"); var s_value = $(this).val(); diff --git a/app/assets/javascripts/admins/tag_disciplines/index.js b/app/assets/javascripts/admins/tag_disciplines/index.js index 3783f691c..cf73de517 100644 --- a/app/assets/javascripts/admins/tag_disciplines/index.js +++ b/app/assets/javascripts/admins/tag_disciplines/index.js @@ -72,5 +72,19 @@ $(document).on('turbolinks:load', function () { data: json }); }); + + // ------------ 上移/下移 ------------- + $('.tag-discipline-list-container').on('click', ".move-action", function () { + var $doAction = $(this); + + var objectId = $doAction.data('id'); + var opr = $doAction.data('opr'); + $.ajax({ + url: '/admins/tag_disciplines/' + objectId + '/adjust_position', + method: 'POST', + dataType: 'script', + data: {opr: opr} + }); + }); } }); \ No newline at end of file diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index c6c8b008c..fc628b2d1 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -51,12 +51,12 @@ class AccountsController < ApplicationController # todo user_extension UserExtension.create!(user_id: @user.id) # 注册完成,手机号或邮箱想可以奖励500金币 - RewardGradeService.call( - @user, - container_id: @user.id, - container_type: pre == 'p' ? 'Phone' : 'Mail', - score: 500 - ) + # RewardGradeService.call( + # @user, + # container_id: @user.id, + # container_type: pre == 'p' ? 'Phone' : 'Mail', + # score: 500 + # ) # 注册时,记录是否是引流用户 ip = request.remote_ip ua = UserAgent.find_by_ip(ip) diff --git a/app/controllers/admins/disciplines_controller.rb b/app/controllers/admins/disciplines_controller.rb index 2b5be595e..598ab7386 100644 --- a/app/controllers/admins/disciplines_controller.rb +++ b/app/controllers/admins/disciplines_controller.rb @@ -7,7 +7,7 @@ class Admins::DisciplinesController < Admins::BaseController def create name = params[:name].to_s.strip return render_error('名称重复') if Discipline.where(name: name).exists? - Discipline.create!(name: name) + Discipline.create!(name: name, position: Discipline.all.pluck(:position).max + 1) render_ok end @@ -39,7 +39,31 @@ class Admins::DisciplinesController < Admins::BaseController def destroy @discipline_id = params[:id] - current_discipline.destroy! + ActiveRecord::Base.transaction do + Discipline.where("position > #{current_discipline.position}").update_all("position=position-1") + current_discipline.destroy! + end + end + + def adjust_position + max_position = Discipline.all.pluck(:position).max + opr = params[:opr] || "down" + if (params[:opr] == "up" && current_discipline.position == 1) || (params[:opr] == "down" && current_discipline.position == max_position) + @message = "超出范围" + else + ActiveRecord::Base.transaction do + if opr == "up" + Discipline.find_by("position = #{current_discipline.position - 1}")&.update!(position: current_discipline.position) + current_discipline.update!(position: current_discipline.position - 1) + else + Discipline.find_by("position = #{current_discipline.position + 1}")&.update!(position: current_discipline.position) + current_discipline.update!(position: current_discipline.position + 1) + end + end + end + @disciplines = Discipline.all + rescue Exception => e + @message = e.message end private diff --git a/app/controllers/admins/salesman_channels_controller.rb b/app/controllers/admins/salesman_channels_controller.rb index 2abf02698..44928253c 100644 --- a/app/controllers/admins/salesman_channels_controller.rb +++ b/app/controllers/admins/salesman_channels_controller.rb @@ -2,7 +2,12 @@ class Admins::SalesmanChannelsController < Admins::BaseController before_action :set_salesman def index - @channels = SalesmanChannel.all + @channels = @salesman.salesman_channels + if params[:keyword].present? + @channels = @channels.joins(:school).where("schools.name like ?", "%#{params[:keyword]}%") + end + @start_time = params[:start_date] + @end_time = params[:end_date].blank? ? Time.now : params[:end_date] end def batch_add @@ -10,10 +15,12 @@ class Admins::SalesmanChannelsController < Admins::BaseController school_ids = params[:school_ids] - channel_ids school_ids.each do |school_id| school = School.find_by(id: school_id) - next if school.blank? + next if school.blank? || @salesman.salesman_channels.where(school_id: school.id).exists? @salesman.salesman_channels.create!(school_id: school.id) end render_ok + rescue Exception => ex + render_error(ex.message) end def destroy diff --git a/app/controllers/admins/salesman_customers_controller.rb b/app/controllers/admins/salesman_customers_controller.rb index 3fa63f147..15645fe6f 100644 --- a/app/controllers/admins/salesman_customers_controller.rb +++ b/app/controllers/admins/salesman_customers_controller.rb @@ -10,7 +10,7 @@ class Admins::SalesmanCustomersController < Admins::BaseController user_ids = params[:user_ids] - customer_ids user_ids.each do |user_id| user = UserExtension.find_by(user_id: user_id) - next if user.blank? + next if user.blank? || @salesman.salesman_customers.where(user_id: user.user_id).exists? @salesman.salesman_customers.create!(user_id: user.user_id, school_id: user.school_id) end render_ok diff --git a/app/controllers/admins/shixun_settings_controller.rb b/app/controllers/admins/shixun_settings_controller.rb index 23278c3a9..357ddabdf 100644 --- a/app/controllers/admins/shixun_settings_controller.rb +++ b/app/controllers/admins/shixun_settings_controller.rb @@ -18,7 +18,7 @@ class Admins::ShixunSettingsController < Admins::BaseController task_pass: params[:task_pass].present? ? params[:task_pass] : false, code_hidden: params[:code_hidden].present? ? params[:code_hidden] : false, vip: params[:vip].present? ? params[:vip] : false, - is_wechat_support: params[:is_wechat_support].present? ? params[:is_wechat_support] : false + no_subject: params[:no_subject].present? ? params[:no_subject] : false } @shixuns_type_check = MirrorRepository.pluck(:type_name,:id) @@ -135,6 +135,6 @@ class Admins::ShixunSettingsController < Admins::BaseController def setting_params params.permit(:use_scope,:excute_time,:close,:status,:can_copy,:webssh,:hidden,:homepage_show,:task_pass, - :code_hidden,:vip,:page_no,:id, :is_wechat_support) + :code_hidden,:vip,:page_no,:id, :no_subject) end end diff --git a/app/controllers/admins/sub_disciplines_controller.rb b/app/controllers/admins/sub_disciplines_controller.rb index ac6eb6419..a60f497e5 100644 --- a/app/controllers/admins/sub_disciplines_controller.rb +++ b/app/controllers/admins/sub_disciplines_controller.rb @@ -9,7 +9,7 @@ class Admins::SubDisciplinesController < Admins::BaseController name = params[:name].to_s.strip return render_error('名称不能为空') if name.blank? return render_error('名称重复') if current_discipline.sub_disciplines.where(name: name).exists? - SubDiscipline.create!(name: name, discipline_id: current_discipline.id) + SubDiscipline.create!(name: name, discipline_id: current_discipline.id, position: current_discipline.sub_disciplines.pluck(:position).max + 1) render_ok end @@ -38,9 +38,36 @@ class Admins::SubDisciplinesController < Admins::BaseController def destroy @sub_discipline_id = params[:id] - current_sub_discipline.destroy! + ActiveRecord::Base.transaction do + discipline = current_sub_discipline.discipline + discipline.sub_disciplines.where("position > #{current_sub_discipline.position}").update_all("position=position-1") + current_sub_discipline.destroy! + end end + def adjust_position + discipline = current_sub_discipline.discipline + max_position = discipline.sub_disciplines.pluck(:position).max + opr = params[:opr] || "down" + if (params[:opr] == "up" && current_sub_discipline.position == 1) || (params[:opr] == "down" && current_sub_discipline.position == max_position) + @message = "超出范围" + else + ActiveRecord::Base.transaction do + if opr == "up" + discipline.sub_disciplines.find_by("position = #{current_sub_discipline.position - 1}")&.update!(position: current_sub_discipline.position) + current_sub_discipline.update!(position: current_sub_discipline.position - 1) + else + discipline.sub_disciplines.find_by("position = #{current_sub_discipline.position + 1}")&.update!(position: current_sub_discipline.position) + current_sub_discipline.update!(position: current_sub_discipline.position + 1) + end + end + end + @sub_disciplines = discipline&.sub_disciplines + rescue Exception => e + @message = e.message + end + + private def current_sub_discipline diff --git a/app/controllers/admins/subject_settings_controller.rb b/app/controllers/admins/subject_settings_controller.rb index 29e4dfd30..8fa9fde8a 100644 --- a/app/controllers/admins/subject_settings_controller.rb +++ b/app/controllers/admins/subject_settings_controller.rb @@ -20,6 +20,11 @@ class Admins::SubjectSettingsController < Admins::BaseController end end + def update_mobile_show + subject = Subject.find(params[:subject_id]) + subject.update_attributes(:show_mobile => params[:show_mobile]) + end + private def current_subject diff --git a/app/controllers/admins/tag_disciplines_controller.rb b/app/controllers/admins/tag_disciplines_controller.rb index 0433e8326..c10f63884 100644 --- a/app/controllers/admins/tag_disciplines_controller.rb +++ b/app/controllers/admins/tag_disciplines_controller.rb @@ -8,7 +8,8 @@ class Admins::TagDisciplinesController < Admins::BaseController def create name = params[:name].to_s.strip return render_error('名称重复') if current_sub_discipline.tag_disciplines.where(name: name).exists? - TagDiscipline.create!(name: name, sub_discipline_id: current_sub_discipline.id, user_id: current_user.id) + TagDiscipline.create!(name: name, sub_discipline_id: current_sub_discipline.id, user_id: current_user.id, + position: current_sub_discipline.tag_disciplines.pluck(:position).max + 1) render_ok end @@ -32,9 +33,36 @@ class Admins::TagDisciplinesController < Admins::BaseController def destroy @tag_discipline_id = params[:id] - current_tag_discipline.destroy! + ActiveRecord::Base.transaction do + sub_discipline = current_tag_discipline.sub_discipline + sub_discipline.tag_disciplines.where("position > #{current_tag_discipline.position}").update_all("position=position-1") + current_tag_discipline.destroy! + end + end + + def adjust_position + sub_discipline = current_tag_discipline.sub_discipline + max_position = sub_discipline.tag_disciplines.pluck(:position).max + opr = params[:opr] || "down" + if (params[:opr] == "up" && current_tag_discipline.position == 1) || (params[:opr] == "down" && current_tag_discipline.position == max_position) + @message = "超出范围" + else + ActiveRecord::Base.transaction do + if opr == "up" + sub_discipline.tag_disciplines.find_by("position = #{current_tag_discipline.position - 1}")&.update!(position: current_tag_discipline.position) + current_tag_discipline.update!(position: current_tag_discipline.position - 1) + else + sub_discipline.tag_disciplines.find_by("position = #{current_tag_discipline.position + 1}")&.update!(position: current_tag_discipline.position) + current_tag_discipline.update!(position: current_tag_discipline.position + 1) + end + end + end + @tag_disciplines = sub_discipline&.tag_disciplines + rescue Exception => e + @message = e.message end + private def current_sub_discipline diff --git a/app/controllers/bind_users_controller.rb b/app/controllers/bind_users_controller.rb index 354b2993b..329ade866 100644 --- a/app/controllers/bind_users_controller.rb +++ b/app/controllers/bind_users_controller.rb @@ -1,13 +1,35 @@ class BindUsersController < ApplicationController - before_action :require_login + # before_action :require_login def create - user = CreateBindUserService.call(current_user, create_params) - successful_authentication(user) if user.id != current_user.id + # user = CreateBindUserService.call(create_params) + # + if params[:type] == "qq" + begin + user = CreateBindUserService.call(current_user, create_params) + successful_authentication(user) if user.id != current_user.id - render_ok - rescue ApplicationService::Error => ex - render_error(ex.message) + render_ok + rescue ApplicationService::Error => ex + render_error(ex.message) + end + else + begin + tip_exception '系统错误' if session[:unionid].blank? + + bind_user = User.try_to_login(params[:username], params[:password]) + tip_exception '用户名或者密码错误' if bind_user.blank? + tip_exception '用户名或者密码错误' unless bind_user.check_password?(params[:password].to_s) + tip_exception '该账号已被绑定,请更换其他账号进行绑定' if bind_user.bind_open_user?(params[:type].to_s) + + OpenUsers::Wechat.create!(user: bind_user, uid: session[:unionid]) + successful_authentication(bind_user) + + render_ok + rescue Exception => e + render_error(e.message) + end + end end def new_user diff --git a/app/controllers/concerns/controller_rescue_handler.rb b/app/controllers/concerns/controller_rescue_handler.rb index e680f32c1..4ab5d3276 100644 --- a/app/controllers/concerns/controller_rescue_handler.rb +++ b/app/controllers/concerns/controller_rescue_handler.rb @@ -6,11 +6,21 @@ module ControllerRescueHandler Util.logger_error e render json: {status: -1, message: e.message} end + rescue_from ActiveRecord::StatementInvalid do |e| Util.logger_error e render json: {status: -1, message: "接口数据异常"} end + rescue_from NoMethodError do |e| + Util.logger_error e + render json: {status: -1, message: "接口方法异常"} + end + + rescue_from ActionController::UnknownFormat do |e| + render json: {status: -1, message: "接口调用非JSON格式"} + end + # rescue_from ActionView::MissingTemplate, with: :object_not_found # rescue_from ActiveRecord::RecordNotFound, with: :object_not_found rescue_from Educoder::TipException, with: :tip_show @@ -26,10 +36,6 @@ module ControllerRescueHandler render_error(ex.record.errors.full_messages.join(',')) end - rescue_from ActionController::UnknownFormat do |e| - render json: {status: -1, message: "接口调用非JSON格式"} - end - # rescue_from RuntimeError do |ex| # Util.logger_error "#######ex:#{ex}" # render_error(ex.message) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 8812e69fe..d0a2e5e4b 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -13,7 +13,7 @@ class CoursesController < ApplicationController end before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, - :left_banner, :top_banner, :informs, :online_learning, :course_groups] + :left_banner, :top_banner, :informs, :online_learning, :course_groups, :search_slim] before_action :check_account, only: [:new, :create, :apply_to_join_course, :join_excellent_course] before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, :left_banner, :top_banner, :apply_to_join_course, :exit_course, :course_groups] @@ -742,12 +742,15 @@ class CoursesController < ApplicationController # 切换为教师 def switch_to_teacher begin - course_member = @course.course_members.find_by!(user_id: current_user.id, is_active: 1) - tip_exception("切换失败") unless course_member.STUDENT? + course_student = @course.students.find_by!(user_id: current_user.id, is_active: 1) + tip_exception("切换失败") unless course_student.present? course_teacher = CourseMember.find_by!(user_id: current_user.id, role: %i[CREATOR PROFESSOR], course_id: @course.id) - course_member.update!(is_active: 0) - course_teacher.update!(is_active: 1) + ActiveRecord::Base.transaction do + course_student.destroy! + course_teacher.update!(is_active: 1) + CourseDeleteStudentDeleteWorksJob.perform_later(@course.id, [current_user.id]) + end normal_status(0, "切换成功") rescue => e uid_logger_error(e.message) @@ -758,12 +761,15 @@ class CoursesController < ApplicationController # 切换为助教 def switch_to_assistant begin - course_member = @course.course_members.find_by!(user_id: current_user.id, is_active: 1) - tip_exception("切换失败") unless course_member.STUDENT? + course_student = @course.course_members.find_by!(user_id: current_user.id, is_active: 1) + tip_exception("切换失败") unless course_student.present? course_teacher = CourseMember.find_by!(user_id: current_user.id, role: %i[ASSISTANT_PROFESSOR], course_id: @course.id) - course_member.update!(is_active: 0) - course_teacher.update!(is_active: 1) + ActiveRecord::Base.transaction do + course_student.destroy! + course_teacher.update!(is_active: 1) + CourseDeleteStudentDeleteWorksJob.perform_later(@course.id, [current_user.id]) + end normal_status(0, "切换成功") rescue => e uid_logger_error(e.message) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 60a437fdc..15f5c67d9 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1168,7 +1168,7 @@ class ExercisesController < ApplicationController #班级的选择 if params[:exercise_group_id].present? group_id = params[:exercise_group_id] - exercise_students = @course_all_members.course_find("course_group_id", group_id) #试卷所分班的全部人数 + exercise_students = @course_all_members.course_find_by_ids("course_group_id", group_id) #试卷所分班的全部人数 user_ids = exercise_students.pluck(:user_id).reject(&:blank?) @exercise_users_list = @exercise_users_list.exercise_commit_users(user_ids) end diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 5def8ec1e..cfcf92e4c 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -524,11 +524,11 @@ class GamesController < ApplicationController else {updated_at: Time.now} end - logger.info("#############myshixuns_update: ##{myshixuns_update}") + #logger.info("#############myshixuns_update: ##{myshixuns_update}") @myshixun.update_attributes!(myshixuns_update) gitUrl = repo_ip_url @myshixun.repo_path - logger.info("#############giturl: ##{gitUrl}") + #logger.info("#############giturl: ##{gitUrl}") gitUrl = Base64.urlsafe_encode64(gitUrl) shixun_tomcat = edu_setting('cloud_bridge') @@ -554,7 +554,7 @@ class GamesController < ApplicationController testSet << test_cases end - logger.info("##############testSet: #{testSet}") + #logger.info("##############testSet: #{testSet}") testCases = Base64.urlsafe_encode64(testSet.to_json) unless testSet.blank? # 评测类型: 0,1,2 用于webssh的评测, 3用于vnc @@ -581,7 +581,7 @@ class GamesController < ApplicationController if secret_rep&.repo_name secretGitUrl = repo_ip_url secret_rep.repo_path br_params.merge!({secretGitUrl: Base64.urlsafe_encode64(secretGitUrl), secretDir: secret_rep.secret_dir_path}) - logger.info("#######br_params:#{br_params}") + #logger.info("#######br_params:#{br_params}") end # 中间层交互 @@ -691,7 +691,7 @@ class GamesController < ApplicationController next_game: next_game&.identifier} rescue Exception => e uid_logger("choose build failed #{e.message}") - @result = [status: -1, contents: "#{e.message}"] + tip_exception(-1, e.message) end # 轮询获取状态 @@ -700,10 +700,10 @@ class GamesController < ApplicationController resubmit_identifier = @game.resubmit_identifier # 如果没有超时并且正在评测中 # 判断评测中的状态有两种:1、如果之前没有通关的,只需判断status为1即可;如果通过关,则判断game的resubmit_identifier是否更新 - uid_logger("################game_status: #{@game.status}") - uid_logger("################params[:resubmit]: #{params[:resubmit]}") - uid_logger("################resubmit_identifier: #{resubmit_identifier}") - uid_logger("################time_out: #{params[:time_out]}") + #uid_logger("################game_status: #{@game.status}") + #uid_logger("################params[:resubmit]: #{params[:resubmit]}") + #uid_logger("################resubmit_identifier: #{resubmit_identifier}") + #uid_logger("################time_out: #{params[:time_out]}") sec_key = params[:sec_key] if (params[:time_out] == "false") && ((params[:resubmit].blank? && @game.status == 1) || (params[:resubmit].present? && (params[:resubmit] != resubmit_identifier))) @@ -764,7 +764,7 @@ class GamesController < ApplicationController end end - uid_logger("game is #{@game.id}, record id is #{e_record.try(:id)}, time is**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") + #uid_logger("game is #{@game.id}, record id is #{e_record.try(:id)}, time is**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") # 记录前端总耗时 record_consume_time = e_record.try(:pod_execute) max_mem = e_record.try(:max_mem) @@ -850,7 +850,7 @@ class GamesController < ApplicationController @allowed_hidden_testset = @identity < User::EDU_GAME_MANAGER || @game.test_sets_view #解锁的用户 if max_query_index > 0 - uid_logger("max_query_index is #{max_query_index} game id is #{@game.id}, challenge_id is #{challenge.id}") + #uid_logger("max_query_index is #{max_query_index} game id is #{@game.id}, challenge_id is #{challenge.id}") @qurey_test_sets = TestSet.find_by_sql("SELECT o.code, o.actual_output, o.out_put, o.result, o.test_set_position, o.ts_time, o.ts_mem, o.query_index, t.is_public, t.input, t.output, o.compile_success FROM outputs o, games g, challenges c, test_sets t where g.id=#{@game.id} and c.id=#{challenge.id} and o.query_index=#{max_query_index} diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index ac3b84871..082c8118d 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -876,10 +876,12 @@ class HomeworkCommonsController < ApplicationController subjects = Subject.where(id: params[:subject_ids], status: 2).includes(stages: :shixuns).reorder("id desc") @homework_ids = [] - none_shixun_ids = ShixunSchool.where("school_id != #{current_user.school_id}").pluck(:shixun_id) + # none_shixun_ids = ShixunSchool.where("school_id != #{current_user.school_id}").pluck(:shixun_id) course_module = @course.course_modules.find_by(module_type: "shixun_homework") subjects.each do |subject| + shixun_ids = subject.shixuns.where(use_scope: 0).pluck(:id) + + subject.shixuns.joins(:shixun_schools).where("school_id = #{current_user.try(:school_id).to_i} and use_scope = 1").pluck(:id) subject.stages.each do |stage| @@ -889,7 +891,7 @@ class HomeworkCommonsController < ApplicationController course_module_id: course_module.id, position: course_module.course_second_categories.count + 1) # 去掉不对当前用户的单位公开的实训,已发布的实训 - stage.shixuns.no_jupyter.where.not(shixuns: {id: none_shixun_ids}).unhidden.each do |shixun| + stage.shixuns.no_jupyter.where(id: 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) @@ -981,8 +983,8 @@ class HomeworkCommonsController < ApplicationController end homework.homework_detail_manual.update_attributes!(comment_status: 1) - if homework.course_acts.size == 0 - homework.course_acts << CourseActivity.new(user_id: homework.user_id, course_id: homework.course_id) + if homework.course_act.blank? + homework.course_act << CourseActivity.new(user_id: homework.user_id, course_id: homework.course_id) end # 发消息 HomeworkCommonPushNotifyJob.perform_later(homework.id, tiding_group_ids) @@ -1043,7 +1045,7 @@ class HomeworkCommonsController < ApplicationController def end_homework tip_exception("请至少选择一个分班") if params[:group_ids].blank? && @course.course_groups.size != 0 - time = Time.now.strftime("%Y-%m-%d %H:%M:%S") + time = Time.now # 已发布且未截止的作业才能立即截止 @@ -1084,7 +1086,7 @@ class HomeworkCommonsController < ApplicationController homework.end_time = time end - homework_detail_manual.update_attributes!(comment_status: 2) if homework.end_time <= time + # homework_detail_manual.update_attributes!(comment_status: 2) if homework.end_time <= time # 实训作业的作品需要计算是否迟交 if homework.homework_type == "practice" diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index d9a62cf90..69323bf49 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -20,11 +20,8 @@ class MainController < ApplicationController uid_logger("main start is #{cookies[:_educoder_session]}") end - - if params[:path] && params[:path]&.include?("educoderh5") && params[:path].split("/").first == "educoderh5" - render file: 'public/h5build/index.html', :layout => false - # TODO: 这块之后需要整合,到上面去,或者架构重新变化,统一跳转到index后再路由分发 - elsif params[:path] && params[:path]&.include?("h5educoderbuild") && params[:path].split("/").first == "h5educoderbuild" + # TODO: 这块之后需要整合,者架构重新变化,统一跳转到index后再路由分发 + if params[:path] && params[:path]&.include?("h5educoderbuild") && params[:path].split("/").first == "h5educoderbuild" render file: 'public/h5educoderbuild/index.html', :layout => false else render file: 'public/react/build/index.html', :layout => false diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 629706759..29a9a9730 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -91,7 +91,7 @@ class MyshixunsController < ApplicationController ActiveRecord::Base.transaction do begin t1 = Time.now - uid_logger_dubug("@@@222222#{params[:jsonTestDetails]}") + #uid_logger_dubug("@@@222222#{params[:jsonTestDetails]}") jsonTestDetails = JSON.parse(params[:jsonTestDetails]) timeCost = JSON.parse(params[:timeCost]) brige_end_time = Time.parse(timeCost['evaluateEnd']) if timeCost['evaluateEnd'].present? @@ -101,7 +101,7 @@ class MyshixunsController < ApplicationController sec_key = jsonTestDetails['sec_key'] server_url = jsonTestDetails['showServer'] - uid_logger_dubug("training_task_status start-#{game_id}-1#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") + #uid_logger_dubug("training_task_status start-#{game_id}-1#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") resubmit = jsonTestDetails['resubmit'] outPut = tran_base64_decode64(jsonTestDetails['outPut']) @@ -267,7 +267,7 @@ class MyshixunsController < ApplicationController @sec_key = generate_identifier(EvaluateRecord, 12) record = EvaluateRecord.create!(:user_id => current_user.id, :shixun_id => @myshixun.shixun_id, :game_id => game_id, :identifier => @sec_key, :exec_time => exec_time) - uid_logger_dubug("-- game build: file update #{@sec_key}, record id is #{record.id}, time is **** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") + #uid_logger_dubug("-- game build: file update #{@sec_key}, record id is #{record.id}, time is **** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") end # 隐藏代码文件 和 VNC的都不需要走版本库 vnc = @myshixun.shixun&.vnc @@ -282,8 +282,6 @@ class MyshixunsController < ApplicationController else params[:content] end - uid_logger_dubug("content_#{@myshixun.identifier}: #{content}") - uid_logger_dubug("###last_content_#{@myshixun.identifier}####{last_content}") if content != last_content @content_modified = 1 @@ -291,9 +289,6 @@ class MyshixunsController < ApplicationController author_name = current_user.real_name author_email = current_user.git_mail message = params[:evaluate] == 0 ? "System automatically submitted" : "User submitted" - uid_logger_dubug("112233#{author_name}") - uid_logger_dubug("112233#{author_email}") - uid_logger_dubug("daiao_debug_#{@myshixun.identifier}: #{@repo_path}: #{path}; #{message}; #{content}; ") @content = GitService.update_file(repo_path: @repo_path, file_path: path, message: message, diff --git a/app/controllers/oauth/base_controller.rb b/app/controllers/oauth/base_controller.rb index 11ac69d71..930abead5 100644 --- a/app/controllers/oauth/base_controller.rb +++ b/app/controllers/oauth/base_controller.rb @@ -30,4 +30,22 @@ class Oauth::BaseController < ActionController::Base @_default_yun_session = "#{request.subdomain.split('.').first}_user_id" # @_default_yun_session = "#{current_laboratory.try(:identifier).split('.').first}_user_id" end + + def session_openid + session[:openid] + end + + def set_session_openid(openid) + Rails.logger.info("[wechat] set session openid: #{openid}") + session[:openid] = openid + end + + def session_unionid + session[:unionid] + end + + def set_session_unionid(unionid) + Rails.logger.info("[wechat] set session unionid: #{unionid}") + session[:unionid] = unionid + end end \ No newline at end of file diff --git a/app/controllers/oauth/cas_controller.rb b/app/controllers/oauth/cas_controller.rb new file mode 100644 index 000000000..d1fa95470 --- /dev/null +++ b/app/controllers/oauth/cas_controller.rb @@ -0,0 +1,13 @@ +class Oauth::CasController < Oauth::BaseController + def create + user, is_new_user = Oauth::CreateORFindCasUserService.call(current_user, auth_hash) + successful_authentication(user) + + redirect_to root_url + end + + + def auth_hash + JSON.parse(CGI.unescape(request.env['omniauth.auth'].extra.to_json)) + end +end \ No newline at end of file diff --git a/app/controllers/oauth/wechat_controller.rb b/app/controllers/oauth/wechat_controller.rb index 6c0c53eb6..47dc53ccc 100644 --- a/app/controllers/oauth/wechat_controller.rb +++ b/app/controllers/oauth/wechat_controller.rb @@ -1,11 +1,32 @@ class Oauth::WechatController < Oauth::BaseController def create - user, new_user = Oauth::CreateOrFindWechatAccountService.call(current_user ,params) + # user, new_user = Oauth::CreateOrFindWechatAccountService.call(current_user ,params) - successful_authentication(user) + begin + code = params['code'].to_s.strip + tip_exception("code不能为空") if code.blank? + new_user = false - render_ok(new_user: new_user) - rescue Oauth::CreateOrFindWechatAccountService::Error => ex - render_error(ex.message) + result = WechatOauth::Service.access_token(code) + result = WechatOauth::Service.user_info(result['access_token'], result['openid']) + + # 存在该用户 + open_user = OpenUsers::Wechat.find_by(uid: result['unionid']) + if open_user.present? && open_user.user.present? + successful_authentication(open_user.user) + else + if current_user.blank? || !current_user.logged? + new_user = true + set_session_openid(result['openid']) + set_session_unionid(result['unionid']) + else + OpenUsers::Wechat.create!(user: current_user, uid: result['unionid']) + end + end + + render_ok(new_user: new_user) + rescue WechatOauth::Error => ex + render_error(ex.message) + end end end \ No newline at end of file diff --git a/app/controllers/tag_disciplines_controller.rb b/app/controllers/tag_disciplines_controller.rb index b161a7af8..c80071824 100644 --- a/app/controllers/tag_disciplines_controller.rb +++ b/app/controllers/tag_disciplines_controller.rb @@ -4,7 +4,8 @@ class TagDisciplinesController < ApplicationController def create sub_discipline = SubDiscipline.find_by!(id: params[:sub_discipline_id]) tip_exception("重复的知识点") if sub_discipline.tag_disciplines.exists?(name: params[:name].to_s.strip) - tag_discipline = TagDiscipline.create!(name: params[:name].to_s.strip, sub_discipline: sub_discipline, user_id: current_user.id) + tag_discipline = TagDiscipline.create!(name: params[:name].to_s.strip, sub_discipline: sub_discipline, user_id: current_user.id, + position: sub_discipline.tag_disciplines.pluck(:position).max + 1) render_ok({tag_discipline_id: tag_discipline.id}) end end \ No newline at end of file diff --git a/app/controllers/weapps/challenges_controller.rb b/app/controllers/weapps/challenges_controller.rb index 4b87ac027..21a7fdee9 100644 --- a/app/controllers/weapps/challenges_controller.rb +++ b/app/controllers/weapps/challenges_controller.rb @@ -6,7 +6,7 @@ class Weapps::ChallengesController < Weapps::BaseController # 关卡有展示效果 || 选择题 || jupyter实训 || vnc || 隐藏代码窗口 || html+css实训 # @challenge.show_type != -1 || @challenge.st == 1 || @shixun.is_jupyter? || @shixun.vnc || # @shixun.hide_code? || (@shixun.small_mirror_name & ["Css", "Html", "Web"]).present? - play = @challenge.st == 1 || @shixun.is_jupyter? || @shixun.vnc || + play = @shixun.is_jupyter? || @shixun.vnc || @shixun.hide_code? || (@shixun.small_mirror_name & ["Css", "Html", "Web"]).present? if play diff --git a/app/controllers/weapps/courses_controller.rb b/app/controllers/weapps/courses_controller.rb index e3af2310d..ccd5d1bcf 100644 --- a/app/controllers/weapps/courses_controller.rb +++ b/app/controllers/weapps/courses_controller.rb @@ -6,6 +6,23 @@ class Weapps::CoursesController < Weapps::BaseController before_action :teacher_allowed, only: [:edit, :update] before_action :teacher_or_admin_allowed, only: [:change_member_roles, :delete_course_teachers] + def course_activities + @course = current_course + homework_commons = @course.homework_commons.where(homework_type: ["practice", "normal"]).homework_published + member = @course.course_members.find_by(user_id: current_user.id, is_active: 1) + if (@user_course_identity == Course::STUDENT && member.try(:course_group_id).to_i == 0) || @user_course_identity > Course::STUDENT + homework_commons = homework_commons.unified_setting + elsif @user_course_identity == Course::STUDENT + not_homework_ids = @course.homework_group_settings.none_published.where("course_group_id = #{member.try(:course_group_id)}").pluck(:homework_common_id) + homework_commons = homework_commons.where.not(id: not_homework_ids) + end + homework_ids = homework_commons.blank? ? "(-1)" : "(" + homework_commons.pluck(:id).join(",") + ")" + + activities = @course.course_activities.where("course_act_type in ('Course', 'CourseMessage') or + (course_act_type = 'HomeworkCommon' and course_act_id in #{homework_ids})").order("id desc") + @activities = paginate activities.includes(:course_act, user: :user_extension) + end + def create # return render_error("只有老师身份才能创建课堂") unless current_user.is_teacher? course = Course.new(tea_id: current_user.id) diff --git a/app/controllers/weapps/shixun_lists_controller.rb b/app/controllers/weapps/shixun_lists_controller.rb index 4db1e171f..d4fc8e8e7 100644 --- a/app/controllers/weapps/shixun_lists_controller.rb +++ b/app/controllers/weapps/shixun_lists_controller.rb @@ -1,5 +1,4 @@ class Weapps::ShixunListsController < ApplicationController - before_action :require_login def index results = Weapps::ShixunSearchService.call(search_params, current_laboratory) diff --git a/app/controllers/weapps/subjects_controller.rb b/app/controllers/weapps/subjects_controller.rb index ab578e5e1..e5c3eb316 100644 --- a/app/controllers/weapps/subjects_controller.rb +++ b/app/controllers/weapps/subjects_controller.rb @@ -1,5 +1,5 @@ class Weapps::SubjectsController < Weapps::BaseController - before_action :require_login + before_action :require_login, except: [:index, :show] before_action :find_subject, except: [:index] # 首页 diff --git a/app/helpers/shixuns_helper.rb b/app/helpers/shixuns_helper.rb index 48ca98f26..1fc656a61 100644 --- a/app/helpers/shixuns_helper.rb +++ b/app/helpers/shixuns_helper.rb @@ -169,6 +169,7 @@ module ShixunsHelper source_class_name << source if source.present? end end + logger.info("####source_class_name: #{source_class_name}") script = if script.include?("sourceClassName") && script.include?("challengeProgramName") script.gsub(/challengeProgramNames=\(.*\)/,"challengeProgramNames=\(#{challenge_program_name.reject(&:blank?).join(" ")}\)").gsub(/sourceClassNames=\(.*\)/, "sourceClassNames=\(#{source_class_name.reject(&:blank?).join(" ")}\)") else diff --git a/app/models/course.rb b/app/models/course.rb index 8de6ef9b6..08e2e36f5 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -70,7 +70,9 @@ class Course < ApplicationRecord # 课堂动态 - has_many :course_acts, class_name: 'CourseActivity', as: :course_act, dependent: :destroy + has_one :course_act, class_name: 'CourseActivity', as: :course_act, dependent: :destroy + has_many :course_activities + has_many :tidings, as: :container, dependent: :destroy # 开放课堂 @@ -300,7 +302,7 @@ class Course < ApplicationRecord #课程动态公共表记录 def act_as_course_activity - self.course_acts << CourseActivity.new(user_id: tea_id, course_id: id) + self.course_act << CourseActivity.new(user_id: tea_id, course_id: id) end # 当前老师分班下的所有学生 diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index 6c0aaaf48..d9930596c 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -4,9 +4,26 @@ class CourseActivity < ApplicationRecord belongs_to :user belongs_to :exercise belongs_to :poll + belongs_to :course_message + belongs_to :homework_common # after_create :add_course_lead + def container_name + case course_act_type + when "HomeworkCommon" + course_act&.name + when "Exercise" + course_act&.exercise_name + when "Poll" + course_act&.poll_name + when "Message" + course_act&.subject + else + "" + end + end + # 发布新课导语 # 导语要放置在课程创建信息之后 def add_course_lead diff --git a/app/models/course_message.rb b/app/models/course_message.rb index a3578d500..b09613ec4 100644 --- a/app/models/course_message.rb +++ b/app/models/course_message.rb @@ -2,6 +2,7 @@ class CourseMessage < ApplicationRecord enum status: { UNHANDLED: 0, PASSED: 1, REJECTED: 2 } belongs_to :course belongs_to :user + has_one :course_act, class_name: 'CourseActivity', as: :course_act, dependent: :destroy scope :find_by_course, ->(course) { where(course_id: course.id) } scope :join_course_requests, -> { where(course_message_type: "JoinCourseRequest") } @@ -9,6 +10,8 @@ class CourseMessage < ApplicationRecord scope :unhandled_join_course_requests_by_course, ->(course) { find_by_course(course).join_course_requests.unhandled } + after_create :act_as_course_activity + def pass! update!(status: :PASSED) send_deal_tiding(1) @@ -25,6 +28,11 @@ class CourseMessage < ApplicationRecord private + #课程动态公共表记录 + def act_as_course_activity + self.course_act << CourseActivity.new(user_id: course_message_id, course_id: course_id) + end + def send_deal_tiding deal_status # 发送申请处理结果消息 Tiding.create!( diff --git a/app/models/discipline.rb b/app/models/discipline.rb index e2761bfe2..06ecf825f 100644 --- a/app/models/discipline.rb +++ b/app/models/discipline.rb @@ -1,5 +1,7 @@ class Discipline < ApplicationRecord - has_many :sub_disciplines, dependent: :destroy + default_scope { order(position: :asc) } + + has_many :sub_disciplines, -> { order("sub_disciplines.position ASC") }, dependent: :destroy has_many :shixun_sub_disciplines, -> { where("shixun = 1") }, class_name: "SubDiscipline" has_many :subject_sub_disciplines, -> { where("subject = 1") }, class_name: "SubDiscipline" diff --git a/app/models/examination_intelligent_setting.rb b/app/models/examination_intelligent_setting.rb index 38c7fbe4b..8bcea5425 100644 --- a/app/models/examination_intelligent_setting.rb +++ b/app/models/examination_intelligent_setting.rb @@ -3,5 +3,5 @@ class ExaminationIntelligentSetting < ApplicationRecord belongs_to :user has_many :examination_type_settings, dependent: :destroy has_many :tag_discipline_containers, as: :container, dependent: :destroy - has_many :item_baskets, dependent: :destroy + has_many :item_baskets, -> { order("item_baskets.position ASC") }, dependent: :destroy end diff --git a/app/models/hack_code.rb b/app/models/hack_code.rb index 19de5e4a4..b765a1358 100644 --- a/app/models/hack_code.rb +++ b/app/models/hack_code.rb @@ -1,3 +1,4 @@ class HackCode < ApplicationRecord # 编程题代码相关 + belongs_to :hack end diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index de245517d..f3a2e85f8 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -28,7 +28,7 @@ class HomeworkCommon < ApplicationRecord belongs_to :course_second_category, optional: true # 课堂动态 - has_many :course_acts, class_name: 'CourseActivity', as: :course_act, dependent: :destroy + has_one :course_act, class_name: 'CourseActivity', as: :course_act, dependent: :destroy has_many :tidings, as: :container, dependent: :destroy # 实训作业的分班查重记录 has_many :homework_group_reviews, :dependent => :destroy diff --git a/app/models/open_users/cas.rb b/app/models/open_users/cas.rb new file mode 100644 index 000000000..301a197a0 --- /dev/null +++ b/app/models/open_users/cas.rb @@ -0,0 +1,9 @@ +class OpenUsers::Cas < OpenUser + def nickname + extra&.[]('nickname') + end + + def en_type + 'cas' + end +end \ No newline at end of file diff --git a/app/models/salesman_channel.rb b/app/models/salesman_channel.rb index b5ae17e0e..020baf75a 100644 --- a/app/models/salesman_channel.rb +++ b/app/models/salesman_channel.rb @@ -6,20 +6,21 @@ class SalesmanChannel < ApplicationRecord school.name end - def teacher_count - UserExtension.where(school_id: school_id).where.not(identity: 1).count + def teacher_count(start_time, end_time) + UserExtension.where("identity = 0 and school_id = #{school_id} and created_at between '#{start_time}' and '#{end_time}'").count + # UserExtension.where(school_id: school_id).where(query).count end - def student_count - UserExtension.where(school_id: school_id, identity: 1).count + def student_count(start_time, end_time) + UserExtension.where("identity = 1 and school_id = #{school_id} and created_at between '#{start_time}' and '#{end_time}'").count end - def course_count - Course.where(school_id: school_id).count + def course_count(start_time, end_time) + Course.where("school_id = #{school_id} and courses.created_at between '#{start_time}' and '#{end_time}'").count end - def shixuns_count - ShixunMember.joins("join user_extensions on user_extensions.user_id = shixun_members.user_id") + def shixuns_count(start_time, end_time) + ShixunMember.joins("join user_extensions on user_extensions.user_id = shixun_members.user_id and shixun_members.created_at between '#{start_time}' and '#{end_time}'") .where(user_extensions: {school_id: school_id}).pluck(:shixun_id).uniq.count end diff --git a/app/models/salesman_customer.rb b/app/models/salesman_customer.rb index c5e84650b..07f2ee83c 100644 --- a/app/models/salesman_customer.rb +++ b/app/models/salesman_customer.rb @@ -1,6 +1,6 @@ class SalesmanCustomer < ApplicationRecord belongs_to :salesman, :touch => true, counter_cache: true - belongs_to :school + belongs_to :school, optional: true belongs_to :user def name @@ -8,7 +8,7 @@ class SalesmanCustomer < ApplicationRecord end def school_name - school.name + school&.name end def courses_count diff --git a/app/models/sub_discipline.rb b/app/models/sub_discipline.rb index db7ca9fc8..57181124c 100644 --- a/app/models/sub_discipline.rb +++ b/app/models/sub_discipline.rb @@ -1,6 +1,6 @@ class SubDiscipline < ApplicationRecord belongs_to :discipline - has_many :tag_disciplines, dependent: :destroy + has_many :tag_disciplines, -> { order("tag_disciplines.position ASC") }, dependent: :destroy has_many :sub_discipline_containers, dependent: :destroy has_one :hack diff --git a/app/models/subject.rb b/app/models/subject.rb index 70f9700df..387e5adb1 100644 --- a/app/models/subject.rb +++ b/app/models/subject.rb @@ -41,6 +41,7 @@ class Subject < ApplicationRecord scope :published, lambda{where(status: 1)} scope :unhidden, lambda{where(hidden: 0)} scope :publiced, lambda{ where(public: 2) } + scope :show_moblied, lambda{ where(show_mobile: true) } after_create :send_tiding def send_tiding diff --git a/app/queries/admins/shixun_settings_query.rb b/app/queries/admins/shixun_settings_query.rb index 30a402d1c..209f37788 100644 --- a/app/queries/admins/shixun_settings_query.rb +++ b/app/queries/admins/shixun_settings_query.rb @@ -51,7 +51,10 @@ class Admins::ShixunSettingsQuery < ApplicationQuery all_shixuns = all_shixuns.where(task_pass: params[:task_pass]) if params[:task_pass] all_shixuns = all_shixuns.where(code_hidden: params[:code_hidden]) if params[:code_hidden] all_shixuns = all_shixuns.where(vip: params[:vip]) if params[:vip] - all_shixuns = all_shixuns.where(is_wechat_support: params[:is_wechat_support]) if params[:is_wechat_support] + if params[:no_subject] + shixun_ids = StageShixun.pluck(:shixun_id).uniq + all_shixuns = all_shixuns.published.where.not(id: shixun_ids) + end custom_sort(all_shixuns, params[:sort_by], params[:sort_direction]) end diff --git a/app/queries/admins/subject_query.rb b/app/queries/admins/subject_query.rb index dc459885b..0415deb9f 100644 --- a/app/queries/admins/subject_query.rb +++ b/app/queries/admins/subject_query.rb @@ -18,9 +18,9 @@ class Admins::SubjectQuery < ApplicationQuery status = case params[:status].to_s.strip when "editing" then {status: 0} - when "processed" then {status: 2, public: 0} + when "applying" then {status: 2, public: [0, 1]} when "pending" then {public: 1} - when "publiced" then {public: 2} + when "published" then {public: 2} end subjects = subjects.where(status) if status diff --git a/app/queries/optional_item_query.rb b/app/queries/optional_item_query.rb index 54cd0eed0..a5f7dea78 100644 --- a/app/queries/optional_item_query.rb +++ b/app/queries/optional_item_query.rb @@ -19,17 +19,20 @@ class OptionalItemQuery < ApplicationQuery end if hacks.present? - items = ItemBank.where(container_id: hacks.pluck(:id), container_type: "Hack").or(ItemBank.where(id: items.pluck(:id))) + items = ItemBank.where(container_id: hacks.where(status: 1).pluck(:id), container_type: "Hack") + .or(ItemBank.where(id: items.pluck(:id)).where("item_type != '6'")) end - # 来源 public = source.present? ? source.to_i : 1 - public = public == 2 ? [0, 1] : public - items = items.where(public: public) + if public == 1 + items = items.where(public: 1) + elsif public == 0 + items = items.where(user_id: User.current.id) + end # 难度 - difficulty = difficulty ? difficulty.to_i : 1 - items = items.where(difficulty: difficulty) + diff = difficulty ? difficulty.to_i : 1 + items = items.where(difficulty: diff) items end end \ No newline at end of file diff --git a/app/queries/weapps/subject_query.rb b/app/queries/weapps/subject_query.rb index 8bfe9e9a8..e2f5625e1 100644 --- a/app/queries/weapps/subject_query.rb +++ b/app/queries/weapps/subject_query.rb @@ -8,7 +8,7 @@ class Weapps::SubjectQuery < ApplicationQuery end def call - subjects = @current_laboratory.subjects.unhidden.publiced + subjects = @current_laboratory.subjects.unhidden.publiced.show_moblied # 课程体系的过滤 if params[:sub_discipline_id].present? diff --git a/app/services/admins/import_discipline_service.rb b/app/services/admins/import_discipline_service.rb index bd284b6af..37cb5b7e5 100644 --- a/app/services/admins/import_discipline_service.rb +++ b/app/services/admins/import_discipline_service.rb @@ -29,14 +29,14 @@ class Admins::ImportDisciplineService < ApplicationService return unless discipline_name.present? discipline = Discipline.find_by(name: discipline_name) if discipline.blank? - discipline = Discipline.create!(name: discipline_name) + discipline = Discipline.create!(name: discipline_name, position: Discipline.all.pluck(:position).max + 1) count += 1 end if sub_discipline_name.present? sub_discipline = SubDiscipline.find_by(name: discipline_name, discipline: discipline) if sub_discipline.blank? - SubDiscipline.create!(name: sub_discipline_name, discipline: discipline) + SubDiscipline.create!(name: sub_discipline_name, discipline: discipline, position: discipline.sub_disciplines.pluck(:position).max + 1) count += 1 end end diff --git a/app/services/create_bind_user_service.rb b/app/services/create_bind_user_service.rb index 86ac6c93b..58956694e 100644 --- a/app/services/create_bind_user_service.rb +++ b/app/services/create_bind_user_service.rb @@ -17,6 +17,7 @@ class CreateBindUserService < ApplicationService bind_user = User.try_to_login(params[:username], params[:password]) raise Error, '用户名或者密码错误' if bind_user.blank? + raise Error, '用户名或者密码错误' unless bind_user.check_password?(params[:password].to_s) raise Error, '该账号已被绑定,请更换其他账号进行绑定' if bind_user.bind_open_user?(params[:type].to_s) ActiveRecord::Base.transaction do diff --git a/app/services/homeworks_service.rb b/app/services/homeworks_service.rb index c70535e17..5483eed83 100644 --- a/app/services/homeworks_service.rb +++ b/app/services/homeworks_service.rb @@ -133,8 +133,10 @@ class HomeworksService # 计算实训作品学生的效率分 def update_student_eff_score homework if homework.work_efficiency && homework.max_efficiency != 0 + max_efficiency = homework.student_works.where("compelete_status != 0").pluck(:efficiency).max + homework.update_column("max_efficiency", max_efficiency) homework.student_works.where("compelete_status != 0").each do |student_work| - eff_score = student_work.efficiency / homework.max_efficiency * homework.eff_score + eff_score = student_work.efficiency / max_efficiency * homework.eff_score student_work.eff_score = format("%.2f", eff_score) student_work.late_penalty = student_work.work_status == 1 ? 0 : homework.late_penalty unless student_work.ultimate_score @@ -333,7 +335,10 @@ class HomeworksService work.compelete_status = myshixun_endtime < setting_time.end_time ? 2 : 3 # 如果作业的最大效率值有变更则更新所有作品的效率分 - homework.update_column("max_efficiency", work.efficiency) if homework.work_efficiency && homework.max_efficiency < work.efficiency + if homework.work_efficiency && homework.max_efficiency < work.efficiency + homework.max_efficiency = work.efficiency + homework.save(validate: false) + end else work.compelete_status = 1 # 未通关 end diff --git a/app/services/oauth/create_or_find_cas_user_service.rb b/app/services/oauth/create_or_find_cas_user_service.rb new file mode 100644 index 000000000..0b6715471 --- /dev/null +++ b/app/services/oauth/create_or_find_cas_user_service.rb @@ -0,0 +1,31 @@ +class Oauth::CreateORFindCasUserService < ApplicationService + + def initialize(user, params) + @user = user + @params = params + end + + def call + return [@user, false] if @user + + open_user = OpenUsers::Cas.find_or_initialize_by(uid: @params['user']) do |u| + u.extra = @params + end + + return [open_user.user, false] if open_user.persisted? + + @user = User.new(login: User.generate_login('C'), type: 'User', status: User::STATUS_ACTIVE, nickname: @params['comsys_name'], lastname: @params['comsys_name']) + + ActiveRecord::Base.transaction do + @user.save! + @user.create_user_extension! + + open_user.user = @user + open_user.save! + + Rails.cache.write(open_user.can_bind_cache_key, 1, expires_in: 1.hours) + end + + [@user, true] + end +end \ No newline at end of file diff --git a/app/services/oauth/create_or_find_wechat_account_service.rb b/app/services/oauth/create_or_find_wechat_account_service.rb index 75091a5c3..8eb44108b 100644 --- a/app/services/oauth/create_or_find_wechat_account_service.rb +++ b/app/services/oauth/create_or_find_wechat_account_service.rb @@ -18,18 +18,22 @@ class Oauth::CreateOrFindWechatAccountService < ApplicationService # 存在该用户 open_user = OpenUsers::Wechat.find_by(uid: result['unionid']) - return [open_user.user, new_user] if open_user.present? + return [open_user.user, new_user] if open_user.present? && open_user.user.present? if user.blank? || !user.logged? new_user = true # 新用户 - login = User.generate_login('w') - # result['nickname'] = regix_emoji(result['nickname']) - @user = User.new(login: login, type: 'User', status: User::STATUS_ACTIVE) - #@user = User.new(login: login, nickname: result['nickname'], type: 'User', status: User::STATUS_ACTIVE) - + # login = User.generate_login('w') + # result['nickname'] = regix_emoji(result['nickname']) + # @user = User.new(login: login, type: 'User', status: User::STATUS_ACTIVE) + # @user = User.new(login: login, nickname: result['nickname'], type: 'User', status: User::STATUS_ACTIVE) + set_session_openid(result['openid']) + set_session_unionid(result['unionid']) + else + OpenUsers::Wechat.create!(user: user, uid: result['unionid']) end +=begin ActiveRecord::Base.transaction do if new_user user.save! @@ -46,6 +50,7 @@ class Oauth::CreateOrFindWechatAccountService < ApplicationService Rails.cache.write(new_open_user.can_bind_cache_key, 1, expires_in: 1.hours) if new_user # 方便后面进行账号绑定 end +=end [user, new_user] rescue WechatOauth::Error => ex diff --git a/app/services/update_homework_publish_setting_service.rb b/app/services/update_homework_publish_setting_service.rb index 61902cd80..0f61bcd75 100644 --- a/app/services/update_homework_publish_setting_service.rb +++ b/app/services/update_homework_publish_setting_service.rb @@ -73,9 +73,11 @@ class UpdateHomeworkPublishSettingService < ApplicationService # 作业在"提交中"状态时 else - if homework.end_time > Time.now && homework.unified_setting + # 实训作业截止时间已过也可修改截止时间,其他作业暂不支持修改 + if (homework.homework_type == "practice" || homework.end_time > Time.now) && homework.unified_setting tip_exception("截止时间不能为空") if params[:end_time].blank? - tip_exception("截止时间不能早于当前时间") if params[:end_time].to_time <= Time.now + tip_exception("截止时间必须晚于发布时间") if params[:end_time].to_time <= homework.publish_time + # tip_exception("截止时间不能早于当前时间") if params[:end_time].to_time <= Time.now tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if course.end_date.present? && params[:end_time].to_time > course.end_date.end_of_day @@ -93,19 +95,29 @@ class UpdateHomeworkPublishSettingService < ApplicationService # 如果该发布规则 没有已发布的分班则需判断发布时间 tip_exception("发布时间不能早于等于当前时间") if setting[:publish_time].to_time <= Time.now && group_settings.group_published.count == 0 - tip_exception("截止时间不能早于等于当前时间") if setting[:end_time].to_time <= Time.now && group_settings.none_end.count > 0 + # tip_exception("截止时间不能早于等于当前时间") if setting[:end_time].to_time <= Time.now && group_settings.none_end.count > 0 tip_exception("截止时间不能早于发布时间") if setting[:publish_time].to_time > setting[:end_time].to_time tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if course.end_date.present? && setting[:end_time].to_time > course.end_date.end_of_day group_settings.none_published.update_all(publish_time: setting[:publish_time]) - group_settings.none_end.update_all(end_time: setting[:end_time]) + # 实训作业截止时间已过也可修改截止时间,其他作业暂不支持修改 + if homework.homework_type == "practice" + group_settings.update_all(end_time: setting[:end_time]) + else + group_settings.none_end.update_all(end_time: setting[:end_time]) + end end homework.end_time = homework.max_group_end_time end end + if homework.end_time > Time.now && homework.homework_detail_manual.try(:comment_status) > 1 + homework.homework_detail_manual.update_attributes!(comment_status: 1) + end + homework.save! + UpdateShixunWorkScoreJob.perform_later(homework.id) HomeworkCommonPushNotifyJob.perform_later(homework.id, publish_group_ids) if send_tiding end diff --git a/app/services/users/update_account_service.rb b/app/services/users/update_account_service.rb index fad1210a5..16824a90e 100644 --- a/app/services/users/update_account_service.rb +++ b/app/services/users/update_account_service.rb @@ -50,7 +50,7 @@ class Users::UpdateAccountService < ApplicationService end if first_full_reward - RewardGradeService.call(user, container_id: user.id, container_type: 'Account', score: 500) + # RewardGradeService.call(user, container_id: user.id, container_type: 'Account', score: 500) if user.user_extension.teacher? join_course(user.id,1309, 2) # sms_notify_admin(user.lastname) diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index b32c87c4e..e6c089ac2 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -3,7 +3,7 @@ class Videos::DispatchCallbackService < ApplicationService def initialize(params) @video = Video.find_by(uuid: params[:VideoId]) - @params = params + @params = params`` end def call diff --git a/app/templates/exercise_export/blank_exercise.html.erb b/app/templates/exercise_export/blank_exercise.html.erb index ae92605dc..936cb6408 100644 --- a/app/templates/exercise_export/blank_exercise.html.erb +++ b/app/templates/exercise_export/blank_exercise.html.erb @@ -4,17 +4,33 @@ - + diff --git a/app/views/admins/disciplines/adjust_position.js.erb b/app/views/admins/disciplines/adjust_position.js.erb new file mode 100644 index 000000000..a0928056e --- /dev/null +++ b/app/views/admins/disciplines/adjust_position.js.erb @@ -0,0 +1,5 @@ +<% 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/shared/_list.html.erb b/app/views/admins/disciplines/shared/_list.html.erb index 343ff4851..38cbe8c9c 100644 --- a/app/views/admins/disciplines/shared/_list.html.erb +++ b/app/views/admins/disciplines/shared/_list.html.erb @@ -1,3 +1,4 @@ +<% max_position = @disciplines.pluck(:position).max %> @@ -11,9 +12,9 @@ <% if @disciplines.present? %> - <% @disciplines.each_with_index do |discipline, index| %> + <% @disciplines.each do |discipline| %> - + @@ -21,6 +22,9 @@ diff --git a/app/views/admins/item_authentications/shared/_list.html.erb b/app/views/admins/item_authentications/shared/_list.html.erb index 628e140a7..0c6b4cfa9 100644 --- a/app/views/admins/item_authentications/shared/_list.html.erb +++ b/app/views/admins/item_authentications/shared/_list.html.erb @@ -1,4 +1,9 @@ <% is_processed = params[:status].to_s != 'pending' %> + + + +
<%= index + 1 %><%= discipline.position %> <%= link_to discipline.name, admins_sub_disciplines_path(discipline_id: discipline), :title => discipline.name %> <%= 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' %>
@@ -30,11 +35,13 @@ - @@ -57,4 +64,18 @@
<%= user.real_name %> <%= raw [user.school_name.presence, user.department_name.presence].compact.join('
') %>
+ <% if item.item_type == "PROGRAM" %> - <%= link_to item.name, "/problems/#{item.container&.identifier}/edit", target: "_blank" %> + <%= link_to item.name, "/problems/#{item.container&.identifier}/edit", id: "item_name_#{index}", class: "d-inline-block text-truncate", + style: "max-width: 280px", target: "_blank", data: { toggle: 'tooltip', title: "#{item.name}"} %> <% else %> - <%= link_to item.name, admins_item_authentication_path(apply), remote: true %> + <%= link_to item.name, admins_item_authentication_path(apply), remote: true, id: "item_name_#{index}", class: "d-inline-block text-truncate", + style: "max-width: 280px", data: { toggle: 'tooltip', title: "#{item.name}"} %> <% end %> <%= item.type_string %>
-<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %> \ No newline at end of file +<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %> + + \ 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 index 5e15d63eb..75847a542 100644 --- a/app/views/admins/salesman_channels/index.html.erb +++ b/app/views/admins/salesman_channels/index.html.erb @@ -2,12 +2,33 @@ <% 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-channel-user-modal' } %> +<% 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') %>
diff --git a/app/views/admins/salesman_channels/index.js.erb b/app/views/admins/salesman_channels/index.js.erb new file mode 100644 index 000000000..422cfe5cb --- /dev/null +++ b/app/views/admins/salesman_channels/index.js.erb @@ -0,0 +1 @@ + $(".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 index 9c435178d..121e711be 100644 --- 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 @@ -8,13 +8,12 @@
diff --git a/app/views/admins/sub_disciplines/adjust_position.js.erb b/app/views/admins/sub_disciplines/adjust_position.js.erb new file mode 100644 index 000000000..0dae991c1 --- /dev/null +++ b/app/views/admins/sub_disciplines/adjust_position.js.erb @@ -0,0 +1,5 @@ +<% 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/shared/_list.html.erb b/app/views/admins/sub_disciplines/shared/_list.html.erb index a56c856f2..cd0b02f88 100644 --- a/app/views/admins/sub_disciplines/shared/_list.html.erb +++ b/app/views/admins/sub_disciplines/shared/_list.html.erb @@ -1,3 +1,4 @@ +<% max_position = @sub_disciplines.pluck(:position).max %> @@ -11,9 +12,9 @@ <% if @sub_disciplines.present? %> - <% @sub_disciplines.each_with_index do |sub, index| %> + <% @sub_disciplines.each do |sub| %> - + @@ -21,6 +22,9 @@ diff --git a/app/views/admins/subject_settings/index.html.erb b/app/views/admins/subject_settings/index.html.erb index bcd2a2fc8..b46c1d90d 100644 --- a/app/views/admins/subject_settings/index.html.erb +++ b/app/views/admins/subject_settings/index.html.erb @@ -6,7 +6,7 @@ <%= form_tag(admins_subject_settings_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
- <% status_options = [['全部', ''], ['编辑中', 'pending'], ['审核中', 'applying'], ['已发布', 'published']] %> + <% status_options = [['全部', ''], ['编辑中', 'pending'], ['审核中', 'applying'], ['已公开', 'published']] %> <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
diff --git a/app/views/admins/subject_settings/mobile.js.erb b/app/views/admins/subject_settings/mobile.js.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/admins/subject_settings/shared/_list.html.erb b/app/views/admins/subject_settings/shared/_list.html.erb index 9f27c084c..79411e892 100644 --- a/app/views/admins/subject_settings/shared/_list.html.erb +++ b/app/views/admins/subject_settings/shared/_list.html.erb @@ -1,14 +1,14 @@
<%= index + 1 %><%= sub.position %> <%= link_to sub.name, admins_tag_disciplines_path(sub_discipline_id: sub), :title => sub.name %> <%= 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' %>
- - - - + + + + - - + + diff --git a/app/views/admins/subject_settings/shared/_td.html.erb b/app/views/admins/subject_settings/shared/_td.html.erb index 6e905d995..94d34f42d 100644 --- a/app/views/admins/subject_settings/shared/_td.html.erb +++ b/app/views/admins/subject_settings/shared/_td.html.erb @@ -5,7 +5,7 @@ 金课 - + @@ -16,6 +16,8 @@ @@ -24,4 +26,22 @@ multiple: true, maximumSelectionLength: 3, placeholder: '请选择课程体系'}); + + + $(".action-container").on("change", '.subject-mobile-form', function () { + var s_id = $(this).attr("data-id"); + var s_value = $(this).val(); + var s_name = $(this).attr("name"); + var json = {}; + var s_index = $(this).parent("td").siblings(".shixun-line-no").text(); + json[s_name] = s_value; + json["page_no"] = s_index; + $.ajax({ + url: "/admins/subject_settings/update_mobile_show?subject_id=" + s_id, + type: "POST", + dataType:'script', + data: json + }); + }); + \ 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 new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/admins/tag_disciplines/adjust_position.js.erb b/app/views/admins/tag_disciplines/adjust_position.js.erb new file mode 100644 index 000000000..32e066698 --- /dev/null +++ b/app/views/admins/tag_disciplines/adjust_position.js.erb @@ -0,0 +1,5 @@ +<% 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/shared/_list.html.erb b/app/views/admins/tag_disciplines/shared/_list.html.erb index 2c91d88fa..59420c42c 100644 --- a/app/views/admins/tag_disciplines/shared/_list.html.erb +++ b/app/views/admins/tag_disciplines/shared/_list.html.erb @@ -1,3 +1,4 @@ +<% max_position = @tag_disciplines.pluck(:position).max %>
序号名称技术体系等级体系序号名称老版技术体系状态 课程体系 封面开课人数操作开课人数操作
<%= display_text subject.repertoire&.name %><%= display_text subject.subject_level_system&.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}") %> <%= 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') %>
@@ -12,9 +13,9 @@ <% if @tag_disciplines.present? %> - <% @tag_disciplines.each_with_index do |tag, index| %> + <% @tag_disciplines.each do |tag| %> - + diff --git a/app/views/weapps/courses/course_activities.json.jbuilder b/app/views/weapps/courses/course_activities.json.jbuilder new file mode 100644 index 000000000..498189cf8 --- /dev/null +++ b/app/views/weapps/courses/course_activities.json.jbuilder @@ -0,0 +1,12 @@ +json.activities @activities do |activity| + json.(activity, :course_act_id, :course_act_type) + json.author do + user = activity.user + json.name user.real_name + json.login user.login + json.img url_to_avatar(user) + end + json.created_at activity.created_at.strftime('%m-%d %H:%M:') + json.container_name activity.container_name + json.container_type activity.course_act_type == "HomeworkCommon" ? activity.course_act&.homework_type : "" +end \ No newline at end of file diff --git a/config/application.rb b/config/application.rb index baa0011f2..31a94e7ed 100644 --- a/config/application.rb +++ b/config/application.rb @@ -29,6 +29,10 @@ module Educoderplus # job config.active_job.queue_adapter = :sidekiq + config.middleware.use OmniAuth::Builder do + provider :cas, url: 'https://urp.tfswufe.edu.cn/cas' + end + config.middleware.insert_before 0, Rack::Cors do allow do origins '*' diff --git a/config/routes.rb b/config/routes.rb index 9455f7719..ba0827676 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,8 +8,8 @@ Rails.application.routes.draw do get 'attachments/download/:id/:filename', to: 'attachments#show' get 'auth/qq/callback', to: 'oauth/qq#create' get 'auth/failure', to: 'oauth/base#auth_failure' + get 'auth/cas/callback', to: 'oauth/cas#create' - resources :edu_settings scope '/api' do @@ -26,7 +26,7 @@ Rails.application.routes.draw do put 'commons/unhidden', to: 'commons#unhidden' delete 'commons/delete', to: 'commons#delete' - resources :jupyters do + resources :jupyters do collection do get :save_with_tpi get :save_with_tpm @@ -42,7 +42,7 @@ Rails.application.routes.draw do post :import_with_tpm end end - + resources :memos do member do post :sticky_or_cancel @@ -1040,12 +1040,13 @@ Rails.application.routes.draw do member do get :shixun_homework_category get :teachers - delete :delete_course_teachers - post :change_member_roles get :students - delete :delete_course_students get :course_groups get :basic_info + get :course_activities + post :change_member_roles + delete :delete_course_teachers + delete :delete_course_students end collection do @@ -1328,7 +1329,9 @@ Rails.application.routes.draw do post :drag, on: :collection end - resources :subject_settings, only: [:index, :update] + resources :subject_settings, only: [:index, :update] do + post :update_mobile_show, on: :collection + end resources :subjects, only: [:index, :edit, :update, :destroy] do member do @@ -1353,9 +1356,15 @@ Rails.application.routes.draw do resources :projects, only: [:index, :destroy] - resources :disciplines, only: [:index, :create, :edit, :update, :destroy] - resources :sub_disciplines, only: [:index, :create, :edit, :update, :destroy] - resources :tag_disciplines, only: [:index, :create, :edit, :update, :destroy] + resources :disciplines, only: [:index, :create, :edit, :update, :destroy] do + post :adjust_position, on: :member + end + resources :sub_disciplines, only: [:index, :create, :edit, :update, :destroy] do + post :adjust_position, on: :member + end + resources :tag_disciplines, only: [:index, :create, :edit, :update, :destroy] do + post :adjust_position, on: :member + end resources :repertoires, only: [:index, :create, :edit, :update, :destroy] resources :sub_repertoires, only: [:index, :create, :edit, :update, :destroy] diff --git a/db/migrate/20200222081052_add_show_moblie_to_subjects.rb b/db/migrate/20200222081052_add_show_moblie_to_subjects.rb new file mode 100644 index 000000000..05e7a8ea9 --- /dev/null +++ b/db/migrate/20200222081052_add_show_moblie_to_subjects.rb @@ -0,0 +1,5 @@ +class AddShowMoblieToSubjects < ActiveRecord::Migration[5.2] + def change + add_column :subjects, :show_mobile, :boolean, :default => false + end +end diff --git a/db/migrate/20200223021427_sync_subjectds_mobile.rb b/db/migrate/20200223021427_sync_subjectds_mobile.rb new file mode 100644 index 000000000..683821ff9 --- /dev/null +++ b/db/migrate/20200223021427_sync_subjectds_mobile.rb @@ -0,0 +1,8 @@ +class SyncSubjectdsMobile < ActiveRecord::Migration[5.2] + def change + + SubDisciplineContainer.find_each do |sc| + Subject.find(sc.container_id).update_column(:show_mobile, true) + end + end +end diff --git a/db/migrate/20200225063751_add_position_to_discipline.rb b/db/migrate/20200225063751_add_position_to_discipline.rb new file mode 100644 index 000000000..5d8a22204 --- /dev/null +++ b/db/migrate/20200225063751_add_position_to_discipline.rb @@ -0,0 +1,7 @@ +class AddPositionToDiscipline < ActiveRecord::Migration[5.2] + def change + add_column :disciplines, :position, :integer, default: 0 + add_column :sub_disciplines, :position, :integer, default: 0 + add_column :tag_disciplines, :position, :integer, default: 0 + end +end diff --git a/db/migrate/20200225063932_migrate_discipline_position.rb b/db/migrate/20200225063932_migrate_discipline_position.rb new file mode 100644 index 000000000..4061cf943 --- /dev/null +++ b/db/migrate/20200225063932_migrate_discipline_position.rb @@ -0,0 +1,15 @@ +class MigrateDisciplinePosition < ActiveRecord::Migration[5.2] + def change + Discipline.all.each_with_index do |discipline, i| + discipline.update_column("position", i + 1) + + discipline.sub_disciplines.each_with_index do |sub, j| + sub.update_column("position", j + 1) + + sub.tag_disciplines.each_with_index do |tag, k| + tag.update_column("position", k + 1) + end + end + end + end +end diff --git a/db/migrate/20200225092846_add_uniq_index_to_salesman_channel.rb b/db/migrate/20200225092846_add_uniq_index_to_salesman_channel.rb new file mode 100644 index 000000000..96540d64e --- /dev/null +++ b/db/migrate/20200225092846_add_uniq_index_to_salesman_channel.rb @@ -0,0 +1,10 @@ +class AddUniqIndexToSalesmanChannel < ActiveRecord::Migration[5.2] + def change + sql = %Q(delete from salesman_channels where (salesman_id, school_id) in + (select * from (select salesman_id, school_id from salesman_channels group by salesman_id, school_id having count(*) > 1) a) + and id not in (select * from (select min(id) from salesman_channels group by salesman_id, school_id having count(*) > 1 order by id) b)) + ActiveRecord::Base.connection.execute sql + + add_index :salesman_channels, [:salesman_id, :school_id], unique: true + end +end diff --git a/db/migrate/20200225093944_add_uniq_index_to_salesman_customer.rb b/db/migrate/20200225093944_add_uniq_index_to_salesman_customer.rb new file mode 100644 index 000000000..a0067a45f --- /dev/null +++ b/db/migrate/20200225093944_add_uniq_index_to_salesman_customer.rb @@ -0,0 +1,10 @@ +class AddUniqIndexToSalesmanCustomer < ActiveRecord::Migration[5.2] + def change + sql = %Q(delete from salesman_customers where (salesman_id, user_id) in + (select * from (select salesman_id, user_id from salesman_customers group by salesman_id, user_id having count(*) > 1) a) + and id not in (select * from (select min(id) from salesman_customers group by salesman_id, user_id having count(*) > 1 order by id) b)) + ActiveRecord::Base.connection.execute sql + + add_index :salesman_customers, [:salesman_id, :user_id], unique: true + end +end diff --git a/db/migrate/20200226031118_migrate_course_message_act.rb b/db/migrate/20200226031118_migrate_course_message_act.rb new file mode 100644 index 000000000..18bc276bc --- /dev/null +++ b/db/migrate/20200226031118_migrate_course_message_act.rb @@ -0,0 +1,5 @@ +class MigrateCourseMessageAct < ActiveRecord::Migration[5.2] + def change + CourseActivity.where(course_act_type: "JoinCourse").update_all(course_act_type: "CourseMessage") + end +end diff --git a/lib/tasks/homework_publishtime.rake b/lib/tasks/homework_publishtime.rake index a57b97eab..180afcdc2 100644 --- a/lib/tasks/homework_publishtime.rake +++ b/lib/tasks/homework_publishtime.rake @@ -45,7 +45,7 @@ namespace :homework_publishtime do end end - homework.course_acts << CourseActivity.new(user_id: homework.user_id, course_id: homework.course_id) if !homework.course_acts.exists? + homework.course_act << CourseActivity.new(user_id: homework.user_id, course_id: homework.course_id) if !homework.course_act.present? end # 分组设置发布时间的作业 @@ -66,7 +66,7 @@ namespace :homework_publishtime do .where("homework_type = 4 and end_time <= '#{Time.now}'") homework_commons.each do |homework| # homework_challenge_settings = homework.homework_challenge_settings - homework.homework_detail_manual.update_column("comment_status", 2) + # homework.homework_detail_manual.update_column("comment_status", 2) if homework.allow_late if homework.unified_setting diff --git a/public/assets/.sprockets-manifest-7657344e1d61e579de6a996a4498d7a2.json b/public/assets/.sprockets-manifest-7657344e1d61e579de6a996a4498d7a2.json index 0513de4d5..8964ac1f1 100644 --- a/public/assets/.sprockets-manifest-7657344e1d61e579de6a996a4498d7a2.json +++ b/public/assets/.sprockets-manifest-7657344e1d61e579de6a996a4498d7a2.json @@ -1 +1 @@ -{"files":{"admin-1bd781fc5959b4f0e8879fa92afc5cec47e2d1a9b79cad9e55177fc1197a0e5b.js":{"logical_path":"admin.js","mtime":"2019-11-27T19:06:45+08:00","size":4594770,"digest":"1bd781fc5959b4f0e8879fa92afc5cec47e2d1a9b79cad9e55177fc1197a0e5b","integrity":"sha256-G9eB/FlZtPDoh5+pKvxc7Efi0am3nK2eVRd/wRl6Dls="},"admin-e78dd8b2041c26973b3851180e413539c07042575e336147194b5f2a1f7fa09c.css":{"logical_path":"admin.css","mtime":"2019-11-21T17:49:31+08:00","size":817848,"digest":"e78dd8b2041c26973b3851180e413539c07042575e336147194b5f2a1f7fa09c","integrity":"sha256-543YsgQcJpc7OFEYDkE1OcBwQldeM2FHGUtfKh9/oJw="},"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot":{"logical_path":"font-awesome/fontawesome-webfont.eot","mtime":"2019-08-23T09:14:02+08:00","size":165742,"digest":"7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979","integrity":"sha256-e/yrbbmdXPvxcFygU23ceFhUMsxfpBu9etDwCQM7KXk="},"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2":{"logical_path":"font-awesome/fontawesome-webfont.woff2","mtime":"2019-08-23T09:14:02+08:00","size":77160,"digest":"2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe","integrity":"sha256-Kt78vAQefRj88tQXh53FoJmXqmTWdbejxLbOM9oT8/4="},"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff":{"logical_path":"font-awesome/fontawesome-webfont.woff","mtime":"2019-08-23T09:14:02+08:00","size":98024,"digest":"ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07","integrity":"sha256-ugxZ3rVFD1y0Gz+TYJ7i0NmVQVh33foiPoqKdTNHTwc="},"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf":{"logical_path":"font-awesome/fontawesome-webfont.ttf","mtime":"2019-08-23T09:14:02+08:00","size":165548,"digest":"aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8","integrity":"sha256-qljzPyOaD7AvXHpsRcBD16msmgkzNYBmlOzW1O3A1qg="},"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg":{"logical_path":"font-awesome/fontawesome-webfont.svg","mtime":"2019-08-23T09:14:02+08:00","size":444379,"digest":"ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4","integrity":"sha256-rWFXkmwWIrpOHQPUePFUE2hSS/xG9R5C/g2UX37zI+Q="},"college-431d908264782ef54e90202095d4cf397c586f74d2b7879684348dc8b53d2cd2.js":{"logical_path":"college.js","mtime":"2020-01-07T14:59:22+08:00","size":3570046,"digest":"431d908264782ef54e90202095d4cf397c586f74d2b7879684348dc8b53d2cd2","integrity":"sha256-Qx2QgmR4LvVOkCAgldTPOXxYb3TSt4eWhDSNyLU9LNI="},"college-eb35b6573dea2a069abd5acb0211940c2165fa21da333555fa859ed155b3ca1f.css":{"logical_path":"college.css","mtime":"2019-11-20T17:50:44+08:00","size":565772,"digest":"eb35b6573dea2a069abd5acb0211940c2165fa21da333555fa859ed155b3ca1f","integrity":"sha256-6zW2Vz3qKgaavVrLAhGUDCFl+iHaMzVV+oWe0VWzyh8="},"cooperative-4f2218bb223392ea4332e9ace5a748baccd4fe66d4b5cc3b5574f97a425203ec.js":{"logical_path":"cooperative.js","mtime":"2020-01-07T14:59:22+08:00","size":4478060,"digest":"4f2218bb223392ea4332e9ace5a748baccd4fe66d4b5cc3b5574f97a425203ec","integrity":"sha256-TyIYuyIzkupDMums5adIuszU/mbUtcw7VXT5ekJSA+w="},"cooperative-9244063fa63cd29c9c3b074af565be75a130cfb31741b2f5252fe68a1f5c13c5.css":{"logical_path":"cooperative.css","mtime":"2019-11-20T17:50:44+08:00","size":799850,"digest":"9244063fa63cd29c9c3b074af565be75a130cfb31741b2f5252fe68a1f5c13c5","integrity":"sha256-kkQGP6Y80pycOwdK9WW+daEwz7MXQbL1JS/mih9cE8U="},"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png":{"logical_path":"logo.png","mtime":"2020-02-05T14:22:08+08:00","size":2816,"digest":"7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423","integrity":"sha256-f/ESVocJv5f5iY/ockm3qPIA/x9I1TfYWvhyFfGHBCM="},"application-d44f4301c7dfbe07bcb2788d7c006c22c184ae6b7016c09f7911b4962aacd767.js":{"logical_path":"application.js","mtime":"2020-01-07T14:59:22+08:00","size":615525,"digest":"d44f4301c7dfbe07bcb2788d7c006c22c184ae6b7016c09f7911b4962aacd767","integrity":"sha256-1E9DAcffvge8sniNfABsIsGErmtwFsCfeRG0liqs12c="},"application-2bf79ac2818959eb18d4df720a0cd0721b3b2385dd4565d635851fc41e192975.css":{"logical_path":"application.css","mtime":"2019-09-09T09:26:59+08:00","size":401033,"digest":"2bf79ac2818959eb18d4df720a0cd0721b3b2385dd4565d635851fc41e192975","integrity":"sha256-K/eawoGJWesY1N9yCgzQchs7I4XdRWXWNYUfxB4ZKXU="},"admin-83797d03d53c38db8e4751348516f8b7c55842cf8899066b86b3b2e6b6b1c8ad.js":{"logical_path":"admin.js","mtime":"2019-12-02T10:11:32+08:00","size":4583649,"digest":"83797d03d53c38db8e4751348516f8b7c55842cf8899066b86b3b2e6b6b1c8ad","integrity":"sha256-g3l9A9U8ONuOR1E0hRb4t8VYQs+ImQZrhrOy5raxyK0="},"admin-1512839e7eaa2136bdf9b238e3710004f8b90f2b74300c8ae7d9f9b25dddf077.css":{"logical_path":"admin.css","mtime":"2019-11-27T15:52:07+08:00","size":868584,"digest":"1512839e7eaa2136bdf9b238e3710004f8b90f2b74300c8ae7d9f9b25dddf077","integrity":"sha256-FRKDnn6qITa9+bI443EABPi5Dyt0MAyK59n5sl3d8Hc="},"college-1e70702e2d864fb4d5f57841bfa5937e31c7c059e6cd672a07f0b4b20740f607.js":{"logical_path":"college.js","mtime":"2019-11-20T16:00:49+08:00","size":3569292,"digest":"1e70702e2d864fb4d5f57841bfa5937e31c7c059e6cd672a07f0b4b20740f607","integrity":"sha256-HnBwLi2GT7TV9XhBv6WTfjHHwFnmzWcqB/C0sgdA9gc="},"college-a14be76ebc459e3bedd86e64c62b07c2dfc7ce632d73b86a7270b17462e5b746.css":{"logical_path":"college.css","mtime":"2019-11-11T18:25:42+08:00","size":610352,"digest":"a14be76ebc459e3bedd86e64c62b07c2dfc7ce632d73b86a7270b17462e5b746","integrity":"sha256-oUvnbrxFnjvt2G5kxisHwt/HzmMtc7hqcnCxdGLlt0Y="},"cooperative-bbf9b1ef14747d17410f2f38a6f308697335f86d4525ed6a5579905efc314ef3.js":{"logical_path":"cooperative.js","mtime":"2019-11-20T16:00:49+08:00","size":4463241,"digest":"bbf9b1ef14747d17410f2f38a6f308697335f86d4525ed6a5579905efc314ef3","integrity":"sha256-u/mx7xR0fRdBDy84pvMIaXM1+G1FJe1qVXmQXvwxTvM="},"cooperative-c36bba05d6a13482ccb6c3696ba5d750841dec9cae7a8043a0318c34c3a4638e.css":{"logical_path":"cooperative.css","mtime":"2019-11-17T09:36:46+08:00","size":849736,"digest":"c36bba05d6a13482ccb6c3696ba5d750841dec9cae7a8043a0318c34c3a4638e","integrity":"sha256-w2u6BdahNILMtsNpa6XXUIQd7JyueoBDoDGMNMOkY44="},"application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js":{"logical_path":"application.js","mtime":"2019-11-20T16:00:49+08:00","size":600706,"digest":"9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb","integrity":"sha256-nPvD15JZmh0N5ce4QgnhwrLmAzbw8B4Z8FgWY5GHCPs="},"application-8c9d6bb61c50908f584b3070c79aeb95f25c1166d39e07da5e95438b39ca0de9.css":{"logical_path":"application.css","mtime":"2019-10-21T22:52:15+08:00","size":436995,"digest":"8c9d6bb61c50908f584b3070c79aeb95f25c1166d39e07da5e95438b39ca0de9","integrity":"sha256-jJ1rthxQkI9YSzBwx5rrlfJcEWbTngfaXpVDiznKDek="},"admin-f1a4d30772fa41e1edd288c1b1d39deeac7481d590b13a886953adf2f2e4f47c.js":{"logical_path":"admin.js","mtime":"2019-11-29T15:05:39+08:00","size":4583647,"digest":"f1a4d30772fa41e1edd288c1b1d39deeac7481d590b13a886953adf2f2e4f47c","integrity":"sha256-8aTTB3L6QeHt0ojBsdOd7qx0gdWQsTqIaVOt8vLk9Hw="},"admin-0172e0b18d559d9648df58d7954e4843256ba2d2eda03543b7cc6c955c8e2eb3.js":{"logical_path":"admin.js","mtime":"2019-12-02T10:58:14+08:00","size":4583648,"digest":"0172e0b18d559d9648df58d7954e4843256ba2d2eda03543b7cc6c955c8e2eb3","integrity":"sha256-AXLgsY1VnZZI31jXlU5IQyVrotLtoDVDt8xslVyOLrM="},"admin-6da32058962cbfc9483b468c26d5f9b968b5f970a2031f73952863c554cd6254.js":{"logical_path":"admin.js","mtime":"2019-12-02T17:44:43+08:00","size":4583680,"digest":"6da32058962cbfc9483b468c26d5f9b968b5f970a2031f73952863c554cd6254","integrity":"sha256-baMgWJYsv8lIO0aMJtX5uWi1+XCiAx9zlShjxVTNYlQ="},"admin-64b90a423722da851a01011acac435b5f29f25e3b741e78854ea1a40742d89f7.js":{"logical_path":"admin.js","mtime":"2019-12-06T11:19:59+08:00","size":4584886,"digest":"64b90a423722da851a01011acac435b5f29f25e3b741e78854ea1a40742d89f7","integrity":"sha256-ZLkKQjci2oUaAQEaysQ1tfKfJeO3QeeIVOoaQHQtifc="},"admin-38dd06255909789c15bb1ae3d2c6b25064dd59d463ed996af2cd93b7aa08626b.css":{"logical_path":"admin.css","mtime":"2019-12-06T11:00:53+08:00","size":870104,"digest":"38dd06255909789c15bb1ae3d2c6b25064dd59d463ed996af2cd93b7aa08626b","integrity":"sha256-ON0GJVkJeJwVuxrj0sayUGTdWdRj7Zlq8s2Tt6oIYms="},"admin-f1565aa714ea18c95e226d27a3685c4b81544a9b531f4d14f88f6aa43cc9f2fa.css":{"logical_path":"admin.css","mtime":"2019-12-06T11:33:41+08:00","size":870109,"digest":"f1565aa714ea18c95e226d27a3685c4b81544a9b531f4d14f88f6aa43cc9f2fa","integrity":"sha256-8VZapxTqGMleIm0no2hcS4FUSptTH00U+I9qpDzJ8vo="},"admin-7e5aa975448fc470736f18156994f5b445b131ed1dbce9fad3b2d1415a0947d6.js":{"logical_path":"admin.js","mtime":"2019-12-06T15:35:42+08:00","size":4584963,"digest":"7e5aa975448fc470736f18156994f5b445b131ed1dbce9fad3b2d1415a0947d6","integrity":"sha256-flqpdUSPxHBzbxgVaZT1tEWxMe0dvOn607LRQVoJR9Y="},"admin-7cf88529e1f8fdafe22b3aef833fbba4898c4a69fdc4043dc9f1796c6f100ead.css":{"logical_path":"admin.css","mtime":"2019-12-06T18:03:36+08:00","size":870265,"digest":"7cf88529e1f8fdafe22b3aef833fbba4898c4a69fdc4043dc9f1796c6f100ead","integrity":"sha256-fPiFKeH4/a/iKzrvgz+7pImMSmn9xAQ9yfF5bG8QDq0="},"admin-aaff9ffea9f10689b47c00147b5cc6650961733dbc8ca30d23eb9afc2e6ee3dd.js":{"logical_path":"admin.js","mtime":"2019-12-06T18:20:13+08:00","size":4584962,"digest":"aaff9ffea9f10689b47c00147b5cc6650961733dbc8ca30d23eb9afc2e6ee3dd","integrity":"sha256-qv+f/qnxBom0fAAUe1zGZQlhcz28jKMNI+ua/C5u490="},"admin-ab3a763c3d168f05c11ca0a9f0cadc3030dc9f0ae0317085d9032d47643f7488.js":{"logical_path":"admin.js","mtime":"2019-12-26T16:08:18+08:00","size":4607541,"digest":"ab3a763c3d168f05c11ca0a9f0cadc3030dc9f0ae0317085d9032d47643f7488","integrity":"sha256-qzp2PD0WjwXBHKCp8MrcMDDcnwrgMXCF2QMtR2Q/dIg="},"admin-31e7cc6208d66802217e899555cd22920bb7d043578b1b16250e09dbe76b7bc6.css":{"logical_path":"admin.css","mtime":"2019-12-10T16:46:58+08:00","size":843730,"digest":"31e7cc6208d66802217e899555cd22920bb7d043578b1b16250e09dbe76b7bc6","integrity":"sha256-MefMYgjWaAIhfomVVc0ikgu30ENXixsWJQ4J2+dre8Y="},"college-893ba916d2b043f4b751cacc104de43d14e0db0b4001822f996e803bacbda169.css":{"logical_path":"college.css","mtime":"2019-12-10T16:46:58+08:00","size":589973,"digest":"893ba916d2b043f4b751cacc104de43d14e0db0b4001822f996e803bacbda169","integrity":"sha256-iTupFtKwQ/S3UcrMEE3kPRTg2wtAAYIvmW6AO6y9oWk="},"cooperative-bef1905d0c3e15357e3a376225923847b33f7388d49741062fe3cb20346da315.css":{"logical_path":"cooperative.css","mtime":"2019-12-10T16:46:58+08:00","size":824051,"digest":"bef1905d0c3e15357e3a376225923847b33f7388d49741062fe3cb20346da315","integrity":"sha256-vvGQXQw+FTV+OjdiJZI4R7M/c4jUl0EGL+PLIDRtoxU="},"application-8853af8ba870ca7fc8bdae048322f1c5a5caa26f1df87dbbf0c6d04232c4ac4e.css":{"logical_path":"application.css","mtime":"2019-10-21T22:52:15+08:00","size":418844,"digest":"8853af8ba870ca7fc8bdae048322f1c5a5caa26f1df87dbbf0c6d04232c4ac4e","integrity":"sha256-iFOvi6hwyn/Iva4EgyLxxaXKom8d+H278MbQQjLErE4="},"admin-f16eb906c3b6dce2c588677637473a128cd7b3d56c8d15b5eba621e9df586f37.js":{"logical_path":"admin.js","mtime":"2020-01-03T16:30:22+08:00","size":4610769,"digest":"f16eb906c3b6dce2c588677637473a128cd7b3d56c8d15b5eba621e9df586f37","integrity":"sha256-8W65BsO23OLFiGd2N0c6EozXs9VsjRW166Yh6d9Ybzc="},"admin-bed977ce14a5b8a1dcb718a4faa7971f54aad01ed4fa9b01a3d2ee333ed36cf8.js":{"logical_path":"admin.js","mtime":"2020-01-03T17:41:50+08:00","size":4611577,"digest":"bed977ce14a5b8a1dcb718a4faa7971f54aad01ed4fa9b01a3d2ee333ed36cf8","integrity":"sha256-vtl3zhSluKHctxik+qeXH1Sq0B7U+psBo9LuMz7TbPg="},"admin-d10431d175587afdb06f99d563f03b9890002351aa3b9a5e568d0396fd5cfe22.js":{"logical_path":"admin.js","mtime":"2020-01-31T16:18:47+08:00","size":4613282,"digest":"d10431d175587afdb06f99d563f03b9890002351aa3b9a5e568d0396fd5cfe22","integrity":"sha256-0QQx0XVYev2wb5nVY/A7mJAAI1GqO5peVo0Dlv1c/iI="},"admin-809fe775cb1fb357743738f65e0761be6b9fbe09dcd7062559f22dd87f1e059c.js":{"logical_path":"admin.js","mtime":"2020-02-04T19:26:18+08:00","size":4621538,"digest":"809fe775cb1fb357743738f65e0761be6b9fbe09dcd7062559f22dd87f1e059c","integrity":"sha256-gJ/ndcsfs1d0Nzj2Xgdhvmufvgnc1wYlWfIt2H8eBZw="},"admin-15ad6e029d1195111f661b61d8252ec40b1e453c44c489c661c8fa3211ff62b2.css":{"logical_path":"admin.css","mtime":"2020-02-05T14:22:08+08:00","size":846651,"digest":"15ad6e029d1195111f661b61d8252ec40b1e453c44c489c661c8fa3211ff62b2","integrity":"sha256-Fa1uAp0RlREfZhth2CUuxAseRTxExInGYcj6MhH/YrI="},"admin-c4d3fa2b049fa3abe12d80939ccd28ab8a824b1469cdb2c72f7daf1483ab6da1.js":{"logical_path":"admin.js","mtime":"2020-02-05T11:49:01+08:00","size":4622038,"digest":"c4d3fa2b049fa3abe12d80939ccd28ab8a824b1469cdb2c72f7daf1483ab6da1","integrity":"sha256-xNP6KwSfo6vhLYCTnM0oq4qCSxRpzbLHL32vFIOrbaE="},"admin-d4133a4bdcbfd4ca5d2dd49735008d8db50f25757650f0b13a62e254dfb201b4.js":{"logical_path":"admin.js","mtime":"2020-02-05T16:36:51+08:00","size":4624767,"digest":"d4133a4bdcbfd4ca5d2dd49735008d8db50f25757650f0b13a62e254dfb201b4","integrity":"sha256-1BM6S9y/1MpdLdSXNQCNjbUPJXV2UPCxOmLiVN+yAbQ="},"admin-7c523d78203d02769553abade33413cdf663eea3fe1d15ee07ab449240a10a9a.js":{"logical_path":"admin.js","mtime":"2020-02-19T15:51:39+08:00","size":4570082,"digest":"7c523d78203d02769553abade33413cdf663eea3fe1d15ee07ab449240a10a9a","integrity":"sha256-fFI9eCA9AnaVU6ut4zQTzfZj7qP+HRXuB6tEkkChCpo="},"college-f9c1b76699b39750bee976e1dbb5d832fdce2fb05edaf1b818c6e76fdf5ba77c.js":{"logical_path":"college.js","mtime":"2020-02-07T16:06:25+08:00","size":3505839,"digest":"f9c1b76699b39750bee976e1dbb5d832fdce2fb05edaf1b818c6e76fdf5ba77c","integrity":"sha256-+cG3Zpmzl1C+6Xbh27XYMv3OL7Be2vG4GMbnb99bp3w="},"college-2065ab3f84df62eb2ca345c83198920fad15cc3b93baf22c091f3c6bfced11b4.css":{"logical_path":"college.css","mtime":"2020-02-05T14:22:08+08:00","size":586787,"digest":"2065ab3f84df62eb2ca345c83198920fad15cc3b93baf22c091f3c6bfced11b4","integrity":"sha256-IGWrP4TfYusso0XIMZiSD60VzDuTuvIsCR88a/ztEbQ="},"cooperative-2efdf753e39599e78fb02527e864784df9a34dd971576db8231b63f618f9786e.js":{"logical_path":"cooperative.js","mtime":"2020-02-10T22:03:17+08:00","size":4413858,"digest":"2efdf753e39599e78fb02527e864784df9a34dd971576db8231b63f618f9786e","integrity":"sha256-Lv33U+OVmeePsCUn6GR4TfmjTdlxV224Ixtj9hj5eG4="},"cooperative-20747152aeb5e0bca475a49899a771a58d73be01d62c8f39396540c4f0abb10c.css":{"logical_path":"cooperative.css","mtime":"2020-02-05T14:22:08+08:00","size":826122,"digest":"20747152aeb5e0bca475a49899a771a58d73be01d62c8f39396540c4f0abb10c","integrity":"sha256-IHRxUq614LykdaSYmadxpY1zvgHWLI85OWVAxPCrsQw="},"application-47eaf72a32e7cee15e04ee7632fbbaadd5efd1129bfe0978d28d9b84ecec913e.js":{"logical_path":"application.js","mtime":"2020-02-07T16:06:25+08:00","size":551318,"digest":"47eaf72a32e7cee15e04ee7632fbbaadd5efd1129bfe0978d28d9b84ecec913e","integrity":"sha256-R+r3KjLnzuFeBO52Mvu6rdXv0RKb/gl40o2bhOzskT4="},"application-d3da385d89dfa7edfbecc09573322b132ffc5580cbd185d5f7a74d5358881815.css":{"logical_path":"application.css","mtime":"2019-09-09T09:26:59+08:00","size":419785,"digest":"d3da385d89dfa7edfbecc09573322b132ffc5580cbd185d5f7a74d5358881815","integrity":"sha256-09o4XYnfp+377MCVczIrEy/8VYDL0YXV96dNU1iIGBU="}},"assets":{"admin.js":"admin-7c523d78203d02769553abade33413cdf663eea3fe1d15ee07ab449240a10a9a.js","admin.css":"admin-15ad6e029d1195111f661b61d8252ec40b1e453c44c489c661c8fa3211ff62b2.css","font-awesome/fontawesome-webfont.eot":"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot","font-awesome/fontawesome-webfont.woff2":"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2","font-awesome/fontawesome-webfont.woff":"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff","font-awesome/fontawesome-webfont.ttf":"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf","font-awesome/fontawesome-webfont.svg":"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg","college.js":"college-f9c1b76699b39750bee976e1dbb5d832fdce2fb05edaf1b818c6e76fdf5ba77c.js","college.css":"college-2065ab3f84df62eb2ca345c83198920fad15cc3b93baf22c091f3c6bfced11b4.css","cooperative.js":"cooperative-2efdf753e39599e78fb02527e864784df9a34dd971576db8231b63f618f9786e.js","cooperative.css":"cooperative-20747152aeb5e0bca475a49899a771a58d73be01d62c8f39396540c4f0abb10c.css","logo.png":"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png","application.js":"application-47eaf72a32e7cee15e04ee7632fbbaadd5efd1129bfe0978d28d9b84ecec913e.js","application.css":"application-d3da385d89dfa7edfbecc09573322b132ffc5580cbd185d5f7a74d5358881815.css"}} \ No newline at end of file +{"files":{"admin-1bd781fc5959b4f0e8879fa92afc5cec47e2d1a9b79cad9e55177fc1197a0e5b.js":{"logical_path":"admin.js","mtime":"2019-11-27T19:06:45+08:00","size":4594770,"digest":"1bd781fc5959b4f0e8879fa92afc5cec47e2d1a9b79cad9e55177fc1197a0e5b","integrity":"sha256-G9eB/FlZtPDoh5+pKvxc7Efi0am3nK2eVRd/wRl6Dls="},"admin-e78dd8b2041c26973b3851180e413539c07042575e336147194b5f2a1f7fa09c.css":{"logical_path":"admin.css","mtime":"2019-11-21T17:49:31+08:00","size":817848,"digest":"e78dd8b2041c26973b3851180e413539c07042575e336147194b5f2a1f7fa09c","integrity":"sha256-543YsgQcJpc7OFEYDkE1OcBwQldeM2FHGUtfKh9/oJw="},"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot":{"logical_path":"font-awesome/fontawesome-webfont.eot","mtime":"2019-08-22T14:54:27+08:00","size":165742,"digest":"7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979","integrity":"sha256-e/yrbbmdXPvxcFygU23ceFhUMsxfpBu9etDwCQM7KXk="},"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2":{"logical_path":"font-awesome/fontawesome-webfont.woff2","mtime":"2019-08-22T14:54:27+08:00","size":77160,"digest":"2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe","integrity":"sha256-Kt78vAQefRj88tQXh53FoJmXqmTWdbejxLbOM9oT8/4="},"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff":{"logical_path":"font-awesome/fontawesome-webfont.woff","mtime":"2019-08-22T14:54:27+08:00","size":98024,"digest":"ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07","integrity":"sha256-ugxZ3rVFD1y0Gz+TYJ7i0NmVQVh33foiPoqKdTNHTwc="},"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf":{"logical_path":"font-awesome/fontawesome-webfont.ttf","mtime":"2019-08-22T14:54:27+08:00","size":165548,"digest":"aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8","integrity":"sha256-qljzPyOaD7AvXHpsRcBD16msmgkzNYBmlOzW1O3A1qg="},"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg":{"logical_path":"font-awesome/fontawesome-webfont.svg","mtime":"2019-08-22T14:54:27+08:00","size":444379,"digest":"ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4","integrity":"sha256-rWFXkmwWIrpOHQPUePFUE2hSS/xG9R5C/g2UX37zI+Q="},"college-431d908264782ef54e90202095d4cf397c586f74d2b7879684348dc8b53d2cd2.js":{"logical_path":"college.js","mtime":"2020-01-07T14:59:22+08:00","size":3570046,"digest":"431d908264782ef54e90202095d4cf397c586f74d2b7879684348dc8b53d2cd2","integrity":"sha256-Qx2QgmR4LvVOkCAgldTPOXxYb3TSt4eWhDSNyLU9LNI="},"college-eb35b6573dea2a069abd5acb0211940c2165fa21da333555fa859ed155b3ca1f.css":{"logical_path":"college.css","mtime":"2019-11-20T17:50:44+08:00","size":565772,"digest":"eb35b6573dea2a069abd5acb0211940c2165fa21da333555fa859ed155b3ca1f","integrity":"sha256-6zW2Vz3qKgaavVrLAhGUDCFl+iHaMzVV+oWe0VWzyh8="},"cooperative-4f2218bb223392ea4332e9ace5a748baccd4fe66d4b5cc3b5574f97a425203ec.js":{"logical_path":"cooperative.js","mtime":"2020-01-07T14:59:22+08:00","size":4478060,"digest":"4f2218bb223392ea4332e9ace5a748baccd4fe66d4b5cc3b5574f97a425203ec","integrity":"sha256-TyIYuyIzkupDMums5adIuszU/mbUtcw7VXT5ekJSA+w="},"cooperative-9244063fa63cd29c9c3b074af565be75a130cfb31741b2f5252fe68a1f5c13c5.css":{"logical_path":"cooperative.css","mtime":"2019-11-20T17:50:44+08:00","size":799850,"digest":"9244063fa63cd29c9c3b074af565be75a130cfb31741b2f5252fe68a1f5c13c5","integrity":"sha256-kkQGP6Y80pycOwdK9WW+daEwz7MXQbL1JS/mih9cE8U="},"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png":{"logical_path":"logo.png","mtime":"2019-12-10T16:46:58+08:00","size":2816,"digest":"7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423","integrity":"sha256-f/ESVocJv5f5iY/ockm3qPIA/x9I1TfYWvhyFfGHBCM="},"application-d44f4301c7dfbe07bcb2788d7c006c22c184ae6b7016c09f7911b4962aacd767.js":{"logical_path":"application.js","mtime":"2020-01-07T14:59:22+08:00","size":615525,"digest":"d44f4301c7dfbe07bcb2788d7c006c22c184ae6b7016c09f7911b4962aacd767","integrity":"sha256-1E9DAcffvge8sniNfABsIsGErmtwFsCfeRG0liqs12c="},"application-2bf79ac2818959eb18d4df720a0cd0721b3b2385dd4565d635851fc41e192975.css":{"logical_path":"application.css","mtime":"2019-09-09T09:26:59+08:00","size":401033,"digest":"2bf79ac2818959eb18d4df720a0cd0721b3b2385dd4565d635851fc41e192975","integrity":"sha256-K/eawoGJWesY1N9yCgzQchs7I4XdRWXWNYUfxB4ZKXU="},"admin-83797d03d53c38db8e4751348516f8b7c55842cf8899066b86b3b2e6b6b1c8ad.js":{"logical_path":"admin.js","mtime":"2019-12-02T10:11:32+08:00","size":4583649,"digest":"83797d03d53c38db8e4751348516f8b7c55842cf8899066b86b3b2e6b6b1c8ad","integrity":"sha256-g3l9A9U8ONuOR1E0hRb4t8VYQs+ImQZrhrOy5raxyK0="},"admin-1512839e7eaa2136bdf9b238e3710004f8b90f2b74300c8ae7d9f9b25dddf077.css":{"logical_path":"admin.css","mtime":"2019-11-27T15:52:07+08:00","size":868584,"digest":"1512839e7eaa2136bdf9b238e3710004f8b90f2b74300c8ae7d9f9b25dddf077","integrity":"sha256-FRKDnn6qITa9+bI443EABPi5Dyt0MAyK59n5sl3d8Hc="},"college-1e70702e2d864fb4d5f57841bfa5937e31c7c059e6cd672a07f0b4b20740f607.js":{"logical_path":"college.js","mtime":"2019-11-20T16:00:49+08:00","size":3569292,"digest":"1e70702e2d864fb4d5f57841bfa5937e31c7c059e6cd672a07f0b4b20740f607","integrity":"sha256-HnBwLi2GT7TV9XhBv6WTfjHHwFnmzWcqB/C0sgdA9gc="},"college-a14be76ebc459e3bedd86e64c62b07c2dfc7ce632d73b86a7270b17462e5b746.css":{"logical_path":"college.css","mtime":"2019-11-11T18:25:42+08:00","size":610352,"digest":"a14be76ebc459e3bedd86e64c62b07c2dfc7ce632d73b86a7270b17462e5b746","integrity":"sha256-oUvnbrxFnjvt2G5kxisHwt/HzmMtc7hqcnCxdGLlt0Y="},"cooperative-bbf9b1ef14747d17410f2f38a6f308697335f86d4525ed6a5579905efc314ef3.js":{"logical_path":"cooperative.js","mtime":"2019-11-20T16:00:49+08:00","size":4463241,"digest":"bbf9b1ef14747d17410f2f38a6f308697335f86d4525ed6a5579905efc314ef3","integrity":"sha256-u/mx7xR0fRdBDy84pvMIaXM1+G1FJe1qVXmQXvwxTvM="},"cooperative-c36bba05d6a13482ccb6c3696ba5d750841dec9cae7a8043a0318c34c3a4638e.css":{"logical_path":"cooperative.css","mtime":"2019-11-17T09:36:46+08:00","size":849736,"digest":"c36bba05d6a13482ccb6c3696ba5d750841dec9cae7a8043a0318c34c3a4638e","integrity":"sha256-w2u6BdahNILMtsNpa6XXUIQd7JyueoBDoDGMNMOkY44="},"application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js":{"logical_path":"application.js","mtime":"2019-11-20T16:00:49+08:00","size":600706,"digest":"9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb","integrity":"sha256-nPvD15JZmh0N5ce4QgnhwrLmAzbw8B4Z8FgWY5GHCPs="},"application-8c9d6bb61c50908f584b3070c79aeb95f25c1166d39e07da5e95438b39ca0de9.css":{"logical_path":"application.css","mtime":"2019-10-21T22:52:15+08:00","size":436995,"digest":"8c9d6bb61c50908f584b3070c79aeb95f25c1166d39e07da5e95438b39ca0de9","integrity":"sha256-jJ1rthxQkI9YSzBwx5rrlfJcEWbTngfaXpVDiznKDek="},"admin-f1a4d30772fa41e1edd288c1b1d39deeac7481d590b13a886953adf2f2e4f47c.js":{"logical_path":"admin.js","mtime":"2019-11-29T15:05:39+08:00","size":4583647,"digest":"f1a4d30772fa41e1edd288c1b1d39deeac7481d590b13a886953adf2f2e4f47c","integrity":"sha256-8aTTB3L6QeHt0ojBsdOd7qx0gdWQsTqIaVOt8vLk9Hw="},"admin-0172e0b18d559d9648df58d7954e4843256ba2d2eda03543b7cc6c955c8e2eb3.js":{"logical_path":"admin.js","mtime":"2019-12-02T10:58:14+08:00","size":4583648,"digest":"0172e0b18d559d9648df58d7954e4843256ba2d2eda03543b7cc6c955c8e2eb3","integrity":"sha256-AXLgsY1VnZZI31jXlU5IQyVrotLtoDVDt8xslVyOLrM="},"admin-6da32058962cbfc9483b468c26d5f9b968b5f970a2031f73952863c554cd6254.js":{"logical_path":"admin.js","mtime":"2019-12-02T17:44:43+08:00","size":4583680,"digest":"6da32058962cbfc9483b468c26d5f9b968b5f970a2031f73952863c554cd6254","integrity":"sha256-baMgWJYsv8lIO0aMJtX5uWi1+XCiAx9zlShjxVTNYlQ="},"admin-64b90a423722da851a01011acac435b5f29f25e3b741e78854ea1a40742d89f7.js":{"logical_path":"admin.js","mtime":"2019-12-06T11:19:59+08:00","size":4584886,"digest":"64b90a423722da851a01011acac435b5f29f25e3b741e78854ea1a40742d89f7","integrity":"sha256-ZLkKQjci2oUaAQEaysQ1tfKfJeO3QeeIVOoaQHQtifc="},"admin-38dd06255909789c15bb1ae3d2c6b25064dd59d463ed996af2cd93b7aa08626b.css":{"logical_path":"admin.css","mtime":"2019-12-06T11:00:53+08:00","size":870104,"digest":"38dd06255909789c15bb1ae3d2c6b25064dd59d463ed996af2cd93b7aa08626b","integrity":"sha256-ON0GJVkJeJwVuxrj0sayUGTdWdRj7Zlq8s2Tt6oIYms="},"admin-f1565aa714ea18c95e226d27a3685c4b81544a9b531f4d14f88f6aa43cc9f2fa.css":{"logical_path":"admin.css","mtime":"2019-12-06T11:33:41+08:00","size":870109,"digest":"f1565aa714ea18c95e226d27a3685c4b81544a9b531f4d14f88f6aa43cc9f2fa","integrity":"sha256-8VZapxTqGMleIm0no2hcS4FUSptTH00U+I9qpDzJ8vo="},"admin-7e5aa975448fc470736f18156994f5b445b131ed1dbce9fad3b2d1415a0947d6.js":{"logical_path":"admin.js","mtime":"2019-12-06T15:35:42+08:00","size":4584963,"digest":"7e5aa975448fc470736f18156994f5b445b131ed1dbce9fad3b2d1415a0947d6","integrity":"sha256-flqpdUSPxHBzbxgVaZT1tEWxMe0dvOn607LRQVoJR9Y="},"admin-7cf88529e1f8fdafe22b3aef833fbba4898c4a69fdc4043dc9f1796c6f100ead.css":{"logical_path":"admin.css","mtime":"2019-12-06T18:03:36+08:00","size":870265,"digest":"7cf88529e1f8fdafe22b3aef833fbba4898c4a69fdc4043dc9f1796c6f100ead","integrity":"sha256-fPiFKeH4/a/iKzrvgz+7pImMSmn9xAQ9yfF5bG8QDq0="},"admin-aaff9ffea9f10689b47c00147b5cc6650961733dbc8ca30d23eb9afc2e6ee3dd.js":{"logical_path":"admin.js","mtime":"2019-12-06T18:20:13+08:00","size":4584962,"digest":"aaff9ffea9f10689b47c00147b5cc6650961733dbc8ca30d23eb9afc2e6ee3dd","integrity":"sha256-qv+f/qnxBom0fAAUe1zGZQlhcz28jKMNI+ua/C5u490="},"admin-ab3a763c3d168f05c11ca0a9f0cadc3030dc9f0ae0317085d9032d47643f7488.js":{"logical_path":"admin.js","mtime":"2019-12-26T16:08:18+08:00","size":4607541,"digest":"ab3a763c3d168f05c11ca0a9f0cadc3030dc9f0ae0317085d9032d47643f7488","integrity":"sha256-qzp2PD0WjwXBHKCp8MrcMDDcnwrgMXCF2QMtR2Q/dIg="},"admin-31e7cc6208d66802217e899555cd22920bb7d043578b1b16250e09dbe76b7bc6.css":{"logical_path":"admin.css","mtime":"2019-12-10T16:46:58+08:00","size":843730,"digest":"31e7cc6208d66802217e899555cd22920bb7d043578b1b16250e09dbe76b7bc6","integrity":"sha256-MefMYgjWaAIhfomVVc0ikgu30ENXixsWJQ4J2+dre8Y="},"college-893ba916d2b043f4b751cacc104de43d14e0db0b4001822f996e803bacbda169.css":{"logical_path":"college.css","mtime":"2019-12-10T16:46:58+08:00","size":589973,"digest":"893ba916d2b043f4b751cacc104de43d14e0db0b4001822f996e803bacbda169","integrity":"sha256-iTupFtKwQ/S3UcrMEE3kPRTg2wtAAYIvmW6AO6y9oWk="},"cooperative-bef1905d0c3e15357e3a376225923847b33f7388d49741062fe3cb20346da315.css":{"logical_path":"cooperative.css","mtime":"2019-12-10T16:46:58+08:00","size":824051,"digest":"bef1905d0c3e15357e3a376225923847b33f7388d49741062fe3cb20346da315","integrity":"sha256-vvGQXQw+FTV+OjdiJZI4R7M/c4jUl0EGL+PLIDRtoxU="},"application-8853af8ba870ca7fc8bdae048322f1c5a5caa26f1df87dbbf0c6d04232c4ac4e.css":{"logical_path":"application.css","mtime":"2019-10-21T22:52:15+08:00","size":418844,"digest":"8853af8ba870ca7fc8bdae048322f1c5a5caa26f1df87dbbf0c6d04232c4ac4e","integrity":"sha256-iFOvi6hwyn/Iva4EgyLxxaXKom8d+H278MbQQjLErE4="},"admin-f16eb906c3b6dce2c588677637473a128cd7b3d56c8d15b5eba621e9df586f37.js":{"logical_path":"admin.js","mtime":"2020-01-03T16:30:22+08:00","size":4610769,"digest":"f16eb906c3b6dce2c588677637473a128cd7b3d56c8d15b5eba621e9df586f37","integrity":"sha256-8W65BsO23OLFiGd2N0c6EozXs9VsjRW166Yh6d9Ybzc="},"admin-bed977ce14a5b8a1dcb718a4faa7971f54aad01ed4fa9b01a3d2ee333ed36cf8.js":{"logical_path":"admin.js","mtime":"2020-01-03T17:41:50+08:00","size":4611577,"digest":"bed977ce14a5b8a1dcb718a4faa7971f54aad01ed4fa9b01a3d2ee333ed36cf8","integrity":"sha256-vtl3zhSluKHctxik+qeXH1Sq0B7U+psBo9LuMz7TbPg="},"admin-d10431d175587afdb06f99d563f03b9890002351aa3b9a5e568d0396fd5cfe22.js":{"logical_path":"admin.js","mtime":"2020-01-31T16:18:47+08:00","size":4613282,"digest":"d10431d175587afdb06f99d563f03b9890002351aa3b9a5e568d0396fd5cfe22","integrity":"sha256-0QQx0XVYev2wb5nVY/A7mJAAI1GqO5peVo0Dlv1c/iI="},"admin-809fe775cb1fb357743738f65e0761be6b9fbe09dcd7062559f22dd87f1e059c.js":{"logical_path":"admin.js","mtime":"2020-02-04T19:26:18+08:00","size":4621538,"digest":"809fe775cb1fb357743738f65e0761be6b9fbe09dcd7062559f22dd87f1e059c","integrity":"sha256-gJ/ndcsfs1d0Nzj2Xgdhvmufvgnc1wYlWfIt2H8eBZw="},"admin-15ad6e029d1195111f661b61d8252ec40b1e453c44c489c661c8fa3211ff62b2.css":{"logical_path":"admin.css","mtime":"2020-02-05T14:22:08+08:00","size":846651,"digest":"15ad6e029d1195111f661b61d8252ec40b1e453c44c489c661c8fa3211ff62b2","integrity":"sha256-Fa1uAp0RlREfZhth2CUuxAseRTxExInGYcj6MhH/YrI="},"admin-c4d3fa2b049fa3abe12d80939ccd28ab8a824b1469cdb2c72f7daf1483ab6da1.js":{"logical_path":"admin.js","mtime":"2020-02-05T11:49:01+08:00","size":4622038,"digest":"c4d3fa2b049fa3abe12d80939ccd28ab8a824b1469cdb2c72f7daf1483ab6da1","integrity":"sha256-xNP6KwSfo6vhLYCTnM0oq4qCSxRpzbLHL32vFIOrbaE="},"admin-d4133a4bdcbfd4ca5d2dd49735008d8db50f25757650f0b13a62e254dfb201b4.js":{"logical_path":"admin.js","mtime":"2020-02-05T16:36:51+08:00","size":4624767,"digest":"d4133a4bdcbfd4ca5d2dd49735008d8db50f25757650f0b13a62e254dfb201b4","integrity":"sha256-1BM6S9y/1MpdLdSXNQCNjbUPJXV2UPCxOmLiVN+yAbQ="},"admin-7c523d78203d02769553abade33413cdf663eea3fe1d15ee07ab449240a10a9a.js":{"logical_path":"admin.js","mtime":"2020-02-19T15:51:39+08:00","size":4570082,"digest":"7c523d78203d02769553abade33413cdf663eea3fe1d15ee07ab449240a10a9a","integrity":"sha256-fFI9eCA9AnaVU6ut4zQTzfZj7qP+HRXuB6tEkkChCpo="},"college-f9c1b76699b39750bee976e1dbb5d832fdce2fb05edaf1b818c6e76fdf5ba77c.js":{"logical_path":"college.js","mtime":"2020-02-07T16:06:25+08:00","size":3505839,"digest":"f9c1b76699b39750bee976e1dbb5d832fdce2fb05edaf1b818c6e76fdf5ba77c","integrity":"sha256-+cG3Zpmzl1C+6Xbh27XYMv3OL7Be2vG4GMbnb99bp3w="},"college-2065ab3f84df62eb2ca345c83198920fad15cc3b93baf22c091f3c6bfced11b4.css":{"logical_path":"college.css","mtime":"2020-02-05T14:22:08+08:00","size":586787,"digest":"2065ab3f84df62eb2ca345c83198920fad15cc3b93baf22c091f3c6bfced11b4","integrity":"sha256-IGWrP4TfYusso0XIMZiSD60VzDuTuvIsCR88a/ztEbQ="},"cooperative-2efdf753e39599e78fb02527e864784df9a34dd971576db8231b63f618f9786e.js":{"logical_path":"cooperative.js","mtime":"2020-02-10T22:03:17+08:00","size":4413858,"digest":"2efdf753e39599e78fb02527e864784df9a34dd971576db8231b63f618f9786e","integrity":"sha256-Lv33U+OVmeePsCUn6GR4TfmjTdlxV224Ixtj9hj5eG4="},"cooperative-20747152aeb5e0bca475a49899a771a58d73be01d62c8f39396540c4f0abb10c.css":{"logical_path":"cooperative.css","mtime":"2020-02-05T14:22:08+08:00","size":826122,"digest":"20747152aeb5e0bca475a49899a771a58d73be01d62c8f39396540c4f0abb10c","integrity":"sha256-IHRxUq614LykdaSYmadxpY1zvgHWLI85OWVAxPCrsQw="},"application-47eaf72a32e7cee15e04ee7632fbbaadd5efd1129bfe0978d28d9b84ecec913e.js":{"logical_path":"application.js","mtime":"2020-02-07T16:06:25+08:00","size":551318,"digest":"47eaf72a32e7cee15e04ee7632fbbaadd5efd1129bfe0978d28d9b84ecec913e","integrity":"sha256-R+r3KjLnzuFeBO52Mvu6rdXv0RKb/gl40o2bhOzskT4="},"application-d3da385d89dfa7edfbecc09573322b132ffc5580cbd185d5f7a74d5358881815.css":{"logical_path":"application.css","mtime":"2019-09-09T09:26:59+08:00","size":419785,"digest":"d3da385d89dfa7edfbecc09573322b132ffc5580cbd185d5f7a74d5358881815","integrity":"sha256-09o4XYnfp+377MCVczIrEy/8VYDL0YXV96dNU1iIGBU="},"admin-8d7c2001aaf2599bddad06c5bc30526b059780d9fda2f01797524c0b8a1c43c3.js":{"logical_path":"admin.js","mtime":"2020-02-22T18:21:49+08:00","size":4636232,"digest":"8d7c2001aaf2599bddad06c5bc30526b059780d9fda2f01797524c0b8a1c43c3","integrity":"sha256-jXwgAaryWZvdrQbFvDBSawWXgNn9ovAXl1JMC4ocQ8M="},"admin-343a62865a99bebf4247a945a48400b472f76196fb80e86b4cce6b2cc480d306.css":{"logical_path":"admin.css","mtime":"2019-12-23T10:10:47+08:00","size":838584,"digest":"343a62865a99bebf4247a945a48400b472f76196fb80e86b4cce6b2cc480d306","integrity":"sha256-NDpihlqZvr9CR6lFpIQAtHL3YZb7gOhrTM5rLMSA0wY="},"college-461b4e52a77522c5ff4341992359aba660dc26d7d985e394b69d8b87db954a14.css":{"logical_path":"college.css","mtime":"2019-11-19T17:05:09+08:00","size":578720,"digest":"461b4e52a77522c5ff4341992359aba660dc26d7d985e394b69d8b87db954a14","integrity":"sha256-RhtOUqd1IsX/Q0GZI1mrpmDcJtfZheOUtp2Lh9uVShQ="},"cooperative-286bab0b704bc8d5295bee551a48f78e1fe8713e0e50c65059cf7a65ed09bbf0.js":{"logical_path":"cooperative.js","mtime":"2020-02-09T13:28:20+08:00","size":4478065,"digest":"286bab0b704bc8d5295bee551a48f78e1fe8713e0e50c65059cf7a65ed09bbf0","integrity":"sha256-KGurC3BLyNUpW+5VGkj3jh/ocT4OUMZQWc96Ze0Ju/A="},"cooperative-716b37420680ce5fb3bedf40508ea89e07f4d7060b412b832c8b4e9b09ac024d.css":{"logical_path":"cooperative.css","mtime":"2019-11-19T17:05:09+08:00","size":818055,"digest":"716b37420680ce5fb3bedf40508ea89e07f4d7060b412b832c8b4e9b09ac024d","integrity":"sha256-cWs3QgaAzl+zvt9AUI6ongf01wYLQSuDLItOmwmsAk0="},"application-e194b45894d0c5240d954851211a86516ee6ad871ca99bf7783ce44aeb8c0687.css":{"logical_path":"application.css","mtime":"2019-11-19T17:04:45+08:00","size":413848,"digest":"e194b45894d0c5240d954851211a86516ee6ad871ca99bf7783ce44aeb8c0687","integrity":"sha256-4ZS0WJTQxSQNlUhRIRqGUW7mrYccqZv3eDzkSuuMBoc="},"admin-04ff7d4c76f406e0df9e02923038d175f26ee098d43e266c2138b07163a2da9e.js":{"logical_path":"admin.js","mtime":"2020-02-25T12:09:35+08:00","size":4635520,"digest":"04ff7d4c76f406e0df9e02923038d175f26ee098d43e266c2138b07163a2da9e","integrity":"sha256-BP99THb0BuDfngKSMDjRdfJu4JjUPiZsITiwcWOi2p4="},"admin-46d2460ea8c06a885f92df73240e8eb84d320402bbdf580ffe3e038d07fdda3d.js":{"logical_path":"admin.js","mtime":"2020-02-25T13:17:26+08:00","size":4635586,"digest":"46d2460ea8c06a885f92df73240e8eb84d320402bbdf580ffe3e038d07fdda3d","integrity":"sha256-RtJGDqjAaohfkt9zJA6OuE0yBAK731gP/j4DjQf92j0="},"admin-b8f26db185886f99021da91f0e2c1a8cc4ced4d1b895794751d11b7a9f45de98.js":{"logical_path":"admin.js","mtime":"2020-02-25T17:16:13+08:00","size":4637067,"digest":"b8f26db185886f99021da91f0e2c1a8cc4ced4d1b895794751d11b7a9f45de98","integrity":"sha256-uPJtsYWIb5kCHakfDiwajMTO1NG4lXlHUdEbep9F3pg="},"admin-8cb0e9724b33e253621a5f1020bdc270f828cb7d602de8434d3cc606e0b4dbc2.js":{"logical_path":"admin.js","mtime":"2020-02-25T17:51:23+08:00","size":4637275,"digest":"8cb0e9724b33e253621a5f1020bdc270f828cb7d602de8434d3cc606e0b4dbc2","integrity":"sha256-jLDpcksz4lNiGl8QIL3CcPgoy31gLehDTTzGBuC028I="}},"assets":{"admin.js":"admin-8cb0e9724b33e253621a5f1020bdc270f828cb7d602de8434d3cc606e0b4dbc2.js","admin.css":"admin-31e7cc6208d66802217e899555cd22920bb7d043578b1b16250e09dbe76b7bc6.css","font-awesome/fontawesome-webfont.eot":"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot","font-awesome/fontawesome-webfont.woff2":"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2","font-awesome/fontawesome-webfont.woff":"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff","font-awesome/fontawesome-webfont.ttf":"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf","font-awesome/fontawesome-webfont.svg":"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg","college.js":"college-431d908264782ef54e90202095d4cf397c586f74d2b7879684348dc8b53d2cd2.js","college.css":"college-893ba916d2b043f4b751cacc104de43d14e0db0b4001822f996e803bacbda169.css","cooperative.js":"cooperative-286bab0b704bc8d5295bee551a48f78e1fe8713e0e50c65059cf7a65ed09bbf0.js","cooperative.css":"cooperative-bef1905d0c3e15357e3a376225923847b33f7388d49741062fe3cb20346da315.css","logo.png":"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png","application.js":"application-d44f4301c7dfbe07bcb2788d7c006c22c184ae6b7016c09f7911b4962aacd767.js","application.css":"application-8853af8ba870ca7fc8bdae048322f1c5a5caa26f1df87dbbf0c6d04232c4ac4e.css"}} \ No newline at end of file diff --git a/public/assets/admin-04ff7d4c76f406e0df9e02923038d175f26ee098d43e266c2138b07163a2da9e.js b/public/assets/admin-04ff7d4c76f406e0df9e02923038d175f26ee098d43e266c2138b07163a2da9e.js new file mode 100644 index 000000000..8b7295228 --- /dev/null +++ b/public/assets/admin-04ff7d4c76f406e0df9e02923038d175f26ee098d43e266c2138b07163a2da9e.js @@ -0,0 +1,142257 @@ +/* +Unobtrusive JavaScript +https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts +Released under the MIT license + */ + + +(function() { + var context = this; + + (function() { + (function() { + this.Rails = { + linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]', + buttonClickSelector: { + selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])', + exclude: 'form button' + }, + inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]', + formSubmitSelector: 'form', + formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])', + formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled', + formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled', + fileInputSelector: 'input[name][type=file]:not([disabled])', + linkDisableSelector: 'a[data-disable-with], a[data-disable]', + buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]' + }; + + }).call(this); + }).call(context); + + var Rails = context.Rails; + + (function() { + (function() { + var nonce; + + nonce = null; + + Rails.loadCSPNonce = function() { + var ref; + return nonce = (ref = document.querySelector("meta[name=csp-nonce]")) != null ? ref.content : void 0; + }; + + Rails.cspNonce = function() { + return nonce != null ? nonce : Rails.loadCSPNonce(); + }; + + }).call(this); + (function() { + var expando, m; + + m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector; + + Rails.matches = function(element, selector) { + if (selector.exclude != null) { + return m.call(element, selector.selector) && !m.call(element, selector.exclude); + } else { + return m.call(element, selector); + } + }; + + expando = '_ujsData'; + + Rails.getData = function(element, key) { + var ref; + return (ref = element[expando]) != null ? ref[key] : void 0; + }; + + Rails.setData = function(element, key, value) { + if (element[expando] == null) { + element[expando] = {}; + } + return element[expando][key] = value; + }; + + Rails.$ = function(selector) { + return Array.prototype.slice.call(document.querySelectorAll(selector)); + }; + + }).call(this); + (function() { + var $, csrfParam, csrfToken; + + $ = Rails.$; + + csrfToken = Rails.csrfToken = function() { + var meta; + meta = document.querySelector('meta[name=csrf-token]'); + return meta && meta.content; + }; + + csrfParam = Rails.csrfParam = function() { + var meta; + meta = document.querySelector('meta[name=csrf-param]'); + return meta && meta.content; + }; + + Rails.CSRFProtection = function(xhr) { + var token; + token = csrfToken(); + if (token != null) { + return xhr.setRequestHeader('X-CSRF-Token', token); + } + }; + + Rails.refreshCSRFTokens = function() { + var param, token; + token = csrfToken(); + param = csrfParam(); + if ((token != null) && (param != null)) { + return $('form input[name="' + param + '"]').forEach(function(input) { + return input.value = token; + }); + } + }; + + }).call(this); + (function() { + var CustomEvent, fire, matches, preventDefault; + + matches = Rails.matches; + + CustomEvent = window.CustomEvent; + + if (typeof CustomEvent !== 'function') { + CustomEvent = function(event, params) { + var evt; + evt = document.createEvent('CustomEvent'); + evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); + return evt; + }; + CustomEvent.prototype = window.Event.prototype; + preventDefault = CustomEvent.prototype.preventDefault; + CustomEvent.prototype.preventDefault = function() { + var result; + result = preventDefault.call(this); + if (this.cancelable && !this.defaultPrevented) { + Object.defineProperty(this, 'defaultPrevented', { + get: function() { + return true; + } + }); + } + return result; + }; + } + + fire = Rails.fire = function(obj, name, data) { + var event; + event = new CustomEvent(name, { + bubbles: true, + cancelable: true, + detail: data + }); + obj.dispatchEvent(event); + return !event.defaultPrevented; + }; + + Rails.stopEverything = function(e) { + fire(e.target, 'ujs:everythingStopped'); + e.preventDefault(); + e.stopPropagation(); + return e.stopImmediatePropagation(); + }; + + Rails.delegate = function(element, selector, eventType, handler) { + return element.addEventListener(eventType, function(e) { + var target; + target = e.target; + while (!(!(target instanceof Element) || matches(target, selector))) { + target = target.parentNode; + } + if (target instanceof Element && handler.call(target, e) === false) { + e.preventDefault(); + return e.stopPropagation(); + } + }); + }; + + }).call(this); + (function() { + var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse; + + cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire; + + AcceptHeaders = { + '*': '*/*', + text: 'text/plain', + html: 'text/html', + xml: 'application/xml, text/xml', + json: 'application/json, text/javascript', + script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript' + }; + + Rails.ajax = function(options) { + var xhr; + options = prepareOptions(options); + xhr = createXHR(options, function() { + var ref, response; + response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type')); + if (Math.floor(xhr.status / 100) === 2) { + if (typeof options.success === "function") { + options.success(response, xhr.statusText, xhr); + } + } else { + if (typeof options.error === "function") { + options.error(response, xhr.statusText, xhr); + } + } + return typeof options.complete === "function" ? options.complete(xhr, xhr.statusText) : void 0; + }); + if ((options.beforeSend != null) && !options.beforeSend(xhr, options)) { + return false; + } + if (xhr.readyState === XMLHttpRequest.OPENED) { + return xhr.send(options.data); + } + }; + + prepareOptions = function(options) { + options.url = options.url || location.href; + options.type = options.type.toUpperCase(); + if (options.type === 'GET' && options.data) { + if (options.url.indexOf('?') < 0) { + options.url += '?' + options.data; + } else { + options.url += '&' + options.data; + } + } + if (AcceptHeaders[options.dataType] == null) { + options.dataType = '*'; + } + options.accept = AcceptHeaders[options.dataType]; + if (options.dataType !== '*') { + options.accept += ', */*; q=0.01'; + } + return options; + }; + + createXHR = function(options, done) { + var xhr; + xhr = new XMLHttpRequest(); + xhr.open(options.type, options.url, true); + xhr.setRequestHeader('Accept', options.accept); + if (typeof options.data === 'string') { + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); + } + if (!options.crossDomain) { + xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + } + CSRFProtection(xhr); + xhr.withCredentials = !!options.withCredentials; + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE) { + return done(xhr); + } + }; + return xhr; + }; + + processResponse = function(response, type) { + var parser, script; + if (typeof response === 'string' && typeof type === 'string') { + if (type.match(/\bjson\b/)) { + try { + response = JSON.parse(response); + } catch (error) {} + } else if (type.match(/\b(?:java|ecma)script\b/)) { + script = document.createElement('script'); + script.setAttribute('nonce', cspNonce()); + script.text = response; + document.head.appendChild(script).parentNode.removeChild(script); + } else if (type.match(/\b(xml|html|svg)\b/)) { + parser = new DOMParser(); + type = type.replace(/;.+/, ''); + try { + response = parser.parseFromString(response, type); + } catch (error) {} + } + } + return response; + }; + + Rails.href = function(element) { + return element.href; + }; + + Rails.isCrossDomain = function(url) { + var e, originAnchor, urlAnchor; + originAnchor = document.createElement('a'); + originAnchor.href = location.href; + urlAnchor = document.createElement('a'); + try { + urlAnchor.href = url; + return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || (originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host)); + } catch (error) { + e = error; + return true; + } + }; + + }).call(this); + (function() { + var matches, toArray; + + matches = Rails.matches; + + toArray = function(e) { + return Array.prototype.slice.call(e); + }; + + Rails.serializeElement = function(element, additionalParam) { + var inputs, params; + inputs = [element]; + if (matches(element, 'form')) { + inputs = toArray(element.elements); + } + params = []; + inputs.forEach(function(input) { + if (!input.name || input.disabled) { + return; + } + if (matches(input, 'select')) { + return toArray(input.options).forEach(function(option) { + if (option.selected) { + return params.push({ + name: input.name, + value: option.value + }); + } + }); + } else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) { + return params.push({ + name: input.name, + value: input.value + }); + } + }); + if (additionalParam) { + params.push(additionalParam); + } + return params.map(function(param) { + if (param.name != null) { + return (encodeURIComponent(param.name)) + "=" + (encodeURIComponent(param.value)); + } else { + return param; + } + }).join('&'); + }; + + Rails.formElements = function(form, selector) { + if (matches(form, 'form')) { + return toArray(form.elements).filter(function(el) { + return matches(el, selector); + }); + } else { + return toArray(form.querySelectorAll(selector)); + } + }; + + }).call(this); + (function() { + var allowAction, fire, stopEverything; + + fire = Rails.fire, stopEverything = Rails.stopEverything; + + Rails.handleConfirm = function(e) { + if (!allowAction(this)) { + return stopEverything(e); + } + }; + + allowAction = function(element) { + var answer, callback, message; + message = element.getAttribute('data-confirm'); + if (!message) { + return true; + } + answer = false; + if (fire(element, 'confirm')) { + try { + answer = confirm(message); + } catch (error) {} + callback = fire(element, 'confirm:complete', [answer]); + } + return answer && callback; + }; + + }).call(this); + (function() { + var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, matches, setData, stopEverything; + + matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements; + + Rails.handleDisabledElement = function(e) { + var element; + element = this; + if (element.disabled) { + return stopEverything(e); + } + }; + + Rails.enableElement = function(e) { + var element; + element = e instanceof Event ? e.target : e; + if (matches(element, Rails.linkDisableSelector)) { + return enableLinkElement(element); + } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) { + return enableFormElement(element); + } else if (matches(element, Rails.formSubmitSelector)) { + return enableFormElements(element); + } + }; + + Rails.disableElement = function(e) { + var element; + element = e instanceof Event ? e.target : e; + if (matches(element, Rails.linkDisableSelector)) { + return disableLinkElement(element); + } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) { + return disableFormElement(element); + } else if (matches(element, Rails.formSubmitSelector)) { + return disableFormElements(element); + } + }; + + disableLinkElement = function(element) { + var replacement; + replacement = element.getAttribute('data-disable-with'); + if (replacement != null) { + setData(element, 'ujs:enable-with', element.innerHTML); + element.innerHTML = replacement; + } + element.addEventListener('click', stopEverything); + return setData(element, 'ujs:disabled', true); + }; + + enableLinkElement = function(element) { + var originalText; + originalText = getData(element, 'ujs:enable-with'); + if (originalText != null) { + element.innerHTML = originalText; + setData(element, 'ujs:enable-with', null); + } + element.removeEventListener('click', stopEverything); + return setData(element, 'ujs:disabled', null); + }; + + disableFormElements = function(form) { + return formElements(form, Rails.formDisableSelector).forEach(disableFormElement); + }; + + disableFormElement = function(element) { + var replacement; + replacement = element.getAttribute('data-disable-with'); + if (replacement != null) { + if (matches(element, 'button')) { + setData(element, 'ujs:enable-with', element.innerHTML); + element.innerHTML = replacement; + } else { + setData(element, 'ujs:enable-with', element.value); + element.value = replacement; + } + } + element.disabled = true; + return setData(element, 'ujs:disabled', true); + }; + + enableFormElements = function(form) { + return formElements(form, Rails.formEnableSelector).forEach(enableFormElement); + }; + + enableFormElement = function(element) { + var originalText; + originalText = getData(element, 'ujs:enable-with'); + if (originalText != null) { + if (matches(element, 'button')) { + element.innerHTML = originalText; + } else { + element.value = originalText; + } + setData(element, 'ujs:enable-with', null); + } + element.disabled = false; + return setData(element, 'ujs:disabled', null); + }; + + }).call(this); + (function() { + var stopEverything; + + stopEverything = Rails.stopEverything; + + Rails.handleMethod = function(e) { + var csrfParam, csrfToken, form, formContent, href, link, method; + link = this; + method = link.getAttribute('data-method'); + if (!method) { + return; + } + href = Rails.href(link); + csrfToken = Rails.csrfToken(); + csrfParam = Rails.csrfParam(); + form = document.createElement('form'); + formContent = ""; + if ((csrfParam != null) && (csrfToken != null) && !Rails.isCrossDomain(href)) { + formContent += ""; + } + formContent += ''; + form.method = 'post'; + form.action = href; + form.target = link.target; + form.innerHTML = formContent; + form.style.display = 'none'; + document.body.appendChild(form); + form.querySelector('[type="submit"]').click(); + return stopEverything(e); + }; + + }).call(this); + (function() { + var ajax, fire, getData, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything, + slice = [].slice; + + matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement; + + isRemote = function(element) { + var value; + value = element.getAttribute('data-remote'); + return (value != null) && value !== 'false'; + }; + + Rails.handleRemote = function(e) { + var button, data, dataType, element, method, url, withCredentials; + element = this; + if (!isRemote(element)) { + return true; + } + if (!fire(element, 'ajax:before')) { + fire(element, 'ajax:stopped'); + return false; + } + withCredentials = element.getAttribute('data-with-credentials'); + dataType = element.getAttribute('data-type') || 'script'; + if (matches(element, Rails.formSubmitSelector)) { + button = getData(element, 'ujs:submit-button'); + method = getData(element, 'ujs:submit-button-formmethod') || element.method; + url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href; + if (method.toUpperCase() === 'GET') { + url = url.replace(/\?.*$/, ''); + } + if (element.enctype === 'multipart/form-data') { + data = new FormData(element); + if (button != null) { + data.append(button.name, button.value); + } + } else { + data = serializeElement(element, button); + } + setData(element, 'ujs:submit-button', null); + setData(element, 'ujs:submit-button-formmethod', null); + setData(element, 'ujs:submit-button-formaction', null); + } else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) { + method = element.getAttribute('data-method'); + url = element.getAttribute('data-url'); + data = serializeElement(element, element.getAttribute('data-params')); + } else { + method = element.getAttribute('data-method'); + url = Rails.href(element); + data = element.getAttribute('data-params'); + } + ajax({ + type: method || 'GET', + url: url, + data: data, + dataType: dataType, + beforeSend: function(xhr, options) { + if (fire(element, 'ajax:beforeSend', [xhr, options])) { + return fire(element, 'ajax:send', [xhr]); + } else { + fire(element, 'ajax:stopped'); + return false; + } + }, + success: function() { + var args; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; + return fire(element, 'ajax:success', args); + }, + error: function() { + var args; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; + return fire(element, 'ajax:error', args); + }, + complete: function() { + var args; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; + return fire(element, 'ajax:complete', args); + }, + crossDomain: isCrossDomain(url), + withCredentials: (withCredentials != null) && withCredentials !== 'false' + }); + return stopEverything(e); + }; + + Rails.formSubmitButtonClick = function(e) { + var button, form; + button = this; + form = button.form; + if (!form) { + return; + } + if (button.name) { + setData(form, 'ujs:submit-button', { + name: button.name, + value: button.value + }); + } + setData(form, 'ujs:formnovalidate-button', button.formNoValidate); + setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction')); + return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod')); + }; + + Rails.preventInsignificantClick = function(e) { + var data, insignificantMetaClick, link, metaClick, method, primaryMouseKey; + link = this; + method = (link.getAttribute('data-method') || 'GET').toUpperCase(); + data = link.getAttribute('data-params'); + metaClick = e.metaKey || e.ctrlKey; + insignificantMetaClick = metaClick && method === 'GET' && !data; + primaryMouseKey = e.button === 0; + if (!primaryMouseKey || insignificantMetaClick) { + return e.stopImmediatePropagation(); + } + }; + + }).call(this); + (function() { + var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens; + + fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod; + + if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null)) { + if (jQuery.rails) { + throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.'); + } + jQuery.rails = Rails; + jQuery.ajaxPrefilter(function(options, originalOptions, xhr) { + if (!options.crossDomain) { + return CSRFProtection(xhr); + } + }); + } + + Rails.start = function() { + if (window._rails_loaded) { + throw new Error('rails-ujs has already been loaded!'); + } + window.addEventListener('pageshow', function() { + $(Rails.formEnableSelector).forEach(function(el) { + if (getData(el, 'ujs:disabled')) { + return enableElement(el); + } + }); + return $(Rails.linkDisableSelector).forEach(function(el) { + if (getData(el, 'ujs:disabled')) { + return enableElement(el); + } + }); + }); + delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement); + delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement); + delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement); + delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement); + delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick); + delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement); + delegate(document, Rails.linkClickSelector, 'click', handleConfirm); + delegate(document, Rails.linkClickSelector, 'click', disableElement); + delegate(document, Rails.linkClickSelector, 'click', handleRemote); + delegate(document, Rails.linkClickSelector, 'click', handleMethod); + delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick); + delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement); + delegate(document, Rails.buttonClickSelector, 'click', handleConfirm); + delegate(document, Rails.buttonClickSelector, 'click', disableElement); + delegate(document, Rails.buttonClickSelector, 'click', handleRemote); + delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement); + delegate(document, Rails.inputChangeSelector, 'change', handleConfirm); + delegate(document, Rails.inputChangeSelector, 'change', handleRemote); + delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement); + delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm); + delegate(document, Rails.formSubmitSelector, 'submit', handleRemote); + delegate(document, Rails.formSubmitSelector, 'submit', function(e) { + return setTimeout((function() { + return disableElement(e); + }), 13); + }); + delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement); + delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement); + delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick); + delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement); + delegate(document, Rails.formInputClickSelector, 'click', handleConfirm); + delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick); + document.addEventListener('DOMContentLoaded', refreshCSRFTokens); + document.addEventListener('DOMContentLoaded', loadCSPNonce); + return window._rails_loaded = true; + }; + + if (window.Rails === Rails && fire(document, 'rails:attachBindings')) { + Rails.start(); + } + + }).call(this); + }).call(this); + + if (typeof module === "object" && module.exports) { + module.exports = Rails; + } else if (typeof define === "function" && define.amd) { + define(Rails); + } +}).call(this); +(function(global, factory) { + typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define([ "exports" ], factory) : factory(global.ActiveStorage = {}); +})(this, function(exports) { + "use strict"; + function createCommonjsModule(fn, module) { + return module = { + exports: {} + }, fn(module, module.exports), module.exports; + } + var sparkMd5 = createCommonjsModule(function(module, exports) { + (function(factory) { + { + module.exports = factory(); + } + })(function(undefined) { + var hex_chr = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" ]; + function md5cycle(x, k) { + var a = x[0], b = x[1], c = x[2], d = x[3]; + a += (b & c | ~b & d) + k[0] - 680876936 | 0; + a = (a << 7 | a >>> 25) + b | 0; + d += (a & b | ~a & c) + k[1] - 389564586 | 0; + d = (d << 12 | d >>> 20) + a | 0; + c += (d & a | ~d & b) + k[2] + 606105819 | 0; + c = (c << 17 | c >>> 15) + d | 0; + b += (c & d | ~c & a) + k[3] - 1044525330 | 0; + b = (b << 22 | b >>> 10) + c | 0; + a += (b & c | ~b & d) + k[4] - 176418897 | 0; + a = (a << 7 | a >>> 25) + b | 0; + d += (a & b | ~a & c) + k[5] + 1200080426 | 0; + d = (d << 12 | d >>> 20) + a | 0; + c += (d & a | ~d & b) + k[6] - 1473231341 | 0; + c = (c << 17 | c >>> 15) + d | 0; + b += (c & d | ~c & a) + k[7] - 45705983 | 0; + b = (b << 22 | b >>> 10) + c | 0; + a += (b & c | ~b & d) + k[8] + 1770035416 | 0; + a = (a << 7 | a >>> 25) + b | 0; + d += (a & b | ~a & c) + k[9] - 1958414417 | 0; + d = (d << 12 | d >>> 20) + a | 0; + c += (d & a | ~d & b) + k[10] - 42063 | 0; + c = (c << 17 | c >>> 15) + d | 0; + b += (c & d | ~c & a) + k[11] - 1990404162 | 0; + b = (b << 22 | b >>> 10) + c | 0; + a += (b & c | ~b & d) + k[12] + 1804603682 | 0; + a = (a << 7 | a >>> 25) + b | 0; + d += (a & b | ~a & c) + k[13] - 40341101 | 0; + d = (d << 12 | d >>> 20) + a | 0; + c += (d & a | ~d & b) + k[14] - 1502002290 | 0; + c = (c << 17 | c >>> 15) + d | 0; + b += (c & d | ~c & a) + k[15] + 1236535329 | 0; + b = (b << 22 | b >>> 10) + c | 0; + a += (b & d | c & ~d) + k[1] - 165796510 | 0; + a = (a << 5 | a >>> 27) + b | 0; + d += (a & c | b & ~c) + k[6] - 1069501632 | 0; + d = (d << 9 | d >>> 23) + a | 0; + c += (d & b | a & ~b) + k[11] + 643717713 | 0; + c = (c << 14 | c >>> 18) + d | 0; + b += (c & a | d & ~a) + k[0] - 373897302 | 0; + b = (b << 20 | b >>> 12) + c | 0; + a += (b & d | c & ~d) + k[5] - 701558691 | 0; + a = (a << 5 | a >>> 27) + b | 0; + d += (a & c | b & ~c) + k[10] + 38016083 | 0; + d = (d << 9 | d >>> 23) + a | 0; + c += (d & b | a & ~b) + k[15] - 660478335 | 0; + c = (c << 14 | c >>> 18) + d | 0; + b += (c & a | d & ~a) + k[4] - 405537848 | 0; + b = (b << 20 | b >>> 12) + c | 0; + a += (b & d | c & ~d) + k[9] + 568446438 | 0; + a = (a << 5 | a >>> 27) + b | 0; + d += (a & c | b & ~c) + k[14] - 1019803690 | 0; + d = (d << 9 | d >>> 23) + a | 0; + c += (d & b | a & ~b) + k[3] - 187363961 | 0; + c = (c << 14 | c >>> 18) + d | 0; + b += (c & a | d & ~a) + k[8] + 1163531501 | 0; + b = (b << 20 | b >>> 12) + c | 0; + a += (b & d | c & ~d) + k[13] - 1444681467 | 0; + a = (a << 5 | a >>> 27) + b | 0; + d += (a & c | b & ~c) + k[2] - 51403784 | 0; + d = (d << 9 | d >>> 23) + a | 0; + c += (d & b | a & ~b) + k[7] + 1735328473 | 0; + c = (c << 14 | c >>> 18) + d | 0; + b += (c & a | d & ~a) + k[12] - 1926607734 | 0; + b = (b << 20 | b >>> 12) + c | 0; + a += (b ^ c ^ d) + k[5] - 378558 | 0; + a = (a << 4 | a >>> 28) + b | 0; + d += (a ^ b ^ c) + k[8] - 2022574463 | 0; + d = (d << 11 | d >>> 21) + a | 0; + c += (d ^ a ^ b) + k[11] + 1839030562 | 0; + c = (c << 16 | c >>> 16) + d | 0; + b += (c ^ d ^ a) + k[14] - 35309556 | 0; + b = (b << 23 | b >>> 9) + c | 0; + a += (b ^ c ^ d) + k[1] - 1530992060 | 0; + a = (a << 4 | a >>> 28) + b | 0; + d += (a ^ b ^ c) + k[4] + 1272893353 | 0; + d = (d << 11 | d >>> 21) + a | 0; + c += (d ^ a ^ b) + k[7] - 155497632 | 0; + c = (c << 16 | c >>> 16) + d | 0; + b += (c ^ d ^ a) + k[10] - 1094730640 | 0; + b = (b << 23 | b >>> 9) + c | 0; + a += (b ^ c ^ d) + k[13] + 681279174 | 0; + a = (a << 4 | a >>> 28) + b | 0; + d += (a ^ b ^ c) + k[0] - 358537222 | 0; + d = (d << 11 | d >>> 21) + a | 0; + c += (d ^ a ^ b) + k[3] - 722521979 | 0; + c = (c << 16 | c >>> 16) + d | 0; + b += (c ^ d ^ a) + k[6] + 76029189 | 0; + b = (b << 23 | b >>> 9) + c | 0; + a += (b ^ c ^ d) + k[9] - 640364487 | 0; + a = (a << 4 | a >>> 28) + b | 0; + d += (a ^ b ^ c) + k[12] - 421815835 | 0; + d = (d << 11 | d >>> 21) + a | 0; + c += (d ^ a ^ b) + k[15] + 530742520 | 0; + c = (c << 16 | c >>> 16) + d | 0; + b += (c ^ d ^ a) + k[2] - 995338651 | 0; + b = (b << 23 | b >>> 9) + c | 0; + a += (c ^ (b | ~d)) + k[0] - 198630844 | 0; + a = (a << 6 | a >>> 26) + b | 0; + d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0; + d = (d << 10 | d >>> 22) + a | 0; + c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0; + c = (c << 15 | c >>> 17) + d | 0; + b += (d ^ (c | ~a)) + k[5] - 57434055 | 0; + b = (b << 21 | b >>> 11) + c | 0; + a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0; + a = (a << 6 | a >>> 26) + b | 0; + d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0; + d = (d << 10 | d >>> 22) + a | 0; + c += (a ^ (d | ~b)) + k[10] - 1051523 | 0; + c = (c << 15 | c >>> 17) + d | 0; + b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0; + b = (b << 21 | b >>> 11) + c | 0; + a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0; + a = (a << 6 | a >>> 26) + b | 0; + d += (b ^ (a | ~c)) + k[15] - 30611744 | 0; + d = (d << 10 | d >>> 22) + a | 0; + c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0; + c = (c << 15 | c >>> 17) + d | 0; + b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0; + b = (b << 21 | b >>> 11) + c | 0; + a += (c ^ (b | ~d)) + k[4] - 145523070 | 0; + a = (a << 6 | a >>> 26) + b | 0; + d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0; + d = (d << 10 | d >>> 22) + a | 0; + c += (a ^ (d | ~b)) + k[2] + 718787259 | 0; + c = (c << 15 | c >>> 17) + d | 0; + b += (d ^ (c | ~a)) + k[9] - 343485551 | 0; + b = (b << 21 | b >>> 11) + c | 0; + x[0] = a + x[0] | 0; + x[1] = b + x[1] | 0; + x[2] = c + x[2] | 0; + x[3] = d + x[3] | 0; + } + function md5blk(s) { + var md5blks = [], i; + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); + } + return md5blks; + } + function md5blk_array(a) { + var md5blks = [], i; + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24); + } + return md5blks; + } + function md51(s) { + var n = s.length, state = [ 1732584193, -271733879, -1732584194, 271733878 ], i, length, tail, tmp, lo, hi; + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk(s.substring(i - 64, i))); + } + s = s.substring(i - 64); + length = s.length; + tail = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3); + } + tail[i >> 2] |= 128 << (i % 4 << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + tail[14] = lo; + tail[15] = hi; + md5cycle(state, tail); + return state; + } + function md51_array(a) { + var n = a.length, state = [ 1732584193, -271733879, -1732584194, 271733878 ], i, length, tail, tmp, lo, hi; + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk_array(a.subarray(i - 64, i))); + } + a = i - 64 < n ? a.subarray(i - 64) : new Uint8Array(0); + length = a.length; + tail = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= a[i] << (i % 4 << 3); + } + tail[i >> 2] |= 128 << (i % 4 << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + tail[14] = lo; + tail[15] = hi; + md5cycle(state, tail); + return state; + } + function rhex(n) { + var s = "", j; + for (j = 0; j < 4; j += 1) { + s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15]; + } + return s; + } + function hex(x) { + var i; + for (i = 0; i < x.length; i += 1) { + x[i] = rhex(x[i]); + } + return x.join(""); + } + if (hex(md51("hello")) !== "5d41402abc4b2a76b9719d911017c592") ; + if (typeof ArrayBuffer !== "undefined" && !ArrayBuffer.prototype.slice) { + (function() { + function clamp(val, length) { + val = val | 0 || 0; + if (val < 0) { + return Math.max(val + length, 0); + } + return Math.min(val, length); + } + ArrayBuffer.prototype.slice = function(from, to) { + var length = this.byteLength, begin = clamp(from, length), end = length, num, target, targetArray, sourceArray; + if (to !== undefined) { + end = clamp(to, length); + } + if (begin > end) { + return new ArrayBuffer(0); + } + num = end - begin; + target = new ArrayBuffer(num); + targetArray = new Uint8Array(target); + sourceArray = new Uint8Array(this, begin, num); + targetArray.set(sourceArray); + return target; + }; + })(); + } + function toUtf8(str) { + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + return str; + } + function utf8Str2ArrayBuffer(str, returnUInt8Array) { + var length = str.length, buff = new ArrayBuffer(length), arr = new Uint8Array(buff), i; + for (i = 0; i < length; i += 1) { + arr[i] = str.charCodeAt(i); + } + return returnUInt8Array ? arr : buff; + } + function arrayBuffer2Utf8Str(buff) { + return String.fromCharCode.apply(null, new Uint8Array(buff)); + } + function concatenateArrayBuffers(first, second, returnUInt8Array) { + var result = new Uint8Array(first.byteLength + second.byteLength); + result.set(new Uint8Array(first)); + result.set(new Uint8Array(second), first.byteLength); + return returnUInt8Array ? result : result.buffer; + } + function hexToBinaryString(hex) { + var bytes = [], length = hex.length, x; + for (x = 0; x < length - 1; x += 2) { + bytes.push(parseInt(hex.substr(x, 2), 16)); + } + return String.fromCharCode.apply(String, bytes); + } + function SparkMD5() { + this.reset(); + } + SparkMD5.prototype.append = function(str) { + this.appendBinary(toUtf8(str)); + return this; + }; + SparkMD5.prototype.appendBinary = function(contents) { + this._buff += contents; + this._length += contents.length; + var length = this._buff.length, i; + for (i = 64; i <= length; i += 64) { + md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i))); + } + this._buff = this._buff.substring(i - 64); + return this; + }; + SparkMD5.prototype.end = function(raw) { + var buff = this._buff, length = buff.length, i, tail = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], ret; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff.charCodeAt(i) << (i % 4 << 3); + } + this._finish(tail, length); + ret = hex(this._hash); + if (raw) { + ret = hexToBinaryString(ret); + } + this.reset(); + return ret; + }; + SparkMD5.prototype.reset = function() { + this._buff = ""; + this._length = 0; + this._hash = [ 1732584193, -271733879, -1732584194, 271733878 ]; + return this; + }; + SparkMD5.prototype.getState = function() { + return { + buff: this._buff, + length: this._length, + hash: this._hash + }; + }; + SparkMD5.prototype.setState = function(state) { + this._buff = state.buff; + this._length = state.length; + this._hash = state.hash; + return this; + }; + SparkMD5.prototype.destroy = function() { + delete this._hash; + delete this._buff; + delete this._length; + }; + SparkMD5.prototype._finish = function(tail, length) { + var i = length, tmp, lo, hi; + tail[i >> 2] |= 128 << (i % 4 << 3); + if (i > 55) { + md5cycle(this._hash, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + tmp = this._length * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + tail[14] = lo; + tail[15] = hi; + md5cycle(this._hash, tail); + }; + SparkMD5.hash = function(str, raw) { + return SparkMD5.hashBinary(toUtf8(str), raw); + }; + SparkMD5.hashBinary = function(content, raw) { + var hash = md51(content), ret = hex(hash); + return raw ? hexToBinaryString(ret) : ret; + }; + SparkMD5.ArrayBuffer = function() { + this.reset(); + }; + SparkMD5.ArrayBuffer.prototype.append = function(arr) { + var buff = concatenateArrayBuffers(this._buff.buffer, arr, true), length = buff.length, i; + this._length += arr.byteLength; + for (i = 64; i <= length; i += 64) { + md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i))); + } + this._buff = i - 64 < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0); + return this; + }; + SparkMD5.ArrayBuffer.prototype.end = function(raw) { + var buff = this._buff, length = buff.length, tail = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], i, ret; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff[i] << (i % 4 << 3); + } + this._finish(tail, length); + ret = hex(this._hash); + if (raw) { + ret = hexToBinaryString(ret); + } + this.reset(); + return ret; + }; + SparkMD5.ArrayBuffer.prototype.reset = function() { + this._buff = new Uint8Array(0); + this._length = 0; + this._hash = [ 1732584193, -271733879, -1732584194, 271733878 ]; + return this; + }; + SparkMD5.ArrayBuffer.prototype.getState = function() { + var state = SparkMD5.prototype.getState.call(this); + state.buff = arrayBuffer2Utf8Str(state.buff); + return state; + }; + SparkMD5.ArrayBuffer.prototype.setState = function(state) { + state.buff = utf8Str2ArrayBuffer(state.buff, true); + return SparkMD5.prototype.setState.call(this, state); + }; + SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy; + SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish; + SparkMD5.ArrayBuffer.hash = function(arr, raw) { + var hash = md51_array(new Uint8Array(arr)), ret = hex(hash); + return raw ? hexToBinaryString(ret) : ret; + }; + return SparkMD5; + }); + }); + var classCallCheck = function(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; + var createClass = function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + }(); + var fileSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice; + var FileChecksum = function() { + createClass(FileChecksum, null, [ { + key: "create", + value: function create(file, callback) { + var instance = new FileChecksum(file); + instance.create(callback); + } + } ]); + function FileChecksum(file) { + classCallCheck(this, FileChecksum); + this.file = file; + this.chunkSize = 2097152; + this.chunkCount = Math.ceil(this.file.size / this.chunkSize); + this.chunkIndex = 0; + } + createClass(FileChecksum, [ { + key: "create", + value: function create(callback) { + var _this = this; + this.callback = callback; + this.md5Buffer = new sparkMd5.ArrayBuffer(); + this.fileReader = new FileReader(); + this.fileReader.addEventListener("load", function(event) { + return _this.fileReaderDidLoad(event); + }); + this.fileReader.addEventListener("error", function(event) { + return _this.fileReaderDidError(event); + }); + this.readNextChunk(); + } + }, { + key: "fileReaderDidLoad", + value: function fileReaderDidLoad(event) { + this.md5Buffer.append(event.target.result); + if (!this.readNextChunk()) { + var binaryDigest = this.md5Buffer.end(true); + var base64digest = btoa(binaryDigest); + this.callback(null, base64digest); + } + } + }, { + key: "fileReaderDidError", + value: function fileReaderDidError(event) { + this.callback("Error reading " + this.file.name); + } + }, { + key: "readNextChunk", + value: function readNextChunk() { + if (this.chunkIndex < this.chunkCount || this.chunkIndex == 0 && this.chunkCount == 0) { + var start = this.chunkIndex * this.chunkSize; + var end = Math.min(start + this.chunkSize, this.file.size); + var bytes = fileSlice.call(this.file, start, end); + this.fileReader.readAsArrayBuffer(bytes); + this.chunkIndex++; + return true; + } else { + return false; + } + } + } ]); + return FileChecksum; + }(); + function getMetaValue(name) { + var element = findElement(document.head, 'meta[name="' + name + '"]'); + if (element) { + return element.getAttribute("content"); + } + } + function findElements(root, selector) { + if (typeof root == "string") { + selector = root; + root = document; + } + var elements = root.querySelectorAll(selector); + return toArray$1(elements); + } + function findElement(root, selector) { + if (typeof root == "string") { + selector = root; + root = document; + } + return root.querySelector(selector); + } + function dispatchEvent(element, type) { + var eventInit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var disabled = element.disabled; + var bubbles = eventInit.bubbles, cancelable = eventInit.cancelable, detail = eventInit.detail; + var event = document.createEvent("Event"); + event.initEvent(type, bubbles || true, cancelable || true); + event.detail = detail || {}; + try { + element.disabled = false; + element.dispatchEvent(event); + } finally { + element.disabled = disabled; + } + return event; + } + function toArray$1(value) { + if (Array.isArray(value)) { + return value; + } else if (Array.from) { + return Array.from(value); + } else { + return [].slice.call(value); + } + } + var BlobRecord = function() { + function BlobRecord(file, checksum, url) { + var _this = this; + classCallCheck(this, BlobRecord); + this.file = file; + this.attributes = { + filename: file.name, + content_type: file.type, + byte_size: file.size, + checksum: checksum + }; + this.xhr = new XMLHttpRequest(); + this.xhr.open("POST", url, true); + this.xhr.responseType = "json"; + this.xhr.setRequestHeader("Content-Type", "application/json"); + this.xhr.setRequestHeader("Accept", "application/json"); + this.xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); + this.xhr.setRequestHeader("X-CSRF-Token", getMetaValue("csrf-token")); + this.xhr.addEventListener("load", function(event) { + return _this.requestDidLoad(event); + }); + this.xhr.addEventListener("error", function(event) { + return _this.requestDidError(event); + }); + } + createClass(BlobRecord, [ { + key: "create", + value: function create(callback) { + this.callback = callback; + this.xhr.send(JSON.stringify({ + blob: this.attributes + })); + } + }, { + key: "requestDidLoad", + value: function requestDidLoad(event) { + if (this.status >= 200 && this.status < 300) { + var response = this.response; + var direct_upload = response.direct_upload; + delete response.direct_upload; + this.attributes = response; + this.directUploadData = direct_upload; + this.callback(null, this.toJSON()); + } else { + this.requestDidError(event); + } + } + }, { + key: "requestDidError", + value: function requestDidError(event) { + this.callback('Error creating Blob for "' + this.file.name + '". Status: ' + this.status); + } + }, { + key: "toJSON", + value: function toJSON() { + var result = {}; + for (var key in this.attributes) { + result[key] = this.attributes[key]; + } + return result; + } + }, { + key: "status", + get: function get$$1() { + return this.xhr.status; + } + }, { + key: "response", + get: function get$$1() { + var _xhr = this.xhr, responseType = _xhr.responseType, response = _xhr.response; + if (responseType == "json") { + return response; + } else { + return JSON.parse(response); + } + } + } ]); + return BlobRecord; + }(); + var BlobUpload = function() { + function BlobUpload(blob) { + var _this = this; + classCallCheck(this, BlobUpload); + this.blob = blob; + this.file = blob.file; + var _blob$directUploadDat = blob.directUploadData, url = _blob$directUploadDat.url, headers = _blob$directUploadDat.headers; + this.xhr = new XMLHttpRequest(); + this.xhr.open("PUT", url, true); + this.xhr.responseType = "text"; + for (var key in headers) { + this.xhr.setRequestHeader(key, headers[key]); + } + this.xhr.addEventListener("load", function(event) { + return _this.requestDidLoad(event); + }); + this.xhr.addEventListener("error", function(event) { + return _this.requestDidError(event); + }); + } + createClass(BlobUpload, [ { + key: "create", + value: function create(callback) { + this.callback = callback; + this.xhr.send(this.file.slice()); + } + }, { + key: "requestDidLoad", + value: function requestDidLoad(event) { + var _xhr = this.xhr, status = _xhr.status, response = _xhr.response; + if (status >= 200 && status < 300) { + this.callback(null, response); + } else { + this.requestDidError(event); + } + } + }, { + key: "requestDidError", + value: function requestDidError(event) { + this.callback('Error storing "' + this.file.name + '". Status: ' + this.xhr.status); + } + } ]); + return BlobUpload; + }(); + var id = 0; + var DirectUpload = function() { + function DirectUpload(file, url, delegate) { + classCallCheck(this, DirectUpload); + this.id = ++id; + this.file = file; + this.url = url; + this.delegate = delegate; + } + createClass(DirectUpload, [ { + key: "create", + value: function create(callback) { + var _this = this; + FileChecksum.create(this.file, function(error, checksum) { + if (error) { + callback(error); + return; + } + var blob = new BlobRecord(_this.file, checksum, _this.url); + notify(_this.delegate, "directUploadWillCreateBlobWithXHR", blob.xhr); + blob.create(function(error) { + if (error) { + callback(error); + } else { + var upload = new BlobUpload(blob); + notify(_this.delegate, "directUploadWillStoreFileWithXHR", upload.xhr); + upload.create(function(error) { + if (error) { + callback(error); + } else { + callback(null, blob.toJSON()); + } + }); + } + }); + }); + } + } ]); + return DirectUpload; + }(); + function notify(object, methodName) { + if (object && typeof object[methodName] == "function") { + for (var _len = arguments.length, messages = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + messages[_key - 2] = arguments[_key]; + } + return object[methodName].apply(object, messages); + } + } + var DirectUploadController = function() { + function DirectUploadController(input, file) { + classCallCheck(this, DirectUploadController); + this.input = input; + this.file = file; + this.directUpload = new DirectUpload(this.file, this.url, this); + this.dispatch("initialize"); + } + createClass(DirectUploadController, [ { + key: "start", + value: function start(callback) { + var _this = this; + var hiddenInput = document.createElement("input"); + hiddenInput.type = "hidden"; + hiddenInput.name = this.input.name; + this.input.insertAdjacentElement("beforebegin", hiddenInput); + this.dispatch("start"); + this.directUpload.create(function(error, attributes) { + if (error) { + hiddenInput.parentNode.removeChild(hiddenInput); + _this.dispatchError(error); + } else { + hiddenInput.value = attributes.signed_id; + } + _this.dispatch("end"); + callback(error); + }); + } + }, { + key: "uploadRequestDidProgress", + value: function uploadRequestDidProgress(event) { + var progress = event.loaded / event.total * 100; + if (progress) { + this.dispatch("progress", { + progress: progress + }); + } + } + }, { + key: "dispatch", + value: function dispatch(name) { + var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + detail.file = this.file; + detail.id = this.directUpload.id; + return dispatchEvent(this.input, "direct-upload:" + name, { + detail: detail + }); + } + }, { + key: "dispatchError", + value: function dispatchError(error) { + var event = this.dispatch("error", { + error: error + }); + if (!event.defaultPrevented) { + alert(error); + } + } + }, { + key: "directUploadWillCreateBlobWithXHR", + value: function directUploadWillCreateBlobWithXHR(xhr) { + this.dispatch("before-blob-request", { + xhr: xhr + }); + } + }, { + key: "directUploadWillStoreFileWithXHR", + value: function directUploadWillStoreFileWithXHR(xhr) { + var _this2 = this; + this.dispatch("before-storage-request", { + xhr: xhr + }); + xhr.upload.addEventListener("progress", function(event) { + return _this2.uploadRequestDidProgress(event); + }); + } + }, { + key: "url", + get: function get$$1() { + return this.input.getAttribute("data-direct-upload-url"); + } + } ]); + return DirectUploadController; + }(); + var inputSelector = "input[type=file][data-direct-upload-url]:not([disabled])"; + var DirectUploadsController = function() { + function DirectUploadsController(form) { + classCallCheck(this, DirectUploadsController); + this.form = form; + this.inputs = findElements(form, inputSelector).filter(function(input) { + return input.files.length; + }); + } + createClass(DirectUploadsController, [ { + key: "start", + value: function start(callback) { + var _this = this; + var controllers = this.createDirectUploadControllers(); + var startNextController = function startNextController() { + var controller = controllers.shift(); + if (controller) { + controller.start(function(error) { + if (error) { + callback(error); + _this.dispatch("end"); + } else { + startNextController(); + } + }); + } else { + callback(); + _this.dispatch("end"); + } + }; + this.dispatch("start"); + startNextController(); + } + }, { + key: "createDirectUploadControllers", + value: function createDirectUploadControllers() { + var controllers = []; + this.inputs.forEach(function(input) { + toArray$1(input.files).forEach(function(file) { + var controller = new DirectUploadController(input, file); + controllers.push(controller); + }); + }); + return controllers; + } + }, { + key: "dispatch", + value: function dispatch(name) { + var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + return dispatchEvent(this.form, "direct-uploads:" + name, { + detail: detail + }); + } + } ]); + return DirectUploadsController; + }(); + var processingAttribute = "data-direct-uploads-processing"; + var submitButtonsByForm = new WeakMap(); + var started = false; + function start() { + if (!started) { + started = true; + document.addEventListener("click", didClick, true); + document.addEventListener("submit", didSubmitForm); + document.addEventListener("ajax:before", didSubmitRemoteElement); + } + } + function didClick(event) { + var target = event.target; + if ((target.tagName == "INPUT" || target.tagName == "BUTTON") && target.type == "submit" && target.form) { + submitButtonsByForm.set(target.form, target); + } + } + function didSubmitForm(event) { + handleFormSubmissionEvent(event); + } + function didSubmitRemoteElement(event) { + if (event.target.tagName == "FORM") { + handleFormSubmissionEvent(event); + } + } + function handleFormSubmissionEvent(event) { + var form = event.target; + if (form.hasAttribute(processingAttribute)) { + event.preventDefault(); + return; + } + var controller = new DirectUploadsController(form); + var inputs = controller.inputs; + if (inputs.length) { + event.preventDefault(); + form.setAttribute(processingAttribute, ""); + inputs.forEach(disable); + controller.start(function(error) { + form.removeAttribute(processingAttribute); + if (error) { + inputs.forEach(enable); + } else { + submitForm(form); + } + }); + } + } + function submitForm(form) { + var button = submitButtonsByForm.get(form) || findElement(form, "input[type=submit], button[type=submit]"); + if (button) { + var _button = button, disabled = _button.disabled; + button.disabled = false; + button.focus(); + button.click(); + button.disabled = disabled; + } else { + button = document.createElement("input"); + button.type = "submit"; + button.style.display = "none"; + form.appendChild(button); + button.click(); + form.removeChild(button); + } + submitButtonsByForm.delete(form); + } + function disable(input) { + input.disabled = true; + } + function enable(input) { + input.disabled = false; + } + function autostart() { + if (window.ActiveStorage) { + start(); + } + } + setTimeout(autostart, 1); + exports.start = start; + exports.DirectUpload = DirectUpload; + Object.defineProperty(exports, "__esModule", { + value: true + }); +}); +/* +Turbolinks 5.2.0 +Copyright © 2018 Basecamp, LLC + */ + +(function(){var t=this;(function(){(function(){this.Turbolinks={supported:function(){return null!=window.history.pushState&&null!=window.requestAnimationFrame&&null!=window.addEventListener}(),visit:function(t,r){return e.controller.visit(t,r)},clearCache:function(){return e.controller.clearCache()},setProgressBarDelay:function(t){return e.controller.setProgressBarDelay(t)}}}).call(this)}).call(t);var e=t.Turbolinks;(function(){(function(){var t,r,n,o=[].slice;e.copyObject=function(t){var e,r,n;r={};for(e in t)n=t[e],r[e]=n;return r},e.closest=function(e,r){return t.call(e,r)},t=function(){var t,e;return t=document.documentElement,null!=(e=t.closest)?e:function(t){var e;for(e=this;e;){if(e.nodeType===Node.ELEMENT_NODE&&r.call(e,t))return e;e=e.parentNode}}}(),e.defer=function(t){return setTimeout(t,1)},e.throttle=function(t){var e;return e=null,function(){var r;return r=1<=arguments.length?o.call(arguments,0):[],null!=e?e:e=requestAnimationFrame(function(n){return function(){return e=null,t.apply(n,r)}}(this))}},e.dispatch=function(t,e){var r,o,i,s,a,u;return a=null!=e?e:{},u=a.target,r=a.cancelable,o=a.data,i=document.createEvent("Events"),i.initEvent(t,!0,r===!0),i.data=null!=o?o:{},i.cancelable&&!n&&(s=i.preventDefault,i.preventDefault=function(){return this.defaultPrevented||Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}}),s.call(this)}),(null!=u?u:document).dispatchEvent(i),i},n=function(){var t;return t=document.createEvent("Events"),t.initEvent("test",!0,!0),t.preventDefault(),t.defaultPrevented}(),e.match=function(t,e){return r.call(t,e)},r=function(){var t,e,r,n;return t=document.documentElement,null!=(e=null!=(r=null!=(n=t.matchesSelector)?n:t.webkitMatchesSelector)?r:t.msMatchesSelector)?e:t.mozMatchesSelector}(),e.uuid=function(){var t,e,r;for(r="",t=e=1;36>=e;t=++e)r+=9===t||14===t||19===t||24===t?"-":15===t?"4":20===t?(Math.floor(4*Math.random())+8).toString(16):Math.floor(15*Math.random()).toString(16);return r}}).call(this),function(){e.Location=function(){function t(t){var e,r;null==t&&(t=""),r=document.createElement("a"),r.href=t.toString(),this.absoluteURL=r.href,e=r.hash.length,2>e?this.requestURL=this.absoluteURL:(this.requestURL=this.absoluteURL.slice(0,-e),this.anchor=r.hash.slice(1))}var e,r,n,o;return t.wrap=function(t){return t instanceof this?t:new this(t)},t.prototype.getOrigin=function(){return this.absoluteURL.split("/",3).join("/")},t.prototype.getPath=function(){var t,e;return null!=(t=null!=(e=this.requestURL.match(/\/\/[^\/]*(\/[^?;]*)/))?e[1]:void 0)?t:"/"},t.prototype.getPathComponents=function(){return this.getPath().split("/").slice(1)},t.prototype.getLastPathComponent=function(){return this.getPathComponents().slice(-1)[0]},t.prototype.getExtension=function(){var t,e;return null!=(t=null!=(e=this.getLastPathComponent().match(/\.[^.]*$/))?e[0]:void 0)?t:""},t.prototype.isHTML=function(){return this.getExtension().match(/^(?:|\.(?:htm|html|xhtml))$/)},t.prototype.isPrefixedBy=function(t){var e;return e=r(t),this.isEqualTo(t)||o(this.absoluteURL,e)},t.prototype.isEqualTo=function(t){return this.absoluteURL===(null!=t?t.absoluteURL:void 0)},t.prototype.toCacheKey=function(){return this.requestURL},t.prototype.toJSON=function(){return this.absoluteURL},t.prototype.toString=function(){return this.absoluteURL},t.prototype.valueOf=function(){return this.absoluteURL},r=function(t){return e(t.getOrigin()+t.getPath())},e=function(t){return n(t,"/")?t:t+"/"},o=function(t,e){return t.slice(0,e.length)===e},n=function(t,e){return t.slice(-e.length)===e},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.HttpRequest=function(){function r(r,n,o){this.delegate=r,this.requestCanceled=t(this.requestCanceled,this),this.requestTimedOut=t(this.requestTimedOut,this),this.requestFailed=t(this.requestFailed,this),this.requestLoaded=t(this.requestLoaded,this),this.requestProgressed=t(this.requestProgressed,this),this.url=e.Location.wrap(n).requestURL,this.referrer=e.Location.wrap(o).absoluteURL,this.createXHR()}return r.NETWORK_FAILURE=0,r.TIMEOUT_FAILURE=-1,r.timeout=60,r.prototype.send=function(){var t;return this.xhr&&!this.sent?(this.notifyApplicationBeforeRequestStart(),this.setProgress(0),this.xhr.send(),this.sent=!0,"function"==typeof(t=this.delegate).requestStarted?t.requestStarted():void 0):void 0},r.prototype.cancel=function(){return this.xhr&&this.sent?this.xhr.abort():void 0},r.prototype.requestProgressed=function(t){return t.lengthComputable?this.setProgress(t.loaded/t.total):void 0},r.prototype.requestLoaded=function(){return this.endRequest(function(t){return function(){var e;return 200<=(e=t.xhr.status)&&300>e?t.delegate.requestCompletedWithResponse(t.xhr.responseText,t.xhr.getResponseHeader("Turbolinks-Location")):(t.failed=!0,t.delegate.requestFailedWithStatusCode(t.xhr.status,t.xhr.responseText))}}(this))},r.prototype.requestFailed=function(){return this.endRequest(function(t){return function(){return t.failed=!0,t.delegate.requestFailedWithStatusCode(t.constructor.NETWORK_FAILURE)}}(this))},r.prototype.requestTimedOut=function(){return this.endRequest(function(t){return function(){return t.failed=!0,t.delegate.requestFailedWithStatusCode(t.constructor.TIMEOUT_FAILURE)}}(this))},r.prototype.requestCanceled=function(){return this.endRequest()},r.prototype.notifyApplicationBeforeRequestStart=function(){return e.dispatch("turbolinks:request-start",{data:{url:this.url,xhr:this.xhr}})},r.prototype.notifyApplicationAfterRequestEnd=function(){return e.dispatch("turbolinks:request-end",{data:{url:this.url,xhr:this.xhr}})},r.prototype.createXHR=function(){return this.xhr=new XMLHttpRequest,this.xhr.open("GET",this.url,!0),this.xhr.timeout=1e3*this.constructor.timeout,this.xhr.setRequestHeader("Accept","text/html, application/xhtml+xml"),this.xhr.setRequestHeader("Turbolinks-Referrer",this.referrer),this.xhr.onprogress=this.requestProgressed,this.xhr.onload=this.requestLoaded,this.xhr.onerror=this.requestFailed,this.xhr.ontimeout=this.requestTimedOut,this.xhr.onabort=this.requestCanceled},r.prototype.endRequest=function(t){return this.xhr?(this.notifyApplicationAfterRequestEnd(),null!=t&&t.call(this),this.destroy()):void 0},r.prototype.setProgress=function(t){var e;return this.progress=t,"function"==typeof(e=this.delegate).requestProgressed?e.requestProgressed(this.progress):void 0},r.prototype.destroy=function(){var t;return this.setProgress(1),"function"==typeof(t=this.delegate).requestFinished&&t.requestFinished(),this.delegate=null,this.xhr=null},r}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.ProgressBar=function(){function e(){this.trickle=t(this.trickle,this),this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement()}var r;return r=300,e.defaultCSS=".turbolinks-progress-bar {\n position: fixed;\n display: block;\n top: 0;\n left: 0;\n height: 3px;\n background: #0076ff;\n z-index: 9999;\n transition: width "+r+"ms ease-out, opacity "+r/2+"ms "+r/2+"ms ease-in;\n transform: translate3d(0, 0, 0);\n}",e.prototype.show=function(){return this.visible?void 0:(this.visible=!0,this.installStylesheetElement(),this.installProgressElement(),this.startTrickling())},e.prototype.hide=function(){return this.visible&&!this.hiding?(this.hiding=!0,this.fadeProgressElement(function(t){return function(){return t.uninstallProgressElement(),t.stopTrickling(),t.visible=!1,t.hiding=!1}}(this))):void 0},e.prototype.setValue=function(t){return this.value=t,this.refresh()},e.prototype.installStylesheetElement=function(){return document.head.insertBefore(this.stylesheetElement,document.head.firstChild)},e.prototype.installProgressElement=function(){return this.progressElement.style.width=0,this.progressElement.style.opacity=1,document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()},e.prototype.fadeProgressElement=function(t){return this.progressElement.style.opacity=0,setTimeout(t,1.5*r)},e.prototype.uninstallProgressElement=function(){return this.progressElement.parentNode?document.documentElement.removeChild(this.progressElement):void 0},e.prototype.startTrickling=function(){return null!=this.trickleInterval?this.trickleInterval:this.trickleInterval=setInterval(this.trickle,r)},e.prototype.stopTrickling=function(){return clearInterval(this.trickleInterval),this.trickleInterval=null},e.prototype.trickle=function(){return this.setValue(this.value+Math.random()/100)},e.prototype.refresh=function(){return requestAnimationFrame(function(t){return function(){return t.progressElement.style.width=10+90*t.value+"%"}}(this))},e.prototype.createStylesheetElement=function(){var t;return t=document.createElement("style"),t.type="text/css",t.textContent=this.constructor.defaultCSS,t},e.prototype.createProgressElement=function(){var t;return t=document.createElement("div"),t.className="turbolinks-progress-bar",t},e}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.BrowserAdapter=function(){function r(r){this.controller=r,this.showProgressBar=t(this.showProgressBar,this),this.progressBar=new e.ProgressBar}var n,o,i;return i=e.HttpRequest,n=i.NETWORK_FAILURE,o=i.TIMEOUT_FAILURE,r.prototype.visitProposedToLocationWithAction=function(t,e){return this.controller.startVisitToLocationWithAction(t,e)},r.prototype.visitStarted=function(t){return t.issueRequest(),t.changeHistory(),t.loadCachedSnapshot()},r.prototype.visitRequestStarted=function(t){return this.progressBar.setValue(0),t.hasCachedSnapshot()||"restore"!==t.action?this.showProgressBarAfterDelay():this.showProgressBar()},r.prototype.visitRequestProgressed=function(t){return this.progressBar.setValue(t.progress)},r.prototype.visitRequestCompleted=function(t){return t.loadResponse()},r.prototype.visitRequestFailedWithStatusCode=function(t,e){switch(e){case n:case o:return this.reload();default:return t.loadResponse()}},r.prototype.visitRequestFinished=function(t){return this.hideProgressBar()},r.prototype.visitCompleted=function(t){return t.followRedirect()},r.prototype.pageInvalidated=function(){return this.reload()},r.prototype.showProgressBarAfterDelay=function(){return this.progressBarTimeout=setTimeout(this.showProgressBar,this.controller.progressBarDelay)},r.prototype.showProgressBar=function(){return this.progressBar.show()},r.prototype.hideProgressBar=function(){return this.progressBar.hide(),clearTimeout(this.progressBarTimeout)},r.prototype.reload=function(){return window.location.reload()},r}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.History=function(){function r(e){this.delegate=e,this.onPageLoad=t(this.onPageLoad,this),this.onPopState=t(this.onPopState,this)}return r.prototype.start=function(){return this.started?void 0:(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0)},r.prototype.stop=function(){return this.started?(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1):void 0},r.prototype.push=function(t,r){return t=e.Location.wrap(t),this.update("push",t,r)},r.prototype.replace=function(t,r){return t=e.Location.wrap(t),this.update("replace",t,r)},r.prototype.onPopState=function(t){var r,n,o,i;return this.shouldHandlePopState()&&(i=null!=(n=t.state)?n.turbolinks:void 0)?(r=e.Location.wrap(window.location),o=i.restorationIdentifier,this.delegate.historyPoppedToLocationWithRestorationIdentifier(r,o)):void 0},r.prototype.onPageLoad=function(t){return e.defer(function(t){return function(){return t.pageLoaded=!0}}(this))},r.prototype.shouldHandlePopState=function(){return this.pageIsLoaded()},r.prototype.pageIsLoaded=function(){return this.pageLoaded||"complete"===document.readyState},r.prototype.update=function(t,e,r){var n;return n={turbolinks:{restorationIdentifier:r}},history[t+"State"](n,null,e)},r}()}.call(this),function(){e.HeadDetails=function(){function t(t){var e,r,n,s,a,u;for(this.elements={},n=0,a=t.length;a>n;n++)u=t[n],u.nodeType===Node.ELEMENT_NODE&&(s=u.outerHTML,r=null!=(e=this.elements)[s]?e[s]:e[s]={type:i(u),tracked:o(u),elements:[]},r.elements.push(u))}var e,r,n,o,i;return t.fromHeadElement=function(t){var e;return new this(null!=(e=null!=t?t.childNodes:void 0)?e:[])},t.prototype.hasElementWithKey=function(t){return t in this.elements},t.prototype.getTrackedElementSignature=function(){var t,e;return function(){var r,n;r=this.elements,n=[];for(t in r)e=r[t].tracked,e&&n.push(t);return n}.call(this).join("")},t.prototype.getScriptElementsNotInDetails=function(t){return this.getElementsMatchingTypeNotInDetails("script",t)},t.prototype.getStylesheetElementsNotInDetails=function(t){return this.getElementsMatchingTypeNotInDetails("stylesheet",t)},t.prototype.getElementsMatchingTypeNotInDetails=function(t,e){var r,n,o,i,s,a;o=this.elements,s=[];for(n in o)i=o[n],a=i.type,r=i.elements,a!==t||e.hasElementWithKey(n)||s.push(r[0]);return s},t.prototype.getProvisionalElements=function(){var t,e,r,n,o,i,s;r=[],n=this.elements;for(e in n)o=n[e],s=o.type,i=o.tracked,t=o.elements,null!=s||i?t.length>1&&r.push.apply(r,t.slice(1)):r.push.apply(r,t);return r},t.prototype.getMetaValue=function(t){var e;return null!=(e=this.findMetaElementByName(t))?e.getAttribute("content"):void 0},t.prototype.findMetaElementByName=function(t){var r,n,o,i;r=void 0,i=this.elements;for(o in i)n=i[o].elements,e(n[0],t)&&(r=n[0]);return r},i=function(t){return r(t)?"script":n(t)?"stylesheet":void 0},o=function(t){return"reload"===t.getAttribute("data-turbolinks-track")},r=function(t){var e;return e=t.tagName.toLowerCase(),"script"===e},n=function(t){var e;return e=t.tagName.toLowerCase(),"style"===e||"link"===e&&"stylesheet"===t.getAttribute("rel")},e=function(t,e){var r;return r=t.tagName.toLowerCase(),"meta"===r&&t.getAttribute("name")===e},t}()}.call(this),function(){e.Snapshot=function(){function t(t,e){this.headDetails=t,this.bodyElement=e}return t.wrap=function(t){return t instanceof this?t:"string"==typeof t?this.fromHTMLString(t):this.fromHTMLElement(t)},t.fromHTMLString=function(t){var e;return e=document.createElement("html"),e.innerHTML=t,this.fromHTMLElement(e)},t.fromHTMLElement=function(t){var r,n,o,i;return o=t.querySelector("head"),r=null!=(i=t.querySelector("body"))?i:document.createElement("body"),n=e.HeadDetails.fromHeadElement(o),new this(n,r)},t.prototype.clone=function(){return new this.constructor(this.headDetails,this.bodyElement.cloneNode(!0))},t.prototype.getRootLocation=function(){var t,r;return r=null!=(t=this.getSetting("root"))?t:"/",new e.Location(r)},t.prototype.getCacheControlValue=function(){return this.getSetting("cache-control")},t.prototype.getElementForAnchor=function(t){try{return this.bodyElement.querySelector("[id='"+t+"'], a[name='"+t+"']")}catch(e){}},t.prototype.getPermanentElements=function(){return this.bodyElement.querySelectorAll("[id][data-turbolinks-permanent]")},t.prototype.getPermanentElementById=function(t){return this.bodyElement.querySelector("#"+t+"[data-turbolinks-permanent]")},t.prototype.getPermanentElementsPresentInSnapshot=function(t){var e,r,n,o,i;for(o=this.getPermanentElements(),i=[],r=0,n=o.length;n>r;r++)e=o[r],t.getPermanentElementById(e.id)&&i.push(e);return i},t.prototype.findFirstAutofocusableElement=function(){return this.bodyElement.querySelector("[autofocus]")},t.prototype.hasAnchor=function(t){return null!=this.getElementForAnchor(t)},t.prototype.isPreviewable=function(){return"no-preview"!==this.getCacheControlValue()},t.prototype.isCacheable=function(){return"no-cache"!==this.getCacheControlValue()},t.prototype.isVisitable=function(){return"reload"!==this.getSetting("visit-control")},t.prototype.getSetting=function(t){return this.headDetails.getMetaValue("turbolinks-"+t)},t}()}.call(this),function(){var t=[].slice;e.Renderer=function(){function e(){}var r;return e.render=function(){var e,r,n,o;return n=arguments[0],r=arguments[1],e=3<=arguments.length?t.call(arguments,2):[],o=function(t,e,r){r.prototype=t.prototype;var n=new r,o=t.apply(n,e);return Object(o)===o?o:n}(this,e,function(){}),o.delegate=n,o.render(r),o},e.prototype.renderView=function(t){return this.delegate.viewWillRender(this.newBody),t(),this.delegate.viewRendered(this.newBody)},e.prototype.invalidateView=function(){return this.delegate.viewInvalidated()},e.prototype.createScriptElement=function(t){var e;return"false"===t.getAttribute("data-turbolinks-eval")?t:(e=document.createElement("script"),e.textContent=t.textContent,e.async=!1,r(e,t),e)},r=function(t,e){var r,n,o,i,s,a,u;for(i=e.attributes,a=[],r=0,n=i.length;n>r;r++)s=i[r],o=s.name,u=s.value,a.push(t.setAttribute(o,u));return a},e}()}.call(this),function(){var t,r,n=function(t,e){function r(){this.constructor=t}for(var n in e)o.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},o={}.hasOwnProperty;e.SnapshotRenderer=function(e){function o(t,e,r){this.currentSnapshot=t,this.newSnapshot=e,this.isPreview=r,this.currentHeadDetails=this.currentSnapshot.headDetails,this.newHeadDetails=this.newSnapshot.headDetails,this.currentBody=this.currentSnapshot.bodyElement,this.newBody=this.newSnapshot.bodyElement}return n(o,e),o.prototype.render=function(t){return this.shouldRender()?(this.mergeHead(),this.renderView(function(e){return function(){return e.replaceBody(),e.isPreview||e.focusFirstAutofocusableElement(),t()}}(this))):this.invalidateView()},o.prototype.mergeHead=function(){return this.copyNewHeadStylesheetElements(),this.copyNewHeadScriptElements(),this.removeCurrentHeadProvisionalElements(),this.copyNewHeadProvisionalElements()},o.prototype.replaceBody=function(){var t;return t=this.relocateCurrentBodyPermanentElements(),this.activateNewBodyScriptElements(),this.assignNewBody(),this.replacePlaceholderElementsWithClonedPermanentElements(t)},o.prototype.shouldRender=function(){return this.newSnapshot.isVisitable()&&this.trackedElementsAreIdentical()},o.prototype.trackedElementsAreIdentical=function(){return this.currentHeadDetails.getTrackedElementSignature()===this.newHeadDetails.getTrackedElementSignature()},o.prototype.copyNewHeadStylesheetElements=function(){var t,e,r,n,o;for(n=this.getNewHeadStylesheetElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.appendChild(t));return o},o.prototype.copyNewHeadScriptElements=function(){var t,e,r,n,o;for(n=this.getNewHeadScriptElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.appendChild(this.createScriptElement(t)));return o},o.prototype.removeCurrentHeadProvisionalElements=function(){var t,e,r,n,o;for(n=this.getCurrentHeadProvisionalElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.removeChild(t));return o},o.prototype.copyNewHeadProvisionalElements=function(){var t,e,r,n,o;for(n=this.getNewHeadProvisionalElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.appendChild(t));return o},o.prototype.relocateCurrentBodyPermanentElements=function(){var e,n,o,i,s,a,u;for(a=this.getCurrentBodyPermanentElements(),u=[],e=0,n=a.length;n>e;e++)i=a[e],s=t(i),o=this.newSnapshot.getPermanentElementById(i.id),r(i,s.element),r(o,i),u.push(s);return u},o.prototype.replacePlaceholderElementsWithClonedPermanentElements=function(t){var e,n,o,i,s,a,u;for(u=[],o=0,i=t.length;i>o;o++)a=t[o],n=a.element,s=a.permanentElement,e=s.cloneNode(!0),u.push(r(n,e));return u},o.prototype.activateNewBodyScriptElements=function(){var t,e,n,o,i,s;for(i=this.getNewBodyScriptElements(),s=[],e=0,o=i.length;o>e;e++)n=i[e],t=this.createScriptElement(n),s.push(r(n,t));return s},o.prototype.assignNewBody=function(){return document.body=this.newBody},o.prototype.focusFirstAutofocusableElement=function(){var t;return null!=(t=this.newSnapshot.findFirstAutofocusableElement())?t.focus():void 0},o.prototype.getNewHeadStylesheetElements=function(){return this.newHeadDetails.getStylesheetElementsNotInDetails(this.currentHeadDetails)},o.prototype.getNewHeadScriptElements=function(){return this.newHeadDetails.getScriptElementsNotInDetails(this.currentHeadDetails)},o.prototype.getCurrentHeadProvisionalElements=function(){return this.currentHeadDetails.getProvisionalElements()},o.prototype.getNewHeadProvisionalElements=function(){return this.newHeadDetails.getProvisionalElements()},o.prototype.getCurrentBodyPermanentElements=function(){return this.currentSnapshot.getPermanentElementsPresentInSnapshot(this.newSnapshot)},o.prototype.getNewBodyScriptElements=function(){return this.newBody.querySelectorAll("script")},o}(e.Renderer),t=function(t){var e;return e=document.createElement("meta"),e.setAttribute("name","turbolinks-permanent-placeholder"),e.setAttribute("content",t.id),{element:e,permanentElement:t}},r=function(t,e){var r;return(r=t.parentNode)?r.replaceChild(e,t):void 0}}.call(this),function(){var t=function(t,e){function n(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e.ErrorRenderer=function(e){function r(t){var e;e=document.createElement("html"),e.innerHTML=t,this.newHead=e.querySelector("head"),this.newBody=e.querySelector("body")}return t(r,e),r.prototype.render=function(t){return this.renderView(function(e){return function(){return e.replaceHeadAndBody(),e.activateBodyScriptElements(),t()}}(this))},r.prototype.replaceHeadAndBody=function(){var t,e;return e=document.head,t=document.body,e.parentNode.replaceChild(this.newHead,e),t.parentNode.replaceChild(this.newBody,t)},r.prototype.activateBodyScriptElements=function(){var t,e,r,n,o,i;for(n=this.getScriptElements(),i=[],e=0,r=n.length;r>e;e++)o=n[e],t=this.createScriptElement(o),i.push(o.parentNode.replaceChild(t,o));return i},r.prototype.getScriptElements=function(){return document.documentElement.querySelectorAll("script")},r}(e.Renderer)}.call(this),function(){e.View=function(){function t(t){this.delegate=t,this.htmlElement=document.documentElement}return t.prototype.getRootLocation=function(){return this.getSnapshot().getRootLocation()},t.prototype.getElementForAnchor=function(t){return this.getSnapshot().getElementForAnchor(t)},t.prototype.getSnapshot=function(){return e.Snapshot.fromHTMLElement(this.htmlElement)},t.prototype.render=function(t,e){var r,n,o;return o=t.snapshot,r=t.error,n=t.isPreview,this.markAsPreview(n),null!=o?this.renderSnapshot(o,n,e):this.renderError(r,e)},t.prototype.markAsPreview=function(t){return t?this.htmlElement.setAttribute("data-turbolinks-preview",""):this.htmlElement.removeAttribute("data-turbolinks-preview")},t.prototype.renderSnapshot=function(t,r,n){return e.SnapshotRenderer.render(this.delegate,n,this.getSnapshot(),e.Snapshot.wrap(t),r)},t.prototype.renderError=function(t,r){return e.ErrorRenderer.render(this.delegate,r,t)},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.ScrollManager=function(){function r(r){this.delegate=r,this.onScroll=t(this.onScroll,this),this.onScroll=e.throttle(this.onScroll)}return r.prototype.start=function(){return this.started?void 0:(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)},r.prototype.stop=function(){return this.started?(removeEventListener("scroll",this.onScroll,!1),this.started=!1):void 0},r.prototype.scrollToElement=function(t){return t.scrollIntoView()},r.prototype.scrollToPosition=function(t){var e,r;return e=t.x,r=t.y,window.scrollTo(e,r)},r.prototype.onScroll=function(t){return this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},r.prototype.updatePosition=function(t){var e;return this.position=t,null!=(e=this.delegate)?e.scrollPositionChanged(this.position):void 0},r}()}.call(this),function(){e.SnapshotCache=function(){function t(t){this.size=t,this.keys=[],this.snapshots={}}var r;return t.prototype.has=function(t){var e;return e=r(t),e in this.snapshots},t.prototype.get=function(t){var e;if(this.has(t))return e=this.read(t),this.touch(t),e},t.prototype.put=function(t,e){return this.write(t,e),this.touch(t),e},t.prototype.read=function(t){var e;return e=r(t),this.snapshots[e]},t.prototype.write=function(t,e){var n;return n=r(t),this.snapshots[n]=e},t.prototype.touch=function(t){var e,n;return n=r(t),e=this.keys.indexOf(n),e>-1&&this.keys.splice(e,1),this.keys.unshift(n),this.trim()},t.prototype.trim=function(){var t,e,r,n,o;for(n=this.keys.splice(this.size),o=[],t=0,r=n.length;r>t;t++)e=n[t],o.push(delete this.snapshots[e]);return o},r=function(t){return e.Location.wrap(t).toCacheKey()},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.Visit=function(){function r(r,n,o){this.controller=r,this.action=o,this.performScroll=t(this.performScroll,this),this.identifier=e.uuid(),this.location=e.Location.wrap(n),this.adapter=this.controller.adapter,this.state="initialized",this.timingMetrics={}}var n;return r.prototype.start=function(){return"initialized"===this.state?(this.recordTimingMetric("visitStart"),this.state="started",this.adapter.visitStarted(this)):void 0},r.prototype.cancel=function(){var t;return"started"===this.state?(null!=(t=this.request)&&t.cancel(),this.cancelRender(),this.state="canceled"):void 0},r.prototype.complete=function(){var t;return"started"===this.state?(this.recordTimingMetric("visitEnd"),this.state="completed","function"==typeof(t=this.adapter).visitCompleted&&t.visitCompleted(this),this.controller.visitCompleted(this)):void 0},r.prototype.fail=function(){var t;return"started"===this.state?(this.state="failed","function"==typeof(t=this.adapter).visitFailed?t.visitFailed(this):void 0):void 0},r.prototype.changeHistory=function(){var t,e;return this.historyChanged?void 0:(t=this.location.isEqualTo(this.referrer)?"replace":this.action,e=n(t),this.controller[e](this.location,this.restorationIdentifier),this.historyChanged=!0)},r.prototype.issueRequest=function(){return this.shouldIssueRequest()&&null==this.request?(this.progress=0,this.request=new e.HttpRequest(this,this.location,this.referrer),this.request.send()):void 0},r.prototype.getCachedSnapshot=function(){var t;return!(t=this.controller.getCachedSnapshotForLocation(this.location))||null!=this.location.anchor&&!t.hasAnchor(this.location.anchor)||"restore"!==this.action&&!t.isPreviewable()?void 0:t},r.prototype.hasCachedSnapshot=function(){return null!=this.getCachedSnapshot()},r.prototype.loadCachedSnapshot=function(){var t,e;return(e=this.getCachedSnapshot())?(t=this.shouldIssueRequest(),this.render(function(){var r;return this.cacheSnapshot(),this.controller.render({snapshot:e,isPreview:t},this.performScroll),"function"==typeof(r=this.adapter).visitRendered&&r.visitRendered(this),t?void 0:this.complete()})):void 0},r.prototype.loadResponse=function(){return null!=this.response?this.render(function(){var t,e;return this.cacheSnapshot(),this.request.failed?(this.controller.render({error:this.response},this.performScroll),"function"==typeof(t=this.adapter).visitRendered&&t.visitRendered(this),this.fail()):(this.controller.render({snapshot:this.response},this.performScroll),"function"==typeof(e=this.adapter).visitRendered&&e.visitRendered(this),this.complete())}):void 0},r.prototype.followRedirect=function(){return this.redirectedToLocation&&!this.followedRedirect?(this.location=this.redirectedToLocation,this.controller.replaceHistoryWithLocationAndRestorationIdentifier(this.redirectedToLocation,this.restorationIdentifier),this.followedRedirect=!0):void 0},r.prototype.requestStarted=function(){var t;return this.recordTimingMetric("requestStart"),"function"==typeof(t=this.adapter).visitRequestStarted?t.visitRequestStarted(this):void 0},r.prototype.requestProgressed=function(t){var e;return this.progress=t,"function"==typeof(e=this.adapter).visitRequestProgressed?e.visitRequestProgressed(this):void 0},r.prototype.requestCompletedWithResponse=function(t,r){return this.response=t,null!=r&&(this.redirectedToLocation=e.Location.wrap(r)),this.adapter.visitRequestCompleted(this)},r.prototype.requestFailedWithStatusCode=function(t,e){return this.response=e,this.adapter.visitRequestFailedWithStatusCode(this,t)},r.prototype.requestFinished=function(){var t;return this.recordTimingMetric("requestEnd"),"function"==typeof(t=this.adapter).visitRequestFinished?t.visitRequestFinished(this):void 0},r.prototype.performScroll=function(){return this.scrolled?void 0:("restore"===this.action?this.scrollToRestoredPosition()||this.scrollToTop():this.scrollToAnchor()||this.scrollToTop(),this.scrolled=!0)},r.prototype.scrollToRestoredPosition=function(){var t,e;return t=null!=(e=this.restorationData)?e.scrollPosition:void 0,null!=t?(this.controller.scrollToPosition(t),!0):void 0},r.prototype.scrollToAnchor=function(){return null!=this.location.anchor?(this.controller.scrollToAnchor(this.location.anchor),!0):void 0},r.prototype.scrollToTop=function(){return this.controller.scrollToPosition({x:0,y:0})},r.prototype.recordTimingMetric=function(t){var e;return null!=(e=this.timingMetrics)[t]?e[t]:e[t]=(new Date).getTime()},r.prototype.getTimingMetrics=function(){return e.copyObject(this.timingMetrics)},n=function(t){switch(t){case"replace":return"replaceHistoryWithLocationAndRestorationIdentifier";case"advance":case"restore":return"pushHistoryWithLocationAndRestorationIdentifier"}},r.prototype.shouldIssueRequest=function(){return"restore"===this.action?!this.hasCachedSnapshot():!0},r.prototype.cacheSnapshot=function(){return this.snapshotCached?void 0:(this.controller.cacheSnapshot(),this.snapshotCached=!0)},r.prototype.render=function(t){return this.cancelRender(),this.frame=requestAnimationFrame(function(e){return function(){return e.frame=null,t.call(e)}}(this))},r.prototype.cancelRender=function(){return this.frame?cancelAnimationFrame(this.frame):void 0},r}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.Controller=function(){function r(){this.clickBubbled=t(this.clickBubbled,this),this.clickCaptured=t(this.clickCaptured,this),this.pageLoaded=t(this.pageLoaded,this),this.history=new e.History(this),this.view=new e.View(this),this.scrollManager=new e.ScrollManager(this),this.restorationData={},this.clearCache(),this.setProgressBarDelay(500)}return r.prototype.start=function(){return e.supported&&!this.started?(addEventListener("click",this.clickCaptured,!0),addEventListener("DOMContentLoaded",this.pageLoaded,!1),this.scrollManager.start(),this.startHistory(),this.started=!0,this.enabled=!0):void 0},r.prototype.disable=function(){return this.enabled=!1},r.prototype.stop=function(){return this.started?(removeEventListener("click",this.clickCaptured,!0),removeEventListener("DOMContentLoaded",this.pageLoaded,!1),this.scrollManager.stop(),this.stopHistory(),this.started=!1):void 0},r.prototype.clearCache=function(){return this.cache=new e.SnapshotCache(10)},r.prototype.visit=function(t,r){var n,o;return null==r&&(r={}),t=e.Location.wrap(t),this.applicationAllowsVisitingLocation(t)?this.locationIsVisitable(t)?(n=null!=(o=r.action)?o:"advance",this.adapter.visitProposedToLocationWithAction(t,n)):window.location=t:void 0},r.prototype.startVisitToLocationWithAction=function(t,r,n){var o;return e.supported?(o=this.getRestorationDataForIdentifier(n),this.startVisit(t,r,{restorationData:o})):window.location=t},r.prototype.setProgressBarDelay=function(t){return this.progressBarDelay=t},r.prototype.startHistory=function(){return this.location=e.Location.wrap(window.location),this.restorationIdentifier=e.uuid(),this.history.start(),this.history.replace(this.location,this.restorationIdentifier)},r.prototype.stopHistory=function(){return this.history.stop()},r.prototype.pushHistoryWithLocationAndRestorationIdentifier=function(t,r){return this.restorationIdentifier=r,this.location=e.Location.wrap(t),this.history.push(this.location,this.restorationIdentifier)},r.prototype.replaceHistoryWithLocationAndRestorationIdentifier=function(t,r){return this.restorationIdentifier=r,this.location=e.Location.wrap(t),this.history.replace(this.location,this.restorationIdentifier)},r.prototype.historyPoppedToLocationWithRestorationIdentifier=function(t,r){var n;return this.restorationIdentifier=r,this.enabled?(n=this.getRestorationDataForIdentifier(this.restorationIdentifier),this.startVisit(t,"restore",{restorationIdentifier:this.restorationIdentifier,restorationData:n,historyChanged:!0}),this.location=e.Location.wrap(t)):this.adapter.pageInvalidated()},r.prototype.getCachedSnapshotForLocation=function(t){var e;return null!=(e=this.cache.get(t))?e.clone():void 0},r.prototype.shouldCacheSnapshot=function(){return this.view.getSnapshot().isCacheable(); +},r.prototype.cacheSnapshot=function(){var t,r;return this.shouldCacheSnapshot()?(this.notifyApplicationBeforeCachingSnapshot(),r=this.view.getSnapshot(),t=this.lastRenderedLocation,e.defer(function(e){return function(){return e.cache.put(t,r.clone())}}(this))):void 0},r.prototype.scrollToAnchor=function(t){var e;return(e=this.view.getElementForAnchor(t))?this.scrollToElement(e):this.scrollToPosition({x:0,y:0})},r.prototype.scrollToElement=function(t){return this.scrollManager.scrollToElement(t)},r.prototype.scrollToPosition=function(t){return this.scrollManager.scrollToPosition(t)},r.prototype.scrollPositionChanged=function(t){var e;return e=this.getCurrentRestorationData(),e.scrollPosition=t},r.prototype.render=function(t,e){return this.view.render(t,e)},r.prototype.viewInvalidated=function(){return this.adapter.pageInvalidated()},r.prototype.viewWillRender=function(t){return this.notifyApplicationBeforeRender(t)},r.prototype.viewRendered=function(){return this.lastRenderedLocation=this.currentVisit.location,this.notifyApplicationAfterRender()},r.prototype.pageLoaded=function(){return this.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()},r.prototype.clickCaptured=function(){return removeEventListener("click",this.clickBubbled,!1),addEventListener("click",this.clickBubbled,!1)},r.prototype.clickBubbled=function(t){var e,r,n;return this.enabled&&this.clickEventIsSignificant(t)&&(r=this.getVisitableLinkForNode(t.target))&&(n=this.getVisitableLocationForLink(r))&&this.applicationAllowsFollowingLinkToLocation(r,n)?(t.preventDefault(),e=this.getActionForLink(r),this.visit(n,{action:e})):void 0},r.prototype.applicationAllowsFollowingLinkToLocation=function(t,e){var r;return r=this.notifyApplicationAfterClickingLinkToLocation(t,e),!r.defaultPrevented},r.prototype.applicationAllowsVisitingLocation=function(t){var e;return e=this.notifyApplicationBeforeVisitingLocation(t),!e.defaultPrevented},r.prototype.notifyApplicationAfterClickingLinkToLocation=function(t,r){return e.dispatch("turbolinks:click",{target:t,data:{url:r.absoluteURL},cancelable:!0})},r.prototype.notifyApplicationBeforeVisitingLocation=function(t){return e.dispatch("turbolinks:before-visit",{data:{url:t.absoluteURL},cancelable:!0})},r.prototype.notifyApplicationAfterVisitingLocation=function(t){return e.dispatch("turbolinks:visit",{data:{url:t.absoluteURL}})},r.prototype.notifyApplicationBeforeCachingSnapshot=function(){return e.dispatch("turbolinks:before-cache")},r.prototype.notifyApplicationBeforeRender=function(t){return e.dispatch("turbolinks:before-render",{data:{newBody:t}})},r.prototype.notifyApplicationAfterRender=function(){return e.dispatch("turbolinks:render")},r.prototype.notifyApplicationAfterPageLoad=function(t){return null==t&&(t={}),e.dispatch("turbolinks:load",{data:{url:this.location.absoluteURL,timing:t}})},r.prototype.startVisit=function(t,e,r){var n;return null!=(n=this.currentVisit)&&n.cancel(),this.currentVisit=this.createVisit(t,e,r),this.currentVisit.start(),this.notifyApplicationAfterVisitingLocation(t)},r.prototype.createVisit=function(t,r,n){var o,i,s,a,u;return i=null!=n?n:{},a=i.restorationIdentifier,s=i.restorationData,o=i.historyChanged,u=new e.Visit(this,t,r),u.restorationIdentifier=null!=a?a:e.uuid(),u.restorationData=e.copyObject(s),u.historyChanged=o,u.referrer=this.location,u},r.prototype.visitCompleted=function(t){return this.notifyApplicationAfterPageLoad(t.getTimingMetrics())},r.prototype.clickEventIsSignificant=function(t){return!(t.defaultPrevented||t.target.isContentEditable||t.which>1||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)},r.prototype.getVisitableLinkForNode=function(t){return this.nodeIsVisitable(t)?e.closest(t,"a[href]:not([target]):not([download])"):void 0},r.prototype.getVisitableLocationForLink=function(t){var r;return r=new e.Location(t.getAttribute("href")),this.locationIsVisitable(r)?r:void 0},r.prototype.getActionForLink=function(t){var e;return null!=(e=t.getAttribute("data-turbolinks-action"))?e:"advance"},r.prototype.nodeIsVisitable=function(t){var r;return(r=e.closest(t,"[data-turbolinks]"))?"false"!==r.getAttribute("data-turbolinks"):!0},r.prototype.locationIsVisitable=function(t){return t.isPrefixedBy(this.view.getRootLocation())&&t.isHTML()},r.prototype.getCurrentRestorationData=function(){return this.getRestorationDataForIdentifier(this.restorationIdentifier)},r.prototype.getRestorationDataForIdentifier=function(t){var e;return null!=(e=this.restorationData)[t]?e[t]:e[t]={}},r}()}.call(this),function(){!function(){var t,e;if((t=e=document.currentScript)&&!e.hasAttribute("data-turbolinks-suppress-warning"))for(;t=t.parentNode;)if(t===document.body)return console.warn("You are loading Turbolinks from a
<%= index + 1 %><%= tag.position %> <%= tag.name %> <% if tag.user.present? %> @@ -36,6 +37,9 @@ <%= 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' %>