init project

This commit is contained in:
Jasder
2020-03-09 00:40:16 +08:00
commit 2937b2a94d
6549 changed files with 7215173 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
admins-mirror_scripts: 'admins-mirror_repositories'
admins-laboratory_settings: 'admins-laboratories'
admins-carousels: 'admins-laboratories'
admins-laboratory_shixuns: 'admins-laboratories'
admins-laboratory_subjects: 'admins-laboratories'
admins-competition_settings: 'admins-competitions'
admins-enroll_lists: 'admins-competitions'
admins-competition_prize_users: 'admins-competitions'
admins-customers: 'admins-partners'

44
config/application.rb Normal file
View File

@@ -0,0 +1,44 @@
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Educoderplus
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
#
#
# config.educoder = config_for(:configuration)
config.active_record.default_timezone = :utc
config.time_zone = 'Beijing'
# I18n
config.i18n.default_locale = 'zh-CN'
config.i18n.load_path += Dir[Rails.root.join('config/locales', '**', '*.yml').to_s]
# 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 '*'
# location of your api
resource '/*', :headers => :any, :methods => [:get, :post, :delete, :options, :put]
end
end
end
end

4
config/boot.rb Normal file
View File

@@ -0,0 +1,4 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.

10
config/cable.yml Normal file
View File

@@ -0,0 +1,10 @@
development:
adapter: async
test:
adapter: async
production:
adapter: redis
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix: educoderplus_production

View File

@@ -0,0 +1,78 @@
default: &default
# 用户登入的时候设置/登出的时候清空
autologin_cookie_name: 'autologin_trustie'
#附件上传路径
attachment_folder: '/tmp'
# webssh相关
tomcat_webssh: 'https://testwebssh.educoder.net'
webssh_username: ''
webssh_password: ''
# git服务地址
git_address_ip: ''
#新版git服务地址
git_address_domain: ''
# git管理员用户名问题, 适用于git客户端的操作
git_username: ''
git_password: ''
ucloud:
public_key: ''
private_key: ''
public_bucket: ''
public_bucket_host: ''
public_cdn_host: ''
oauth:
qq:
appid: 'test'
secret: 'test123456'
wechat:
appid: 'test'
secret: 'test'
scope: 'snsapi_login'
base_url: 'https://api.weixin.qq.com'
aliyun_vod:
access_key_id: 'test'
access_key_secret: 'test'
base_url: 'http://vod.cn-shanghai.aliyuncs.com'
cate_id: '-1'
callback_url: 'callback_url'
signature_key: 'test12345678'
gitea:
access_key_id: 'root'
access_key_secret: '_Trustie_10010'
domain: 'https://testgitea.trustie.net'
base_url: '/api/v1'
production:
<<: *default
# 中间层地址
cloud_bridge: ''
cloud_tomcat_php: ''
bridge_secret_key: ''
cookie_domain: '.educoder.net'
attachment_folder: ''
host_name: 'https://testeduplus2.educoder.net'
old_edu_host: 'http://testbdweb.educoder.net'
development:
<<: *default
cloud_bridge: ''
cloud_tomcat_php: ''
host_name: ''
old_edu_host: ''
test:
<<: *default
cloud_tomcat_php: 'http://10.9.63.225'
host_name: 'https://testeduplus2.educoder.net'
old_edu_host: 'http://testbdweb.educoder.net'

View File

@@ -0,0 +1 @@
HQzrAxnd5iZF+w0HBwIETJ66R0NXf7lW02rnNpD0nfzWVpRxtFwBtVKYzbwih+8RA2BIVF6uHFjDVdBnLL0/VcQt6iOAgYqWUUnjThaGu62M4OxbxCKpp/qiWTkxPalAGjIFN3xc/OR76G1aKwW8kfBJhvzyT74YC3NfhJditXQlZWPBn4XJQFlqabGJH2BR9FoKyuOBLuSwDLK5LCE4BIz5gPeJBD1G7et1UimSixG7Fc8DeJfwMFfikFG51YqcX7wNyeQQQifv4f/bdduX31dhWG6ElE9sXcQCD4iowsHLyepA++3nCpSqCSuht0SsSb6r16QJBh0zfr/IscjFnWM1WoW5Iccp3WllqAENzKHi6iS9M6lk87SL4r/Kbf5n7WTEPkyL76OrC1tugnfE2ARMmzmZ2uVyXWea--DhX+q3d9jB/R6/Iv--ibe53X5kyDC3RPvu2x2OqQ==

View File

@@ -0,0 +1,54 @@
# MySQL. Versions 5.1.10 and up are supported.
#
# Install the MySQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
#
default: &default
adapter: mysql2
encoding: utf8
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root
password: 123456
# socket: /var/run/mysqld/mysqld.sock
development:
<<: *default
database: forge_development
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: forge_test
# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password as a unix environment variable when you boot
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full rundown on how to provide these environment variables in a
# production deployment.
#
# On Heroku and other platform providers, you may have a full connection URL
# available as an environment variable. For example:
#
# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
#
# You can use this database configuration with:
#
# production:
# url: <%= ENV['DATABASE_URL'] %>
#
production:
<<: *default
database: forge_production
username: educoderplus
password: <%= ENV['EDUCODERPLUS_DATABASE_PASSWORD'] %>

5
config/environment.rb Normal file
View File

@@ -0,0 +1,5 @@
# Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!

View File

@@ -0,0 +1,78 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
config.cache_store = :file_store, "#{Rails.root }/files/cache_store/"
# if Rails.root.join('tmp', 'caching-dev.txt').exist?
# config.action_controller.perform_caching = true
#
# config.cache_store = :memory_store
# config.public_file_server.headers = {
# 'Cache-Control' => "public, max-age=#{2.days.to_i}"
# }
# else
# config.action_controller.perform_caching = false
#
# config.cache_store = :null_store
# end
# Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# config.assets.prefix = '/dev-assets'
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_controller.perform_caching = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.exmail.qq.com',
port: 25,
domain: 'smtp.qq.com',
user_name: 'educoder@trustie.org',
password: 'mAZc9EWbe2Kawaqo2',
authentication: 'login',
enable_starttls_auto: true }
end

View File

@@ -0,0 +1,76 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
config.cache_store = :file_store, "#{Rails.root }/files/cache_store/"
# if Rails.root.join('tmp', 'caching-dev.txt').exist?
# config.action_controller.perform_caching = true
#
# config.cache_store = :memory_store
# config.public_file_server.headers = {
# 'Cache-Control' => "public, max-age=#{2.days.to_i}"
# }
# else
# config.action_controller.perform_caching = false
#
# config.cache_store = :null_store
# end
# Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_controller.perform_caching = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.exmail.qq.com',
port: 25,
domain: 'smtp.qq.com',
user_name: 'educoder@trustie.org',
password: 'mAZc9EWbe2Kawaqo2',
authentication: 'login',
enable_starttls_auto: true }
end

View File

@@ -0,0 +1,51 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
}
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
# Store uploaded files on the local file system in a temporary directory
config.active_storage.service = :test
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
#
#
# Dont clean the database before test
config.active_record.maintain_test_schema = false
end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,66 @@
6-4tianwang
89-64cdjp
ADMIN
Administrator
asshole
BLOWJOB
chinaliberal
chinamz
chinesenewsnet
Clockgemstone
creaders
Crestbone
dajiyuan
dfdz
DICK
falun
falundafa
Feelmistone
freechina
freenet
fuck
gcd
Gruepin
Guichuideng
HACKING
hongzhi
hrichina
HUANET
hypermart.net
incest
jiangdongriji
jiaochuang
jiaochun
KEFU
KISSMYASS
lihongzhi
minghui
minghuinews
nacb
Neckromancer
NMIS
PAPER64
penis
qiangjian
renminbao
renmingbao
SHIT
SUCKPENIS
taip
tibetalk
triangle
triangleboy
Tringel
UltraSurf
ustibet
voachinese
wangce
WEBZEN
wstaiji
xinsheng
YUMING
zangdu
ZHENGJIAN
ZHENGJIANWANG
ZHENSHANREN
zhuanfalun

Binary file not shown.

View File

@@ -0,0 +1,67 @@
---
- 6-4tianwang
- 89-64cdjp
- ADMIN
- Administrator
- asshole
- BLOWJOB
- chinaliberal
- chinamz
- chinesenewsnet
- Clockgemstone
- creaders
- Crestbone
- dajiyuan
- dfdz
- DICK
- falun
- falundafa
- Feelmistone
- freechina
- freenet
- fuck
- gcd
- Gruepin
- Guichuideng
- HACKING
- hongzhi
- hrichina
- HUANET
- hypermart.net
- incest
- jiangdongriji
- jiaochuang
- jiaochun
- KEFU
- KISSMYASS
- lihongzhi
- minghui
- minghuinews
- nacb
- Neckromancer
- NMIS
- PAPER64
- penis
- qiangjian
- renminbao
- renmingbao
- SHIT
- SUCKPENIS
- taip
- tibetalk
- triangle
- triangleboy
- Tringel
- UltraSurf
- ustibet
- voachinese
- wangce
- WEBZEN
- wstaiji
- xinsheng
- YUMING
- zangdu
- ZHENGJIAN
- ZHENGJIANWANG
- ZHENSHANREN
-

