Fix bug.
This commit is contained in:
parent
a6bb253f20
commit
0ff0b42b70
|
@ -7,7 +7,7 @@ class Cancerpredictfields
|
|||
include OrbitTag::Taggable
|
||||
include OrbitCategory::Categorizable
|
||||
FIELDINFO = {"variable"=>"String","name"=>"String","is_num"=>"Fixnum","hint"=>"String","comment_text"=>"String","choice_fields"=>"Array","range"=>"Array","right"=>"Fixnum","is_float"=>"Fixnum","revert_value"=>"Fixnum","map_values"=>"Array","cancer_predict_mapping_file"=>"String"}
|
||||
|
||||
NonLoclaized = ["variable","is_num","range","right","is_float","revert_value","map_values","cancer_predict_mapping_file"]
|
||||
field :title ,type:String ,default:""
|
||||
field :form_show , :type=> Hash ,default:{0=>{:variable=>"sex",:name=>{"zh_tw"=>"性別<br/>(Sex)","en"=>"Sex"},:is_num=>0, :hint=>{'zh_tw'=>'','en'=>''} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>['男','女'],"en"=>['Male','Female']},:range=>[],:right=>0,:is_float=>0,:revert_value=>0,:map_values=>[],:cancer_predict_mapping_file=>""},
|
||||
1=>{:variable=>"age",:name=>{"zh_tw"=>"年齡<br/>(Age)","en"=>"Age"},:is_num=>1, :hint=>{'zh_tw'=>'從 20 歲(含)開始至 98 歲','en'=>'Age must be between 20 and 98'} , :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[20,98],:right=>0,:is_float=>0,:revert_value=>0,:map_values=>[],:cancer_predict_mapping_file=>""},
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<% else%>
|
||||
<td><%= make_fields.check_box key,{:checked=>false,:class=>"checkbox",:style=>"float:left;"}%></td>
|
||||
<%end%>
|
||||
<% elsif value_type == BSON::Document || value_type == Hash %>
|
||||
<% elsif Cancerpredictfields::NonLoclaized.exclude?(key) %>
|
||||
<%=make_fields.fields_for I18n.locale.to_s do |locale_fields|%>
|
||||
<td><%= locale_fields.text_field key,{:value=>@disp_value}%></td>
|
||||
<%end%>
|
||||
|
|
|
@ -259,13 +259,13 @@
|
|||
<%else%>
|
||||
<% @disp_value = @value %>
|
||||
<%end%>
|
||||
<% if @value.class == Fixnum %>
|
||||
<% if Cancerpredictfields::FIELDINFO[key] == "Fixnum" %>
|
||||
<% if @value == 1%>
|
||||
<td><%= make_fields.check_box key,{:checked=>true,:class=>"checkbox",:style=>"float:left;"}%></td>
|
||||
<% else%>
|
||||
<td><%= make_fields.check_box key,{:checked=>false,:class=>"checkbox",:style=>"float:left;"}%></td>
|
||||
<%end%>
|
||||
<% elsif @value.class == BSON::Document || @value.class == Hash %>
|
||||
<% elsif Cancerpredictfields::NonLoclaized.exclude?(key) %>
|
||||
<%=make_fields.fields_for I18n.locale.to_s do |locale_fields|%>
|
||||
<td><%= locale_fields.text_field key,{:value=>@disp_value}%></td>
|
||||
<%end%>
|
||||
|
|
Loading…
Reference in New Issue