fixed journal paper author type in form
This commit is contained in:
parent
93cba6bad7
commit
0b60e4886e
|
@ -1,9 +1,9 @@
|
||||||
module Admin::JournalPapersHelper
|
module Admin::JournalPapersHelper
|
||||||
def page_for_journal_paper(journal_paper)
|
def page_for_journal_paper(journal_paper_object)
|
||||||
journal_paper_page = nil
|
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?
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,6 +36,8 @@ class JournalPaper
|
||||||
has_and_belongs_to_many :journal_paper_authors
|
has_and_belongs_to_many :journal_paper_authors
|
||||||
accepts_nested_attributes_for :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
|
after_save :save_journal_paper_files, :save_journal_paper_authors
|
||||||
|
|
||||||
before_validation :add_http
|
before_validation :add_http
|
||||||
|
|
|
@ -7,5 +7,6 @@ class JournalPaperAuthorType
|
||||||
field :key, type: String
|
field :key, type: String
|
||||||
field :title, type: String, localize: true
|
field :title, type: String, localize: true
|
||||||
|
|
||||||
|
has_and_belongs_to_many :journal_papers
|
||||||
has_and_belongs_to_many :journal_paper_authors
|
has_and_belongs_to_many :journal_paper_authors
|
||||||
end
|
end
|
||||||
|
|
|
@ -100,9 +100,8 @@
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<% @author_types.each do |author_type| %>
|
<% @author_types.each do |author_type| %>
|
||||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
<%= content_tag :label,:class => "checkbox inline" do -%>
|
||||||
<%= check_box_tag 'journal_paper[journal_paper_author_type_ids][]', author_type.id, @journal_paper.journal_paper_author_ids.include?(author_type.id)%>
|
<%= check_box_tag 'journal_paper[journal_paper_author_type_ids][]', author_type.id, @journal_paper.journal_paper_author_type_ids.include?(author_type.id)%>
|
||||||
<%= author_type.title %>
|
<%= author_type.title %>
|
||||||
<%= hidden_field_tag 'journal_paper[journal_paper_author_type_ids][]', '' %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -66,7 +66,6 @@
|
||||||
<td><%= writing_journal.year %></td>
|
<td><%= writing_journal.year %></td>
|
||||||
<td>
|
<td>
|
||||||
<%= link_to writing_journal.create_link, page_for_journal_paper(writing_journal), target: "blank"%>
|
<%= link_to writing_journal.create_link, page_for_journal_paper(writing_journal), target: "blank"%>
|
||||||
|
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills hide">
|
<ul class="nav nav-pills hide">
|
||||||
<li><%= link_to t('edit'), edit_admin_journal_paper_path(writing_journal, member_profile_id: @member.id) %></li>
|
<li><%= link_to t('edit'), edit_admin_journal_paper_path(writing_journal, member_profile_id: @member.id) %></li>
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
# get 'journal_papers/index'
|
|
||||||
|
|
||||||
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
|
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
|
||||||
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
|
|
Loading…
Reference in New Issue