From a6821b0437e8590647e522dce7fcb0b2de6e54f9 Mon Sep 17 00:00:00 2001 From: manson Date: Thu, 3 Jul 2014 12:53:38 +0800 Subject: [PATCH] Frontend --- app/controllers/personal_honors_controller.rb | 50 +++++++++++++++++++ app/views/personal_honors/index.html.erb | 1 + app/views/personal_honors/show.html.erb | 1 + lib/personal_honor/engine.rb | 4 +- 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 app/controllers/personal_honors_controller.rb create mode 100644 app/views/personal_honors/index.html.erb create mode 100644 app/views/personal_honors/show.html.erb diff --git a/app/controllers/personal_honors_controller.rb b/app/controllers/personal_honors_controller.rb new file mode 100644 index 0000000..6e586ce --- /dev/null +++ b/app/controllers/personal_honors_controller.rb @@ -0,0 +1,50 @@ +class PersonalHonorsController < ApplicationController + def index + honors = Honor.all + honor_list = honors.collect do |honor| + { + "year" => honor.year, + "award_name" => honor.award_name, + "awarding_unit" => honor.awarding_unit, + "award_winner" => honor.member_profile.name, + "link_to_show" => OrbitHelper.url_to_show(honor.to_param) + } + end + { + "honors" => honor_list, + "extras" => { + "widget-title" => t("module_name.personal_honor"), + "th_year" => t('personal_honor.year'), + "th_award_name" => t('personal_honor.award_name'), + "th_awarding_unit" => t('personal_honor.awarding_unit'), + "th_award_winner" => t('personal_honor.award_winner'), + "th_detail" => t('detail') + } + } + end + + def show + params = OrbitHelper.params + honor = Honor.find_by(uid: params[:uid]) + + { + "year" => honor.year, + "honor_type" => honor.honor_type.title, + "award_name" => honor.award_name, + "awarding_unit" => honor.awarding_unit, + "language" => t(honor.language), + "keywords" => honor.keywords, + "url" => honor.url, + "note" => honor.note, + + "th_year" => t("personal_honor.year"), + "th_honor_type" => t("personal_honor.honor_category"), + "th_award_name" => t("personal_honor.award_name"), + "th_awarding_unit" => t("personal_honor.awarding_unit"), + "th_language" => t("personal_honor.language"), + "th_keywords" => t("personal_honor.keywords"), + "th_url" => t("personal_honor.url"), + "th_note" => t("personal_honor.note") + } + end +end \ No newline at end of file diff --git a/app/views/personal_honors/index.html.erb b/app/views/personal_honors/index.html.erb new file mode 100644 index 0000000..648b75c --- /dev/null +++ b/app/views/personal_honors/index.html.erb @@ -0,0 +1 @@ +<%= render_view %> \ No newline at end of file diff --git a/app/views/personal_honors/show.html.erb b/app/views/personal_honors/show.html.erb new file mode 100644 index 0000000..648b75c --- /dev/null +++ b/app/views/personal_honors/show.html.erb @@ -0,0 +1 @@ +<%= render_view %> \ No newline at end of file diff --git a/lib/personal_honor/engine.rb b/lib/personal_honor/engine.rb index 44b0ad5..f586d64 100644 --- a/lib/personal_honor/engine.rb +++ b/lib/personal_honor/engine.rb @@ -4,7 +4,7 @@ module PersonalHonor OrbitApp.registration "PersonalHonor",:type=> 'ModuleApp' do module_label 'module_name.personal_honor' base_url File.expand_path File.dirname(__FILE__) - personal_plugin :enable => true, :sort_number => '50', :app_name=>"Honor", :intro_app_name=>"PersonalHonorIntro",:path=>"/plugin/personal_honor/profile",:front_path=>"/profile",:admin_path=>"/admin/honors",:i18n=>'module_name.personal_honor' + personal_plugin :enable => true, :sort_number => '50', :app_name=>"Honor", :intro_app_name=>"PersonalHonorIntro",:path=>"/plugin/personal_honor/profile",:front_path=>"/profile",:admin_path=>"/admin/honors",:i18n=>'module_name.personal_honor', :module_app_name=>'PersonalHonor' version "0.1" organization "Rulingcom" @@ -12,6 +12,8 @@ module PersonalHonor intro "I am intro" update_info 'some update_info' + frontend_enabled + icon_class_no_sidebar "icons-user" end end end