From 37f1669e7b9c0dc250018c06eefec2e9266ebcac Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Sat, 7 Jan 2023 10:16:39 +0800 Subject: [PATCH] Add hide time fields setting file for create_link. --- app/models/writing_conference.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/models/writing_conference.rb b/app/models/writing_conference.rb index e6a0b35..9330fc4 100644 --- a/app/models/writing_conference.rb +++ b/app/models/writing_conference.rb @@ -6,7 +6,7 @@ class WritingConference include OrbitTag::Taggable include MemberHelper include Slug - + HideTimeInLinK = (File.exist?("#{Rails.root}/hide_time_fields_for_plugins.txt") rescue false) field :paper_title, as: :slug_title, localize: true field :conference_title, localize: true field :authors, localize: true @@ -63,12 +63,14 @@ class WritingConference title << "vol. " + self.vol_no.strip if (self.vol_no.present? && self.vol_no != "0") title << self.issue_no if (self.issue_no.present? && self.issue_no != "0") title << "pp." + self.form_to_start.to_s+"-"+self.form_to_end.to_s if (self.form_to_start.present? && self.form_to_start != "0") - if self.period_start_date.present? && self.period_end_date.present? - title << self.duration - elsif !self.publication_date.nil? - title << (self.publication_date.strftime("%b. %Y") rescue nil) - elsif self.year.present? - title << self.year + unless HideTimeInLinK + if self.period_start_date.present? && self.period_end_date.present? + title << self.duration + elsif !self.publication_date.nil? + title << (self.publication_date.strftime("%b. %Y") rescue nil) + elsif self.year.present? + title << self.year + end end if self.location.present? title << self.location