From 57c9fd5d6cd5d4f994e2cb22b95b4400e8fbc072 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 6 Apr 2016 02:09:42 +0800 Subject: [PATCH] changed get patent and fixed intro --- app/controllers/admin/technology_transfers_controller.rb | 8 ++++---- .../personal_technology_transfers_controller.rb | 2 ++ app/models/technology_transfer.rb | 2 ++ .../admin/technology_transfers/frontend_setting.html.erb | 2 +- config/locales/en.yml | 2 ++ config/locales/zh_tw.yml | 4 +++- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/technology_transfers_controller.rb b/app/controllers/admin/technology_transfers_controller.rb index edc4d66..91fab2d 100644 --- a/app/controllers/admin/technology_transfers_controller.rb +++ b/app/controllers/admin/technology_transfers_controller.rb @@ -49,9 +49,9 @@ class Admin::TechnologyTransfersController < OrbitMemberController end def update_frontend_setting - @member = MemberProfile.find(intro_params['member_profile_id']) rescue nil - @intro = CourseIntro.find_by(:member_profile_id=>@member.id) rescue nil - @intro = @intro.nil? ? CourseIntro.new({:member_profile_id=>@member.id}) : @intro + @member = MemberProfile.find(params['member_profile_id']) rescue nil + @intro = TechnologyTransferIntro.find_by(:member_profile_id=>@member.id) rescue nil + @intro = @intro.nil? ? TechnologyTransferIntro.new({:member_profile_id=>@member.id}) : @intro @intro.update_attributes(intro_params) @intro.save redirect_to URI.encode('/admin/members/'+@member.to_param+'/TechnologyTransfer') @@ -59,7 +59,7 @@ class Admin::TechnologyTransfersController < OrbitMemberController def toggle_hide if params[:ids] - @projects = Course.any_in(_id: params[:ids]) + @projects = TechnologyTransfer.any_in(_id: params[:ids]) @projects.each do |project| project.is_hidden = params[:disable] diff --git a/app/controllers/personal_technology_transfers_controller.rb b/app/controllers/personal_technology_transfers_controller.rb index 52eb9f3..47cae25 100644 --- a/app/controllers/personal_technology_transfers_controller.rb +++ b/app/controllers/personal_technology_transfers_controller.rb @@ -28,6 +28,8 @@ class PersonalTechnologyTransfersController < ApplicationController t << {"value" => (tt.send("technology_transfer_category").title rescue "")} when "authors" t << {"value" => (tt.send(:member_profile).name rescue "")} + when "patent_granted" + t << {"value" => (tt.patent_granted ? t("personal_technology_transfer.y_es") : t("personal_technology_transfer.n_o"))} else t << {"value" => (tt.send(fs) rescue "")} end diff --git a/app/models/technology_transfer.rb b/app/models/technology_transfer.rb index 696ca47..5cbcb14 100644 --- a/app/models/technology_transfer.rb +++ b/app/models/technology_transfer.rb @@ -64,6 +64,8 @@ class TechnologyTransfer pd_data << {"data_title" => (p.patent_granted ? "Yes" : "No")} elsif t == "authors" pd_data << {"data_title" => (p.member_profile.name rescue "")} + elsif t == "patent_granted" + pd_data << {"data_title" => (p.patent_granted ? t("personal_technology_transfer.y_es") : t("personal_technology_transfer.n_o"))} else pd_data << { "data_title" => p.send(t) } end diff --git a/app/views/admin/technology_transfers/frontend_setting.html.erb b/app/views/admin/technology_transfers/frontend_setting.html.erb index f3b3377..32b7868 100644 --- a/app/views/admin/technology_transfers/frontend_setting.html.erb +++ b/app/views/admin/technology_transfers/frontend_setting.html.erb @@ -3,7 +3,7 @@ <%= stylesheet_link_tag "lib/main-list" %> <% end %> -<%= form_for(:course_intro, :url => update_frontend_setting_admin_technology_transfers_path, :method => "post", html: {class: "form-horizontal main-forms previewable"} ) do |f| %> +<%= form_for(:technology_transfer_intro, :url => update_frontend_setting_admin_technology_transfers_path, :method => "post", html: {class: "form-horizontal main-forms previewable"} ) do |f| %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 149f18f..d342ec2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -6,6 +6,8 @@ en: personal_technology_transfer: title: Title year: Year + y_es: Yes + n_o: No category: Category patent_granted: Patent Granted patent_title: Patent Title diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index aee7654..76cfc53 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -1,4 +1,4 @@ - zh_tw: +zh_tw: module_name: personal_technology_transfer: 技術移轉/授權 technology_transfers: 技術移轉/授權 @@ -6,6 +6,8 @@ personal_technology_transfer: title: 名稱 year: 年度 + y_es: 是 + n_o: 否 category: 類別 patent_granted: 是否取得專利 patent_title: 專利名稱