changed get patent and fixed intro

This commit is contained in:
Harry Bomrah 2016-04-06 02:09:42 +08:00
parent 7bf694f717
commit 57c9fd5d6c
6 changed files with 14 additions and 6 deletions

View File

@ -49,9 +49,9 @@ class Admin::TechnologyTransfersController < OrbitMemberController
end end
def update_frontend_setting def update_frontend_setting
@member = MemberProfile.find(intro_params['member_profile_id']) rescue nil @member = MemberProfile.find(params['member_profile_id']) rescue nil
@intro = CourseIntro.find_by(:member_profile_id=>@member.id) rescue nil @intro = TechnologyTransferIntro.find_by(:member_profile_id=>@member.id) rescue nil
@intro = @intro.nil? ? CourseIntro.new({:member_profile_id=>@member.id}) : @intro @intro = @intro.nil? ? TechnologyTransferIntro.new({:member_profile_id=>@member.id}) : @intro
@intro.update_attributes(intro_params) @intro.update_attributes(intro_params)
@intro.save @intro.save
redirect_to URI.encode('/admin/members/'+@member.to_param+'/TechnologyTransfer') redirect_to URI.encode('/admin/members/'+@member.to_param+'/TechnologyTransfer')
@ -59,7 +59,7 @@ class Admin::TechnologyTransfersController < OrbitMemberController
def toggle_hide def toggle_hide
if params[:ids] if params[:ids]
@projects = Course.any_in(_id: params[:ids]) @projects = TechnologyTransfer.any_in(_id: params[:ids])
@projects.each do |project| @projects.each do |project|
project.is_hidden = params[:disable] project.is_hidden = params[:disable]

View File

@ -28,6 +28,8 @@ class PersonalTechnologyTransfersController < ApplicationController
t << {"value" => (tt.send("technology_transfer_category").title rescue "")} t << {"value" => (tt.send("technology_transfer_category").title rescue "")}
when "authors" when "authors"
t << {"value" => (tt.send(:member_profile).name rescue "")} 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 else
t << {"value" => (tt.send(fs) rescue "")} t << {"value" => (tt.send(fs) rescue "")}
end end

View File

@ -64,6 +64,8 @@ class TechnologyTransfer
pd_data << {"data_title" => (p.patent_granted ? "Yes" : "No")} pd_data << {"data_title" => (p.patent_granted ? "Yes" : "No")}
elsif t == "authors" elsif t == "authors"
pd_data << {"data_title" => (p.member_profile.name rescue "")} 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 else
pd_data << { "data_title" => p.send(t) } pd_data << { "data_title" => p.send(t) }
end end

View File

@ -3,7 +3,7 @@
<%= stylesheet_link_tag "lib/main-list" %> <%= stylesheet_link_tag "lib/main-list" %>
<% end %> <% 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| %>
<fieldset> <fieldset>
<!-- Input Area --> <!-- Input Area -->
<div class="input-area"> <div class="input-area">

View File

@ -6,6 +6,8 @@ en:
personal_technology_transfer: personal_technology_transfer:
title: Title title: Title
year: Year year: Year
y_es: Yes
n_o: No
category: Category category: Category
patent_granted: Patent Granted patent_granted: Patent Granted
patent_title: Patent Title patent_title: Patent Title

View File

@ -6,6 +6,8 @@
personal_technology_transfer: personal_technology_transfer:
title: 名稱 title: 名稱
year: 年度 year: 年度
y_es:
n_o:
category: 類別 category: 類別
patent_granted: 是否取得專利 patent_granted: 是否取得專利
patent_title: 專利名稱 patent_title: 專利名稱