2020-03-19 09:13:01 +00:00
|
|
|
class PersonalWritingsController < ApplicationController
|
|
|
|
def index
|
|
|
|
writings = Writing.where(:is_hidden=>false).order_by(:year=>'desc').page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
|
|
|
writing_list = writings.collect do |writing|
|
|
|
|
{
|
|
|
|
"year" => writing.year,
|
2020-03-19 14:35:41 +00:00
|
|
|
"month" => writing.month,
|
2020-03-19 09:13:01 +00:00
|
|
|
"writing_title" => writing.writing_title,
|
2020-03-19 14:35:41 +00:00
|
|
|
"other" => writing.other,
|
2020-03-19 09:13:01 +00:00
|
|
|
"member" => (writing.member_profile.name rescue ""),
|
|
|
|
"link_to_show" => OrbitHelper.url_to_show(writing.to_param)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
{
|
|
|
|
"writings" => writing_list,
|
|
|
|
"extras" => {
|
|
|
|
"widget-title" => t("module_name.personal_writing"),
|
|
|
|
"th_year" => t('personal_writing.year'),
|
2020-03-19 14:35:41 +00:00
|
|
|
"th_month" => t('personal_writing.month'),
|
2020-03-19 09:13:01 +00:00
|
|
|
"th_writing_title" => t('module_name.personal_writing'),
|
2020-03-19 14:35:41 +00:00
|
|
|
"th_other" => t('personal_writing.other'),
|
2020-03-19 09:13:01 +00:00
|
|
|
"th_member" => t('users.name'),
|
|
|
|
"th_detail" => t('detail')
|
|
|
|
},
|
|
|
|
"total_pages" => writings.total_pages
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
params = OrbitHelper.params
|
|
|
|
plugin = Writing.where(:is_hidden=>false).find_by(uid: params[:uid])
|
|
|
|
fields_to_show = [
|
|
|
|
"year",
|
2020-03-19 14:35:41 +00:00
|
|
|
"month",
|
2020-03-19 09:13:01 +00:00
|
|
|
"writing_title",
|
2020-03-19 14:35:41 +00:00
|
|
|
"other",
|
2020-03-19 09:13:01 +00:00
|
|
|
"url",
|
|
|
|
"file"
|
|
|
|
]
|
|
|
|
|
|
|
|
{"plugin_datas"=>plugin.get_plugin_data(fields_to_show)}
|
|
|
|
end
|
|
|
|
end
|