Skip to content

Commit

Permalink
Merge pull request #279 from razeware/WEB-7274
Browse files Browse the repository at this point in the history
WEB-7274: Makes Text descriptions markdownable
  • Loading branch information
jellodiil authored Aug 16, 2024
2 parents 0bf38d1 + cd02cbd commit ac70cb8
Show file tree
Hide file tree
Showing 4 changed files with 992 additions and 921 deletions.
2 changes: 1 addition & 1 deletion app/lib/parser/text_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Parser
class TextMetadata
include MarkdownMetadata

VALID_SIMPLE_ATTRIBUTES = %i[title description short_description free ref authors_notes_md].freeze
VALID_SIMPLE_ATTRIBUTES = %i[title description_md free ref].freeze

attr_reader :text

Expand Down
15 changes: 3 additions & 12 deletions app/models/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ class Text
include Concerns::MarkdownRenderable
include Concerns::TitleCleanser

attr_accessor :title, :ordinal, :ref, :description, :authors, :markdown_file, :root_path, :free, :kind
attr_accessor :title, :ordinal, :ref, :description_md, :authors, :markdown_file, :root_path, :free

attr_markdown :body, source: :markdown_file, file: true, wrapper_class: :wrapper_class
attr_markdown :body, source: :markdown_file, file: true
attr_markdown :description, source: :description_md, file: false
validates :title, :ordinal, :ref, :markdown_file, presence: true
validate do |text|
# Check the ref is a string
Expand All @@ -22,7 +23,6 @@ def initialize(attributes = {})
super
@authors ||= []
@free ||= false
@kind ||= 'chapter'
end

def slug
Expand All @@ -39,15 +39,6 @@ def validation_name
title
end

# For wrapping content
def wrapper_class
{
chapter: nil,
dedications: 'c-book-chapter__dedications',
'team-bios': 'c-book-chapter__team'
}[kind&.to_sym]
end

def episode_type
'text'
end
Expand Down
Loading

0 comments on commit ac70cb8

Please sign in to comment.