forked from saurabh/personal-journal
Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
7254a672de | |
|
|
ef9ab12a23 |
|
|
@ -2,9 +2,9 @@ class JournalPaper
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
include Mongoid::Attributes::Dynamic
|
include Mongoid::Attributes::Dynamic
|
||||||
include Admin::JournalPapersHelper
|
ActiveSupport.on_load(:after_initialize) { JournalPaper.include Admin::JournalPapersHelper }
|
||||||
include OrbitModel::Status
|
include OrbitModel::Status
|
||||||
include MemberHelper
|
ActiveSupport.on_load(:after_initialize) { JournalPaper.include MemberHelper }
|
||||||
include Slug
|
include Slug
|
||||||
HideTimeInLinK = (File.exist?("#{Rails.root}/hide_time_fields_for_plugins.txt") rescue false)
|
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
|
||||||
|
|
@ -148,16 +148,19 @@ class JournalPaper
|
||||||
fields_to_show = fields_to_show - fields_to_remove
|
fields_to_show = fields_to_show - fields_to_remove
|
||||||
|
|
||||||
plugin_datas = datas.sort_for_frontend.collect do |p|
|
plugin_datas = datas.sort_for_frontend.collect do |p|
|
||||||
|
|
||||||
pd_data = []
|
pd_data = []
|
||||||
fields_to_show.collect do |t|
|
|
||||||
|
p_keywords = p.keywords.to_s.strip rescue ""
|
||||||
|
rep_mark_html = "<span class='rep-mark' style='display:none;'>#{p_keywords}</span>"
|
||||||
|
fields_to_show.each do |t|
|
||||||
if !page.nil? && page.custom_string_field == "table"
|
if !page.nil? && page.custom_string_field == "table"
|
||||||
case t
|
case t
|
||||||
when "paper_title"
|
when "paper_title"
|
||||||
link = OrbitHelper.url_to_plugin_show(p.to_param,'personal_journal')
|
link = OrbitHelper.url_to_plugin_show(p.to_param,'personal_journal')
|
||||||
url_to_plugin_show_blank = OrbitHelper.instance_variable_get(:@url_to_plugin_show_blank)
|
url_to_plugin_show_blank = OrbitHelper.instance_variable_get(:@url_to_plugin_show_blank)
|
||||||
tmp_title = p.paper_title
|
tmp_title = p.paper_title
|
||||||
pd_data << { "data_title" => (url_to_plugin_show_blank ? tmp_title : "<a title=\"#{tmp_title}\" href=\"#{link}\" target=\"_blank\">#{tmp_title}</a>") }
|
title_content = (url_to_plugin_show_blank ? tmp_title : "<a title=\"#{tmp_title}\" href=\"#{link}\" target=\"_blank\">#{tmp_title}</a>")
|
||||||
|
pd_data << { "data_title" => "#{title_content}#{rep_mark_html}".html_safe }
|
||||||
when "level_type"
|
when "level_type"
|
||||||
pd_data << {"data_title" => ( !p.journal_levels.blank? ? "(#{p.journal_levels.collect{|x| x.title}.join(', ')})" : nil)}
|
pd_data << {"data_title" => ( !p.journal_levels.blank? ? "(#{p.journal_levels.collect{|x| x.title}.join(', ')})" : nil)}
|
||||||
when "publication_date"
|
when "publication_date"
|
||||||
|
|
@ -169,7 +172,7 @@ class JournalPaper
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if t == "paper_title"
|
if t == "paper_title"
|
||||||
pd_data << { "data_title" => p.create_link_tag_for_title}
|
pd_data << { "data_title" => "#{p.create_link_tag_for_title}#{rep_mark_html}".html_safe }
|
||||||
else
|
else
|
||||||
pd_data << { "data_title" => p.send(t) }
|
pd_data << { "data_title" => p.send(t) }
|
||||||
end
|
end
|
||||||
|
|
@ -179,8 +182,8 @@ class JournalPaper
|
||||||
{
|
{
|
||||||
"pd_datas" => pd_data
|
"pd_datas" => pd_data
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return [pd_title,plugin_datas]
|
return [pd_title,plugin_datas]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue