From cb8b3946667522724b4eb50ead65c500fdd069b0 Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Fri, 16 Aug 2024 13:38:46 +0100 Subject: [PATCH] WEB-7274: Removing unnecessary attributes from the Text model --- app/lib/parser/text_metadata.rb | 2 +- app/models/text.rb | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/app/lib/parser/text_metadata.rb b/app/lib/parser/text_metadata.rb index 14260d8..798c1f9 100644 --- a/app/lib/parser/text_metadata.rb +++ b/app/lib/parser/text_metadata.rb @@ -5,7 +5,7 @@ module Parser class TextMetadata include MarkdownMetadata - VALID_SIMPLE_ATTRIBUTES = %i[title description_md short_description free ref authors_notes_md].freeze + VALID_SIMPLE_ATTRIBUTES = %i[title description_md free ref].freeze attr_reader :text diff --git a/app/models/text.rb b/app/models/text.rb index 3559c87..45f4d86 100644 --- a/app/models/text.rb +++ b/app/models/text.rb @@ -9,9 +9,9 @@ class Text include Concerns::MarkdownRenderable include Concerns::TitleCleanser - attr_accessor :title, :ordinal, :ref, :description_md, :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| @@ -23,7 +23,6 @@ def initialize(attributes = {}) super @authors ||= [] @free ||= false - @kind ||= 'chapter' end def slug @@ -40,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