From 0ff0b42b7016bb207b33a3e86e5b0c2e7a999080 Mon Sep 17 00:00:00 2001 From: Bohung Date: Sat, 22 Jan 2022 12:52:03 +0800 Subject: [PATCH] Fix bug. --- app/models/cancerpredictfields.rb | 2 +- app/views/admin/cancerpredicts/_form.html.erb | 2 +- app/views/admin/cancerpredicts/index.html.erb | 38 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/models/cancerpredictfields.rb b/app/models/cancerpredictfields.rb index 01a4821..2fa3b23 100644 --- a/app/models/cancerpredictfields.rb +++ b/app/models/cancerpredictfields.rb @@ -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"=>"性別
(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"=>"年齡
(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=>""}, diff --git a/app/views/admin/cancerpredicts/_form.html.erb b/app/views/admin/cancerpredicts/_form.html.erb index 1c91614..743fc97 100644 --- a/app/views/admin/cancerpredicts/_form.html.erb +++ b/app/views/admin/cancerpredicts/_form.html.erb @@ -26,7 +26,7 @@ <% else%> <%= make_fields.check_box key,{:checked=>false,:class=>"checkbox",:style=>"float:left;"}%> <%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|%> <%= locale_fields.text_field key,{:value=>@disp_value}%> <%end%> diff --git a/app/views/admin/cancerpredicts/index.html.erb b/app/views/admin/cancerpredicts/index.html.erb index 7be0a82..9f46f89 100644 --- a/app/views/admin/cancerpredicts/index.html.erb +++ b/app/views/admin/cancerpredicts/index.html.erb @@ -4,7 +4,7 @@ <%#= javascript_include_tag "lib/bootstrap-datetimepicker" %> <%#= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> <%= javascript_include_tag "lib/file-type" %> - <%= javascript_include_tag "lib/module-area" %> + <%= javascript_include_tag "lib/module-area" %> <%= javascript_include_tag "form" %> <% end %> @@ -12,7 +12,7 @@ .sort_div:before{ content: "\e096"; font-family: 'entypo'; - cursor: pointer; + cursor: pointer; } .sort_div{ padding: 1em; @@ -259,13 +259,13 @@ <%else%> <% @disp_value = @value %> <%end%> - <% if @value.class == Fixnum %> + <% if Cancerpredictfields::FIELDINFO[key] == "Fixnum" %> <% if @value == 1%> <%= make_fields.check_box key,{:checked=>true,:class=>"checkbox",:style=>"float:left;"}%> <% else%> <%= make_fields.check_box key,{:checked=>false,:class=>"checkbox",:style=>"float:left;"}%> <%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|%> <%= locale_fields.text_field key,{:value=>@disp_value}%> <%end%> @@ -355,21 +355,21 @@ var ui_child=$(ele).parent().find('> tr'); console.log(ui_child); for (var i=0;i tbody" ).sortable({