Merge branch 'dev_aliyun' into develop

dev_aliyun_beta
daiao 6 years ago
commit 6504123d1b

@ -13,6 +13,9 @@
//= require bootstrap-datepicker
//= require bootstrap.viewer
//= require lib/codemirror
//= require mode/shell/shell
//= require_tree ./i18n
//= require_tree ./admins
@ -40,6 +43,11 @@ $(document).on('turbolinks:load', function(){
}
});
$(document).on("turbolinks:before-cache", function () {
$('[data-toggle="tooltip"]').tooltip('hide');
$('[data-toggle="popover"]').popover('hide');
});
// var progressBar = new Turbolinks.ProgressBar();
// $(document).on('ajax:send', function(event){

@ -0,0 +1,33 @@
$(document).on('turbolinks:load', function() {
if ($('body.admins-mirror-scripts-edit-page, body.admins-mirror-scripts-update-page, body.admins-mirror-scripts-new-page, body.admins-mirror-scripts-create-page').length > 0) {
var $form = $('form.script-form');
// codemirror编辑器
var scriptEditor = CodeMirror.fromTextArea(document.getElementById('mirror_script_script'), {
lineNumbers: true,
mode: 'shell',
theme: "default",
indentUnit: 4, //代码缩进为一个tab的距离
matchBrackets: true,
autoRefresh: true,
smartIndent: true,//智能换行
styleActiveLine: true,
lint: true
});
scriptEditor.setSize('auto', '600px');
$form.validate({
errorElement: 'span',
errorClass: 'danger text-danger',
rules: {
"mirror_script[script_type]": {
required: true
}
}
});
$form.submit(function(e){
if(!$form.valid()){ e.preventDefault(); }
});
}
});

@ -5,6 +5,7 @@
@import "select2-bootstrap4.min";
@import "bootstrap-datepicker";
@import "bootstrap-datepicker.standalone";
@import "lib/codemirror";
@import "admins/*";

@ -106,5 +106,9 @@
padding: 0.5rem 2rem;
}
}
.CodeMirror {
border: 1px solid #ced4da;
}
}

@ -87,6 +87,7 @@ class Admins::MirrorRepositoriesController < Admins::BaseController
end
def check_shixun_mirrors!
return
return unless request.format.html?
Admins::CheckShixunMirrorsService.call

@ -0,0 +1,59 @@
class Admins::MirrorScriptsController < Admins::BaseController
helper_method :current_mirror
def index
scripts = current_mirror.mirror_scripts.order(updated_at: :desc)
@scripts = paginate scripts
end
def new
@script = current_mirror.mirror_scripts.new
end
def create
@script = current_mirror.mirror_scripts.new(form_params)
if @script.save
flash[:success] = '保存成功'
redirect_to edit_admins_mirror_repository_mirror_script_path(current_mirror, @script)
else
flash[:danger] = '保存失败'
render 'new'
end
end
def edit
@script = current_script
end
def update
@script = current_script
if @script.update(form_params)
flash[:success] = '保存成功'
redirect_to edit_admins_mirror_repository_mirror_script_path(current_mirror, @script)
else
flash[:danger] = '保存失败'
render 'edit'
end
end
def destroy
current_script.destroy!
render_delete_success
end
private
def current_script
@_current_script ||= current_mirror.mirror_scripts.find(params[:id])
end
def current_mirror
@_current_mirror ||= MirrorRepository.find(params[:mirror_repository_id])
end
def form_params
params.require(:mirror_script).permit(:script_type, :description, :script)
end
end

@ -234,18 +234,21 @@ class ChallengesController < ApplicationController
# {...}, ...]
#}
def crud_answer
raise '参考答案不能为空' if params[:challenge_answer].empty?
raise '占比之和必须为100%' if params[:challenge_answer].map{|a| a[:score]}.sum != 100
ActiveRecord::Base.transaction do
@challenge.challenge_answers.destroy_all if @challenge.challenge_answers
params[:challenge_answer].each_with_index do |answer, index|
# 内容为空不保存
next if answer[:contents].blank?
ChallengeAnswer.create(name: answer[:name], contents: answer[:contents],
level: index+1, score: answer[:score], challenge_id: @challenge.id)
if @challenge.challenge_answers && params[:challenge_answer].blank?
@challenge.challenge_answers.destroy_all
else
raise '参考答案不能为空' if params[:challenge_answer].empty?
raise '占比之和必须为100%' if params[:challenge_answer].map{|a| a[:score]}.sum != 100
ActiveRecord::Base.transaction do
@challenge.challenge_answers.destroy_all if @challenge.challenge_answers
params[:challenge_answer].each_with_index do |answer, index|
# 内容为空不保存
next if answer[:contents].blank?
ChallengeAnswer.create(name: answer[:name], contents: answer[:contents],
level: index+1, score: answer[:score], challenge_id: @challenge.id)
end
end
end
end
# 查看参考答案接口

@ -7,7 +7,7 @@ module Admins::RenderHelper
end
def render_forbidden
render_by_format(html: -> { redirect_to '/403' },
render_by_format(html: -> { current_user&.business? ? render('admins/shared/403') : redirect_to('/403') },
json: -> { render status: 403, json: { messages: I18n.t('error.forbidden') } } )
end

@ -172,17 +172,17 @@ class FilesController < ApplicationController
attachment_ids.each do |attachment_id|
ori = Attachment.find_by_id(attachment_id)
# 同一个资源可以多次发送到课堂
@course.attachments.each do |att|
@exist = false
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
att.created_on = Time.now
att.save
@exist = true
break
end
end
next if @exist
# @course.attachments.each do |att|
# @exist = false
# if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
# att.created_on = Time.now
# att.save
# @exist = true
# break
# end
# end
#
# next if @exist
attach_copied_obj = ori.copy
attach_copied_obj.container = @course
attach_copied_obj.created_on = Time.now

@ -92,6 +92,7 @@ class StudentWorksController < ApplicationController
student_work.commit_time = Time.now
student_work.update_time = Time.now
student_work.commit_user_id = current_user.id
student_work.update_user_id = current_user.id
student_work.group_id = @homework.homework_type == "group" ? @homework.max_group_id : 0
#提交作品时,计算是否迟交
@ -112,7 +113,7 @@ class StudentWorksController < ApplicationController
homework_common_id: @homework.id, project_id: student_work.project_id,
late_penalty: student_work.late_penalty, work_status: student_work.work_status,
commit_time: Time.now, update_time: Time.now, group_id: student_work.group_id,
commit_user_id: current_user.id)
commit_user_id: current_user.id, update_user_id: current_user.id)
stu_work.save!
student_work.attachments.each do |attachment|
att = attachment.copy
@ -156,6 +157,7 @@ class StudentWorksController < ApplicationController
begin
@work.description = params[:description]
@work.update_time = Time.now
@work.update_user_id = current_user.id
# @work.commit_user_id = current_user.id
if @work.save!
Attachment.associate_container(params[:attachment_ids], @work.id, @work.class)
@ -172,7 +174,7 @@ class StudentWorksController < ApplicationController
# 原成员更新描述、更新时间以及附件
@homework.student_works.where(group_id: @work.group_id, user_id: (work_user_ids & params_user_ids)).each do |work|
# work.update_attributes(update_time: Time.now, description: @work.description, commit_user_id: current_user.id)
work.update_attributes(update_time: Time.now, description: @work.description)
work.update_attributes(update_time: Time.now, description: @work.description, update_user_id: current_user.id)
work.attachments.destroy_all
@work.attachments.each do |attachment|
att = attachment.copy
@ -192,7 +194,7 @@ class StudentWorksController < ApplicationController
@homework.student_works.where(group_id: @work.group_id, user_id: delete_user_ids).
update_all(work_status: 0, description: nil, late_penalty: 0, commit_time: nil, update_time: nil,
final_score: nil, teacher_score: nil, student_score: nil, teaching_asistant_score: nil,
work_score: nil, project_id: 0, group_id: 0, commit_user_id: nil)
work_score: nil, project_id: 0, group_id: 0, commit_user_id: nil, update_user_id: nil)
# 新增加的成员
(params_user_ids - work_user_ids).each do |user_id|
@ -200,7 +202,7 @@ class StudentWorksController < ApplicationController
stu_work.update_attributes(user_id: user_id, description: @work.description, homework_common_id: @homework.id,
project_id: @work.project_id, late_penalty: @work.late_penalty,
work_status: @work.work_status, commit_time: Time.now, update_time: Time.now,
group_id: @work.group_id, commit_user_id: @work.commit_user_id)
group_id: @work.group_id, commit_user_id: @work.commit_user_id, update_user_id: current_user.id)
@work.attachments.each do |attachment|
att = attachment.copy
att.author_id = attachment.author_id

