From 69f56c301ec89a73e53b82232d548c6ec4c84b14 Mon Sep 17 00:00:00 2001 From: Dilraj Date: Fri, 27 Oct 2023 03:04:41 -0400 Subject: [PATCH] #69 Created `copy_paste_info` for `Chapter` --- app/models/chapter.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app/models/chapter.rb b/app/models/chapter.rb index 06b54ef..02c9854 100644 --- a/app/models/chapter.rb +++ b/app/models/chapter.rb @@ -17,4 +17,29 @@ class Chapter < ApplicationRecord else scope :released, -> { all } end + + # @brief Generates a formatted chapter description with relevant information and links. + # @example Generating chapter description + # `Book.find(15).chapters.second.copy_paste_info` + # @return [void] + def copy_paste_info + info = <<~HEREDOC + #{self.title} (#{self.en_title}) + + #{self.en_short_summary} + + Discover the uncensored Suraj Prakash and its English translations, summaries, and audio discourse at https://spg.dev/chapters/#{self.id}! Explore Chapter #{self.number} of #{self.book.en_title} now! + + ✍🏽 Explore this chapter: + https://spg.dev/chapters/#{self.id} + + 📖 Explore other chapters in #{self.book.en_title}: + https://spg.dev/books/#{self.book.en_title.parameterize} + + ☀️ Explore Gurpartap Suraj Granth - Suraj Prakash Granth (SPG) + https://spg.dev/books + HEREDOC + + Rails.logger.debug info + end end