diff --git a/app/helpers/admin/journal_papers_helper.rb b/app/helpers/admin/journal_papers_helper.rb index 5c40ff1..c072f7b 100644 --- a/app/helpers/admin/journal_papers_helper.rb +++ b/app/helpers/admin/journal_papers_helper.rb @@ -1,9 +1,9 @@ module Admin::JournalPapersHelper - def page_for_journal_paper(journal_paper) + def page_for_journal_paper(journal_paper_object) journal_paper_page = nil - pages = Page.where(:module=>"member") + pages = Page.where(:module=>"journal_paper") journal_paper_page = pages.first if journal_paper_page.nil? - request.protocol+(request.host_with_port+journal_paper_page.url+'/'+journal_paper.to_param+"?method=personal_plugin&plugin_name=JournalPaper").gsub('//','/') rescue "/" + request.protocol+(request.host_with_port+journal_paper_page.url+'/'+journal_paper_object.to_param).gsub('//','/') rescue "/" end end diff --git a/app/models/journal_paper.rb b/app/models/journal_paper.rb index 86c94ba..f870b74 100644 --- a/app/models/journal_paper.rb +++ b/app/models/journal_paper.rb @@ -36,6 +36,8 @@ class JournalPaper has_and_belongs_to_many :journal_paper_authors accepts_nested_attributes_for :journal_paper_authors + has_and_belongs_to_many :journal_paper_author_types + after_save :save_journal_paper_files, :save_journal_paper_authors before_validation :add_http diff --git a/app/models/journal_paper_author_type.rb b/app/models/journal_paper_author_type.rb index 71ad4d5..97672dc 100644 --- a/app/models/journal_paper_author_type.rb +++ b/app/models/journal_paper_author_type.rb @@ -7,5 +7,6 @@ class JournalPaperAuthorType field :key, type: String field :title, type: String, localize: true + has_and_belongs_to_many :journal_papers has_and_belongs_to_many :journal_paper_authors end diff --git a/app/views/admin/journal_papers/_form.html.erb b/app/views/admin/journal_papers/_form.html.erb index 28c2824..fee5018 100644 --- a/app/views/admin/journal_papers/_form.html.erb +++ b/app/views/admin/journal_papers/_form.html.erb @@ -100,9 +100,8 @@