View File

@@ -0,0 +1,9 @@
# Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end

View File

@@ -0,0 +1,16 @@
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# 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 college.js college.css cooperative.js cooperative.css )

View File

@@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!

View File

@@ -0,0 +1,25 @@
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true

View File

@@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :marshal

View File

@@ -0,0 +1,2 @@
redis_config = Rails.application.config_for(:elasticsearch)
ENV['ELASTICSEARCH_URL'] = redis_config['url']

View File

@@ -0,0 +1 @@
require 'educoder'

View File

@@ -0,0 +1,4 @@
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]

View File

@@ -0,0 +1,21 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
ActiveSupport::Inflector.inflections do |inflect|
inflect.acronym 'QQ'
inflect.acronym 'OmniAuth'
end

View File

@@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
Mime::Type.register "application/xls", :xls

View File

@@ -0,0 +1,21 @@
OmniAuth.config.add_camelization 'qq', 'QQ'
OmniAuth.config.logger = Rails.logger
OmniAuth.config.on_failure = Proc.new { |env|
OmniAuth::FailureEndpoint.new(env).redirect_to_failure
}
oauth_config = {}
begin
config = Rails.application.config_for(:configuration)
oauth_config = config.dig('oauth', 'qq')
raise 'oauth qq config missing' if oauth_config.blank?
rescue => ex
raise ex if Rails.env.production?
puts %Q{\033[33m [warning] qq oauth config or configuration.yml missing,
please add it or execute 'cp config/configuration.yml.example config/configuration.yml' \033[0m}
end
Rails.application.config.middleware.use OmniAuth::Builder do
provider :qq, oauth_config['appid'], oauth_config['secret'], { provider_ignores_state: true }
end

View File

@@ -0,0 +1,27 @@
PDFKit.configure do |config|
config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || 'wkhtmltopdf'
# config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || '/usr/bin/wkhtmltopdf'
config.default_options = {
encoding: "UTF-8",
page_size: 'A4',
print_media_type: true,
dpi: 300,
debug_javascript: true,
javascript_delay: 500,
# quiet: false
stop_slow_scripts:false,
no_stop_slow_scripts: true
}
end
# 原有方法会给所有含 head 标签的地方插入css导致html类实训代码块渲染异常
module FixStylesheetAppend
def append_stylesheets
raise ImproperSourceError.new('Stylesheets may only be added to an HTML source') if stylesheets.any? && !@source.html?
stylesheets.each do |stylesheet|
@source.to_s.insert(0, style_tag_for(stylesheet))
end
end
end
PDFKit.prepend(FixStylesheetAppend)

View File

@@ -0,0 +1,33 @@
#coding=utf-8
module SessionExtenstions
module EntryExtension
def compressed?
@compressed
end
def value
if @value
begin
Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value)
rescue TypeError
compressed? ? Zlib::Inflate.inflate(@value) : @value
end
end
end
def size
if @value.nil?
0
else
@value.bytesize
end
end
end
end
ActiveSupport::Cache::Entry.const_set("DEFAULT_COMPRESS_LIMIT", 1)
ActiveSupport::Cache::Entry.send(:prepend, SessionExtenstions::EntryExtension)

View File

@@ -0,0 +1,8 @@
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails g active_record:session_migration")
# Rails.application.config.session_store :active_record_store
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cache_store, :expire_after => 24.hours, :httponly => false, :secure => false, key: '_educoder_session', domain: :all

View File

@@ -0,0 +1,10 @@
redis_config = Rails.application.config_for(:redis)
sidekiq_url = redis_config["url"]
Sidekiq.configure_server do |config|
config.redis = { url: sidekiq_url }
end
Sidekiq.configure_client do |config|
config.redis = { url: sidekiq_url }
end

View File

@@ -0,0 +1,179 @@
# frozen_string_literal: true
#
# Uncomment this and change the path if necessary to include your own
# components.
# See https://github.com/plataformatec/simple_form#custom-components to know
# more about custom components.
# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
#
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
# complete input. You can remove any component from the
# wrapper, change the order or even add your own to the
# stack. The options given below are used to wrap the
# whole input.
config.wrappers :default, class: :input,
hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b|
## Extensions enabled by default
# Any of these extensions can be disabled for a
# given input by passing: `f.input EXTENSION_NAME => false`.
# You can make any of these extensions optional by
# renaming `b.use` to `b.optional`.
# Determines whether to use HTML5 (:email, :url, ...)
# and required attributes
b.use :html5
# Calculates placeholders automatically from I18n
# You can also pass a string as f.input placeholder: "Placeholder"
b.use :placeholder
## Optional extensions
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
# to the input. If so, they will retrieve the values from the model
# if any exists. If you want to enable any of those
# extensions by default, you can change `b.optional` to `b.use`.
# Calculates maxlength from length validations for string inputs
# and/or database column lengths
b.optional :maxlength
# Calculate minlength from length validations for string inputs
b.optional :minlength
# Calculates pattern from format validations for string inputs
b.optional :pattern
# Calculates min and max from length validations for numeric inputs
b.optional :min_max
# Calculates readonly automatically from readonly attributes
b.optional :readonly
## Inputs
# b.use :input, class: 'input', error_class: 'is-invalid', valid_class: 'is-valid'
b.use :label_input
b.use :hint, wrap_with: { tag: :span, class: :hint }
b.use :error, wrap_with: { tag: :span, class: :error }
## full_messages_for
# If you want to display the full error message for the attribute, you can
# use the component :full_error, like:
#
# b.use :full_error, wrap_with: { tag: :span, class: :error }
end
# The default wrapper to be used by the FormBuilder.
config.default_wrapper = :default
# Define the way to render check boxes / radio buttons with labels.
# Defaults to :nested for bootstrap config.
# inline: input + label
# nested: label > input
config.boolean_style = :nested
# Default class for buttons
config.button_class = 'btn'
# Method used to tidy up errors. Specify any Rails Array method.
# :first lists the first message for each field.
# Use :to_sentence to list all errors for each field.
# config.error_method = :first
# Default tag used for error notification helper.
config.error_notification_tag = :div
# CSS class to add for error notification helper.
config.error_notification_class = 'error_notification'
# Series of attempts to detect a default label method for collection.
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
# Series of attempts to detect a default value method for collection.
# config.collection_value_methods = [ :id, :to_s ]
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
# config.collection_wrapper_tag = nil
# You can define the class to use on all collection wrappers. Defaulting to none.
# config.collection_wrapper_class = nil
# You can wrap each item in a collection of radio/check boxes with a tag,
# defaulting to :span.
# config.item_wrapper_tag = :span
# You can define a class to use in all item wrappers. Defaulting to none.
# config.item_wrapper_class = nil
# How the label text should be generated altogether with the required text.
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
# You can define the class to use on all labels. Default is nil.
# config.label_class = nil
# You can define the default class to be used on forms. Can be overriden
# with `html: { :class }`. Defaulting to none.
# config.default_form_class = nil
# You can define which elements should obtain additional classes
# config.generate_additional_classes_for = [:wrapper, :label, :input]
# Whether attributes are required by default (or not). Default is true.
# config.required_by_default = true
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
# These validations are enabled in SimpleForm's internal config but disabled by default
# in this configuration, which is recommended due to some quirks from different browsers.
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
# change this configuration to true.
config.browser_validations = false
# Collection of methods to detect if a file type was given.
# config.file_methods = [ :mounted_as, :file?, :public_filename, :attached? ]
# Custom mappings for input types. This should be a hash containing a regexp
# to match as key, and the input type that will be used when the field name
# matches the regexp as value.
# config.input_mappings = { /count/ => :integer }
# Custom wrappers for input types. This should be a hash containing an input
# type as key and the wrapper that will be used for all inputs with specified type.
# config.wrapper_mappings = { string: :prepend }
# Namespaces where SimpleForm should look for custom input classes that
# override default inputs.
# config.custom_inputs_namespaces << "CustomInputs"
# Default priority for time_zone inputs.
# config.time_zone_priority = nil
# Default priority for country inputs.
# config.country_priority = nil
# When false, do not use translations for labels.
# config.translate_labels = true
# Automatically discover new inputs in Rails' autoload path.
# config.inputs_discovery = true
# Cache SimpleForm inputs discovery
# config.cache_discovery = !Rails.env.development?
# Default class for inputs
# config.input_class = nil
# Define the default class of the input wrapper of the boolean input.
config.boolean_label_class = 'checkbox'
# Defines if the default input wrapper class should be included in radio
# collection wrappers.
# config.include_default_input_wrapper_class = true
# Defines which i18n scope will be used in Simple Form.
# config.i18n_scope = 'simple_form'
# Defines validation classes to the input_field. By default it's nil.
# config.input_field_valid_class = 'is-valid'
# config.input_field_error_class = 'is-invalid'
end

View File

@@ -0,0 +1,439 @@
# frozen_string_literal: true
# Please do not make direct changes to this file!
# This generator is maintained by the community around simple_form-bootstrap:
# https://github.com/rafaelfranca/simple_form-bootstrap
# All future development, tests, and organization should happen there.
# Background history: https://github.com/plataformatec/simple_form/issues/1561
# Uncomment this and change the path if necessary to include your own
# components.
# See https://github.com/plataformatec/simple_form#custom-components
# to know more about custom components.
# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Default class for buttons
config.button_class = 'btn'
# Define the default class of the input wrapper of the boolean input.
config.boolean_label_class = 'form-check-label'
# How the label text should be generated altogether with the required text.
config.label_text = lambda { |label, required, explicit_label| "#{label} #{required}" }
# Define the way to render check boxes / radio buttons with labels.
config.boolean_style = :inline
# You can wrap each item in a collection of radio/check boxes with a tag
config.item_wrapper_tag = :div
# Defines if the default input wrapper class should be included in radio
# collection wrappers.
config.include_default_input_wrapper_class = false
# CSS class to add for error notification helper.
config.error_notification_class = 'alert alert-danger'
# Method used to tidy up errors. Specify any Rails Array method.
# :first lists the first message for each field.
# :to_sentence to list all errors for each field.
config.error_method = :to_sentence
# add validation classes to `input_field`
config.input_field_error_class = 'is-invalid'
config.input_field_valid_class = 'is-valid'
# vertical forms
#
# vertical default_wrapper
config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :minlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :label, class: 'form-control-label'
b.use :input, class: 'form-control', error_class: 'is-invalid'
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# vertical input for boolean
config.wrappers :vertical_boolean, tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.wrapper :form_check_wrapper, tag: 'div', class: 'form-check' do |bb|
bb.use :input, class: 'form-check-input', error_class: 'is-invalid'
bb.use :label, class: 'form-check-label'
bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
bb.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
end
# vertical input for radio buttons and check boxes
config.wrappers :vertical_collection, item_wrapper_class: 'form-check', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
ba.use :label_text
end
b.use :input, class: 'form-check-input', error_class: 'is-invalid'
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# vertical input for inline radio buttons and check boxes
config.wrappers :vertical_collection_inline, item_wrapper_class: 'form-check form-check-inline', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
ba.use :label_text
end
b.use :input, class: 'form-check-input', error_class: 'is-invalid'
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# vertical file input
config.wrappers :vertical_file, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :minlength
b.optional :readonly
b.use :label
b.use :input, class: 'form-control-file', error_class: 'is-invalid'
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# vertical multi select
config.wrappers :vertical_multi_select, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.use :label, class: 'form-control-label'
b.wrapper tag: 'div', class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
ba.use :input, class: 'form-control mx-1', error_class: 'is-invalid'
end
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# vertical range input
config.wrappers :vertical_range, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.use :placeholder
b.optional :readonly
b.optional :step
b.use :label
b.use :input, class: 'form-control-range', error_class: 'is-invalid'
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# horizontal forms
#
# horizontal default_wrapper
config.wrappers :horizontal_form, tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :minlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :label, class: 'col-sm-3 col-form-label'
b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
ba.use :input, class: 'form-control', error_class: 'is-invalid'
ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
end
# horizontal input for boolean
config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.wrapper tag: 'label', class: 'col-sm-3' do |ba|
ba.use :label_text
end
b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |wr|
wr.wrapper :form_check_wrapper, tag: 'div', class: 'form-check' do |bb|
bb.use :input, class: 'form-check-input', error_class: 'is-invalid'
bb.use :label, class: 'form-check-label'
bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
bb.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
end
end
# horizontal input for radio buttons and check boxes
config.wrappers :horizontal_collection, item_wrapper_class: 'form-check', tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.use :label, class: 'col-sm-3 form-control-label'
b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
ba.use :input, class: 'form-check-input', error_class: 'is-invalid'
ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
end
# horizontal input for inline radio buttons and check boxes
config.wrappers :horizontal_collection_inline, item_wrapper_class: 'form-check form-check-inline', tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.use :label, class: 'col-sm-3 form-control-label'
b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
ba.use :input, class: 'form-check-input', error_class: 'is-invalid'
ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
end
# horizontal file input
config.wrappers :horizontal_file, tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :minlength
b.optional :readonly
b.use :label, class: 'col-sm-3 form-control-label'
b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
ba.use :input, error_class: 'is-invalid'
ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
end
# horizontal multi select
config.wrappers :horizontal_multi_select, tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.use :label, class: 'col-sm-3 control-label'
b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
ba.wrapper tag: 'div', class: 'd-flex flex-row justify-content-between align-items-center' do |bb|
bb.use :input, class: 'form-control mx-1', error_class: 'is-invalid'
end
ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
end
# horizontal range input
config.wrappers :horizontal_range, tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.use :placeholder
b.optional :readonly
b.optional :step
b.use :label, class: 'col-sm-3 form-control-label'
b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
ba.use :input, class: 'form-control-range', error_class: 'is-invalid'
ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
end
# inline forms
#
# inline default_wrapper
config.wrappers :inline_form, tag: 'span', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :minlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :label, class: 'sr-only'
b.use :input, class: 'form-control', error_class: 'is-invalid'
b.use :error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
b.optional :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# inline input for boolean
config.wrappers :inline_boolean, tag: 'span', class: 'form-check flex-wrap justify-content-start mr-sm-2', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.use :input, class: 'form-check-input', error_class: 'is-invalid'
b.use :label, class: 'form-check-label'
b.use :error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
b.optional :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# bootstrap custom forms
#
# custom input for boolean
config.wrappers :custom_boolean, tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.wrapper :form_check_wrapper, tag: 'div', class: 'custom-control custom-checkbox' do |bb|
bb.use :input, class: 'custom-control-input', error_class: 'is-invalid'
bb.use :label, class: 'custom-control-label'
bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
bb.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
end
config.wrappers :custom_boolean_switch, tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.wrapper :form_check_wrapper, tag: 'div', class: 'custom-control custom-checkbox-switch' do |bb|
bb.use :input, class: 'custom-control-input', error_class: 'is-invalid'
bb.use :label, class: 'custom-control-label'
bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
bb.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
end
# custom input for radio buttons and check boxes
config.wrappers :custom_collection, item_wrapper_class: 'custom-control', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
ba.use :label_text
end
b.use :input, class: 'custom-control-input', error_class: 'is-invalid'
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# custom input for inline radio buttons and check boxes
config.wrappers :custom_collection_inline, item_wrapper_class: 'custom-control custom-control-inline', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
ba.use :label_text
end
b.use :input, class: 'custom-control-input', error_class: 'is-invalid'
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# custom file input
config.wrappers :custom_file, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :minlength
b.optional :readonly
b.use :label, class: 'form-control-label'
b.wrapper :custom_file_wrapper, tag: 'div', class: 'custom-file' do |ba|
ba.use :input, class: 'custom-file-input', error_class: 'is-invalid'
ba.use :label, class: 'custom-file-label'
ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
end
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# custom multi select
config.wrappers :custom_multi_select, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.use :label, class: 'form-control-label'
b.wrapper tag: 'div', class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
ba.use :input, class: 'custom-select mx-1', error_class: 'is-invalid'
end
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# custom range input
config.wrappers :custom_range, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.use :placeholder
b.optional :readonly
b.optional :step
b.use :label, class: 'form-control-label'
b.use :input, class: 'custom-range', error_class: 'is-invalid'
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# Input Group - custom component
# see example app and config at https://github.com/rafaelfranca/simple_form-bootstrap
# config.wrappers :input_group, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
# b.use :html5
# b.use :placeholder
# b.optional :maxlength
# b.optional :minlength
# b.optional :pattern
# b.optional :min_max
# b.optional :readonly
# b.use :label, class: 'form-control-label'
# b.wrapper :input_group_tag, tag: 'div', class: 'input-group' do |ba|
# ba.optional :prepend
# ba.use :input, class: 'form-control', error_class: 'is-invalid'
# ba.optional :append
# end
# b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
# b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
# end
# Floating Labels form
#
# floating labels default_wrapper
config.wrappers :floating_labels_form, tag: 'div', class: 'form-label-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :minlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :input, class: 'form-control', error_class: 'is-invalid'
b.use :label, class: 'form-control-label'
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# custom multi select
config.wrappers :floating_labels_select, tag: 'div', class: 'form-label-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
b.use :html5
b.optional :readonly
b.use :input, class: 'custom-select custom-select-lg', error_class: 'is-invalid'
b.use :label, class: 'form-control-label'
b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
end
# The default wrapper to be used by the FormBuilder.
config.default_wrapper = :vertical_form
# Custom wrappers for input types. This should be a hash containing an input
# type as key and the wrapper that will be used for all inputs with specified type.
config.wrapper_mappings = {
boolean: :vertical_boolean,
check_boxes: :vertical_collection_inline,
date: :vertical_multi_select,
datetime: :vertical_multi_select,
file: :vertical_file,
radio_buttons: :vertical_collection_inline,
range: :vertical_range,
time: :vertical_multi_select
}
# enable custom form wrappers
# config.wrapper_mappings = {
# boolean: :custom_boolean,
# check_boxes: :custom_collection,
# date: :custom_multi_select,
# datetime: :custom_multi_select,
# file: :custom_file,
# radio_buttons: :custom_collection,
# range: :custom_range,
# time: :custom_multi_select
# }
end

View File

@@ -0,0 +1,25 @@
wechat_config = {}
weapp_config = {}
begin
config = Rails.application.config_for(:configuration)
wechat_config = config['wechat']
weapp_config = config['weapp']
raise 'wechat config missing' if wechat_config.blank?
raise 'weapp config missing' if weapp_config.blank?
rescue => ex
raise ex if Rails.env.production?
puts %Q{\033[33m [warning] wechat config or configuration.yml missing,
please add it or execute 'cp config/configuration.yml.example config/configuration.yml' \033[0m}
wechat_config = {}
weapp_config = {}
end
# 网站应用
Wechat::OfficialAccount.appid = wechat_config['appid']
Wechat::OfficialAccount.secret = wechat_config['secret']
# 小程序
Wechat::Weapp.appid = weapp_config['appid']
Wechat::Weapp.secret = weapp_config['secret']

View File

@@ -0,0 +1,17 @@
oauth_config = {}
begin
config = Rails.application.config_for(:configuration)
oauth_config = config.dig('oauth', 'wechat')
raise 'oauth wechat config missing' if oauth_config.blank?
rescue => ex
raise ex if Rails.env.production?
puts %Q{\033[33m [warning] wechat oauth config or configuration.yml missing,
please add it or execute 'cp config/configuration.yml.example config/configuration.yml' \033[0m}
end
WechatOauth.appid = oauth_config['appid']
WechatOauth.secret = oauth_config['secret']
WechatOauth.scope = oauth_config['scope']
WechatOauth.base_url = oauth_config['base_url']
WechatOauth.logger = Rails.logger

View File

@@ -0,0 +1,14 @@
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end

View File

@@ -0,0 +1,7 @@
zh-CN:
apply_action:
status:
'0': '待处理'
'1': '已同意'
'2': '已拒绝'
'3': '已撤销'

View File

@@ -0,0 +1,7 @@
zh-CN:
apply_user_authentication:
status:
'0': '待处理'
'1': '已同意'
'2': '已拒绝'
'3': '已撤销'

View File

@@ -0,0 +1,6 @@
'zh-CN':
bidding_user:
status:
pending: 竞标中
bidding_won: 已中标
bidding_lost: 未中标

View File

@@ -0,0 +1,6 @@
zh-CN:
enumerize:
competition_prize:
category:
bonus: '奖金'
unset: '无'

View File

@@ -0,0 +1,8 @@
'zh-CN':
activerecord:
models:
competition_module_md_content: ''
attributes:
competition_module_md_content:
name: '标题'
content: '内容'

View File

@@ -0,0 +1,7 @@
zh-CN:
enumerize:
coo_img:
img_type:
com_coop: '知名企业'
edu_coop: '各类院校'
alliance_coop: '产学联盟'

View File

@@ -0,0 +1,9 @@
'zh-CN':
activerecord:
models:
ec_course_target: '课程目标'
attributes:
ec_course_target:
content: '内容'
standard_grade: '达成标准(分)'
weight: '权重'

5
config/locales/en.yml Normal file
View File

@@ -0,0 +1,5 @@
en:
error:
record_not_found: Record not found
forbidden: Forbidden
unauthorized: Unauthorized

View File

@@ -0,0 +1,5 @@
'zh-CN':
experience:
container_type:
game: 闯关
shixun_publish: 发布实训

View File

@@ -0,0 +1,8 @@
'zh-CN':
activemodel:
attributes:
add_school_apply_form:
name: 名称
province: 省份
city: 城市
address: 详细地址

View File

@@ -0,0 +1,7 @@
'zh-CN':
activemodel:
attributes:
users/apply_authentication_form:
name: 姓名
id_number: 身份证号

View File

@@ -0,0 +1,9 @@
'zh-CN':
activemodel:
attributes:
users/apply_professional_auth_form:
school_id: 学校/单位
department_id: 学院/部门
identity: 职业
extra: 职称/学号

View File

@@ -0,0 +1,15 @@
'zh-CN':
activemodel:
attributes:
apply_shixun_mirror_form:
language: 语言
runtime: 系统环境
run_method: 测试代码运行方式
attachment_id: 测试代码附件
errors:
models:
apply_shixun_mirror_form:
attributes:
attachment_id:
attachment_not_exist: 不存在

View File

@@ -0,0 +1,15 @@
'zh-CN':
activemodel:
attributes:
users/apply_trail_form:
user: ''
phone: 手机号
code: 验证码
reason: 申请原因
errors:
models:
users/apply_trail_form:
attributes:
user:
already_trial: 已经处于试用状态了

View File

@@ -0,0 +1,6 @@
'zh-CN':
activemodel:
attributes:
users/bind_email_form:
email: 邮箱
code: 验证码

View File

@@ -0,0 +1,6 @@
'zh-CN':
activemodel:
attributes:
users/bind_phone_form:
phone: 手机号
code: 验证码

View File

@@ -0,0 +1,25 @@
'zh-CN':
activemodel:
models:
ecs/create_course_achievement_methods_form: 评价方法
attributes:
ecs/create_course_achievement_methods_form:
course_achievement_methods: 评价方法
ecs/create_course_achievement_methods_form/sub_form:
course_evaluation_id: 考核方式
course_evaluation_subitem_ids: 考核方式分项
score: 支撑总分值
percentage: 评价占比
errors:
models:
ecs/create_course_achievement_methods_form:
attributes:
course_achievement_methods:
percentage_error: 评价占比总和必须在0~100范围内
ecs/create_course_achievement_methods_form/sub_form:
attributes:
course_evaluation_id:
record_not_exist: 不存在
course_evaluation_subitem_ids:
record_not_exist: 不存在

View File

@@ -0,0 +1,17 @@
'zh-CN':
activemodel:
models:
ecs/save_course_evaluation_form: 考核方式
attributes:
ecs/save_course_evaluation_form:
name: 名称
evaluation_count: 考核次数
status: 支撑方式
course_evaluation_subitems: 考核分项
errors:
models:
ecs/save_course_evaluation_form:
attributes:
course_evaluation_subitems:
name_blank: 名称不能为空

View File

@@ -0,0 +1,15 @@
'zh-CN':
activemodel:
models:
ecs/save_graduation_course_support_form: ''
attributes:
ecs/save_graduation_course_support_form:
course_supports: ''
errors:
models:
ecs/save_graduation_course_support_form:
attributes:
course_supports:
weights_too_big: 权重之和不能大于1
not_unique: 支撑课程不能重复

View File

@@ -0,0 +1,12 @@
'zh-CN':
activemodel:
attributes:
libraries/save_form:
title: 标题
content: 描述
author_name: 作者名称
author_school_name: 作者单位
cover_id: 封面
publish: ''
attachment_ids: 附件
tag_ids: 标签

View File

@@ -0,0 +1,8 @@
'zh-CN':
activemodel:
attributes:
competitions/save_prize_team_account_form:
bank: '开户行'
second_bank: '支行'
card_no: '卡号'

View File

@@ -0,0 +1,13 @@
'zh-CN':
activemodel:
attributes:
project_packages/save_form:
category_id: 类型
title: 标题
content: 描述
deadline_at: 截止日期
min_price: 最小价格
max_price: 最大价格
contact_name: 联系人姓名
contact_phone: 联系人电话
code: 验证码

View File

@@ -0,0 +1,26 @@
'zh-CN':
activemodel:
attributes:
competitions/save_team_form:
competition: ''
name: '战队名称'
creator: ''
teacher_ids: ''
member_ids: ''
errors:
models:
competitions/save_team_form:
attributes:
creator:
enrolled: "您已经报名过该竞赛了"
teacher_enroll_forbidden: "本竞赛的参赛者限定为:学生"
member_enroll_forbidden: "本竞赛的参赛者限定为:教师"
teacher_ids:
enroll_forbidden: "本竞赛的参赛者限定为:学生"
invalid_count: "教师数量应为%{minimum}~%{maximum}人"
enrolled: "教师 %{names} 已加入其它战队了"
member_ids:
enroll_forbidden: "本竞赛的参赛者限定为:教师"
invalid_count: "队员数量应为%{minimum}~%{maximum}人"
enrolled: "队员 %{names} 已加入其它战队了"

View File

@@ -0,0 +1,25 @@
'zh-CN':
activemodel:
attributes:
users/update_account_form:
user: ''
nickname: 昵称
name: 姓名
gender: 性别
location: 所在省份
location_city: 所在城市
identity: 职业
technical_title: 职称
school_id: '学校/单位'
department_id: '院系/部门'
errors:
models:
users/update_account_form:
attributes:
school_id:
blank: 不能为空
not_exist: 不存在
department_id:
blank: 不能为空
not_exist: 不存在

View File

@@ -0,0 +1,6 @@
'zh-CN':
activemodel:
attributes:
users/update_password_form:
password: 新密码
old_password: 旧密码

View File

@@ -0,0 +1,20 @@
'zh-CN':
grade:
container_type:
avatar: 首次上传头像
phone: 绑定手机
attendance: 签到
mail: 绑定邮箱
account: 完善基本资料
answer: 查看参考答案
game: 闯关
memo: 额外奖励
discusses: 额外奖励
test_set: 查看隐藏测试集
shixun_publish: 发布实训
star: 实训评分
check_ta_answer: 查看TA人解答
feedback: 额外奖励
authentication: 完成实名认证
professional: 完成职业认证

View File

@@ -0,0 +1,17 @@
zh-CN:
views:
pagination:
first: "&laquo; 首页"
last: "尾页 &raquo;"
previous: "&lsaquo; 上一页"
next: "下一页 &rsaquo;"
truncate: "&hellip;"
helpers:
page_entries_info:
one_page:
display_entries:
zero: "暂无数据"
one: "共<b>1</b>条数据"
other: "共<b>%{count}</b>条数据"
more_pages:
display_entries: "当前<b>%{first}&nbsp;-&nbsp;%{last}</b>,共<b>%{total}</b>条数据"

View File

@@ -0,0 +1,7 @@
zh-CN:
activerecord:
models:
laboratory: ''
attributes:
laboratory:
identifier: '二级域名'

View File

@@ -0,0 +1,7 @@
zh-CN:
library_apply:
status:
'pending': '待审批'
'processed': '已审批'
'refused': '已拒绝'
'agreed': '已同意'

View File

@@ -0,0 +1,4 @@
'zh-CN':
oauth:
wechat:
'40029': '授权已失效,请重新授权'

View File

@@ -0,0 +1,9 @@
zh-CN:
project_package:
status:
pending: 已创建
applying: 审核中
refused: 已拒绝
published: 竞标中
bidding_ended: 待选标
bidding_finished: 已完成

View File

@@ -0,0 +1,10 @@
'zh-CN':
question_bank:
container_type:
Common: 普通作业
Shixun: 实训作业
Group: 分组作业
Exercise: 试卷
Poll: 问卷
GraduationTask: 毕设任务
GradutionTopic: 毕设选题

View File

@@ -0,0 +1,9 @@
zh-CN:
school_daily_report:
teacher_increase_count: 新增教师
student_increase_count: 新增学生
course_increase_count: 新增课堂
shixun_increase_count: 新增实训
shixun_homework_count: 新增实训作业
shixun_evaluate_count: 新增实训评测
active_user_count: 活跃用户

View File

@@ -0,0 +1,7 @@
'en':
shixun:
status:
'0': editing
'1': applying
'2': published
'3': closed

View File

@@ -0,0 +1,7 @@
'zh-CN':
shixun:
status:
'0': 编辑中
'1': 审核中
'2': 已发布
'3': 已关闭

View File

@@ -0,0 +1,31 @@
en:
simple_form:
"yes": 'Yes'
"no": 'No'
required:
text: 'required'
mark: '*'
# You can uncomment the line below if you need to overwrite the whole required html.
# When using html, text and mark won't be used.
# html: '<abbr title="required">*</abbr>'
error_notification:
default_message: "Please review the problems below:"
# Examples
# labels:
# defaults:
# password: 'Password'
# user:
# new:
# email: 'E-mail to sign in.'
# edit:
# email: 'E-mail.'
# hints:
# defaults:
# username: 'User name to sign in.'
# password: 'No special characters, please.'
# include_blanks:
# defaults:
# age: 'Rather not say'
# prompts:
# defaults:
# age: 'Select your age'

View File

@@ -0,0 +1,11 @@
'zh-CN':
subject:
status:
'0': 编辑中
'1': 审核中
'2': 已发布
public:
'editing': 编辑中
'processed': 已发布
'pending': 审核中
'publiced': 已公开

View File

@@ -0,0 +1,241 @@
'zh-CN':
tiding:
ApplyUserAuthentication:
Apply:
"1_end": "申请实名认证:%s %s"
"2_end": "申请职业认证:%s %s"
System:
"1_1_end": "你提交的实名认证申请,审核已通过"
"1_2_end": "你提交的实名认证申请,审核未通过<br/><span>原因:%{reason}</span>"
"2_1_end": "你提交的职业认证申请,审核已通过"
"2_2_end": "你提交的职业认证申请,审核未通过<br/><span>原因:%{reason}</span>"
CancelUserAuthentication_end: "取消了你的实名认证:%s %s"
CancelUserProCertification_end: "取消了你的职业认证:%s %s"
JoinCourse:
"9_end": "申请加入课堂:%s教师"
"7_end": "申请加入课堂:%s助教"
DealCourse:
"9_1_end": "你提交的加入课堂申请:%s教师, 审核已通过"
"9_2_end": "你提交的加入课堂申请:%s教师, 审核未通过"
"7_1_end": "你提交的加入课堂申请:%s助教, 审核已通过"
"7_2_end": "你提交的加入课堂申请:%s助教, 审核未通过"
StudentJoinCourse_end: "%s 加入了课堂:%s学生"
TeacherJoinCourse:
"2_end": "%s将你加入课堂%s教师"
"3_end": "%s将你加入课堂%s助教"
"4_end": "%s将你加入课堂%s学生"
"9_end": "%s将你加入课堂%s教师"
"7_end": "%s将你加入课堂%s助教"
"10_end": "%s将你加入课堂%s学生"
ApplyAddDepartment:
Apply_end: "申请添加二级单位:%s%s"
System:
"1_end": "你提交的添加二级单位申请:%s%s审核已通过"
"2_false_end": "你提交的添加二级单位申请:%s%s审核未通过<br/><span>原因:%{reason}</span>"
"2_true_end": "你提交的添加二级单位申请:%s%s审核未通过"
"3_end": "你提交的添加二级单位申请:%s%s已被更改为%{reason}"
ApplyAddSchools:
Apply_end: "申请添加单位:%s"
System:
"1_end": "你提交的添加单位申请:%{name},审核已通过"
"2_false_end": "你提交的添加单位申请:%{name},审核未通过<br/><span>原因:%{reason}</span>"
"2_true_end": "你提交的添加单位申请:%{name},审核未通过"
"3_end": "你提交的添加单位申请:%{name},已被更改为:%{reason}"
ApplyAction:
ApplyShixun:
System:
"1_end": "你提交的实训发布申请:%{name},审核已通过"
"2_end": "你提交的实训发布申请:%{name},审核未通过<br/><span>原因:%{reason}</span>"
Apply_end: "申请发布实训:%{name}"
ApplySubject:
System:
"1_end": "你提交的实践课程发布申请:%{name},审核已通过"
"2_end": "你提交的实践课程发布申请:%{name},审核未通过<br/><span>原因:%{reason}</span>"
Apply_end: "申请发布实践课程:%{name}"
TrialAuthorization:
System:
"1_end": "你提交的试用授权申请,审核已通过"
"2_end": "你提交的试用授权申请,审核未通过<br/><span>原因:%{reason}</span>"
Apply_end: "提交了试用授权申请"
Course_end: "你创建了课堂:%s"
DeleteCourse_end: "你删除了课堂:%s"
DeleteCourseMember_end: "%s 将你从课堂中删除了:%s"
Shixun_end: "你创建了实训:%s"
Subject_end: "你创建了实践课程:%s"
ArchiveCourse_end: "你的课堂已经归档:%s"
JournalsForMessage:
Mentioned_end: "@了你:%s"
Principal:
true_true_end: "评论了你的回复:%s"
true_false_end: "评论了你的留言:%s"
false_true_end: "给你留言:%s"
false_false_end: "给你私信:%s"
HomeworkCommon:
true_end: "评论了你的回复:%s"
false_end: "评论了你发布的作业:%s"
GraduationTopic:
true_end: "评论了你的回复:%s"
false_end: "评论了你发布的毕设选题:%s"
StudentWorksScore:
true_end: "评论了你的回复:%s"
false_end: "评论了你发布的作品评语:%s"
Message:
Mentioned_end: "@了你:%s"
true_true_end: "评论了你的帖子:%s"
true_false_end: "评论了你的回复:%s"
false_end: "发布了帖子:%s"
Memo:
true_true_end: "评论了你的帖子:%s"
true_false_end: "评论了你的回复:%s"
false_end: "发布了帖子:%s"
Watcher_end: "关注了你"
PraiseTread:
Challenge:
"1_end": "赞了你发布的实训任务:%s第%s关"
"2_end": "踩了你发布的实训任务:%s第%s关"
Hack_end: "赞了你发布的题目:%s"
Memo:
true_end: "赞了你的评论:%s"
false_end: "赞了发布的帖子:%s"
Message:
true_end: "赞了你的评论:%s"
false_end: "赞了发布的帖子:%s"
HomeworkCommon_end: "赞了你发布的作业:%s"
JournalsForMessage:
true_end: "赞了你的留言:%s"
false_end: "赞了你的评论:%s"
Discuss_end: "赞了你的评论:%s"
Issue_end: "赞了你发布的项目Issue%s"
Journal_end: "赞了你的回复%s"
Discuss:
Challenge:
true_end: "评论了你的回复:%s"
false_end: "评论了你发布的实训:%s"
Hack:
true_end: "评论了你的回复:%s"
false_end: "评论了你发布的题目:%s"
Hack:
HackPublish_end: "你发布了题目:%s"
HackUnPublish_end: "你撤销发布了题目:%s"
HackDelete_end: "你删除了题目:%s"
Grade:
Avatar_end: "首次上传头像获得金币奖励:%s金币"
Phone_end: "首次绑定手机号码获得金币奖励:%s金币"
Attendance_end: "签到成功获得金币奖励:%s金币"
Mail_end: "首次绑定邮箱获得金币奖励:%s金币"
Account_end: "首次填写基本资料获得金币奖励:%s金币"
Answer:
true_end: "查看实训%s第%s关的参考答案消耗金币%s金币"
false_end: "查看实训的参考答案消耗金币:%s金币"
Hack_end: "完成题目解答:%s获得金币奖励%s金币"
Game_end: "通过实训%s的第%s关获得金币奖励%s金币"
Memo_end: "发布的评论或者帖子获得平台奖励:%s金币"
Discusses_end: "发布的评论获得金币奖励:%s金币"
testSet_end: "查看实训的第%s关的隐藏测试集消耗的金币%s金币"
shixunPublish_end: "发布实训%s获得的奖励%s金币"
Star_end: "给实训评分获得的随机奖励:%s金币"
Feedback_end: "反馈的问题获得平台奖励:%s金币"
Authentication_end: "用户首次完成实名认证获得的奖励:%s金币"
Professional_end: "用户首次完成职业认证获得的奖励:%s金币"
JoinProject:
3_end: "申请加入项目:%s管理人员"
4_end: "申请加入项目:%s开发人员"
DealProject:
3_1_end: "你提交的加入项目申请:%s管理人员, 审核已通过"
3_2_end: "你提交的加入项目申请:%s管理人员, 审核未通过"
4_1_end: "你提交的加入项目申请:%s开发人员, 审核已通过"
4_2_end: "你提交的加入项目申请:%s开发人员, 审核未通过"
ReporterJoinProject_end: "加入了项目:%s报告人员"
ManagerJoinProject:
3_end: "%s将你加入项目%s管理人员"
4_end: "%s将你加入项目%s开发人员"
5_end: "%s将你加入项目%s报告人员"
Journal_end: "更新了Issue%s"
Journal:
Mentioned_end: "@了你:%s"
Comment:
true_end: "评论了你的回复:%s"
false_end: "评论了你发布的项目issue%s"
Issue_end: "指派了Issue给你%s"
PullRequest:
Apply_end: "提交了PullRequest%s"
2_end: "接受了PullRequest%s"
3_end: "重新打开了PullRequest%s"
4_end: "关闭了PullRequest%s"
SendMessage:
old_end: "申请了新镜像:%s"
new_end: "申请了新镜像:【语言】%s【系统环境】%s【测试代码运行方式】%s"
Poll:
PollPublish_end: "发布了问卷:%s"
NearlyEnd_end: "问卷的截止时间快到啦:%s"
CommitPoll_end: "提交了问卷答题:%s"
Exercise:
ExercisePublish_end: "发布了试卷:%s"
NearlyEnd_end: "试卷的截止时间快到啦:%s"
CommitExercise_end: "提交了试卷答题:%s"
ExerciseScore_end: "评阅了你的试卷:%s"
StudentGraduationTopic_end: "申请选择毕设选题:%s"
DealStudentTopicSelect:
1_end: "你提交的选题申请:%s审核已通过"
2_end: "你提交的选题申请:%s审核未通过"
GraduationTask:
TaskPublish_end: "发布了毕设任务:%s"
NearlyEnd_end: "毕设任务的提交截止时间快到啦:%s"
NearlyLateEnd_end: "毕设任务的补交截止时间快到啦:%s"
CrossComment_end: "开启了交叉评阅:%s"
GraduationWork:
true_end: "提交了作品:%s"
false_end: "重新提交了作品,建议您重新评阅:%s"
GraduationWorkScore_end: "评阅了你的作品:%s"
HomeworkCommon:
AnonymousComment_end: "开启了作业匿评:%{name}"
AnonymousCommentFail_end: "开启作业匿评失败:%{name}<br/><span>原因:%{reason}</span>"
AnonymousAppeal_end: "开启了匿评申诉:%{name}"
HomeworkPublish_end: "发布了作业:%{name}"
NearlyEnd_end: "作业的提交截止时间快到啦:%{name}"
AppealNearlyEnd_end: "作品的匿评申诉时间快到啦:%{name}"
EvaluationNearlyEnd_end: "作业的匿评截止时间快到啦:%{name}"
StudentWork_end: "提交了作品:%s"
ResubmitStudentWork_end: "重新提交了作品,建议您重新评阅作品:%s"
StudentWorksScore:
1_end: "评阅了你的作品:%s"
2_end: "评阅了你的作品:%s"
3_end: "有人匿评了你的作品:%s"
AdjustScore_end: "调整了你的作品得分:%s"
ChallengeWorkScore_end: "调整了你的作品分数:%s"
StudentWorksScoresAppeal:
UserAppealResult:
1_end: "你提交的匿评申诉申请:%s审核已通过"
2_end: "你提交的匿评申诉:%s审核未通过"
AppealResult:
1_end: "别人对你的匿评发起的申诉申请:%s审核已通过"
2_end: "别人对你的匿评发起的申诉申请:%s审核未通过"
StudentWork:
Apply_end: "发起了匿评申诉申请:%s"
HomeworkCommon_end: "发起了匿评申诉申请:%s"
System_end: "有人对你的匿评发起了申诉:%s"
Department_end: "你选填的二级单位:%s%s因不符合规范,已被系统删除.请重新选择"
Library:
Apply_end: "申请发布教学案例:%s"
System:
1_end: "你提交的发布教学案例申请:%s审核已通过"
2_end: "你提交的发布教学案例申请:%s审核未通过<br/><span>原因:%{reason}</span>"
ProjectPackage:
Apply_end: "申请发布众包需求:%s"
System:
1_end: "你提交的众包需求申请:%s审核已通过"
2_end: "你提交的众包需求申请:%s审核未通过<br/><span>原因:%{reason}</span>"
Created_end: "你创建了众包需求:%s"
Destroyed_end: "你删除了众包需求:%s"
Bidding_end: "应征了你发布的众包任务:%s"
BiddingEnd_end: "你发布的众包任务:%s已进入选标阶段请尽快进行选择确认"
BiddingWon_end: "恭喜,你应征的众包任务:%s在评选环节中标了"
BiddingLost_end: "很遗憾,你应征投稿的众包任务:%s未中标"
Video:
Apply_end: "申请发布视频:%s"
System:
1_end: "你提交的发布视频申请:%s审核已通过"
2_end: "你提交的发布视频申请:%s审核未通过<br/><span>原因:%{reason}</span>"
PublicCourseStart_end: "你报名参与的开放课程:%s将于%s正式开课"
SubjectStartCourse_end: "您创建的开放课程:%s 已达到开课人数要求。您可以在24小时内自主开设新一期课程。如果超过24小时未开课平台将自动开课并复制您上一期的课程内容。"
LiveLink_end: "%s 直播将于30分钟后开始"

View File

@@ -0,0 +1,21 @@
'zh-CN':
activerecord:
models:
user: '用户'
attributes:
user:
phone: '手机号'
mail: '邮箱'
user:
identity:
teacher: 教师
student: 学生
professional: 专业人士
developer: 从业者
enterprise: 组织
unselect: 未选择
"0": 教师
"1": 学生
"2": 专业人士
"3": 从业者
"4": 组织

222
config/locales/zh-CN.yml Normal file
View File

@@ -0,0 +1,222 @@
zh-CN:
error:
record_not_found: 您访问的页面不存在或已被删除
forbidden: 您没有权限进行该操作
unauthorized: 未登录
button_test: 测试
button_edit: 编辑
button_delete: 删除
admins_apply_status:
status:
'pending': '待审批'
'processed': '已审批'
'refused': '已拒绝'
'agreed': '已同意'
trend:
Issue: 工单
PullRequest: 合并请求
VersionRelease: 版本发布
create: 创建了
journal: 回复了
close: 关闭了
merge: 合并了
push: 发布了
version:
draft: 草稿
journal_detail:
merge: 合并
issue_tags_value: 标签
lock_issue: 锁定工单
unlock_issue: 解锁工单
destroy_issue_depend: 删除依赖
issue_depend: 增加依赖
work_time: 开始工作
cancel_time: 取消时间跟踪
end_time: 停止工作
subject: 主题
description: 描述
is_private: 私有
assigned_to_id: 指派给
tracker_id: 类型
status_id: 状态
priority_id: 优先级
fixed_version_id: 里程碑
start_date: 开始日期
due_date: 结束日期
estimated_hours: 添加耗时
done_ratio: 完成度
t:
f:
true:
false:
issue_tag_ids: 标签
issue_type: 分类
token: 悬赏金额
close_issue: 工单
activerecord:
attributes:
user:
login: '登录名'
lastname: '姓名'
nickname: '昵称'
discuss:
content: '内容'
journals_for_message:
notes: '内容'
subject:
name: '课程名称'
description: '课程简介'
learning_notes: '学习须知'
stage:
name: '章节名称'
description: '章节描述'
shixun_info:
description: '简介'
fork_reason: 'fork原因'
challenge:
task_pass: '过关任务'
test_set:
input: '输入'
output: '输出'
challenge_question:
option_name: '选项'
challenge_choose:
subject: '题干'
challenge_answer:
contents: '答案内容'
memo:
content: '帖子内容'
course:
name: '课堂名称'
course_group:
name: '分班名称'
course_module:
module_name: '目录名称'
course_second_category:
name: '目录名称'
inform:
name: '标题'
description: '内容'
course_stage:
name: '章节名称'
description: '章节描述'
attachment:
description: '资源描述'
message:
subject: '标题'
message_detail:
content: '内容'
homework_common:
name: '标题'
description: '内容'
explanation: '内容'
reference_answer: '参考答案'
student_work:
description: '内容'
student_works_score:
comment: '评语'
challenge_work_score:
comment: '评语'
shixun_work_comment:
comment: '评语'
hidden_comment: '隐藏评语'
graduation_topic:
name: '选题名称'
description: '选题简介'
graduation_task:
name: '任务标题'
description: '内容'
graduation_work:
description: '作品内容'
graduation_work_score:
comment: '评语'
poll:
polls_name: '问卷标题'
polls_description: '问卷须知'
poll_question:
question_title: '题干'
poll_answer:
answer_text: '选项'
poll_vote:
vote_text: '内容'
exercise:
exercise_name: '试卷标题'
exercise_description: '试卷须知'
exercise_question:
question_title: '题干'
exercise_choice:
choice_text: '选项'
exercise_answer:
answer_text: '答案'
exercise_standard_answer:
answer_text: '参考答案'
exercise_answer_comment:
comment: '评语'
homework_bank:
name: '标题'
description: '内容'
reference_answer: '参考答案'
gtask_bank:
name: '任务标题'
description: '内容'
gtopic_bank:
name: '选题名称'
description: '选题简介'
exercise_bank:
name: '试卷标题'
description: '试卷须知'
exercise_bank_question:
question_title: '题干'
exerise_bank_choice:
choice_text: '选项'
exercise_bank_standard_answer:
answer_text: '参考答案'
library:
title: '标题'
content: '内容'
author_name: '作者姓名'
author_school_name: '作者单位名称'
competition:
introduction: '简介'
competition_module_md_content:
content: '内容'
chart_rule:
content: '内容'
project_package:
title: '标题'
examination_bank:
name: '试卷名称'
item_bank:
name: '题干'
item_analysis:
analysis: '解析'
item_choice:
choice_text: '选项'
hack:
name: '任务名称'
description: '描述'
hack_set:
input: '测试集输入'
output: '测试集输出'
hack_user_lastest_code:
notes: '笔记'
trustie_hack:
description: '描述'
discipline:
name: '名称'
sub_discipline:
name: '名称'
tag_discipline:
name: '名称'
live_link:
description: '说明'
url: '链接'
course_name: '课程名称'
platform: '直播平台'
live_time: '开播时间'
duration: '直播时长'
close_pr: 合并请求

34
config/puma.rb Normal file
View File

@@ -0,0 +1,34 @@
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart

655
config/routes.rb Normal file
View File

@@ -0,0 +1,655 @@
Rails.application.routes.draw do
require 'sidekiq/web'
require 'admin_constraint'
mount Sidekiq::Web => '/sidekiq', :constraints => AdminConstraint.new
get 'attachments/download/:id', to: 'attachments#show'
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'
scope '/api' do
resources :composes do
resources :compose_projects, only: [:create, :destroy]
end
get 'home/index'
get 'home/search'
get 'main/first_stamp'
get 'search', to: 'searchs#index'
put 'commons/hidden', to: 'commons#hidden'
put 'commons/unhidden', to: 'commons#unhidden'
delete 'commons/delete', to: 'commons#delete'
resources :issues, except: [:index, :new,:create, :update, :edit, :destroy] do
resources :journals, only: [:index, :create, :destroy, :edit, :update]
resources :issue_times, only: [:create] do
collection do
post :end_work
end
end
resources :issue_depends, only: [:create, :destroy]
end
resources :project_categories, only: [:index, :show] do
get :group_list, on: :collection
end
resources :project_languages, only: [:index, :show]
resources :ignores, only: [:index, :show]
resources :licenses, only: [:index, :show]
resources :disciplines, only: [:index]
resources :tag_disciplines, only: [:create]
resources :projects do
resources :pull_requests, except: [:destroy] do
member do
post :pr_merge
post :check_merge
end
collection do
post :check_can_merge
end
end
resources :version_releases, only: [:index,:new, :create, :edit, :update, :destroy]
resources :project_trends, only: [:index, :create]
resources :issues do
collection do
get :commit_issues
get :index_chosen
end
member do
post :copy
post :close_issue
post :lock_issue
end
end
resources :issue_tags, only: [:create, :edit, :update, :destroy, :index]
resources :versions do
member do
post :update_status
end
end
resources :watchers, only: [:index] do
collection do
post :follow
delete :unfollow
get :check_watch
end
end
resources :praise_tread, only: [:index] do
collection do
post :like
delete :unlike
get :check_like
end
end
resources :members, only: [:index, :create] do
collection do
delete :remove
put :change_role
end
end
resources :forks, only: [:create]
collection do
post :migrate
get :group_type_list
post :watch
end
member do
get :branches
post :watch
end
end
resources :accounts do
collection do
post :login
post :register
post :reset_password
get :logout
get :get_verification_code
get :valid_email_and_phone
post :remote_register
end
end
resources :users do
member do
get :homepage_info
end
collection do
post :following
post :unfollow
get :get_user_info
get :attachment_show
get :html_show
get :get_navigation_info
post :reply_message
get :search_user_projects
post :brief_introduction
post :attendance
get :system_update
get :me
get :list
end
scope module: :users do
resources :courses, only: [:index]
resources :projects, only: [:index]
resources :subjects, only: [:index]
resources :project_packages, only: [:index]
# 私信
resources :private_messages, only: [:index, :create, :destroy]
resources :recent_contacts, only: [:index]
resource :private_message_details, only: [:show]
resource :unread_message_info, only: [:show]
end
resource :trial_apply, only: [:create]
resources :projects, module: :users, only: [] do
get :search, on: :collection
end
resources :tidings, only: [:index]
scope module: :users do
resource :interest, only: [:create]
resources :accounts, only: [:show, :update] do
resource :phone_bind, only: [:create]
resource :email_bind, only: [:create]
resource :password, only: [:update]
resource :avatar, only: [:update]
resource :auth_attachment, only: [:create]
resource :authentication_apply, only: [:create, :destroy]
resource :professional_auth_apply, only: [:create, :destroy]
resources :open_users, only: [:destroy]
end
end
end
get '/:login/:repo_identifier', to: 'repositories#show'
get '/:login/:repo_identifier/edit', to: 'repositories#edit'
resources :repositories, path: '/:login/:repo_identifier', only: [:index] do
collection do
get :entries
match :sub_entries, :via => [:get, :put]
get :commits
get :single_commit
post :files
get :tags
end
end
resources :contents, path: '/:login/:repo_identifier/contents', only: [:create] do
collection do
put 'files/update', :action => 'update_file'
delete 'files/delete', :action => 'delete_file'
end
end
resources :users_for_private_messages, only: [:index]
resources :files, only: [:index, :show, :update] do
collection do
delete :bulk_delete
put :bulk_move
post :bulk_send
put :bulk_public
get :public_with_course_and_project
get :mine_with_course_and_project
post :import
post :upload
put :bulk_publish
end
member do
get :histories
end
end
resources :courses do
member do
get 'settings', :action => 'settings', :as => 'settings'
post 'set_invite_code_halt'
post 'set_public_or_private'
post 'search_teacher_candidate'
post 'add_teacher'
post 'create_graduation_group'
post 'join_graduation_group'
post 'set_course_group'
post 'change_course_admin'
post 'change_member_role'
post 'change_course_teacher'
post 'delete_course_teacher'
post 'teacher_application_review'
post 'transfer_to_course_group'
post 'delete_from_course'
post 'add_students_by_search'
post 'create_group_by_importing_file'
post 'duplicate_course'
post 'visits_plus_one'
get 'get_historical_courses'
get 'get_historical_course_students'
get 'course_group_list'
get 'add_teacher_popup'
get 'teachers'
get 'apply_teachers'
get 'graduation_group_list'
get 'top_banner'
get 'left_banner'
get 'students'
get 'all_course_groups'
get 'search_users'
get 'base_info'
get 'attahcment_category_list'
get 'export_member_scores_excel' #导出课堂信息
get 'export_couser_info'
get 'export_member_act_score'
post 'switch_to_teacher'
post 'switch_to_assistant'
post 'switch_to_student'
post 'exit_course'
get 'informs'
post 'update_informs'
post 'new_informs'
delete 'delete_informs'
get 'online_learning'
post 'join_excellent_course'
get 'tasks_list'
post 'update_task_position'
get 'course_groups'
post 'join_course_group'
get 'work_score'
get 'act_score'
get 'statistics'
get 'course_videos'
delete 'delete_course_video'
post :inform_up
post :inform_down
end
collection do
post 'apply_to_join_course'
post 'search_course_list'
get 'board_list'
get 'mine'
get 'search_slim'
end
resources :course_stages, shallow: true do
member do
post :up_position
post :down_position
end
end
resources :course_groups, shallow: true do
member do
post 'rename_group'
post 'move_category'
post 'set_invite_code_halt'
end
end
end
resources :course_modules, shallow: true do
member do
get 'sticky_module'
get 'hidden_module'
post 'rename_module'
post 'add_second_category'
end
collection do
post 'unhidden_modules'
end
end
resources :course_second_categories, shallow: true do
member do
post 'rename_category'
post 'move_category'
end
end
resources :attachments do
collection do
delete :destroy_files
end
end
resources :repertoires, only: [:index]
scope module: :projects do
resources :project_applies, only: [:create]
end
namespace :wechats do
resource :js_sdk_signature, only: [:create]
end
resource :template, only: [:show]
resource :setting, only: [:show]
get '/auth/qq/callback', to: 'oauth/qq#create'
get '/auth/wechat/callback', to: 'oauth/wechat#create'
resource :bind_user, only: [:create]
resources :hot_keywords, only: [:index]
namespace :weapps do
resource :home, only: [:show]
resource :session, only: [:create]
resource :register, only: [:create]
resource :verification_code, only: [:create]
resource :code_session, only: [:create]
resource :verify, only: [:create]
resource :check_account, only: [:create]
resource :unbind_accounts, only: [:show, :destroy]
resources :searchs, only: [:index]
resources :course_stickies, only: [:create] do
post :cancel_sticky, on: :collection
end
resources :shixun_lists, only: [:index]
resources :subjects, path: :paths, only: [:index, :create, :update, :edit, :show]
resources :challenges do
get :is_play, on: :member
end
resources :courses, only: [:create, :update, :edit, :show] do
member do
get :shixun_homework_category
get :teachers
get :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
get :check_invite_code
end
end
end
end
namespace :admins do
get '/', to: 'dashboards#index'
resources :project_statistics, only: [:index] do
collection do
get :visits_static
end
end
resources :major_informations, only: [:index]
resources :ec_templates, only: [:index, :destroy] do
collection do
post :create_template
end
end
resources :graduation_standards, only: [:index, :destroy] do
collection do
post :create_standard
end
end
resources :auth_schools, only: [:index, :destroy] do
collection do
get :search_school
post :add_school
get :search_manager
post :add_manager
post :remove_manager
end
end
resources :dashboards, only: [:index] do
collection do
get :month_active_user
get :evaluate
end
end
resources :files, only: [:create]
resources :daily_school_statistics, only: [:index] do
get :export, on: :collection
end
resources :school_statistics, only: [:index] do
get :contrast, on: :collection
end
resources :users, only: [:index, :edit, :update, :destroy] do
member do
post :reward_grade
post :lock
post :unlock
post :active
post :reset_login_times
end
end
resource :import_disciplines, only: [:create]
resource :import_users, only: [:create]
resource :import_course_members, only: [:create]
resources :user_statistics, only: [:index] do
get :export, on: :collection
end
resources :library_applies, only: [:index] do
member do
post :agree
post :refuse
end
end
resources :video_applies, only: [:index] do
member do
post :agree
post :refuse
end
end
resources :identity_authentications, only: [:index] do
member do
post :agree
post :refuse
post :revoke
end
collection do
post :batch_agree
end
end
resources :professional_authentications, only: [:index] do
member do
post :agree
post :refuse
post :revoke
end
collection do
post :batch_agree
end
end
resources :shixun_authorizations, only: [:index] do
member do
post :agree
post :refuse
end
end
resources :subject_authorizations, only: [:index] do
member do
post :agree
post :refuse
end
end
resources :project_package_applies, only: [:index] do
member do
post :agree
post :refuse
end
end
resources :item_authentications, only: [:index, :show] do
member do
post :agree
post :refuse
end
end
resources :examination_authentications, only: [:index] do
member do
post :agree
post :refuse
end
end
resources :shixuns, only: [:index,:destroy]
resources :shixun_settings, only: [:index,:update] do
post :update_tag_repertoires, on: :member
end
resources :shixun_feedback_messages, only: [:index]
resources :shixun_recycles, only: [:index, :destroy] do
post :resume, on: :member
end
resources :shixun_modify_records, only: [:index]
resources :department_applies,only: [:index,:destroy] do
collection do
post :merge
end
member do
post :agree
end
end
resources :unit_applies,only: [:index,:destroy,:edit,:update] do
member do
post :agree
end
end
resources :mirror_repositories, only: [:index, :new, :create, :edit, :update, :destroy] do
collection 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]
resources :schools, only: [:index, :destroy]
resources :departments, only: [:index, :create, :edit, :update, :destroy] do
resource :department_member, only: [:create, :destroy]
post :merge, on: :collection
end
resource :about, only: [:edit, :update]
resource :agreement, only: [:edit, :update]
resource :help_center, only: [:edit, :update]
resource :contact_us, only: [:edit, :update] do
patch :update_address, on: :collection
end
resources :cooperatives, only: [:index, :create, :update, :destroy] do
post :drag, on: :collection
post :replace_image_url, on: :member
end
resources :laboratories, only: [:index, :create, :destroy, :update] do
member do
get :shixuns_for_select
get :subjects_for_select
get :synchronize_user
post :update_sync_course
end
resource :laboratory_setting, only: [:show, :update]
resource :laboratory_user, only: [:create, :destroy]
resources :carousels, only: [:index, :create, :update, :destroy] do
post :drag, on: :collection
end
resources :laboratory_shixuns, only: [:index, :create, :destroy] do
member do
post :homepage
post :cancel_homepage
end
end
resources :laboratory_subjects, only: [:index, :create, :destroy] do
member do
post :homepage
post :cancel_homepage
end
end
end
resources :weapp_carousels, only: [:index, :create, :update, :destroy] do
post :drag, on: :collection
end
resources :weapp_adverts, only: [:index, :create, :update, :destroy] do
post :drag, on: :collection
end
resources :subject_settings, only: [:index, :update] do
post :update_mobile_show, on: :collection
end
resources :subjects, only: [:index, :edit, :update, :destroy] do
member do
post :hide
post :cancel_hide
post :homepage_show
post :cancel_homepage_show
post :excellent
post :cancel_excellent
end
end
resources :partners, only: [:index, :create, :destroy] do
resources :customers, only: [:index, :create, :destroy]
end
resources :course_lists, only: [:index, :destroy] do
post :merge, on: :collection
end
resources :courses, only: [:index, :destroy, :update]
resources :projects, only: [:index, :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]
resources :tag_repertoires, only: [:index, :create, :edit, :update, :destroy]
resources :salesmans, only: [:index, :create, :edit, :update, :destroy] do
post :batch_add, on: :collection
end
resources :salesman_channels, only: [:index, :create, :edit, :update, :destroy] do
post :batch_add, on: :collection
end
resources :salesman_customers, only: [:index, :create, :edit, :update, :destroy] do
post :batch_add, on: :collection
end
end
#git 认证回调
match 'gitauth/*url', to: 'gits#auth', via: :all
get 'oauth/get_code', to: 'oauth#get_code'
get 'oauth/get_token_callback', to: 'oauth#get_token_callback'
root 'main#index'
## react用
get '*path', to: 'main#index', constraints: ReactConstraint.new
end

8
config/sidekiq.yml Normal file
View File

@@ -0,0 +1,8 @@
:concurrency: <%= ENV["sidekiq_threads"] || 20 %>
:pidfile: tmp/pids/sidekiq.pid
:logfile: log/sidekiq.log
:queues:
- [default, 3]
- [searchkick, 10]
- [notify, 100]
- [mailers, 101]

6
config/spring.rb Normal file
View File

@@ -0,0 +1,6 @@
%w[
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
].each { |path| Spring.watch(path) }

34
config/storage.yml Normal file
View File

@@ -0,0 +1,34 @@
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
local:
service: Disk
root: <%= Rails.root.join("storage") %>
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
# service: S3
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
# region: us-east-1
# bucket: your_own_bucket
# Remember not to checkin your GCS keyfile to a repository
# google:
# service: GCS
# project: your_project
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
# bucket: your_own_bucket
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
# microsoft:
# service: AzureStorage
# storage_account_name: your_account_name
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
# container: your_container_name
# mirror:
# service: Mirror
# primary: local
# mirrors: [ amazon, google, microsoft ]