字符限制提示的国际化

dev_new_shixunsrepository
cxt 5 years ago
parent 1185eb6683
commit 26dd6312a7

@ -6,7 +6,7 @@ class ExaminationBanks::SaveExamForm
validates :discipline_id, presence: true
validates :sub_discipline_id, presence: true
validates :difficulty, presence: true, inclusion: {in: 1..3}, numericality: { only_integer: true }
validates :name, presence: true, length: { maximum: 60, too_long: "名称不能超过60个字符" }
validates :name, presence: true, length: { maximum: 60, too_long: "不能超过60个字符" }
validate :validate_duration
def validate_duration

@ -7,8 +7,8 @@ class ItemBanks::SaveItemForm
validates :sub_discipline_id, presence: true
validates :item_type, presence: true, inclusion: {in: %W(SINGLE MULTIPLE JUDGMENT COMPLETION SUBJECTIVE PRACTICAL PROGRAM)}
validates :difficulty, presence: true, inclusion: {in: 1..3}, numericality: { only_integer: true }
validates :name, presence: true, length: { maximum: 1000, too_long: "题干不能超过1000个字符" }
validates :analysis, length: { maximum: 1000, too_long: "解析不能超过1000个字符" }
validates :name, presence: true, length: { maximum: 1000, too_long: "不能超过1000个字符" }
validates :analysis, length: { maximum: 1000, too_long: "不能超过1000个字符" }
def validate!
super
@ -27,7 +27,7 @@ class ItemBanks::SaveItemForm
attr_accessor :choice_text, :is_answer
validates :choice_text, presence: true, length: { maximum: 500, too_long: "选项不能超过500个字符" }
validates :choice_text, presence: true, length: { maximum: 500, too_long: "不能超过500个字符" }
validates :is_answer, presence: true, inclusion: {in: 0..1}, numericality: { only_integer: true }
end
end

@ -4,7 +4,7 @@ module Validate
attr_accessor :nickname, :lastname
validates :nickname, presence: true, length: { maximum: 10, too_long: "昵称不能超过10个字符" }
validates :nickname, presence: true, length: { maximum: 10, too_long: "不能超过10个字符" }
validates :lastname, presence: true
end
end

@ -25,7 +25,7 @@ class Attachment < ApplicationRecord
scope :search_by_container, -> (ids) {where(container_id: ids)}
scope :unified_setting, -> {where("unified_setting = ? ", 1)}
validates_length_of :description, maximum: 100, message: "资源描述不能超过100个字符"
validates_length_of :description, maximum: 100, message: "不能超过100个字符"
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)

@ -28,7 +28,7 @@ class Challenge < ApplicationRecord
scope :fields_for_list, -> { select([:id, :subject, :st, :score, :position, :shixun_id]) }
validates :task_pass, length: { maximum: 10000, too_long: "过关任务不能超过10000个字符" }
validates :task_pass, length: { maximum: 10000, too_long: "不能超过10000个字符" }
after_commit :create_diff_record

@ -3,7 +3,7 @@ class ChallengeAnswer < ApplicationRecord
belongs_to :challenge
has_many :game_answers, :dependent => :destroy
validates :contents, length: { maximum: 5000 , too_long: "答案内容不能超过5000个字符"}
validates :contents, length: { maximum: 5000 , too_long: "不能超过5000个字符"}
def view_answer_time(user_id)
game_answers.where(user_id: user_id).last&.view_time

@ -4,6 +4,6 @@ class ChallengeChoose < ApplicationRecord
has_many :challenge_tags, :dependent => :destroy
has_many :challenge_questions, dependent: :destroy
validates :subject, length: { maximum: 1000, too_long: "题干不能超过1000个字符" }
validates :subject, length: { maximum: 1000, too_long: "不能超过1000个字符" }
end

@ -1,6 +1,6 @@
class ChallengeQuestion < ApplicationRecord
belongs_to :challenge_choose
validates :option_name, length: { maximum: 500, too_long: "选项不能超过500个字符" }
validates :option_name, length: { maximum: 500, too_long: "不能超过500个字符" }
end

