From 0aa6715a2ffd60738ce9d1d4fdd0590af57282ae Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 12:21:02 +0800 Subject: [PATCH 001/119] Update personal_journals_controller.rb --- app/controllers/personal_journals_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index 326c8ab..271bbca 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -75,7 +75,7 @@ class PersonalJournalsController < ApplicationController when "language" t << {"value" => (!journal_paper.language.nil? ? t("#{journal_paper.language}") : "")} else - t << {"value" => journal_paper.send(fs)} + t << {"value" => (journal_paper.send(fs) rescue "")} end end journal_paper_list << {"jps" => t} From b63aebc633d02a619278b9a4ee573d4b5841ec87 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 13:00:44 +0800 Subject: [PATCH 002/119] Update personal_journals_controller.rb fix paper_type show error --- app/controllers/personal_journals_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index 271bbca..38f2bf2 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -72,6 +72,8 @@ class PersonalJournalsController < ApplicationController t << {"value" => (journal_paper.send(fs).strftime("%Y/%m") rescue "")} when "author_type" t << {"value" => (journal_paper.journal_paper_author_types.collect{|jat| jat.title}.join(", ") rescue "")} + when "paper_types" + t << {"value" => ( !journal_paper.paper_types.blank? ? "(#{journal_paper.paper_types.collect{|x| x.title}.join(', ')})" : nil)} when "language" t << {"value" => (!journal_paper.language.nil? ? t("#{journal_paper.language}") : "")} else From 2b2b1704f640659a098d85877e8ce4746083fc86 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 13:14:04 +0800 Subject: [PATCH 003/119] Update personal_journals_controller.rb fix paper_type error --- .../personal_journals_controller.rb | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index 38f2bf2..dc2ea81 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -1,12 +1,8 @@ class PersonalJournalsController < ApplicationController - def search_all_words(target,word) - target=target.upcase - words=word.upcase.split(' ') - return words.select{|value| target.include? value}==words - end def index params = OrbitHelper.params - journal_papers = JournalPaper.where(:is_hidden=>false).sort_for_frontend.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) + page_data_count = OrbitHelper.page_data_count + journal_papers = JournalPaper.where(:is_hidden=>false).sort_for_frontend.page(OrbitHelper.params[:page_no]).per(page_data_count) page = Page.where(:page_id => params[:page_id]).first rescue nil if page.custom_string_field == "table" fields_to_show = page.custom_array_field rescue [] @@ -40,6 +36,8 @@ class PersonalJournalsController < ApplicationController journal_papers_show = journal_papers_temp.select {|value| search_all_words((value.send("publication_date").strftime("%Y/%m/%d") rescue ""), params[:keywords])} when "author_type" journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_author_types.collect{|jat| jat.title}.join(", "), params[:keywords])} + when "paper_types" + journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_type.collect{|x| x.title}.join(", "), params[:keywords])} when "language" journal_papers_show = journal_papers_temp.select {|value| search_all_words((!value.language.nil? ? t("#{value.language}") : ""), params[:keywords])} else @@ -50,8 +48,8 @@ class PersonalJournalsController < ApplicationController else page_to_show = params[:page_no].to_i end - journal_papers = journal_papers_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count] - journal_papers_total_pages = (journal_papers_show.length/OrbitHelper.page_data_count.to_f).ceil + journal_papers = journal_papers_show[(page_to_show-1)*page_data_count...page_to_show*page_data_count] + journal_papers_total_pages = (journal_papers_show.length/page_data_count.to_f).ceil else journal_papers_total_pages = journal_papers.total_pages end @@ -73,7 +71,7 @@ class PersonalJournalsController < ApplicationController when "author_type" t << {"value" => (journal_paper.journal_paper_author_types.collect{|jat| jat.title}.join(", ") rescue "")} when "paper_types" - t << {"value" => ( !journal_paper.paper_types.blank? ? "(#{journal_paper.paper_types.collect{|x| x.title}.join(', ')})" : nil)} + t << {"value" => ( !journal_paper.journal_paper_type.blank? ? "(#{journal_paper.journal_paper_type.collect{|x| x.title}.join(', ')})" : nil)} when "language" t << {"value" => (!journal_paper.language.nil? ? t("#{journal_paper.language}") : "")} else @@ -185,4 +183,10 @@ class PersonalJournalsController < ApplicationController page.save render :json => {"success" => true}.to_json end +private + def search_all_words(target,word) + target=target.upcase + words=word.upcase.split(' ') + return words.select{|value| target.include? value}==words + end end From 5881bbea9e8b0cd0f02affdf183f06d2fdc12af1 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 13:15:20 +0800 Subject: [PATCH 004/119] Update personal_journals_controller.rb --- app/controllers/personal_journals_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index dc2ea81..5c63913 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -37,7 +37,7 @@ class PersonalJournalsController < ApplicationController when "author_type" journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_author_types.collect{|jat| jat.title}.join(", "), params[:keywords])} when "paper_types" - journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_type.collect{|x| x.title}.join(", "), params[:keywords])} + journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_types.collect{|x| x.title}.join(", "), params[:keywords])} when "language" journal_papers_show = journal_papers_temp.select {|value| search_all_words((!value.language.nil? ? t("#{value.language}") : ""), params[:keywords])} else @@ -71,7 +71,7 @@ class PersonalJournalsController < ApplicationController when "author_type" t << {"value" => (journal_paper.journal_paper_author_types.collect{|jat| jat.title}.join(", ") rescue "")} when "paper_types" - t << {"value" => ( !journal_paper.journal_paper_type.blank? ? "(#{journal_paper.journal_paper_type.collect{|x| x.title}.join(', ')})" : nil)} + t << {"value" => ( !journal_paper.journal_paper_types.blank? ? "(#{journal_paper.journal_paper_types.collect{|x| x.title}.join(', ')})" : nil)} when "language" t << {"value" => (!journal_paper.language.nil? ? t("#{journal_paper.language}") : "")} else From a5abf0b2ef22ab8c32f439228b433e3ac171295c Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 13:17:03 +0800 Subject: [PATCH 005/119] Update personal_journals_controller.rb --- app/controllers/personal_journals_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index 5c63913..b5512b0 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -36,8 +36,8 @@ class PersonalJournalsController < ApplicationController journal_papers_show = journal_papers_temp.select {|value| search_all_words((value.send("publication_date").strftime("%Y/%m/%d") rescue ""), params[:keywords])} when "author_type" journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_author_types.collect{|jat| jat.title}.join(", "), params[:keywords])} - when "paper_types" - journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_types.collect{|x| x.title}.join(", "), params[:keywords])} + when "paper_type" + journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_type.collect{|x| x.title}.join(", "), params[:keywords])} when "language" journal_papers_show = journal_papers_temp.select {|value| search_all_words((!value.language.nil? ? t("#{value.language}") : ""), params[:keywords])} else @@ -70,8 +70,8 @@ class PersonalJournalsController < ApplicationController t << {"value" => (journal_paper.send(fs).strftime("%Y/%m") rescue "")} when "author_type" t << {"value" => (journal_paper.journal_paper_author_types.collect{|jat| jat.title}.join(", ") rescue "")} - when "paper_types" - t << {"value" => ( !journal_paper.journal_paper_types.blank? ? "(#{journal_paper.journal_paper_types.collect{|x| x.title}.join(', ')})" : nil)} + when "paper_type" + t << {"value" => ( !journal_paper.journal_paper_type.blank? ? "(#{journal_paper.journal_paper_type.collect{|x| x.title}.join(', ')})" : nil)} when "language" t << {"value" => (!journal_paper.language.nil? ? t("#{journal_paper.language}") : "")} else From d6b7db3b08701be979c59ed10f9762cba2592ca7 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 13:18:17 +0800 Subject: [PATCH 006/119] Update personal_journals_controller.rb --- app/controllers/personal_journals_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index b5512b0..3812f4e 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -37,7 +37,7 @@ class PersonalJournalsController < ApplicationController when "author_type" journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_author_types.collect{|jat| jat.title}.join(", "), params[:keywords])} when "paper_type" - journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_type.collect{|x| x.title}.join(", "), params[:keywords])} + journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_types.collect{|x| x.title}.join(", "), params[:keywords])} when "language" journal_papers_show = journal_papers_temp.select {|value| search_all_words((!value.language.nil? ? t("#{value.language}") : ""), params[:keywords])} else @@ -71,7 +71,7 @@ class PersonalJournalsController < ApplicationController when "author_type" t << {"value" => (journal_paper.journal_paper_author_types.collect{|jat| jat.title}.join(", ") rescue "")} when "paper_type" - t << {"value" => ( !journal_paper.journal_paper_type.blank? ? "(#{journal_paper.journal_paper_type.collect{|x| x.title}.join(', ')})" : nil)} + t << {"value" => ( !journal_paper.journal_paper_types.blank? ? "(#{journal_paper.journal_paper_types.collect{|x| x.title}.join(', ')})" : nil)} when "language" t << {"value" => (!journal_paper.language.nil? ? t("#{journal_paper.language}") : "")} else From 5aa2f7966e5446b670848270c29b365fddf3742f Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 13:24:24 +0800 Subject: [PATCH 007/119] Update personal_journals_controller.rb fix error --- app/controllers/personal_journals_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index 3812f4e..f084f59 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -71,7 +71,7 @@ class PersonalJournalsController < ApplicationController when "author_type" t << {"value" => (journal_paper.journal_paper_author_types.collect{|jat| jat.title}.join(", ") rescue "")} when "paper_type" - t << {"value" => ( !journal_paper.journal_paper_types.blank? ? "(#{journal_paper.journal_paper_types.collect{|x| x.title}.join(', ')})" : nil)} + t << {"value" => (journal_paper.journal_paper_types.collect{|x| x.title}.join(', ') rescue "")} when "language" t << {"value" => (!journal_paper.language.nil? ? t("#{journal_paper.language}") : "")} else From 1769d9008f94fa5d13bc30cc9c58117a82757d94 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 13:26:52 +0800 Subject: [PATCH 008/119] Update personal_journals_controller.rb --- app/controllers/personal_journals_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index f084f59..14ba882 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -37,7 +37,7 @@ class PersonalJournalsController < ApplicationController when "author_type" journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_author_types.collect{|jat| jat.title}.join(", "), params[:keywords])} when "paper_type" - journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_types.collect{|x| x.title}.join(", "), params[:keywords])} + journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_type.collect{|x| x.title}.join(", "), params[:keywords])} when "language" journal_papers_show = journal_papers_temp.select {|value| search_all_words((!value.language.nil? ? t("#{value.language}") : ""), params[:keywords])} else @@ -71,7 +71,7 @@ class PersonalJournalsController < ApplicationController when "author_type" t << {"value" => (journal_paper.journal_paper_author_types.collect{|jat| jat.title}.join(", ") rescue "")} when "paper_type" - t << {"value" => (journal_paper.journal_paper_types.collect{|x| x.title}.join(', ') rescue "")} + t << {"value" => (journal_paper.journal_paper_type.collect{|x| x.title}.join(', ') rescue "")} when "language" t << {"value" => (!journal_paper.language.nil? ? t("#{journal_paper.language}") : "")} else From 9ab4bdefb00c1e55b51ff52fb53fae34f47eb3a6 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 13:54:10 +0800 Subject: [PATCH 009/119] Update personal_journals_controller.rb fix error? --- app/controllers/personal_journals_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index 14ba882..0f04765 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -37,7 +37,7 @@ class PersonalJournalsController < ApplicationController when "author_type" journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_author_types.collect{|jat| jat.title}.join(", "), params[:keywords])} when "paper_type" - journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_type.collect{|x| x.title}.join(", "), params[:keywords])} + journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_type.title, params[:keywords])} when "language" journal_papers_show = journal_papers_temp.select {|value| search_all_words((!value.language.nil? ? t("#{value.language}") : ""), params[:keywords])} else @@ -71,7 +71,7 @@ class PersonalJournalsController < ApplicationController when "author_type" t << {"value" => (journal_paper.journal_paper_author_types.collect{|jat| jat.title}.join(", ") rescue "")} when "paper_type" - t << {"value" => (journal_paper.journal_paper_type.collect{|x| x.title}.join(', ') rescue "")} + t << {"value" => (journal_paper.journal_paper_type.title rescue "")} when "language" t << {"value" => (!journal_paper.language.nil? ? t("#{journal_paper.language}") : "")} else From 67b787c3083052bf2d8a268c9fb540e31cfa6be8 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 13:56:07 +0800 Subject: [PATCH 010/119] Update personal_journals_controller.rb --- app/controllers/personal_journals_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index 0f04765..9791270 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -37,7 +37,7 @@ class PersonalJournalsController < ApplicationController when "author_type" journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_author_types.collect{|jat| jat.title}.join(", "), params[:keywords])} when "paper_type" - journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_type.title, params[:keywords])} + journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_type.title.to_s, params[:keywords])} when "language" journal_papers_show = journal_papers_temp.select {|value| search_all_words((!value.language.nil? ? t("#{value.language}") : ""), params[:keywords])} else From ac15dccd1635eb478c7e5e2b09294f8c513dc957 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 13:57:47 +0800 Subject: [PATCH 011/119] Update personal_journals_controller.rb fix error --- app/controllers/personal_journals_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index 9791270..5a79635 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -37,7 +37,7 @@ class PersonalJournalsController < ApplicationController when "author_type" journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_author_types.collect{|jat| jat.title}.join(", "), params[:keywords])} when "paper_type" - journal_papers_show = journal_papers_temp.select {|value| search_all_words(value.journal_paper_type.title.to_s, params[:keywords])} + journal_papers_show = journal_papers_temp.select {|value| search_all_words((value.journal_paper_type.title rescue ""), params[:keywords])} when "language" journal_papers_show = journal_papers_temp.select {|value| search_all_words((!value.language.nil? ? t("#{value.language}") : ""), params[:keywords])} else From 099fc02d9e75d41c524f500b825817720bc4dad9 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 14:17:45 +0800 Subject: [PATCH 012/119] Update en.yml add search translation --- config/locales/en.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index 6c45e60..8e659ec 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3,6 +3,9 @@ en: personal_journal: Journal Paper journal_paper: Journal Paper personal_journal: + select_class: "——select class——" + search_class: "search class:" + word_to_search: "word to search:" paper_title : "Paper Title" associated_project: Associated Project paper_type : "Paper Type" From 00bc6b4355dee33401e0d2f874f10256f5bc964e Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 14:18:32 +0800 Subject: [PATCH 013/119] Update zh_tw.yml --- config/locales/zh_tw.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 5e59531..8d8b997 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -3,6 +3,9 @@ zh_tw: personal_journal: 期刊論文 journal_paper: 期刊論文 personal_journal: + select_class: "——選取分類——" + search_class: "搜尋類別:" + word_to_search: "關鍵字搜尋:" associated_project: "所屬計畫案" number_of_authors: "著作人數" paper_title : "論文名稱" From b4e220918e1e7fd2db8469fa7c38d7c94b429c67 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 14:21:18 +0800 Subject: [PATCH 014/119] =?UTF-8?q?Update=20personal=5Fjournals=5Fcontroll?= =?UTF-8?q?er.rb=20=E6=94=B9=E6=90=9C=E5=B0=8B=E6=A1=86=E7=82=BA=E5=8F=AF?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E5=9C=8B=E8=AA=9E=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/personal_journals_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index 5a79635..e9042bf 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -96,13 +96,13 @@ class PersonalJournalsController < ApplicationController choice_select=choice_value.map{|iter| iter==params[:selectbox] ? "selected" : ""} choice_select=choice_select.map{|value| {"choice_select" => value}} choice_value=choice_value.map{|value| {"choice_value" => value}} - choice_default = params[:locale]!='en' ? "——選取分類——" : "——select class——" + choice_default = t("personal_journal.select_class") choice_show.unshift(choice_default) choice_show=choice_show.map{|value| {"choice_show" => value}} choice=choice_value.zip(choice_show,choice_select) choice=choice.map{|value| value.inject:merge} - select_text = params[:locale]!='en' ? "搜尋類別:" : "search class:" - search_text = params[:locale]!='en' ? "關鍵字搜尋:" : "word to search:" + select_text = t("personal_journal.search_class") + search_text = t("word_to_search") { "journal_papers" => journal_paper_list, "headers" => headers, From 8ba1b730ed4fa3449e8149eba4fd9661cb87b61f Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 14:22:45 +0800 Subject: [PATCH 015/119] Update personal_journals_controller.rb fix error --- app/controllers/personal_journals_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/personal_journals_controller.rb b/app/controllers/personal_journals_controller.rb index e9042bf..5bcff11 100644 --- a/app/controllers/personal_journals_controller.rb +++ b/app/controllers/personal_journals_controller.rb @@ -102,7 +102,7 @@ class PersonalJournalsController < ApplicationController choice=choice_value.zip(choice_show,choice_select) choice=choice.map{|value| value.inject:merge} select_text = t("personal_journal.search_class") - search_text = t("word_to_search") + search_text = t("personal_journal.word_to_search") { "journal_papers" => journal_paper_list, "headers" => headers, From a8db77e659fed54bd06248137f0215cb67c6114c Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 15:12:50 +0800 Subject: [PATCH 016/119] Update journal_paper.rb try destroy --- app/models/journal_paper.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/journal_paper.rb b/app/models/journal_paper.rb index 0152181..fdabd5e 100644 --- a/app/models/journal_paper.rb +++ b/app/models/journal_paper.rb @@ -159,13 +159,13 @@ class JournalPaper # member_data.to_json # end - # def save_journal_paper_files - # self.journal_paper_files.each do |t| - # if t.should_destroy - # t.destroy - # end - # end - # end + def save_journal_paper_files + self.journal_paper_files.each do |t| + if t.should_destroy + t.destroy + end + end + end # def save_journal_paper_authors # self.journal_paper_authors.each do |t| From 66a80eacd044985331d04551120a47fe71dc587e Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 15:15:45 +0800 Subject: [PATCH 017/119] =?UTF-8?q?Update=20journal=5Fpaper.rb=20=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E8=A8=BB=E8=A7=A3=EF=BC=8C=E5=9B=A0=E7=82=BA=E6=B2=92?= =?UTF-8?q?=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journal_paper.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/journal_paper.rb b/app/models/journal_paper.rb index fdabd5e..a9aefb2 100644 --- a/app/models/journal_paper.rb +++ b/app/models/journal_paper.rb @@ -159,13 +159,13 @@ class JournalPaper # member_data.to_json # end - def save_journal_paper_files - self.journal_paper_files.each do |t| - if t.should_destroy - t.destroy - end - end - end + # def save_journal_paper_files + # self.journal_paper_files.each do |t| + # if t.should_destroy + # t.destroy + # end + # end + # end # def save_journal_paper_authors # self.journal_paper_authors.each do |t| From 750eeac9a30ac73ff9cdbb8f78b7cc373b9af8a0 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 15:22:52 +0800 Subject: [PATCH 018/119] Update journal_papers_controller.rb try fix --- app/controllers/admin/journal_papers_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/journal_papers_controller.rb b/app/controllers/admin/journal_papers_controller.rb index d8c675c..3073be8 100644 --- a/app/controllers/admin/journal_papers_controller.rb +++ b/app/controllers/admin/journal_papers_controller.rb @@ -116,7 +116,7 @@ class Admin::JournalPapersController < OrbitMemberController def destroy @journal_paper.destroy respond_to do |format| - format.html { redirect_to(admin_journal_paper_url) } + format.html { redirect_to(admin_journal_papers_url) } # format.xml { head :ok } format.js format.json {render json: {"success" => true}} From c7fd7194c9f28bfedba3bd0f5d505d32baa70bdd Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 15:31:04 +0800 Subject: [PATCH 019/119] Update _form_file.html.erb try fix --- app/views/admin/journal_papers/_form_file.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/journal_papers/_form_file.html.erb b/app/views/admin/journal_papers/_form_file.html.erb index 7d52692..a1d8251 100644 --- a/app/views/admin/journal_papers/_form_file.html.erb +++ b/app/views/admin/journal_papers/_form_file.html.erb @@ -38,7 +38,7 @@ <%= f.hidden_field :id %> - <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> <% end %> From 3ef7a8d3935ca677e65932152f8e48ff6c26d0b7 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 15:44:54 +0800 Subject: [PATCH 020/119] Update journal_paper.rb try fix error --- app/models/journal_paper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/journal_paper.rb b/app/models/journal_paper.rb index a9aefb2..3110104 100644 --- a/app/models/journal_paper.rb +++ b/app/models/journal_paper.rb @@ -36,7 +36,7 @@ class JournalPaper has_and_belongs_to_many :journal_levels has_many :journal_paper_files, autosave: true, dependent: :destroy - accepts_nested_attributes_for :journal_paper_files + accepts_nested_attributes_for :journal_paper_files, :allow_destroy => true # has_and_belongs_to_many :journal_paper_authors, dependent: :destroy # accepts_nested_attributes_for :journal_paper_authors From d3b6b159313d5c5b2271372c1a5ef7184faf16ae Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 15:53:18 +0800 Subject: [PATCH 021/119] Update journal_paper.rb fix error when no file --- app/models/journal_paper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/journal_paper.rb b/app/models/journal_paper.rb index 3110104..6ca2312 100644 --- a/app/models/journal_paper.rb +++ b/app/models/journal_paper.rb @@ -210,9 +210,9 @@ class JournalPaper when "file" files = [] self.journal_paper_files.each do |file| - url = file.journal_file.url + url = (file.journal_file.url rescue "") title = (file.title.blank? ? File.basename(file.journal_file.path) : file.title) - files << "
  • #{title}
  • " + files << (url=="" ? "" : "
  • #{title}
  • ") end value = files.join("") else From a5a3008a5e22d441e775c065f515971b790dd748 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 15:55:16 +0800 Subject: [PATCH 022/119] Update journal_paper.rb fix error? --- app/models/journal_paper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/journal_paper.rb b/app/models/journal_paper.rb index 6ca2312..a19aeb1 100644 --- a/app/models/journal_paper.rb +++ b/app/models/journal_paper.rb @@ -211,7 +211,7 @@ class JournalPaper files = [] self.journal_paper_files.each do |file| url = (file.journal_file.url rescue "") - title = (file.title.blank? ? File.basename(file.journal_file.path) : file.title) + title = ((file.title.blank? ? File.basename(file.journal_file.path) : file.title) rescue "") files << (url=="" ? "" : "
  • #{title}
  • ") end value = files.join("") From a8153e68705d39802291cf8383fbe372a7aeac89 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 15:57:15 +0800 Subject: [PATCH 023/119] Update journal_paper.rb fix error --- app/models/journal_paper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/journal_paper.rb b/app/models/journal_paper.rb index a19aeb1..8ff8da1 100644 --- a/app/models/journal_paper.rb +++ b/app/models/journal_paper.rb @@ -210,9 +210,9 @@ class JournalPaper when "file" files = [] self.journal_paper_files.each do |file| - url = (file.journal_file.url rescue "") + url = file.journal_file.url title = ((file.title.blank? ? File.basename(file.journal_file.path) : file.title) rescue "") - files << (url=="" ? "" : "
  • #{title}
  • ") + files << (url.nil? ? "" : "
  • #{title}
  • ") end value = files.join("") else From 9e7b9140b12e975072669264cadd29b1ec0bcdb5 Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 17:08:01 +0800 Subject: [PATCH 024/119] Update _writing_journal.html.erb fix the problem that don't render to page but render to home? --- app/views/admin/journal_papers/_writing_journal.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/journal_papers/_writing_journal.html.erb b/app/views/admin/journal_papers/_writing_journal.html.erb index b348310..0670767 100644 --- a/app/views/admin/journal_papers/_writing_journal.html.erb +++ b/app/views/admin/journal_papers/_writing_journal.html.erb @@ -2,7 +2,7 @@ <%= writing_journal.year %> - <%= link_to writing_journal.create_link, page_for_journal_paper(writing_journal), target: "blank"%> + <%= link_to writing_journal.create_link, OrbitHelper.url_to_plugin_show(writing_journal.to_param,'personal_journal').to_s, target: "blank"%>