Add backend for tips and enable markdown support

This commit is contained in:
Sebastian Serth
2020-10-08 19:04:10 +02:00
parent dce5998a2a
commit e550828c58
16 changed files with 171 additions and 10 deletions

View File

@@ -32,6 +32,10 @@ class FileType < ApplicationRecord
end
private :set_default_values
def programming_language
editor_mode.gsub('ace/mode/', '')
end
def to_s
name
end

View File

@@ -20,4 +20,9 @@ class Tip < ApplicationRecord
"#{I18n.t('activerecord.models.tip.one')} #{id}"
end
end
def can_be_destroyed?
# This tip can only be destroyed if it is no parent to any other exercise tip
ExerciseTip.where(parent_exercise_tip: exercise_tips).none?
end
end