can select one line and table
This commit is contained in:
parent
b4fcb4d2f1
commit
98ce21d67e
|
@ -1,22 +1,60 @@
|
||||||
class PersonalConferencesController < ApplicationController
|
class PersonalConferencesController < ApplicationController
|
||||||
def index
|
def index
|
||||||
|
params = OrbitHelper.params
|
||||||
writing_conferences = WritingConference.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
writing_conferences = WritingConference.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||||
|
page = Page.where(:page_id => params[:page_id]).first rescue nil
|
||||||
|
if page.custom_string_field == "table"
|
||||||
|
fields_to_show = [
|
||||||
|
"authors",
|
||||||
|
"paper_title",
|
||||||
|
"conference_title",
|
||||||
|
"location",
|
||||||
|
"paper_types",
|
||||||
|
"paper_levels"
|
||||||
|
]
|
||||||
|
else
|
||||||
|
fields_to_show = [
|
||||||
|
"year",
|
||||||
|
"paper_title"
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
writing_conference_list = writing_conferences.collect do |writing_conference|
|
writing_conference_list = []
|
||||||
{
|
writing_conferences.each do |writing_conference|
|
||||||
"year" => writing_conference.year,
|
t = []
|
||||||
"paper_title" => writing_conference.create_link,
|
fields_to_show.each do |fs|
|
||||||
"link_to_show" => OrbitHelper.url_to_show(writing_conference.to_param)
|
case fs
|
||||||
|
when "paper_title"
|
||||||
|
if page.custom_string_field == "table"
|
||||||
|
t << {"value" => "<a href='#{OrbitHelper.url_to_show(writing_conference.to_param)}'>#{writing_conference.paper_title}</a>"}
|
||||||
|
else
|
||||||
|
t << {"value" => "<a href='#{OrbitHelper.url_to_show(writing_conference.to_param)}'>#{writing_conference.create_link}</a>"}
|
||||||
|
end
|
||||||
|
when "paper_levels"
|
||||||
|
t << {"value" => ( !writing_conference.conference_paper_levels.blank? ? "(#{writing_conference.conference_paper_levels.collect{|x| x.title}.join(', ')})" : nil)}
|
||||||
|
when "paper_types"
|
||||||
|
t << {"value" => ( !writing_conference.conference_paper_levels.blank? ? "(#{writing_conference.conference_paper_levels.collect{|x| x.title}.join(', ')})" : nil)}
|
||||||
|
else
|
||||||
|
t << {"value" => writing_conference.send(fs)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
writing_conference_list << {"cps" => t}
|
||||||
|
end
|
||||||
|
|
||||||
|
headers = []
|
||||||
|
fields_to_show.each do |fs|
|
||||||
|
col = 2
|
||||||
|
col = 3 if fs == "paper_title"
|
||||||
|
headers << {
|
||||||
|
"head-title" => t("personal_conference.#{fs}"),
|
||||||
|
"col" => col
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
{
|
{
|
||||||
"writing_conferences" => writing_conference_list,
|
"writing_conferences" => writing_conference_list,
|
||||||
"extras" => {
|
"extras" => { "widget-title" => t("module_name.personal_conference") },
|
||||||
"widget-title" => t("module_name.personal_conference"),
|
"headers" => headers,
|
||||||
"th_year" => t('personal_plugins.year'),
|
|
||||||
"th_title" => t("personal_conference.paper_title"),
|
|
||||||
"th_author" => t('personal_plugins.author')
|
|
||||||
},
|
|
||||||
"total_pages" => writing_conferences.total_pages
|
"total_pages" => writing_conferences.total_pages
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -65,11 +65,24 @@ class WritingConference
|
||||||
title.join(', ')
|
title.join(', ')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def self.get_plugin_datas_to_member(datas)
|
def self.get_plugin_datas_to_member(datas)
|
||||||
fields_to_show = [
|
page = Page.where(:module => "personal_conference").first rescue nil
|
||||||
"year",
|
if page.custom_string_field == "table"
|
||||||
"paper_title"
|
fields_to_show = [
|
||||||
]
|
"authors",
|
||||||
|
"paper_title",
|
||||||
|
"conference_title",
|
||||||
|
"location",
|
||||||
|
"paper_types",
|
||||||
|
"paper_levels"
|
||||||
|
]
|
||||||
|
else
|
||||||
|
fields_to_show = [
|
||||||
|
"year",
|
||||||
|
"paper_title"
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
fields_to_remove = []
|
fields_to_remove = []
|
||||||
|
|
||||||
|
@ -92,10 +105,23 @@ class WritingConference
|
||||||
|
|
||||||
pd_data = []
|
pd_data = []
|
||||||
fields_to_show.collect do |t|
|
fields_to_show.collect do |t|
|
||||||
if t == "paper_title"
|
if page.custom_string_field == "table"
|
||||||
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_conference')}' target='_blank'>#{p.create_link}</a>" }
|
case t
|
||||||
|
when "paper_title"
|
||||||
|
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_conference')}' target='_blank'>#{p.paper_title}</a>" }
|
||||||
|
when "paper_types"
|
||||||
|
pd_data << {"data_title" => ( !p.conference_paper_types.blank? ? p.conference_paper_types.collect{|x| x.title}.join(', ') : "")}
|
||||||
|
when "paper_levels"
|
||||||
|
pd_data << {"data_title" => ( !p.conference_paper_levels.blank? ? p.conference_paper_levels.collect{|x| x.title}.join(', ') : "")}
|
||||||
|
else
|
||||||
|
pd_data << { "data_title" => p.send(t) }
|
||||||
|
end
|
||||||
else
|
else
|
||||||
pd_data << { "data_title" => p.send(t) }
|
if t == "paper_title"
|
||||||
|
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_conference')}' target='_blank'>#{p.create_link}</a>" }
|
||||||
|
else
|
||||||
|
pd_data << { "data_title" => p.send(t) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ en:
|
||||||
paper_title : "Paper Title"
|
paper_title : "Paper Title"
|
||||||
paper_type : "Paper Type"
|
paper_type : "Paper Type"
|
||||||
paper_level : "Paper Level"
|
paper_level : "Paper Level"
|
||||||
|
paper_types : "Paper Type"
|
||||||
|
paper_levels : "Paper Level"
|
||||||
conference_title : "Conference Name"
|
conference_title : "Conference Name"
|
||||||
conference_time: "Conference Time"
|
conference_time: "Conference Time"
|
||||||
period_start_date : "Start Date"
|
period_start_date : "Start Date"
|
||||||
|
|
|
@ -8,6 +8,8 @@ zh_tw:
|
||||||
paper_title : "論文名稱"
|
paper_title : "論文名稱"
|
||||||
paper_type : "論文類型"
|
paper_type : "論文類型"
|
||||||
paper_level: "論文等級"
|
paper_level: "論文等級"
|
||||||
|
paper_types : "論文類型"
|
||||||
|
paper_levels: "論文等級"
|
||||||
conference_title : "會議名稱"
|
conference_title : "會議名稱"
|
||||||
conference_time: "會議時間"
|
conference_time: "會議時間"
|
||||||
period_start_date : "會議開始時間"
|
period_start_date : "會議開始時間"
|
||||||
|
|
|
@ -4,7 +4,7 @@ module PersonalConference
|
||||||
OrbitApp.registration "PersonalConference",:type=> 'ModuleApp' do
|
OrbitApp.registration "PersonalConference",:type=> 'ModuleApp' do
|
||||||
module_label 'module_name.personal_conference'
|
module_label 'module_name.personal_conference'
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
personal_plugin :enable => true, :sort_number => '6', :app_name=>"WritingConference", :intro_app_name=>"PersonalConferenceIntro",:path=>"/plugin/personal_conference/profile",:front_path=>"/profile",:admin_path=>"/admin/writing_conferences",:i18n=>'module_name.personal_conference', :module_app_name=>'PersonalConference'
|
personal_plugin :enable => true, :sort_number => '6', :app_name=>"WritingConference", :intro_app_name=>"PersonalConferenceIntro",:path=>"/plugin/personal_conference/profile",:front_path=>"/profile",:admin_path=>"/admin/writing_conferences",:i18n=>'module_name.personal_conference', :module_app_name=>'PersonalConference', :one_line_title => true
|
||||||
|
|
||||||
version "0.1"
|
version "0.1"
|
||||||
desktop_enabled true
|
desktop_enabled true
|
||||||
|
|
Loading…
Reference in New Issue