From 415f79314c87f109f7cc5eaed9ad43c4a3bd5f5a Mon Sep 17 00:00:00 2001 From: bohung Date: Tue, 23 Aug 2022 18:40:15 +0800 Subject: [PATCH] Updated. --- .../personal_journals_controller.rb | 8 +++---- app/models/journal_paper.rb | 23 ++++++++++++++----- config/locales/en.yml | 2 +- config/locales/zh_tw.yml | 2 +- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index 4aee316..e031d00 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -13,8 +13,8 @@ class PersonalJournalsController < ApplicationController journal_title authors year - issue_no vol_no + issue_no level_type ] end @@ -134,8 +134,7 @@ class PersonalJournalsController < ApplicationController journal_title vol_no issue_no - form_to_start - form_to_end + form_to level_type paper_type total_pages @@ -160,8 +159,7 @@ class PersonalJournalsController < ApplicationController journal_title vol_no issue_no - form_to_start - form_to_end + form_to level_type paper_type total_pages diff --git a/app/models/journal_paper.rb b/app/models/journal_paper.rb index 2016ea2..673124f 100644 --- a/app/models/journal_paper.rb +++ b/app/models/journal_paper.rb @@ -57,9 +57,9 @@ class JournalPaper title << self.authors if !self.authors.blank? title << self.paper_title if self.paper_title.present? title << self.journal_title if self.journal_title.present? - title << self.vol_no if (self.vol_no.present? && self.vol_no != "0") + 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") + 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) if !self.publication_date.nil? title << (self.publication_date.strftime("%b. %Y") rescue nil) @@ -68,7 +68,13 @@ class JournalPaper title.delete(nil) title.join(', ').sub(/^\\s*,/,'').gsub(/,(\s*,)+/,',').strip end - + def form_to + if (self.form_to_start.present? && self.form_to_start != "0") + self.form_to_start.to_s+"-"+self.form_to_end.to_s + else + "" + end + end def self.get_plugin_datas_to_member(datas) page = Page.where(:module => "personal_journal").first rescue nil @@ -101,9 +107,14 @@ class JournalPaper if (self.fields[t].type.to_s == "String" rescue false) fields_to_remove << t if (datas.where(t.to_sym.ne => nil).or(t.to_sym.ne => "").count == 0 rescue false) else - t = "journal_paper_author_types" if t == "author_type" - fields_to_remove << t if (datas.where(t.to_sym.ne => nil).count == 0 rescue false) - t = "author_type" if t == "journal_paper_author_types" + t2 = t + case t + when "form_to" + t2 = "form_to_start" + when "author_type" + t2 = "journal_paper_author_types" + end + fields_to_remove << t if (datas.where(t2.to_sym.ne => nil).count == 0 rescue false) end pd_title << { "plugin_data_title" => I18n.t("personal_journal.#{t}") diff --git a/config/locales/en.yml b/config/locales/en.yml index 86bc349..f1300a1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -24,7 +24,7 @@ en: isbn : "ISSN(ISBN)" vol_no : "Vol.No" issue_no : "Issue.No" - form_to: "From To" + form_to: "Page(s)" form_to_start : "From" form_to_end : "To" total_pages : "Total Pages" diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 5e589d9..2693b3c 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -22,7 +22,7 @@ zh_tw: isbn : "ISSN(ISBN)" vol_no : "卷數" issue_no : "期數" - form_to: "From To" + form_to: "頁碼" form_to_start : "起頁" form_to_end : "迄頁" total_pages : "總頁數"