personal-conference/app/controllers/personal_conferences_contro...

96 lines
3.9 KiB
Ruby
Raw Normal View History

2014-07-03 04:52:21 +00:00
class PersonalConferencesController < ApplicationController
def index
writing_conferences = WritingConference.all
writing_conference_list = writing_conferences.collect do |writing_conference|
{
"year" => writing_conference.year,
"paper_title" => writing_conference.paper_title,
"author" => writing_conference.member_profile.name,
"link_to_show" => OrbitHelper.url_to_show(writing_conference.to_param)
}
end
{
"writing_conferences" => writing_conference_list,
"extras" => {
"widget-title" => t("module_name.personal_conference"),
"th_year" => t('personal_plugins.year'),
"th_title" => t("personal_conference.paper_title"),
"th_author" => t('personal_plugins.author')
}
}
end
def show
params = OrbitHelper.params
writing_conference = WritingConference.find_by(uid: params[:uid])
files = writing_conference.writing_conference_files.map do |file|
{
"file_url" => file.file.url,
"file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title),
"file_ext" => File.extname(file.file.path).sub('.',''),
"file_description" => file.description
}
end
paper_types = writing_conference.conference_paper_types.map do |type|
{"paper_type"=>type.title}
end
author_types = writing_conference.conference_author_types.map do |type|
{"author_type"=>type.title}
end
paper_levels = writing_conference.conference_paper_levels.map do |level|
{"paper_level"=>level.title}
end
{
"files" => files,
"paper_types" => paper_types,
"author_types" => author_types,
"paper_levels" => paper_levels,
"data" => {
"paper_title" => writing_conference.paper_title,
"conference_title" => writing_conference.conference_title,
"authors" => writing_conference.authors,
"location" => writing_conference.location,
"sponsor" => writing_conference.sponsor,
"year" => writing_conference.year,
"language" => t(writing_conference.language),
"keywords" => writing_conference.keywords,
"abstract" => writing_conference.abstract,
"publication_date" => writing_conference.publication_date,
"period_start_date"=> writing_conference.period_start_date,
"period_end_date" => writing_conference.period_end_date,
"url" => writing_conference.url,
"note" => writing_conference.note,
"isbn" => writing_conference.isbn,
"isi_number" => writing_conference.isi_number,
"td_year" => t("personal_conference.year"),
"td_paper_title" => t("personal_conference.paper_title"),
"td_conference_title" => t("personal_conference.conference_title"),
"td_location" => t("personal_conference.location"),
"td_period_start_date" => t("personal_conference.period_start_date"),
"td_period_end_date" => t("personal_conference.period_end_date"),
"td_duration" => t("personal_conference.duration"),
"td_publication_date" => t("personal_conference.publication_date"),
"td_sponsor" => t("personal_conference.sponsor"),
"td_authors" => t("personal_conference.authors"),
"td_language" => t("personal_conference.language"),
"td_isbn" => t("personal_conference.isbn"),
"td_isi_number" => t("personal_conference.isi_number"),
"td_url" => t("personal_conference.url"),
"td_keywords" => t("personal_conference.keywords"),
"td_abstract" => t("personal_conference.abstract"),
"td_note" => t("personal_conference.note"),
"td_paper_type" => t("personal_conference.paper_type"),
"td_author_type" => t("personal_conference.author_type"),
"td_paper_level" => t("personal_conference.paper_level"),
"td_files" => t(:file_)
}
}
end
end