This commit is contained in:
bohung 2020-02-27 16:31:32 +08:00
parent 802c4de893
commit 97337b7716
2 changed files with 20 additions and 15 deletions

View File

@ -267,20 +267,25 @@ class Admin::CancerpredictsController < OrbitAdminController
if @field_property["is_float"] == 1 if @field_property["is_float"] == 1
@table_str_left += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"/></div>' @table_str_left += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"/></div>'
else else
@table_str_left += '<div class="num_group"><form class="for_num">' if @field_property["range"] == []
@table_str_left += '<input class="num_only cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'" onkeyup="value=value.replace(/[^\d]/g,\'\') "onbeforepaste="clipboardData.setData(\'text\',clipboardData.getData(\'text\').replace(/[^\d]/g,\'\'))"/>' @table_str_left += '<div class="num_group"><input class="num_only float_num cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"/></div>'
@table_str_left += '<input class="num_only_value" type="hidden" value="0"/>' else
@please_choice = (current_locale.to_s == "zh_tw") ? "請選擇" : "Please choice" @table_str_left += '<div class="num_group"><form class="for_num">'
@table_str_left += '<select class="select_num"><option value="">'+@please_choice+'</option>' @table_str_left += '<input class="num_only cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'" onkeyup="value=value.replace(/[^\d]/g,\'\') "onbeforepaste="clipboardData.setData(\'text\',clipboardData.getData(\'text\').replace(/[^\d]/g,\'\'))"/>'
if @field_property["choice_fields"] != [] @table_str_left += '<input class="num_only_value" type="hidden" value="0"/>'
@field_property["choice_fields"].each do |choice|
@table_str_left += ('<option value="0">' + choice.to_s.titleize + '</option>') @please_choice = (current_locale.to_s == "zh_tw") ? "請選擇" : "Please choice"
@table_str_left += '<select class="select_num"><option value="">'+@please_choice+'</option>'
if @field_property["choice_fields"] != []
@field_property["choice_fields"].each do |choice|
@table_str_left += ('<option value="0">' + choice.to_s.titleize + '</option>')
end
end end
for @num in @field_property["range"][0] .. @field_property["range"][1]
@table_str_left += ('<option value="' + @num.to_s + '">' + @num.to_s + '</option>')
end
@table_str_left += '</select></form></div>'
end end
for @num in @field_property["range"][0] .. @field_property["range"][1]
@table_str_left += ('<option value="' + @num.to_s + '">' + @num.to_s + '</option>')
end
@table_str_left += '</select></form></div>'
end end
else else
@table_str_left += '<div class= "cancer-btn-group cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;">' @table_str_left += '<div class= "cancer-btn-group cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;">'

View File

@ -7,9 +7,9 @@ class Cancerpredictfields
include OrbitTag::Taggable include OrbitTag::Taggable
include OrbitCategory::Categorizable include OrbitCategory::Categorizable
field :title ,type:String ,default:"" field :title ,type:String ,default:""
field :form_show , :type=> Hash ,default:{0=>{:variable=>"sex",:name=>{"zh_tw"=>"性別<br/>(Sex)","en"=>"Sex"},:is_num=>1, :hint=>{'zh_tw'=>'從 18 歲(含)開始至 93 歲','en'=>'Age must be between 18 and 93'} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['男','女'],"en"=>['Male','Female']},:range=>[],:right=>0,:is_float=>0}, field :form_show , :type=> Hash ,default:{0=>{:variable=>"sex",:name=>{"zh_tw"=>"性別<br/>(Sex)","en"=>"Sex"},:is_num=>0, :hint=>{'zh_tw'=>'從 18 歲(含)開始至 93 歲','en'=>'Age must be between 18 and 93'} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['男','女'],"en"=>['Male','Female']},:range=>[],:right=>0,:is_float=>0},
1=>{:variable=>"age",:name=>{"zh_tw"=>"年齡<br/>(Age)","en"=>"Age"},:is_num=>1, :hint=>{'zh_tw'=>'從 18 歲(含)開始至 93 歲','en'=>'Age must be between 18 and 93'} , :comment_text=>{'zh_tw'=>'年齡為該婦女於確診罹患乳癌時之年齡','en'=>'Age at diagnosis'}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[],:right=>0,:is_float=>0}, 1=>{:variable=>"age",:name=>{"zh_tw"=>"年齡<br/>(Age)","en"=>"Age"},:is_num=>1, :hint=>{'zh_tw'=>'從 18 歲(含)開始至 93 歲','en'=>'Age must be between 18 and 93'} , :comment_text=>{'zh_tw'=>'年齡為該婦女於確診罹患乳癌時之年齡','en'=>'Age at diagnosis'}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[18.93],:right=>0,:is_float=>0},
2=>{:variable=>"calcification_score",:name=>{"zh_tw"=>"鈣化指數<br/>(Calcification score)","en"=>"Calcification score"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[],:right=>0,:is_float=>0}, 2=>{:variable=>"calcification_score",:name=>{"zh_tw"=>"鈣化指數<br/>(Calcification score)","en"=>"Calcification score"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[],:right=>0,:is_float=>0}
} }
field :form_show_in_result , :type=> Hash ,default:{0=>{:variable=>"hormone_therapy",:name=>{"zh_tw"=>"賀爾蒙治療","en"=>"Hormone/Steroid therapy"},:is_num=>0, :hint=>{'zh_tw'=>'適用賀爾蒙受體陽性病人','en'=>'Hormone/ steroid therapy is available when ER status is positive'} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]}, field :form_show_in_result , :type=> Hash ,default:{0=>{:variable=>"hormone_therapy",:name=>{"zh_tw"=>"賀爾蒙治療","en"=>"Hormone/Steroid therapy"},:is_num=>0, :hint=>{'zh_tw'=>'適用賀爾蒙受體陽性病人','en'=>'Hormone/ steroid therapy is available when ER status is positive'} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]},
1=>{:variable=>"Chemotherapy",:name=>{"zh_tw"=>"化學治療","en"=>"Chemotherapy"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]}, 1=>{:variable=>"Chemotherapy",:name=>{"zh_tw"=>"化學治療","en"=>"Chemotherapy"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['否','是'],"en"=>['No','Yes']},:range=>[]},