@ -48,7 +48,7 @@ module HomeworkCommonsHelper
end
when 2, 5, 6
status << "评阅中"
time = "评阅剩余时间:" + (course.end_date.present? ? how_much_time(course.end_date.end_of_day) : "")
time = course.end_date.present? ? ("评阅剩余时间:" + how_much_time(course.end_date.end_of_day)) : ""
time_status = 5
end

@ -2,6 +2,7 @@ class StudentWork < ApplicationRecord
#学生提交作品表 #work_status :0 未提交 1 已提交 2 迟交
belongs_to :user
belongs_to :commit_user, class_name: 'User', foreign_key: :commit_user_id, optional: true
belongs_to :update_user, class_name: 'User', foreign_key: :update_user_id, optional: true
belongs_to :homework_common
belongs_to :myshixun, optional: true
has_many :student_works_evaluation_distributions, dependent: :destroy

@ -24,8 +24,8 @@
<td><%= mirror.updated_at.strftime('%Y-%m-%d %H:%M') %></td>
<td>
<% if mirror.main_type == "1" %>
<%= link_to "/users/modify_script?mirror_id=#{mirror.id}", target: '_blank' do %>
<i class="fa fa-file-text <%= mirror.mirror_scripts.blank? ? 'text-danger' : 'text-success' %>" aria-hidden="true" data-toggle="tooltip" data-title="脚本模板"></i>
<%= link_to admins_mirror_repository_mirror_scripts_path(mirror) do %>
<i class="fa fa-file-text <%= mirror.mirror_scripts.blank? ? 'text-danger' : 'text-success' %>" aria-hidden="true" data-toggle="tooltip" data-title="查看脚本"></i>
<% end %>
<% end %>
</td>

@ -0,0 +1,8 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('镜像管理', admins_mirror_repositories_path) %>
<% add_admin_breadcrumb(current_mirror.type_name, edit_admins_mirror_repository_path(current_mirror)) %>
<% add_admin_breadcrumb('脚本列表', admins_mirror_repository_mirror_scripts_path(current_mirror)) %>
<% add_admin_breadcrumb('编辑脚本') %>
<% end %>
<%= render partial: 'admins/mirror_scripts/shared/form', locals: { mirror: current_mirror, script: @script, form_action: 'update' } %>

@ -0,0 +1,14 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('镜像管理', admins_mirror_repositories_path) %>
<% add_admin_breadcrumb(current_mirror.type_name, edit_admins_mirror_repository_path(current_mirror)) %>
<% add_admin_breadcrumb('脚本列表') %>
<% end %>
<div class="box search-form-container mirror-script-list-form">
<form class="flex-1"></form>
<%= link_to '新建', new_admins_mirror_repository_mirror_script_path(current_mirror), class: 'btn btn-primary' %>
</div>
<div class="box mirror-script-list-container">
<%= render partial: 'admins/mirror_scripts/shared/list', locals: { mirror: current_mirror, scripts: @scripts } %>
</div>

@ -0,0 +1,8 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('镜像管理', admins_mirror_repositories_path) %>
<% add_admin_breadcrumb(current_mirror.type_name, edit_admins_mirror_repository_path(current_mirror)) %>
<% add_admin_breadcrumb('脚本列表', admins_mirror_repository_mirror_scripts_path(current_mirror)) %>
<% add_admin_breadcrumb('新建脚本') %>
<% end %>
<%= render partial: 'admins/mirror_scripts/shared/form', locals: { mirror: current_mirror, script: @script, form_action: 'create' } %>

@ -0,0 +1,12 @@
<div class="box edit-mirror-script-container">
<%= simple_form_for([:admins, mirror, script], url: { action: form_action }, html: { class: 'script-form' }) do |f| %>
<%= f.input :script_type, label: '名称', input_html: { class: 'col-md-6' } %>
<%= f.input :description, as: :text, label: '说明', input_html: { class: 'col-md-6' } %>
<%= f.input :script, as: :text, label: '评测脚本' %>
<div class="form-row">
<%= f.button :submit, value: '保存', class: 'btn-primary mr-3 px-4', 'data-disable-with': '保存中...' %>
<%= link_to '取消', admins_mirror_repository_mirror_scripts_path(mirror), class: 'btn btn-secondary px-4' %>
</div>
<% end %>
</div>

@ -0,0 +1,32 @@
<table class="table table-hover text-center mirror-script-list-table">
<thead class="thead-light">
<tr>
<th width="10%">ID</th>
<th width="20%" class="text-left">名称</th>
<th width="34%" class="text-left">说明</th>
<th width="16%">更新时间</th>
<th width="20%">操作</th>
</tr>
</thead>
<tbody>
<% if scripts.present? %>
<% scripts.each do |script| %>
<tr class="mirror-script-item-<%= script.id %>">
<td><%= script.id %></td>
<td class="text-left"><%= overflow_hidden_span script.script_type, width: 200 %></td>
<td class="text-left"><%= overflow_hidden_span script.description, width: 400 %></td>
<td><%= script.updated_at.strftime('%Y-%m-%d %H:%M') %></td>
<td class="action-container">
<%= link_to '编辑', edit_admins_mirror_repository_mirror_script_path(mirror, script), class: 'action edit-action' %>
<%= delete_link '删除', admins_mirror_repository_mirror_script_path(mirror, script, element: ".mirror-script-item-#{script.id}"), class: 'delete-mirror-script-action' %>
</td>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'admins/shared/paginate', locals: { objects: scripts } %>

@ -0,0 +1,6 @@
<div class="d-flex flex-column align-items-center justify-content-center global-error">
<div class="global-error-code">
<span>403</span>
</div>
<div class="global-error-text">未授权</div>
</div>

@ -1,2 +1,2 @@
json.status 1
json.message "创建参考答案成功"
json.message "操作成功"

@ -5,7 +5,8 @@ json.is_evaluation @is_evaluation
json.author_name @is_evaluation ? "匿名" : @work.user.real_name
json.is_leader_work @work.user_id == @work.commit_user_id if @homework.homework_type == "group"
json.is_author @is_author
json.update_user_name @is_evaluation ? "匿名" : @work.commit_user.try(:real_name)
json.commit_user_name @is_evaluation ? "匿名" : @work.commit_user.try(:real_name)
json.update_user_name @is_evaluation ? "匿名" : @work.update_user.try(:real_name)
json.update_atta @homework.late_duration && @is_author

@ -1 +1 @@
admins-users: admins-users
admins-mirror_scripts: 'admins-mirror_repositories'

@ -7,8 +7,10 @@ Rails.application.config.assets.version = '1.0'
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('node_modules')
Rails.application.config.assets.paths << Rails.root.join('vendor/assets')
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
Rails.application.config.assets.precompile += %w( admin.js admin.css )

