From de48a045abda72e936eb2226a7a8c31282d61f12 Mon Sep 17 00:00:00 2001 From: manson Date: Thu, 3 Jul 2014 12:52:47 +0800 Subject: [PATCH] Frontend --- .../personal_diplomas_controller.rb | 56 +++++++++++++++++++ app/views/personal_diplomas/index.html.erb | 1 + app/views/personal_diplomas/show.html.erb | 1 + lib/personal_diploma/engine.rb | 5 +- 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 app/controllers/personal_diplomas_controller.rb create mode 100644 app/views/personal_diplomas/index.html.erb create mode 100644 app/views/personal_diplomas/show.html.erb diff --git a/app/controllers/personal_diplomas_controller.rb b/app/controllers/personal_diplomas_controller.rb new file mode 100644 index 0000000..97544f0 --- /dev/null +++ b/app/controllers/personal_diplomas_controller.rb @@ -0,0 +1,56 @@ +class PersonalDiplomasController < ApplicationController + def index + diplomas = Diploma.all + diploma_list = diplomas.collect do |diploma| + { + "member" => diploma.member_profile.name, + "duration" => diploma.duration, + "school_name" => diploma.school_name, + "degree" => diploma.degree, + "link_to_show" => OrbitHelper.url_to_show(diploma.to_param) + } + end + { + "diplomas" => diploma_list, + "extras" => { + "widget-title" => t("module_name.personal_diploma"), + "th_member" => t('users.name'), + "th_duration" => t('personal_diploma.duration'), + "th_school_name" => t('personal_diploma.school_name'), + "th_degree" => t('personal_diploma.degree'), + "th_detail" => t('detail') + } + } + end + + def show + params = OrbitHelper.params + diploma = Diploma.find_by(uid: params[:uid]) + + { + "school_name" => diploma.school_name, + "country" => diploma.country, + "department" => diploma.department, + "degree" => diploma.degree, + "language" => t(diploma.language), + "keywords" => diploma.keywords, + "start_date" => diploma.start_date, + "end_date" => diploma.end_date, + "duration" => diploma.duration, + "url" => diploma.url, + "note" => diploma.note, + + "th_school_name" => t("personal_diploma.school_name"), + "th_country" => t("personal_diploma.country"), + "th_department" => t("personal_diploma.department"), + "th_degree" => t("personal_diploma.degree"), + "th_language" => t("personal_diploma.language"), + "th_keywords" => t("personal_diploma.keywords"), + "th_start_date" => t("personal_diploma.start_date"), + "th_end_date" => t("personal_diploma.end_date"), + "th_duration" => t("personal_diploma.duration"), + "th_url" => t("personal_diploma.url"), + "th_note" => t("personal_diploma.note") + } + end +end \ No newline at end of file diff --git a/app/views/personal_diplomas/index.html.erb b/app/views/personal_diplomas/index.html.erb new file mode 100644 index 0000000..648b75c --- /dev/null +++ b/app/views/personal_diplomas/index.html.erb @@ -0,0 +1 @@ +<%= render_view %> \ No newline at end of file diff --git a/app/views/personal_diplomas/show.html.erb b/app/views/personal_diplomas/show.html.erb new file mode 100644 index 0000000..648b75c --- /dev/null +++ b/app/views/personal_diplomas/show.html.erb @@ -0,0 +1 @@ +<%= render_view %> \ No newline at end of file diff --git a/lib/personal_diploma/engine.rb b/lib/personal_diploma/engine.rb index 888239e..c922191 100644 --- a/lib/personal_diploma/engine.rb +++ b/lib/personal_diploma/engine.rb @@ -4,13 +4,16 @@ module PersonalDiploma OrbitApp.registration "PersonalDiploma",:type=> 'ModuleApp' do module_label 'module_name.personal_journal' base_url File.expand_path File.dirname(__FILE__) - personal_plugin :enable => true, :sort_number => '40', :app_name=>"Diploma", :intro_app_name=>"PersonalDiplomaIntro",:path=>"/plugin/personal_diploma/profile",:front_path=>"/profile",:admin_path=>"/admin/diplomas",:i18n=>'module_name.personal_diploma' + personal_plugin :enable => true, :sort_number => '40', :app_name=>"Diploma", :intro_app_name=>"PersonalDiplomaIntro",:path=>"/plugin/personal_diploma/profile",:front_path=>"/profile",:admin_path=>"/admin/diplomas",:i18n=>'module_name.personal_diploma', :module_app_name=>'PersonalDiploma' 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