@ -4,6 +4,8 @@ class ChallengeWorkScore < ApplicationRecord
belongs_to :challenge
has_many :tidings, as: :container, dependent: :destroy
validates :comment, length: { maximum: 500, too_long: "不能超过500个字符" }
def create_tiding trigger_user_id
tidings << Tiding.new(user_id: student_work.user_id, trigger_user_id: trigger_user_id, container_id: id,
container_type: "ChallengeWorkScore", parent_container_id: student_work_id,

@ -2,5 +2,5 @@ class ChartRule < ApplicationRecord
belongs_to :competition
belongs_to :competition_stage, optional: true
validates :content, length: { maximum: 1000, too_long: "内容不能超过1000个字符" }
validates :content, length: { maximum: 1000, too_long: "不能超过1000个字符" }
end

@ -33,7 +33,7 @@ class Competition < ApplicationRecord
has_many :competition_prizes, dependent: :destroy
has_many :competition_prize_users, dependent: :destroy
validates :introduction, length: { maximum: 500, too_long: "简介不能超过500个字符" }
validates :introduction, length: { maximum: 500, too_long: "不能超过500个字符" }
before_save :set_laboratory
after_create :create_competition_modules

@ -5,6 +5,6 @@ class CompetitionModuleMdContent < ApplicationRecord
# validates :name, presence: true
validates :content, presence: true
validates :content, length: { maximum: 10000 , too_long: "内容不能超过10000个字符"}
validates :content, length: { maximum: 10000 , too_long: "不能超过10000个字符"}
end

@ -108,7 +108,7 @@ class Course < ApplicationRecord
NORMAL = 6 # 普通用户
Anonymous = 7 # 普未登录
validates :name, presence: true, length: { maximum: 60, too_long: "课堂名称不能超过60个字符" }
validates :name, presence: true, length: { maximum: 60, too_long: "不能超过60个字符" }
before_save :set_laboratory
after_create :create_board_sync, :act_as_course_activity, :send_tiding

@ -9,7 +9,7 @@ class CourseGroup < ApplicationRecord
has_many :homework_group_settings, :dependent => :destroy
scope :by_group_ids, lambda { |ids| where(id: ids)}
validates :name, length: { maximum: 60, too_long: "分班名称不能超过60个字符" }
validates :name, length: { maximum: 60, too_long: "不能超过60个字符" }
validates_uniqueness_of :name, scope: :course_id, message: "不能创建相同名称的分班"
after_create :generate_invite_code

@ -5,7 +5,7 @@ class CourseModule < ApplicationRecord
# 二级目录
has_many :course_second_categories
validates :module_name, length: { maximum: 20, too_long: "目录名称不能超过20个字符" }
validates :module_name, length: { maximum: 20, too_long: "不能超过20个字符" }
scope :not_hidden, -> { where(hidden: 0) }
scope :graduation_module, -> { where(module_type: "graduation") }

@ -5,7 +5,7 @@ class CourseSecondCategory < ApplicationRecord
belongs_to :course_module
has_many :homework_commons
validates :name, length: { maximum: 60, too_long: "名称不能超过60个字符" }
validates :name, length: { maximum: 60, too_long: "不能超过60个字符" }
def category_type_str
category_type == "graduation" && name == "毕设选题" ? "graduation_topics" : (

@ -4,6 +4,6 @@ class CourseStage < ApplicationRecord
has_many :course_stage_shixuns, -> { order("course_stage_shixuns.position ASC") }, dependent: :destroy
has_many :shixuns, :through => :course_stage_shixuns
validates :name, length: { maximum: 60 , too_long: "章节名称不能超过60个字符"}
validates :description, length: { maximum: 1000, too_long: "章节描述不能超过1000个字符" }
validates :name, length: { maximum: 60 , too_long: "不能超过60个字符"}
validates :description, length: { maximum: 1000, too_long: "不能超过1000个字符" }
end

@ -19,8 +19,8 @@ class Exercise < ApplicationRecord
scope :exercise_search, lambda { |keywords|
where("exercise_name LIKE ?", "%#{keywords}%") unless keywords.blank?}
validates :exercise_name, length: { maximum: 60, too_long: "试卷名称不能超过60个字符" }
validates :exercise_description, length: { maximum: 100, too_long: "试卷须知不能超过100个字符" }
validates :exercise_name, length: { maximum: 60, too_long: "不能超过60个字符" }
validates :exercise_description, length: { maximum: 100, too_long: "不能超过100个字符" }
after_create :create_exercise_list

@ -11,6 +11,6 @@ class ExerciseAnswer < ApplicationRecord
scope :exercise_answer_is_right, -> {where("score > ?",0.0)} #判断答案是否正确根据分数总和大于0
scope :score_reviewed, lambda {where("score >= ?",0.0)} #是否评分,用于判断主观题的
validates :answer_text, length: { maximum: 5000, too_long: "答案不能超过5000个字符" }
validates :answer_text, length: { maximum: 5000, too_long: "不能超过5000个字符" }
end

@ -7,5 +7,5 @@ class ExerciseAnswerComment < ApplicationRecord
scope :search_answer_comments, lambda {|name,ids| where("#{name}":ids)}
validates :comment, length: { maximum: 100, too_long: "评语不能超过100个字符" }
validates :comment, length: { maximum: 100, too_long: "不能超过100个字符" }
end

@ -18,7 +18,7 @@ class ExerciseBank < ApplicationRecord
scope :exercise_bank_search, lambda { |keywords|
where("name LIKE ?", "%#{keywords}%") unless keywords.blank?}
validates :name, length: { maximum: 60, too_long: "试卷名称不能超过60个字符" }
validates :description, length: { maximum: 100, too_long: "试卷须知不能超过100个字符" }
validates :name, length: { maximum: 60, too_long: "不能超过60个字符" }
validates :description, length: { maximum: 100, too_long: "不能超过100个字符" }
end

@ -5,6 +5,6 @@ class ExerciseBankChoice < ApplicationRecord
scope :find_choice_custom, lambda {|k,v| where("#{k} = ?",v)} #根据传入的参数查找问题
scope :left_choice_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题
validates :choice_text, length: { maximum: 500, too_long: "选项不能超过500个字符" }
validates :choice_text, length: { maximum: 500, too_long: "不能超过500个字符" }
end

@ -11,7 +11,7 @@ class ExerciseBankQuestion < ApplicationRecord
scope :left_question_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题
scope :find_objective_questions, -> {where("question_type != ?",4)} #查找全部客观题
validates :question_title, length: { maximum: 1000, too_long: "题干不能超过1000个字符" }
validates :question_title, length: { maximum: 1000, too_long: "不能超过1000个字符" }
def question_type_name
case self.question_type

@ -4,6 +4,6 @@ class ExerciseBankStandardAnswer < ApplicationRecord
#attr_accessible :answer_text
scope :standard_by_ids, lambda { |s| where(exercise_bank_choice_id: s) }
validates :answer_text, length: { maximum: 5000, too_long: "参考答案不能超过5000个字符" }
validates :answer_text, length: { maximum: 5000, too_long: "不能超过5000个字符" }
end

@ -7,6 +7,6 @@ class ExerciseChoice < ApplicationRecord
scope :find_choice_custom, lambda {|k,v| where("#{k} = ?",v)} #根据传入的参数查找问题
scope :left_choice_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题
validates :choice_text, length: { maximum: 500, too_long: "选项不能超过500个字符" }
validates :choice_text, length: { maximum: 500, too_long: "不能超过500个字符" }
end

@ -16,7 +16,7 @@ class ExerciseQuestion < ApplicationRecord
scope :left_question_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题
scope :find_objective_questions, -> {where("question_type != ?",4)} #查找全部客观题
validates :question_title, length: { maximum: 1000, too_long: "题干不能超过1000个字符" }
validates :question_title, length: { maximum: 1000, too_long: "不能超过1000个字符" }
def question_type_name

@ -6,5 +6,5 @@ class ExerciseStandardAnswer < ApplicationRecord
scope :find_standard_answer_custom, lambda {|k,v| where("#{k} = ?",v)} #根据传入的参数查找问题
scope :standard_by_ids, lambda { |s| where(exercise_choice_id: s) }
validates :answer_text, length: { maximum: 5000, too_long: "参考答案不能超过5000个字符" }
validates :answer_text, length: { maximum: 5000, too_long: "不能超过5000个字符" }
end

@ -29,8 +29,8 @@ class GraduationTask < ApplicationRecord
belongs_to :gtask_bank, optional: true
validates :name, length: { maximum: 60, too_long: "任务名称不能超过60个字符" }
validates :description, length: { maximum: 5000, too_long: "任务描述不能超过5000个字符" }
validates :name, length: { maximum: 60, too_long: "不能超过60个字符" }
validates :description, length: { maximum: 5000, too_long: "不能超过5000个字符" }
# 未提交
scope :unfinished, -> {where(status: 0)}

@ -19,8 +19,8 @@ class GraduationTopic < ApplicationRecord
#after_create :act_as_course_activity
# 课题名称和描述字段长度限制
validates :name, length: { maximum: 60, too_long: "选题名称不能超过60个字符" }
validates :description, length: { maximum: 5000, too_long: "选题描述不能超过5000个字符" }
validates :name, length: { maximum: 60, too_long: "不能超过60个字符" }
validates :description, length: { maximum: 5000, too_long: "不能超过5000个字符" }
def status_name
case self.status

@ -19,7 +19,7 @@ class GraduationWork < ApplicationRecord
# has_many :formal_graduation_task_group_assignations, -> { formal }, class_name: "GraduationTaskGroupAssignation"
# has_many :temporary_graduation_task_group_assignations, -> { temporary }, class_name: "GraduationTaskGroupAssignation"
validates :description, length: { maximum: 5000, too_long: "作品描述不能超过5000个字符" }
validates :description, length: { maximum: 5000, too_long: "不能超过5000个字符" }
scope :has_committed, lambda { where("work_status != 0") }

@ -5,5 +5,5 @@ class GraduationWorkScore < ApplicationRecord
belongs_to :graduation_task
has_many :attachments, as: :container, dependent: :destroy
validates :comment, length: { maximum: 1000, too_long: "评语不能超过1000个字符" }
validates :comment, length: { maximum: 1000, too_long: "不能超过1000个字符" }
end

@ -9,6 +9,6 @@ class GtaskBank < ApplicationRecord
scope :myself, ->(user_id) { where(user_id: user_id)}
scope :is_public, -> { where(:is_public => true) }
validates :name, length: { maximum: 60, too_long: "任务名称不能超过60个字符" }
validates :description, length: { maximum: 5000, too_long: "任务描述不能超过5000个字符" }
validates :name, length: { maximum: 60, too_long: "不能超过60个字符" }
validates :description, length: { maximum: 5000, too_long: "不能超过5000个字符" }
end

@ -10,6 +10,6 @@ class GtopicBank < ApplicationRecord
# 课题名称和描述字段长度限制
validates :name, length: { maximum: 60, too_long: "选题名称不能超过60个字符" }
validates :description, length: { maximum: 5000, too_long: "选题描述不能超过5000个字符" }
validates :name, length: { maximum: 60, too_long: "不能超过60个字符" }
validates :description, length: { maximum: 5000, too_long: "不能超过5000个字符" }
end

@ -2,8 +2,8 @@ class Hack < ApplicationRecord
# status: 0 未发布; 1已发布
# diffcult: 难度 1简单2中等 3困难
# 编程题
validates_length_of :name, maximum: 60, message: "名称不能超过60个字符"
validates_length_of :description, maximum: 5000, message: "描述不能超过5000个字符"
validates_length_of :name, maximum: 60, message: "不能超过60个字符"
validates_length_of :description, maximum: 5000, message: "不能超过5000个字符"
validates :description, presence: { message: "描述不能为空" }
validates :name, presence: { message: "名称不能为空" }
# 测试集

@ -1,6 +1,6 @@
class HackSet < ApplicationRecord
validates_length_of :input, maximum: 1000, message: "测试集输入不能超过5000个字符"
validates_length_of :output, maximum: 1000, message: "测试集输出不能超过5000个字符"
validates_length_of :input, maximum: 1000, message: "不能超过5000个字符"
validates_length_of :output, maximum: 1000, message: "不能超过5000个字符"
validates :input, presence: { message: "测试集输入不能为空" }
validates :output, presence: { message: "测试集输出不能为空" }
validates_uniqueness_of :input, scope: [:hack_id, :input], message: "多个测试集的输入不能相同"

@ -12,6 +12,6 @@ class HackUserLastestCode < ApplicationRecord
scope :mine_hack, ->(author_id){ where(user_id: author_id) }
scope :passed, -> {where(status: 1)}
validates_length_of :notes, maximum: 5000, message: "笔记不能超过5000个字"
validates_length_of :notes, maximum: 5000, message: "不能超过5000个字"
end

@ -10,7 +10,7 @@ class HomeworkBank < ApplicationRecord
scope :is_public, -> { where(is_public: true)}
scope :myself, ->(user_id) { where(user_id: user_id)}
validates :name, length: { maximum: 60, too_long: "作业名称不能超过60个字符" }
validates :description, length: { maximum: 15000, too_long: "作业描述不能超过15000个字符" }
validates :reference_answer, length: { maximum: 15000, too_long: "参考答案不能超过15000个字符" }
validates :name, length: { maximum: 60, too_long: "不能超过60个字符" }
validates :description, length: { maximum: 15000, too_long: "不能超过15000个字符" }
validates :reference_answer, length: { maximum: 15000, too_long: "不能超过15000个字符" }
end

@ -35,10 +35,10 @@ class HomeworkCommon < ApplicationRecord
# 学生的查重情况
has_many :homework_review_results, :dependent => :destroy
validates :name, length: { maximum: 60, too_long: "作业名称不能超过60个字符" }
validates :description, length: { maximum: 15000, too_long: "作业描述不能超过15000个字符" }
validates :explanation, length: { maximum: 5000, too_long: "说明不能超过5000个字符" }
validates :reference_answer, length: { maximum: 15000, too_long: "参考答案不能超过15000个字符" }
validates :name, length: { maximum: 60, too_long: "不能超过60个字符" }
validates :description, length: { maximum: 15000, too_long: "不能超过15000个字符" }
validates :explanation, length: { maximum: 5000, too_long: "不能超过5000个字符" }
validates :reference_answer, length: { maximum: 15000, too_long: "不能超过15000个字符" }
# after_update :update_activity
before_destroy :update_homework_bank_quotes

@ -1,8 +1,8 @@
class Inform < ApplicationRecord
belongs_to :container, polymorphic: true, optional: true
validates :name, length: { maximum: 60, too_long: "名称不能超过60个字符" }
validates :description, length: { maximum: 5000, too_long: "内容不能超过5000个字符" }
validates :name, length: { maximum: 60, too_long: "不能超过60个字符" }
validates :description, length: { maximum: 5000, too_long: "不能超过5000个字符" }
has_many :attachments, as: :container, dependent: :destroy

@ -13,7 +13,7 @@ class Library < ApplicationRecord
has_one :praise_tread_cache, foreign_key: :object_id
has_many :praise_treads, as: :praise_tread_object, dependent: :destroy
validates :content, length: { maximum: 5000, too_long: "内容不能超过5000个字符" }
validates :content, length: { maximum: 5000, too_long: "不能超过5000个字符" }
validates :uuid, presence: true, uniqueness: true

@ -27,7 +27,7 @@ class Memo < ApplicationRecord
scope :hot, -> { order("all_replies_count desc, updated_at desc") }
scope :posts, -> { where(root_id: nil, forum_id: [3, 5]) }
validates :content, length: { maximum: 10000, too_long: "帖子内容不能超过10000个字符" }
validates :content, length: { maximum: 10000, too_long: "不能超过10000个字符" }
after_create :send_tiding

@ -33,7 +33,7 @@ class Message < ApplicationRecord
#转发表
# has_many :forwards, as: :from, dependent: :destroy
validates :subject, length: { maximum: 255, too_long: "标题不能超过255个字符" }
validates :subject, length: { maximum: 255, too_long: "不能超过255个字符" }
def update_content(content)
message_detail.update_attributes(content: content)

@ -24,8 +24,8 @@ class Poll < ApplicationRecord
scope :poll_search, lambda { |keywords|
where("polls_name LIKE ?", "%#{keywords}%") unless keywords.blank?}
validates :polls_name, length: { maximum: 60, too_long: "问卷名称不能超过60个字符" }
validates :polls_description, length: { maximum: 100, too_long: "问卷须知不能超过100个字符" }
validates :polls_name, length: { maximum: 60, too_long: "不能超过60个字符" }
validates :polls_description, length: { maximum: 100, too_long: "不能超过100个字符" }
after_create :create_polls_list

@ -8,6 +8,6 @@ class PollAnswer < ApplicationRecord
scope :find_answer_by_custom, lambda {|k,v| where("#{k}":v)} #根据传入的参数查找问题
scope :left_answer_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题
validates :answer_text, length: { maximum: 500, too_long: "选项不能超过500个字符" }
validates :answer_text, length: { maximum: 500, too_long: "不能超过500个字符" }
end

@ -9,7 +9,7 @@ class PollQuestion < ApplicationRecord
scope :ques_necessary, -> {where("is_necessary = ?",1)}
scope :insert_question, lambda {|k| where("question_number > ?",k)}
validates :question_title, length: { maximum: 1000, too_long: "题干不能超过1000个字符" }
validates :question_title, length: { maximum: 1000, too_long: "不能超过1000个字符" }
def question_type_name
case self.question_type

@ -9,6 +9,6 @@ class PollVote < ApplicationRecord
scope :find_current_vote,lambda {|k,v| where("#{k}": v)}
scope :find_vote_text,-> {where("vote_text IS NOT NULL")}
validates :vote_text, length: { maximum: 5000, too_long: "内容不能超过5000个字符" }
validates :vote_text, length: { maximum: 5000, too_long: "不能超过5000个字符" }
end

@ -1,10 +1,10 @@
class ShixunInfo < ApplicationRecord
belongs_to :shixun
validates_uniqueness_of :shixun_id
validates_length_of :fork_reason, maximum: 60, message: "fork原因不能超过60个字符"
validates_length_of :fork_reason, maximum: 60, message: "不能超过60个字符"
after_commit :create_diff_record
validates :description, length: { maximum: 5000, too_long: "简介不能超过5000个字符" }
validates :description, length: { maximum: 5000, too_long: "不能超过5000个字符" }
private

@ -2,6 +2,6 @@ class ShixunWorkComment < ApplicationRecord
belongs_to :student_work
belongs_to :user
belongs_to :challenge, optional: true
validates :comment, length: { maximum: 500, too_long: "评语不能超过500个字符" }
validates :hidden_comment, length: { maximum: 500, too_long: "隐藏评语不能超过500个字符" }
validates :comment, length: { maximum: 500, too_long: "不能超过500个字符" }
validates :hidden_comment, length: { maximum: 500, too_long: "不能超过500个字符" }
end

@ -6,6 +6,6 @@ class Stage < ApplicationRecord
has_many :stage_shixuns, -> { order("stage_shixuns.position ASC") }, dependent: :destroy
has_many :shixuns, :through => :stage_shixuns
validates :name, length: { maximum: 60 , too_long: "章节名称不能超过60个字符" }
validates :description, length: { maximum: 1000, too_long: "章节描述不能超过1000个字符" }
validates :name, length: { maximum: 60 , too_long: "不能超过60个字符" }
validates :description, length: { maximum: 1000, too_long: "不能超过1000个字符" }
end

@ -19,7 +19,7 @@ class StudentWork < ApplicationRecord
before_save :set_work_score
validates :description, length: { maximum: 5000, too_long: "描述不能超过5000个字符" }
validates :description, length: { maximum: 5000, too_long: "不能超过5000个字符" }
scope :has_committed, lambda { where("work_status != 0") }
# 未提交

@ -7,7 +7,7 @@ class StudentWorksScore < ApplicationRecord
has_many :tidings, as: :container, dependent: :destroy
has_many :attachments, as: :container, dependent: :destroy
validates :comment, length: { maximum: 1000, too_long: "评语不能超过1000个字符" }
validates :comment, length: { maximum: 1000, too_long: "不能超过1000个字符" }
scope :shixun_comment, lambda { where(is_ultimate: 0) }

@ -31,9 +31,9 @@ class Subject < ApplicationRecord
has_many :subject_shixun_infos, dependent: :destroy
has_many :subject_user_infos, dependent: :destroy
validates :name, length: { maximum: 60, too_long: "实践课程名称不能超过60个字符" }
validates :description, length: { maximum: 8000, too_long: "实践课程简介不能超过8000个字符" }
validates :learning_notes, length: { maximum: 2000, too_long: "实践课程须知不能超过2000个字符" }
validates :name, length: { maximum: 60, too_long: "不能超过60个字符" }
validates :description, length: { maximum: 8000, too_long: "不能超过8000个字符" }
validates :learning_notes, length: { maximum: 2000, too_long: "不能超过2000个字符" }
scope :visible, lambda{where(status: 2)}
scope :published, lambda{where(status: 1)}

@ -1,7 +1,7 @@
class TestSet < ApplicationRecord
# match_rule: 匹配规则: full 完全匹配, last 末尾匹配
#
validates :input, length: { maximum: 5000, too_long: "输入不能超过5000个字符" }
validates :output, length: { maximum: 5000, too_long: "输出不能超过5000个字符" }
validates :input, length: { maximum: 5000, too_long: "不能超过5000个字符" }
validates :output, length: { maximum: 5000, too_long: "不能超过5000个字符" }
end

@ -1,5 +1,5 @@
class TrustieHack < ApplicationRecord
validates_length_of :description, maximum: 500, message: "描述不能超过500个字符"
validates_length_of :description, maximum: 500, message: "不能超过500个字符"
has_many :hack_users, :dependent => :destroy
belongs_to :trustie_hackathon, counter_cache: true

@ -20,7 +20,150 @@ zh-CN:
user:
login: '登录名'
lastname: '姓名'
nickname: '昵称'
discuss:
content: '内容'
journals_for_message:
notes: '内容'
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_work_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: '描述'

Loading…
Cancel
Save