@ -791,6 +791,8 @@ Rails.application.routes.draw do
post :merge
get :for_select
end
resources :mirror_scripts, only: [:index, :new, :create, :edit, :update, :destroy]
end
resources :choose_mirror_repositories, only: [:new, :create]
end

@ -0,0 +1,6 @@
class AddUpdateUserIdToStudentWorks < ActiveRecord::Migration[5.2]
def change
add_column :student_works, :update_user_id, :integer
StudentWork.update_all("update_user_id = commit_user_id")
end
end

File diff suppressed because one or more lines are too long

@ -17816,6 +17816,607 @@ form.was-validated select:valid ~ .select2-container--bootstrap4 .select2-select
.datepicker.datepicker-inline td {
padding: 4px 5px;
}
/* BASICS */
/* line 3, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 300px;
color: black;
direction: ltr;
}
/* PADDING */
/* line 13, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-lines {
padding: 4px 0;
/* Vertical padding around content */
}
/* line 16, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
padding: 0 4px;
/* Horizontal padding of content */
}
/* line 21, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
background-color: white;
/* The little square between H and V scrollbars */
}
/* GUTTER */
/* line 27, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutters {
border-right: 1px solid #ddd;
background-color: #f7f7f7;
white-space: nowrap;
}
/* line 33, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-linenumber {
padding: 0 3px 0 5px;
min-width: 20px;
text-align: right;
color: #999;
white-space: nowrap;
}
/* line 41, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-guttermarker {
color: black;
}
/* line 42, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-guttermarker-subtle {
color: #999;
}
/* CURSOR */
/* line 46, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-cursor {
border-left: 1px solid black;
border-right: none;
width: 0;
}
/* Shown when moving in bi-directional text */
/* line 52, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver;
}
/* line 55, vendor/assets/codemirror/lib/codemirror.css */
.cm-fat-cursor .CodeMirror-cursor {
width: auto;
border: 0 !important;
background: #7e7;
}
/* line 60, vendor/assets/codemirror/lib/codemirror.css */
.cm-fat-cursor div.CodeMirror-cursors {
z-index: 1;
}
/* line 63, vendor/assets/codemirror/lib/codemirror.css */
.cm-fat-cursor-mark {
background-color: rgba(20, 255, 20, 0.5);
-webkit-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
}
/* line 69, vendor/assets/codemirror/lib/codemirror.css */
.cm-animate-fat-cursor {
width: auto;
border: 0;
-webkit-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
background-color: #7e7;
}
@-webkit-keyframes blink {
0% {
}
50% {
background-color: transparent;
}
100% {
}
}
@keyframes blink {
0% {
}
50% {
background-color: transparent;
}
100% {
}
}
/* Can style cursor different in overwrite (non-insert) mode */
/* line 96, vendor/assets/codemirror/lib/codemirror.css */
.cm-tab {
display: inline-block;
text-decoration: inherit;
}
/* line 98, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-rulers {
position: absolute;
left: 0;
right: 0;
top: -50px;
bottom: 0;
overflow: hidden;
}
/* line 103, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-ruler {
border-left: 1px solid #ccc;
top: 0;
bottom: 0;
position: absolute;
}
/* DEFAULT THEME */
/* line 111, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-header {
color: blue;
}
/* line 112, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-quote {
color: #090;
}
/* line 113, vendor/assets/codemirror/lib/codemirror.css */
.cm-negative {
color: #d44;
}
/* line 114, vendor/assets/codemirror/lib/codemirror.css */
.cm-positive {
color: #292;
}
/* line 115, vendor/assets/codemirror/lib/codemirror.css */
.cm-header, .cm-strong {
font-weight: bold;
}
/* line 116, vendor/assets/codemirror/lib/codemirror.css */
.cm-em {
font-style: italic;
}
/* line 117, vendor/assets/codemirror/lib/codemirror.css */
.cm-link {
text-decoration: underline;
}
/* line 118, vendor/assets/codemirror/lib/codemirror.css */
.cm-strikethrough {
text-decoration: line-through;
}
/* line 120, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-keyword {
color: #708;
}
/* line 121, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-atom {
color: #219;
}
/* line 122, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-number {
color: #164;
}
/* line 123, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-def {
color: #00f;
}
/* line 128, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-variable-2 {
color: #05a;
}
/* line 129, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {
color: #085;
}
/* line 130, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-comment {
color: #a50;
}
/* line 131, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-string {
color: #a11;
}
/* line 132, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-string-2 {
color: #f50;
}
/* line 133, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-meta {
color: #555;
}
/* line 134, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-qualifier {
color: #555;
}
/* line 135, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-builtin {
color: #30a;
}
/* line 136, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-bracket {
color: #997;
}
/* line 137, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-tag {
color: #170;
}
/* line 138, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-attribute {
color: #00c;
}
/* line 139, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-hr {
color: #999;
}
/* line 140, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-link {
color: #00c;
}
/* line 142, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-error {
color: #f00;
}
/* line 143, vendor/assets/codemirror/lib/codemirror.css */
.cm-invalidchar {
color: #f00;
}
/* line 145, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-composing {
border-bottom: 2px solid;
}
/* Default styles for common addons */
/* line 149, vendor/assets/codemirror/lib/codemirror.css */
div.CodeMirror span.CodeMirror-matchingbracket {
color: #0b0;
}
/* line 150, vendor/assets/codemirror/lib/codemirror.css */
div.CodeMirror span.CodeMirror-nonmatchingbracket {
color: #a22;
}
/* line 151, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-matchingtag {
background: rgba(255, 150, 0, 0.3);
}
/* line 152, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-activeline-background {
background: #e8f2ff;
}
/* STOP */
/* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */
/* line 159, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror {
position: relative;
overflow: hidden;
background: white;
}
/* line 165, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-scroll {
overflow: scroll !important;
/* Things will break if this is overridden */
/* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror */
margin-bottom: -30px;
margin-right: -30px;
padding-bottom: 30px;
height: 100%;
outline: none;
/* Prevent dragging from highlighting the element */
position: relative;
}
/* line 175, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-sizer {
position: relative;
border-right: 30px solid transparent;
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
before actual scrolling happens, thus preventing shaking and
flickering artifacts. */
/* line 183, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
position: absolute;
z-index: 6;
display: none;
}
/* line 188, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-vscrollbar {
right: 0;
top: 0;
overflow-x: hidden;
overflow-y: scroll;
}
/* line 193, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-hscrollbar {
bottom: 0;
left: 0;
overflow-y: hidden;
overflow-x: scroll;
}
/* line 198, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-scrollbar-filler {
right: 0;
bottom: 0;
}
/* line 201, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter-filler {
left: 0;
bottom: 0;
}
/* line 205, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutters {
position: absolute;
left: 0;
top: 0;
min-height: 100%;
z-index: 3;
}
/* line 210, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter {
white-space: normal;
height: 100%;
display: inline-block;
vertical-align: top;
margin-bottom: -30px;
}
/* line 217, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter-wrapper {
position: absolute;
z-index: 4;
background: none !important;
border: none !important;
}
/* line 223, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter-background {
position: absolute;
top: 0;
bottom: 0;
z-index: 4;
}
/* line 228, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter-elt {
position: absolute;
cursor: default;
z-index: 4;
}
/* line 233, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter-wrapper ::-moz-selection {
background-color: transparent;
}
.CodeMirror-gutter-wrapper ::selection {
background-color: transparent;
}
/* line 234, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter-wrapper ::-moz-selection {
background-color: transparent;
}
/* line 236, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-lines {
cursor: text;
min-height: 1px;
/* prevents collapsing before first draw */
}
/* line 240, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
/* Reset some styles that the rest of the page might have set */
border-radius: 0;
border-width: 0;
background: transparent;
font-family: inherit;
font-size: inherit;
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
-webkit-font-variant-ligatures: contextual;
font-variant-ligatures: contextual;
}
/* line 260, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-wrap pre.CodeMirror-line,
.CodeMirror-wrap pre.CodeMirror-line-like {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
/* line 267, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-linebackground {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 0;
}
/* line 273, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-linewidget {
position: relative;
z-index: 2;
padding: 0.1px;
/* Force widget margins to stay inside of the container */
}
/* line 281, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-rtl pre {
direction: rtl;
}
/* line 283, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-code {
outline: none;
}
/* Force content-box sizing for the elements where we expect it */
/* line 288, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumber {
box-sizing: content-box;
}
/* line 297, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-measure {
position: absolute;
width: 100%;
height: 0;
overflow: hidden;
visibility: hidden;
}
/* line 305, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-cursor {
position: absolute;
pointer-events: none;
}
/* line 309, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-measure pre {
position: static;
}
/* line 311, vendor/assets/codemirror/lib/codemirror.css */
div.CodeMirror-cursors {
visibility: hidden;
position: relative;
z-index: 3;
}
/* line 316, vendor/assets/codemirror/lib/codemirror.css */
div.CodeMirror-dragcursors {
visibility: visible;
}
/* line 320, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-focused div.CodeMirror-cursors {
visibility: visible;
}
/* line 324, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-selected {
background: #d9d9d9;
}
/* line 325, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-focused .CodeMirror-selected {
background: #d7d4f0;
}
/* line 326, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-crosshair {
cursor: crosshair;
}
/* line 327, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection {
background: #d7d4f0;
}
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection {
background: #d7d4f0;
}
/* line 328, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection {
background: #d7d4f0;
}
/* line 330, vendor/assets/codemirror/lib/codemirror.css */
.cm-searching {
background-color: #ffa;
background-color: rgba(255, 255, 0, 0.4);
}
/* Used to force a border model for a node */
/* line 336, vendor/assets/codemirror/lib/codemirror.css */
.cm-force-border {
padding-right: .1px;
}
@media print {
/* Hide the cursor when printing */
/* line 340, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror div.CodeMirror-cursors {
visibility: hidden;
}
}
/* See issue #2901 */
/* line 346, vendor/assets/codemirror/lib/codemirror.css */
.cm-tab-wrap-hack:after {
content: '';
}
/* Help users use markselection to safely style text background */
/* line 349, vendor/assets/codemirror/lib/codemirror.css */
span.CodeMirror-selectedtext {
background: none;
}
/* line 1, app/assets/stylesheets/admins/common.scss */
.admin-body-container {
padding: 20px;
@ -17952,6 +18553,11 @@ form.was-validated select:valid ~ .select2-container--bootstrap4 .select2-select
padding: 0.5rem 2rem;
}
/* line 110, app/assets/stylesheets/admins/common.scss */
.admin-body-container .CodeMirror {
border: 1px solid #ced4da;
}
/* line 2, app/assets/stylesheets/admins/daily_school_statistics.scss */
.admins-daily-school-statistics-index-page .daily-school-statistic-list-container {
text-align: center;
@ -18359,7 +18965,7 @@ form.was-validated select:valid ~ .select2-container--bootstrap4 .select2-select
text-align: center;
}
/* line 11, app/assets/stylesheets/admin.scss */
/* line 12, app/assets/stylesheets/admin.scss */
body {
width: 100vw;
height: 100vh;
@ -18373,53 +18979,53 @@ body {
background: #efefef;
}
/* line 23, app/assets/stylesheets/admin.scss */
/* line 24, app/assets/stylesheets/admin.scss */
a:hover {
text-decoration: unset;
}
/* line 28, app/assets/stylesheets/admin.scss */
/* line 29, app/assets/stylesheets/admin.scss */
textarea.danger, input.danger {
border-color: #dc3545 !important;
}
/* line 32, app/assets/stylesheets/admin.scss */
/* line 33, app/assets/stylesheets/admin.scss */
label.error {
color: #dc3545 !important;
}
/* line 38, app/assets/stylesheets/admin.scss */
/* line 39, app/assets/stylesheets/admin.scss */
.simple_form .form-group .collection_radio_buttons {
margin-bottom: 0px;
}
/* line 42, app/assets/stylesheets/admin.scss */
/* line 43, app/assets/stylesheets/admin.scss */
.simple_form .form-group .form-check-inline {
height: calc(1.5em + 0.75rem + 2px);
}
/* line 48, app/assets/stylesheets/admin.scss */
/* line 49, app/assets/stylesheets/admin.scss */
.flex-1 {
-webkit-box-flex: 1;
flex: 1;
}
/* line 52, app/assets/stylesheets/admin.scss */
/* line 53, app/assets/stylesheets/admin.scss */
.font-12 {
font-size: 12px !important;
}
/* line 53, app/assets/stylesheets/admin.scss */
/* line 54, app/assets/stylesheets/admin.scss */
.font-14 {
font-size: 14px !important;
}
/* line 54, app/assets/stylesheets/admin.scss */
/* line 55, app/assets/stylesheets/admin.scss */
.font-16 {
font-size: 16px !important;
}
/* line 55, app/assets/stylesheets/admin.scss */
/* line 56, app/assets/stylesheets/admin.scss */
.font-18 {
font-size: 18px !important;
}

@ -17816,6 +17816,607 @@ form.was-validated select:valid ~ .select2-container--bootstrap4 .select2-select
.datepicker.datepicker-inline td {
padding: 4px 5px;
}
/* BASICS */
/* line 3, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 300px;
color: black;
direction: ltr;
}
/* PADDING */
/* line 13, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-lines {
padding: 4px 0;
/* Vertical padding around content */
}
/* line 16, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
padding: 0 4px;
/* Horizontal padding of content */
}
/* line 21, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
background-color: white;
/* The little square between H and V scrollbars */
}
/* GUTTER */
/* line 27, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutters {
border-right: 1px solid #ddd;
background-color: #f7f7f7;
white-space: nowrap;
}
/* line 33, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-linenumber {
padding: 0 3px 0 5px;
min-width: 20px;
text-align: right;
color: #999;
white-space: nowrap;
}
/* line 41, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-guttermarker {
color: black;
}
/* line 42, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-guttermarker-subtle {
color: #999;
}
/* CURSOR */
/* line 46, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-cursor {
border-left: 1px solid black;
border-right: none;
width: 0;
}
/* Shown when moving in bi-directional text */
/* line 52, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver;
}
/* line 55, vendor/assets/codemirror/lib/codemirror.css */
.cm-fat-cursor .CodeMirror-cursor {
width: auto;
border: 0 !important;
background: #7e7;
}
/* line 60, vendor/assets/codemirror/lib/codemirror.css */
.cm-fat-cursor div.CodeMirror-cursors {
z-index: 1;
}
/* line 63, vendor/assets/codemirror/lib/codemirror.css */
.cm-fat-cursor-mark {
background-color: rgba(20, 255, 20, 0.5);
-webkit-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
}
/* line 69, vendor/assets/codemirror/lib/codemirror.css */
.cm-animate-fat-cursor {
width: auto;
border: 0;
-webkit-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
background-color: #7e7;
}
@-webkit-keyframes blink {
0% {
}
50% {
background-color: transparent;
}
100% {
}
}
@keyframes blink {
0% {
}
50% {
background-color: transparent;
}
100% {
}
}
/* Can style cursor different in overwrite (non-insert) mode */
/* line 96, vendor/assets/codemirror/lib/codemirror.css */
.cm-tab {
display: inline-block;
text-decoration: inherit;
}
/* line 98, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-rulers {
position: absolute;
left: 0;
right: 0;
top: -50px;
bottom: 0;
overflow: hidden;
}
/* line 103, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-ruler {
border-left: 1px solid #ccc;
top: 0;
bottom: 0;
position: absolute;
}
/* DEFAULT THEME */
/* line 111, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-header {
color: blue;
}
/* line 112, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-quote {
color: #090;
}
/* line 113, vendor/assets/codemirror/lib/codemirror.css */
.cm-negative {
color: #d44;
}
/* line 114, vendor/assets/codemirror/lib/codemirror.css */
.cm-positive {
color: #292;
}
/* line 115, vendor/assets/codemirror/lib/codemirror.css */
.cm-header, .cm-strong {
font-weight: bold;
}
/* line 116, vendor/assets/codemirror/lib/codemirror.css */
.cm-em {
font-style: italic;
}
/* line 117, vendor/assets/codemirror/lib/codemirror.css */
.cm-link {
text-decoration: underline;
}
/* line 118, vendor/assets/codemirror/lib/codemirror.css */
.cm-strikethrough {
text-decoration: line-through;
}
/* line 120, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-keyword {
color: #708;
}
/* line 121, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-atom {
color: #219;
}
/* line 122, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-number {
color: #164;
}
/* line 123, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-def {
color: #00f;
}
/* line 128, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-variable-2 {
color: #05a;
}
/* line 129, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {
color: #085;
}
/* line 130, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-comment {
color: #a50;
}
/* line 131, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-string {
color: #a11;
}
/* line 132, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-string-2 {
color: #f50;
}
/* line 133, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-meta {
color: #555;
}
/* line 134, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-qualifier {
color: #555;
}
/* line 135, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-builtin {
color: #30a;
}
/* line 136, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-bracket {
color: #997;
}
/* line 137, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-tag {
color: #170;
}
/* line 138, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-attribute {
color: #00c;
}
/* line 139, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-hr {
color: #999;
}
/* line 140, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-link {
color: #00c;
}
/* line 142, vendor/assets/codemirror/lib/codemirror.css */
.cm-s-default .cm-error {
color: #f00;
}
/* line 143, vendor/assets/codemirror/lib/codemirror.css */
.cm-invalidchar {
color: #f00;
}
/* line 145, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-composing {
border-bottom: 2px solid;
}
/* Default styles for common addons */
/* line 149, vendor/assets/codemirror/lib/codemirror.css */
div.CodeMirror span.CodeMirror-matchingbracket {
color: #0b0;
}
/* line 150, vendor/assets/codemirror/lib/codemirror.css */
div.CodeMirror span.CodeMirror-nonmatchingbracket {
color: #a22;
}
/* line 151, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-matchingtag {
background: rgba(255, 150, 0, 0.3);
}
/* line 152, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-activeline-background {
background: #e8f2ff;
}
/* STOP */
/* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */
/* line 159, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror {
position: relative;
overflow: hidden;
background: white;
}
/* line 165, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-scroll {
overflow: scroll !important;
/* Things will break if this is overridden */
/* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror */
margin-bottom: -30px;
margin-right: -30px;
padding-bottom: 30px;
height: 100%;
outline: none;
/* Prevent dragging from highlighting the element */
position: relative;
}
/* line 175, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-sizer {
position: relative;
border-right: 30px solid transparent;
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
before actual scrolling happens, thus preventing shaking and
flickering artifacts. */
/* line 183, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
position: absolute;
z-index: 6;
display: none;
}
/* line 188, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-vscrollbar {
right: 0;
top: 0;
overflow-x: hidden;
overflow-y: scroll;
}
/* line 193, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-hscrollbar {
bottom: 0;
left: 0;
overflow-y: hidden;
overflow-x: scroll;
}
/* line 198, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-scrollbar-filler {
right: 0;
bottom: 0;
}
/* line 201, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter-filler {
left: 0;
bottom: 0;
}
/* line 205, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutters {
position: absolute;
left: 0;
top: 0;
min-height: 100%;
z-index: 3;
}
/* line 210, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter {
white-space: normal;
height: 100%;
display: inline-block;
vertical-align: top;
margin-bottom: -30px;
}
/* line 217, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter-wrapper {
position: absolute;
z-index: 4;
background: none !important;
border: none !important;
}
/* line 223, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter-background {
position: absolute;
top: 0;
bottom: 0;
z-index: 4;
}
/* line 228, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter-elt {
position: absolute;
cursor: default;
z-index: 4;
}
/* line 233, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter-wrapper ::-moz-selection {
background-color: transparent;
}
.CodeMirror-gutter-wrapper ::selection {
background-color: transparent;
}
/* line 234, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-gutter-wrapper ::-moz-selection {
background-color: transparent;
}
/* line 236, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-lines {
cursor: text;
min-height: 1px;
/* prevents collapsing before first draw */
}
/* line 240, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
/* Reset some styles that the rest of the page might have set */
border-radius: 0;
border-width: 0;
background: transparent;
font-family: inherit;
font-size: inherit;
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
-webkit-font-variant-ligatures: contextual;
font-variant-ligatures: contextual;
}
/* line 260, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-wrap pre.CodeMirror-line,
.CodeMirror-wrap pre.CodeMirror-line-like {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
/* line 267, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-linebackground {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 0;
}
/* line 273, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-linewidget {
position: relative;
z-index: 2;
padding: 0.1px;
/* Force widget margins to stay inside of the container */
}
/* line 281, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-rtl pre {
direction: rtl;
}
/* line 283, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-code {
outline: none;
}
/* Force content-box sizing for the elements where we expect it */
/* line 288, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumber {
box-sizing: content-box;
}
/* line 297, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-measure {
position: absolute;
width: 100%;
height: 0;
overflow: hidden;
visibility: hidden;
}
/* line 305, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-cursor {
position: absolute;
pointer-events: none;
}
/* line 309, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-measure pre {
position: static;
}
/* line 311, vendor/assets/codemirror/lib/codemirror.css */
div.CodeMirror-cursors {
visibility: hidden;
position: relative;
z-index: 3;
}
/* line 316, vendor/assets/codemirror/lib/codemirror.css */
div.CodeMirror-dragcursors {
visibility: visible;
}
/* line 320, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-focused div.CodeMirror-cursors {
visibility: visible;
}
/* line 324, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-selected {
background: #d9d9d9;
}
/* line 325, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-focused .CodeMirror-selected {
background: #d7d4f0;
}
/* line 326, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-crosshair {
cursor: crosshair;
}
/* line 327, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection {
background: #d7d4f0;
}
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection {
background: #d7d4f0;
}
/* line 328, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection {
background: #d7d4f0;
}
/* line 330, vendor/assets/codemirror/lib/codemirror.css */
.cm-searching {
background-color: #ffa;
background-color: rgba(255, 255, 0, 0.4);
}
/* Used to force a border model for a node */
/* line 336, vendor/assets/codemirror/lib/codemirror.css */
.cm-force-border {
padding-right: .1px;
}
@media print {
/* Hide the cursor when printing */
/* line 340, vendor/assets/codemirror/lib/codemirror.css */
.CodeMirror div.CodeMirror-cursors {
visibility: hidden;
}
}
/* See issue #2901 */
/* line 346, vendor/assets/codemirror/lib/codemirror.css */
.cm-tab-wrap-hack:after {
content: '';
}
/* Help users use markselection to safely style text background */
/* line 349, vendor/assets/codemirror/lib/codemirror.css */
span.CodeMirror-selectedtext {
background: none;
}
/* line 1, app/assets/stylesheets/admins/common.scss */
.admin-body-container {
padding: 20px;
@ -17952,6 +18553,11 @@ form.was-validated select:valid ~ .select2-container--bootstrap4 .select2-select
padding: 0.5rem 2rem;
}
/* line 110, app/assets/stylesheets/admins/common.scss */
.admin-body-container .CodeMirror {
border: 1px solid #ced4da;
}
/* line 2, app/assets/stylesheets/admins/daily_school_statistics.scss */
.admins-daily-school-statistics-index-page .daily-school-statistic-list-container {
text-align: center;
@ -18359,7 +18965,7 @@ form.was-validated select:valid ~ .select2-container--bootstrap4 .select2-select
text-align: center;
}
/* line 11, app/assets/stylesheets/admin.scss */
/* line 12, app/assets/stylesheets/admin.scss */
body {
width: 100vw;
height: 100vh;
@ -18373,53 +18979,53 @@ body {
background: #efefef;
}
/* line 23, app/assets/stylesheets/admin.scss */
/* line 24, app/assets/stylesheets/admin.scss */
a:hover {
text-decoration: unset;
}
/* line 28, app/assets/stylesheets/admin.scss */
/* line 29, app/assets/stylesheets/admin.scss */
textarea.danger, input.danger {
border-color: #dc3545 !important;
}
/* line 32, app/assets/stylesheets/admin.scss */
/* line 33, app/assets/stylesheets/admin.scss */
label.error {
color: #dc3545 !important;
}
/* line 38, app/assets/stylesheets/admin.scss */
/* line 39, app/assets/stylesheets/admin.scss */
.simple_form .form-group .collection_radio_buttons {
margin-bottom: 0px;
}
/* line 42, app/assets/stylesheets/admin.scss */
/* line 43, app/assets/stylesheets/admin.scss */
.simple_form .form-group .form-check-inline {
height: calc(1.5em + 0.75rem + 2px);
}
/* line 48, app/assets/stylesheets/admin.scss */
/* line 49, app/assets/stylesheets/admin.scss */
.flex-1 {
-webkit-box-flex: 1;
flex: 1;
}
/* line 52, app/assets/stylesheets/admin.scss */
/* line 53, app/assets/stylesheets/admin.scss */
.font-12 {
font-size: 12px !important;
}
/* line 53, app/assets/stylesheets/admin.scss */
/* line 54, app/assets/stylesheets/admin.scss */
.font-14 {
font-size: 14px !important;
}
/* line 54, app/assets/stylesheets/admin.scss */
/* line 55, app/assets/stylesheets/admin.scss */
.font-16 {
font-size: 16px !important;
}
/* line 55, app/assets/stylesheets/admin.scss */
/* line 56, app/assets/stylesheets/admin.scss */
.font-18 {
font-size: 18px !important;
}
@ -18559,6 +19165,11 @@ label.error {
.admin-body-container .nav-tabs .nav-link {
padding: 0.5rem 2rem;
}
/* line 110, app/assets/stylesheets/admins/common.scss */
.admin-body-container .CodeMirror {
border: 1px solid #ced4da;
}
/* line 2, app/assets/stylesheets/admins/daily_school_statistics.scss */
.admins-daily-school-statistics-index-page .daily-school-statistic-list-container {
text-align: center;

@ -119,20 +119,21 @@ class Fileslists extends Component{
}).then((response) => {
if(response!=undefined){
if(response.data&&response.data){
let list=response.data.course_modules;
let course_second_categoriess;
list.map((item,key)=>{
course_second_categoriess=item.course_second_categories
})
this.setState({
course_modules:response.data,
has_course_groups:response.data.has_course_groups,
course_second_categories:course_second_categoriess
})
}
if(response.data&&response.data) {
if (response.data.status != 401) {
let list = response.data.course_modules;
let course_second_categoriess;
list.map((item, key) => {
course_second_categoriess = item.course_second_categories
})
this.setState({
course_modules: response.data,
has_course_groups: response.data.has_course_groups,
course_second_categories: course_second_categoriess
})
}
}
}

@ -162,7 +162,7 @@ class CommonWorkAppraise extends Component{
let {course_name, homework_name, search, page, loadingstate, homework_status, reference_answer,
attachments, homework_id, project_info, work_members, is_evaluation,
description, update_user_name, update_time, commit_time, author_name,
description, update_user_name, commit_user_name, update_time, commit_time, author_name,
revise_attachments, revise_reason, atta_update_user, atta_update_time, atta_update_user_login,
Modalstype,Modalstopval,ModalCancel,ModalSave,loadtype, is_leader_work
} =this.state;
@ -237,7 +237,7 @@ class CommonWorkAppraise extends Component{
{ commit_time &&
<React.Fragment>
<span className={"color9B9B fr mr30"}>提交</span>
<span className={"fr font-14 mr10 ml10"}>{author_name}</span>
<span className={"fr font-14 mr10 ml10"}>{commit_user_name}</span>
<span className={" color9B9B fr"}>
{moment(commit_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"":moment(commit_time).format('YYYY-MM-DD HH:mm')}
</span>

@ -740,7 +740,7 @@ render(){
<div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '147px' }}
title={item.group_name && item.group_name.length > 9 ? item.group_name : ''}
>{item.group_name}</div>
<div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '84px' }}
<div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '99px' }}
title={item.student_id && item.student_id.length > 12 ? item.student_id : ''}
>{item.student_id}</div>
<div className={"fl ml20"}>{item.commit_status===true?<span className={"color-orange"}>已提交</span> :""}</div>
@ -784,7 +784,7 @@ render(){
<div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '147px' }}
title={item.group_name && item.group_name.length > 9 ? item.group_name : ''}
>{item.group_name}</div>
<div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '84px' }}
<div className={"fl ml20 color-grey-9 overflowHidden1"} style={{ maxWidth: '99px' }}
title={item.student_id && item.student_id.length > 12 ? item.student_id : ''}
>{item.student_id}</div>
{item.user_id != this.props.current_user.user_id ?

@ -1210,7 +1210,7 @@ class ShixunHomework extends Component{
</div>
{
datas===undefined?'' :datas.homeworks.length===0? <NoneData></NoneData>:""
datas===undefined?"":datas.homeworks && datas.homeworks.length===0? <NoneData></NoneData>:""
}
</Spin>

@ -37,13 +37,18 @@ class MemoDetailMDEditor extends Component {
const placeholder = '我要回复...'
// const imageUrl = `/upload_with_markdown?container_id=${this.props.memo.id}&container_type=Memo`;
const imageUrl = `/api/attachments.json`;
if (this.isMDInited) {
return;
}
this.isMDInited = true
// 执行太快了,样式不正常
window.__tt = 400;
setTimeout(() => {
console.log('create_editorMD_4comment')
var commentMDEditor = window.create_editorMD_4comment("memo_comment_editorMd", '', this.props.height || 240, placeholder, imageUrl, () => {
// commentMDEditor.focus()
this.isMDInited = true
this.initDrag()
commentMDEditor.cm.on("change", (_cm, changeObj) => {
@ -119,7 +124,7 @@ class MemoDetailMDEditor extends Component {
this.initMDEditor()
} else {
setTimeout(() => {
this.commentMDEditor.focus()
this.commentMDEditor && this.commentMDEditor.focus()
}, 10)
}
}

File diff suppressed because it is too large Load Diff

@ -116,20 +116,40 @@ class TPICodeSetting extends Component {
<div className="ide-settings--item-value">代码补全</div>
</div> */}
<div className="-layout-h -center -justify-between">
<div className="ide-settings--item-key">CTRL + S</div>
<div className="ide-settings--item-value">保存代码</div>
<div className="ide-settings--item-key">保存代码</div>
<div className="ide-settings--item-value">Ctrl + S</div>
</div>
<div className="-layout-h -center -justify-between">
<div className="ide-settings--item-key">唤出快捷键列表</div>
<div className="ide-settings--item-value">F1 / Alt + F1</div>
</div>
<div className="-layout-h -center -justify-between">
<div className="ide-settings--item-key">左右缩进</div>
<div className="ide-settings--item-value">Ctrl + ]/[</div>
</div>
<div className="-layout-h -center -justify-between">
<div className="ide-settings--item-key">跳到匹配的括号</div>
<div className="ide-settings--item-value">Ctrl + Shift + \</div>
</div>
<div className="-layout-h -center -justify-between">
<div className="ide-settings--item-key">转到行首</div>
<div className="ide-settings--item-value">Home</div>
</div>
<div className="-layout-h -center -justify-between">
<div className="ide-settings--item-key">转到行尾</div>
<div className="ide-settings--item-value">End</div>
</div>
</div>
<h3 className="ide-settings--section -light ">
学员使用说明
关卡配置信息
{/* <a href="https://github.com/Microsoft/monaco-editor/wiki/Monaco-Editor-Accessibility-Guide"></a> */}
</h3>
<div className="-padding-24 ">
<div className="-padding-24 " style={{ marginBottom: '40px' }}>
<Tooltip title={ task_pass ? "允许学员跳关挑战实训" : "禁止学员跳关挑战实训"} disableFocusListener={true}>
<div className="-layout-h -center -justify-between">
<div className="ide-settings--item-key">跳关</div>
<div className="ide-settings--item-value">{ task_pass ? 'on' : 'off'}</div>
<div className="ide-settings--item-value">{ task_pass ? '允许' : '不允许'}</div>
</div>
</Tooltip>
@ -137,7 +157,7 @@ class TPICodeSetting extends Component {
: "禁止学员通过金币解锁查看测试集内容"} disableFocusListener={true}>
<div className="-layout-h -center -justify-between">
<div className="ide-settings--item-key">测试集解锁</div>
<div className="ide-settings--item-value">{ test_set_permission ? 'on' : 'off'}</div>
<div className="ide-settings--item-value">{ test_set_permission ? '允许' : '不允许'}</div>
</div>
</Tooltip>
@ -145,15 +165,15 @@ class TPICodeSetting extends Component {
: "启用页面复制和粘贴功能"} disableFocusListener={true}>
<div className="-layout-h -center -justify-between">
<div className="ide-settings--item-key">禁止代码复制粘贴</div>
<div className="ide-settings--item-value">{ forbid_copy ? 'on' : 'off'}</div>
<div className="ide-settings--item-key">代码复制粘贴</div>
<div className="ide-settings--item-value">{ !forbid_copy ? '允许' : '不允许'}</div>
</div>
</Tooltip>
</div>
<h3 className="ide-settings--section -light ">
{/* <a href="https://github.com/Microsoft/monaco-editor/wiki/Monaco-Editor-Accessibility-Guide"></a> */}
{/* <h3 className="ide-settings--section -light ">
说明
{/* <a href="https://github.com/Microsoft/monaco-editor/wiki/Monaco-Editor-Accessibility-Guide"></a> */}
</h3>
<div className="-padding-24 " style={{ marginBottom: '75px' }}>
<div className="-layout-h -center -justify-between">
@ -161,7 +181,7 @@ class TPICodeSetting extends Component {
本编辑器和Visual Studio Code的快捷键一致使用F1或Alt+F1 (Internet Explorer)可以唤出快捷键列表
</div>
</div>
</div>
</div> */}
</div>

@ -120,7 +120,9 @@ export default class TPManswer extends Component {
let urlAnswer = `/shixuns/${id}/challenges/${checkpointId}/answer.json`;
axios.get(urlAnswer).then((response) => {
if (response.data) {
if (response.data.status === 401) {
} else if (response.data) {
this.setState({ answers: response.data })
}
})
@ -158,7 +160,7 @@ export default class TPManswer extends Component {
if (!isValidate) {
return;
}
if (totalScore != 100) {
if (answersParams.length != 0 && totalScore != 100) {
this.props.showSnackbar("请先保证占比和为100%");
return;
}

@ -0,0 +1,349 @@
/* BASICS */
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 300px;
color: black;
direction: ltr;
}
/* PADDING */
.CodeMirror-lines {
padding: 4px 0; /* Vertical padding around content */
}
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
padding: 0 4px; /* Horizontal padding of content */
}
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
background-color: white; /* The little square between H and V scrollbars */
}
/* GUTTER */
.CodeMirror-gutters {
border-right: 1px solid #ddd;
background-color: #f7f7f7;
white-space: nowrap;
}
.CodeMirror-linenumbers {}
.CodeMirror-linenumber {
padding: 0 3px 0 5px;
min-width: 20px;
text-align: right;
color: #999;
white-space: nowrap;
}
.CodeMirror-guttermarker { color: black; }
.CodeMirror-guttermarker-subtle { color: #999; }
/* CURSOR */
.CodeMirror-cursor {
border-left: 1px solid black;
border-right: none;
width: 0;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver;
}
.cm-fat-cursor .CodeMirror-cursor {
width: auto;
border: 0 !important;
background: #7e7;
}
.cm-fat-cursor div.CodeMirror-cursors {
z-index: 1;
}
.cm-fat-cursor-mark {
background-color: rgba(20, 255, 20, 0.5);
-webkit-animation: blink 1.06s steps(1) infinite;
-moz-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
}
.cm-animate-fat-cursor {
width: auto;
border: 0;
-webkit-animation: blink 1.06s steps(1) infinite;
-moz-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
background-color: #7e7;
}
@-moz-keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
@-webkit-keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
@keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
/* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror-overwrite .CodeMirror-cursor {}
.cm-tab { display: inline-block; text-decoration: inherit; }
.CodeMirror-rulers {
position: absolute;
left: 0; right: 0; top: -50px; bottom: 0;
overflow: hidden;
}
.CodeMirror-ruler {
border-left: 1px solid #ccc;
top: 0; bottom: 0;
position: absolute;
}
/* DEFAULT THEME */
.cm-s-default .cm-header {color: blue;}
.cm-s-default .cm-quote {color: #090;}
.cm-negative {color: #d44;}
.cm-positive {color: #292;}
.cm-header, .cm-strong {font-weight: bold;}
.cm-em {font-style: italic;}
.cm-link {text-decoration: underline;}
.cm-strikethrough {text-decoration: line-through;}
.cm-s-default .cm-keyword {color: #708;}
.cm-s-default .cm-atom {color: #219;}
.cm-s-default .cm-number {color: #164;}
.cm-s-default .cm-def {color: #00f;}
.cm-s-default .cm-variable,
.cm-s-default .cm-punctuation,
.cm-s-default .cm-property,
.cm-s-default .cm-operator {}
.cm-s-default .cm-variable-2 {color: #05a;}
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
.cm-s-default .cm-comment {color: #a50;}
.cm-s-default .cm-string {color: #a11;}
.cm-s-default .cm-string-2 {color: #f50;}
.cm-s-default .cm-meta {color: #555;}
.cm-s-default .cm-qualifier {color: #555;}
.cm-s-default .cm-builtin {color: #30a;}
.cm-s-default .cm-bracket {color: #997;}
.cm-s-default .cm-tag {color: #170;}
.cm-s-default .cm-attribute {color: #00c;}
.cm-s-default .cm-hr {color: #999;}
.cm-s-default .cm-link {color: #00c;}
.cm-s-default .cm-error {color: #f00;}
.cm-invalidchar {color: #f00;}
.CodeMirror-composing { border-bottom: 2px solid; }
/* Default styles for common addons */
div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
.CodeMirror-activeline-background {background: #e8f2ff;}
/* STOP */
/* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */
.CodeMirror {
position: relative;
overflow: hidden;
background: white;
}
.CodeMirror-scroll {
overflow: scroll !important; /* Things will break if this is overridden */
/* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror */
margin-bottom: -30px; margin-right: -30px;
padding-bottom: 30px;
height: 100%;
outline: none; /* Prevent dragging from highlighting the element */
position: relative;
}
.CodeMirror-sizer {
position: relative;
border-right: 30px solid transparent;
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
before actual scrolling happens, thus preventing shaking and
flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
position: absolute;
z-index: 6;
display: none;
}
.CodeMirror-vscrollbar {
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
}
.CodeMirror-hscrollbar {
bottom: 0; left: 0;
overflow-y: hidden;
overflow-x: scroll;
}
.CodeMirror-scrollbar-filler {
right: 0; bottom: 0;
}
.CodeMirror-gutter-filler {
left: 0; bottom: 0;
}
.CodeMirror-gutters {
position: absolute; left: 0; top: 0;
min-height: 100%;
z-index: 3;
}
.CodeMirror-gutter {
white-space: normal;
height: 100%;
display: inline-block;
vertical-align: top;
margin-bottom: -30px;
}
.CodeMirror-gutter-wrapper {
position: absolute;
z-index: 4;
background: none !important;
border: none !important;
}
.CodeMirror-gutter-background {
position: absolute;
top: 0; bottom: 0;
z-index: 4;
}
.CodeMirror-gutter-elt {
position: absolute;
cursor: default;
z-index: 4;
}
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
.CodeMirror-lines {
cursor: text;
min-height: 1px; /* prevents collapsing before first draw */
}
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
/* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
border-width: 0;
background: transparent;
font-family: inherit;
font-size: inherit;
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
-webkit-font-variant-ligatures: contextual;
font-variant-ligatures: contextual;
}
.CodeMirror-wrap pre.CodeMirror-line,
.CodeMirror-wrap pre.CodeMirror-line-like {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-linebackground {
position: absolute;
left: 0; right: 0; top: 0; bottom: 0;
z-index: 0;
}
.CodeMirror-linewidget {
position: relative;
z-index: 2;
padding: 0.1px; /* Force widget margins to stay inside of the container */
}
.CodeMirror-widget {}
.CodeMirror-rtl pre { direction: rtl; }
.CodeMirror-code {
outline: none;
}
/* Force content-box sizing for the elements where we expect it */
.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumber {
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.CodeMirror-measure {
position: absolute;
width: 100%;
height: 0;
overflow: hidden;
visibility: hidden;
}
.CodeMirror-cursor {
position: absolute;
pointer-events: none;
}
.CodeMirror-measure pre { position: static; }
div.CodeMirror-cursors {
visibility: hidden;
position: relative;
z-index: 3;
}
div.CodeMirror-dragcursors {
visibility: visible;
}
.CodeMirror-focused div.CodeMirror-cursors {
visibility: visible;
}
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-crosshair { cursor: crosshair; }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
.cm-searching {
background-color: #ffa;
background-color: rgba(255, 255, 0, .4);
}
/* Used to force a border model for a node */
.cm-force-border { padding-right: .1px; }
@media print {
/* Hide the cursor when printing */
.CodeMirror div.CodeMirror-cursors {
visibility: hidden;
}
}
/* See issue #2901 */
.cm-tab-wrap-hack:after { content: ''; }
/* Help users use markselection to safely style text background */
span.CodeMirror-selectedtext { background: none; }

File diff suppressed because it is too large Load Diff

@ -0,0 +1,152 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode('shell', function() {
var words = {};
function define(style, dict) {
for(var i = 0; i < dict.length; i++) {
words[dict[i]] = style;
}
};
var commonAtoms = ["true", "false"];
var commonKeywords = ["if", "then", "do", "else", "elif", "while", "until", "for", "in", "esac", "fi",
"fin", "fil", "done", "exit", "set", "unset", "export", "function"];
var commonCommands = ["ab", "awk", "bash", "beep", "cat", "cc", "cd", "chown", "chmod", "chroot", "clear",
"cp", "curl", "cut", "diff", "echo", "find", "gawk", "gcc", "get", "git", "grep", "hg", "kill", "killall",
"ln", "ls", "make", "mkdir", "openssl", "mv", "nc", "nl", "node", "npm", "ping", "ps", "restart", "rm",
"rmdir", "sed", "service", "sh", "shopt", "shred", "source", "sort", "sleep", "ssh", "start", "stop",
"su", "sudo", "svn", "tee", "telnet", "top", "touch", "vi", "vim", "wall", "wc", "wget", "who", "write",
"yes", "zsh"];
CodeMirror.registerHelper("hintWords", "shell", commonAtoms.concat(commonKeywords, commonCommands));
define('atom', commonAtoms);
define('keyword', commonKeywords);
define('builtin', commonCommands);
function tokenBase(stream, state) {
if (stream.eatSpace()) return null;
var sol = stream.sol();
var ch = stream.next();
if (ch === '\\') {
stream.next();
return null;
}
if (ch === '\'' || ch === '"' || ch === '`') {
state.tokens.unshift(tokenString(ch, ch === "`" ? "quote" : "string"));
return tokenize(stream, state);
}
if (ch === '#') {
if (sol && stream.eat('!')) {
stream.skipToEnd();
return 'meta'; // 'comment'?
}
stream.skipToEnd();
return 'comment';
}
if (ch === '$') {
state.tokens.unshift(tokenDollar);
return tokenize(stream, state);
}
if (ch === '+' || ch === '=') {
return 'operator';
}
if (ch === '-') {
stream.eat('-');
stream.eatWhile(/\w/);
return 'attribute';
}
if (/\d/.test(ch)) {
stream.eatWhile(/\d/);
if(stream.eol() || !/\w/.test(stream.peek())) {
return 'number';
}
}
stream.eatWhile(/[\w-]/);
var cur = stream.current();
if (stream.peek() === '=' && /\w+/.test(cur)) return 'def';
return words.hasOwnProperty(cur) ? words[cur] : null;
}
function tokenString(quote, style) {
var close = quote == "(" ? ")" : quote == "{" ? "}" : quote
return function(stream, state) {
var next, escaped = false;
while ((next = stream.next()) != null) {
if (next === close && !escaped) {
state.tokens.shift();
break;
} else if (next === '$' && !escaped && quote !== "'" && stream.peek() != close) {
escaped = true;
stream.backUp(1);
state.tokens.unshift(tokenDollar);
break;
} else if (!escaped && quote !== close && next === quote) {
state.tokens.unshift(tokenString(quote, style))
return tokenize(stream, state)
} else if (!escaped && /['"]/.test(next) && !/['"]/.test(quote)) {
state.tokens.unshift(tokenStringStart(next, "string"));
stream.backUp(1);
break;
}
escaped = !escaped && next === '\\';
}
return style;
};
};
function tokenStringStart(quote, style) {
return function(stream, state) {
state.tokens[0] = tokenString(quote, style)
stream.next()
return tokenize(stream, state)
}
}
var tokenDollar = function(stream, state) {
if (state.tokens.length > 1) stream.eat('$');
var ch = stream.next()
if (/['"({]/.test(ch)) {
state.tokens[0] = tokenString(ch, ch == "(" ? "quote" : ch == "{" ? "def" : "string");
return tokenize(stream, state);
}
if (!/\d/.test(ch)) stream.eatWhile(/\w/);
state.tokens.shift();
return 'def';
};
function tokenize(stream, state) {
return (state.tokens[0] || tokenBase) (stream, state);
};
return {
startState: function() {return {tokens:[]};},
token: function(stream, state) {
return tokenize(stream, state);
},
closeBrackets: "()[]{}''\"\"``",
lineComment: '#',
fold: "brace"
};
});
CodeMirror.defineMIME('text/x-sh', 'shell');
// Apache uses a slightly different Media Type for Shell scripts
// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
CodeMirror.defineMIME('application/x-sh', 'shell');
});
Loading…
Cancel
Save