From dd9bc683ba7f171a7879acea9833adcb93089ed9 Mon Sep 17 00:00:00 2001 From: manson Date: Thu, 3 Jul 2014 12:52:21 +0800 Subject: [PATCH] Frontend --- .../personal_conferences_controller.rb | 96 +++++++++++++++++++ app/views/personal_conferences/index.html.erb | 1 + app/views/personal_conferences/show.html.erb | 1 + config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + lib/personal_conference/engine.rb | 5 +- 6 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 app/controllers/personal_conferences_controller.rb create mode 100644 app/views/personal_conferences/index.html.erb create mode 100644 app/views/personal_conferences/show.html.erb diff --git a/app/controllers/personal_conferences_controller.rb b/app/controllers/personal_conferences_controller.rb new file mode 100644 index 0000000..dec2bef --- /dev/null +++ b/app/controllers/personal_conferences_controller.rb @@ -0,0 +1,96 @@ +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 \ No newline at end of file diff --git a/app/views/personal_conferences/index.html.erb b/app/views/personal_conferences/index.html.erb new file mode 100644 index 0000000..648b75c --- /dev/null +++ b/app/views/personal_conferences/index.html.erb @@ -0,0 +1 @@ +<%= render_view %> \ No newline at end of file diff --git a/app/views/personal_conferences/show.html.erb b/app/views/personal_conferences/show.html.erb new file mode 100644 index 0000000..648b75c --- /dev/null +++ b/app/views/personal_conferences/show.html.erb @@ -0,0 +1 @@ +<%= render_view %> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 15b20a2..b852ee4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -13,6 +13,7 @@ en: conference_time: "Conference Time" period_start_date : "Start Date" period_end_date : "End Date" + duration: "Duration" location : "Location" sponsor : "Sponsor" authors : "Authors" diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 02dd173..8cf6014 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -12,6 +12,7 @@ zh_tw: conference_time: "會議時間" period_start_date : "起" period_end_date : "訖" + duration: "期間" location : "地點" sponsor : "主辦單位" authors : "全部作者" diff --git a/lib/personal_conference/engine.rb b/lib/personal_conference/engine.rb index 5a201cb..322af9f 100644 --- a/lib/personal_conference/engine.rb +++ b/lib/personal_conference/engine.rb @@ -4,13 +4,16 @@ module PersonalConference OrbitApp.registration "PersonalConference",:type=> 'ModuleApp' do module_label 'module_name.personal_conference' 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' + 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' version "0.1" organization "Rulingcom" author "RD dep" intro "I am intro" update_info 'some update_info' + + frontend_enabled + icon_class_no_sidebar "icons-user" end end end