Add hide time fields setting file for create_link.
This commit is contained in:
parent
fb4187e368
commit
1e9a0cb143
|
@ -6,7 +6,7 @@ class JournalPaper
|
||||||
include OrbitModel::Status
|
include OrbitModel::Status
|
||||||
include MemberHelper
|
include MemberHelper
|
||||||
include Slug
|
include Slug
|
||||||
|
HideTimeInLinK = (File.exist?("#{Rails.root}/hide_time_fields_for_plugins.txt") rescue false)
|
||||||
field :paper_title, as: :slug_title, type: String, localize: true
|
field :paper_title, as: :slug_title, type: String, localize: true
|
||||||
field :journal_title, type: String, localize: true
|
field :journal_title, type: String, localize: true
|
||||||
field :authors, type: String, localize: true
|
field :authors, type: String, localize: true
|
||||||
|
@ -61,11 +61,13 @@ class JournalPaper
|
||||||
title << self.issue_no if (self.issue_no.present? && self.issue_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")
|
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")
|
||||||
# title << ( !self.journal_levels.blank? ? "(#{self.journal_levels.collect{|x| x.title}.join(', ')})" : nil)
|
# title << ( !self.journal_levels.blank? ? "(#{self.journal_levels.collect{|x| x.title}.join(', ')})" : nil)
|
||||||
|
unless HideTimeInLinK
|
||||||
if !self.publication_date.nil?
|
if !self.publication_date.nil?
|
||||||
title << (self.publication_date.strftime("%b. %Y") rescue nil)
|
title << (self.publication_date.strftime("%b. %Y") rescue nil)
|
||||||
elsif self.year.present?
|
elsif self.year.present?
|
||||||
title << self.year
|
title << self.year
|
||||||
end
|
end
|
||||||
|
end
|
||||||
title.delete(nil)
|
title.delete(nil)
|
||||||
title.join(', ').sub(/^\\s*,/,'').gsub(/,(\s*,)+/,',').strip
|
title.join(', ').sub(/^\\s*,/,'').gsub(/,(\s*,)+/,',').strip
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue