diff --git a/app/models/book.rb b/app/models/book.rb index 905af9b..26cea45 100644 --- a/app/models/book.rb +++ b/app/models/book.rb @@ -6,7 +6,7 @@ class Book include OrbitModel::Status include MemberHelper include Slug - + HideTimeInLinK = (File.exist?("#{Rails.root}/hide_time_fields_for_plugins.txt") rescue false) field :book_title, as: :slug_title, localize: true field :extracted_chapters, type: String, localize: true field :publisher, type: String, localize: true @@ -53,15 +53,16 @@ class Book title << self.extracted_chapters if self.extracted_chapters.present? title << self.publisher if self.publisher.present? title << self.isbn if self.isbn.present? - - if !self.publish_date.nil? - pd = self.publish_date.strftime("%Y-%m-%d").split('-') - title << pd[0]+"/"+pd[1] - end - title << self.pages if self.pages.present? - # title << self.year - + unless HideTimeInLinK + if self.publish_date + title << (self.publish_date.strftime("%b. %Y") rescue nil) + elsif self.publication_date + title << (self.publication_date.strftime("%b. %Y") rescue nil) + elsif self.year.present? + title << self.year + end + end title.join(', ') end