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%>
|
||||
|
|
|
@ -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%>
|
||||
<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%>
|
||||
|
@ -355,21 +355,21 @@
|
|||
var ui_child=$(ele).parent().find('> tr');
|
||||
console.log(ui_child);
|
||||
for (var i=0;i<ui_child.length;i++){
|
||||
var now_ele = ui_child.eq(i);
|
||||
var $inputs = now_ele.find('input');
|
||||
$inputs.each(function(input_index,input){
|
||||
var name = input.name;
|
||||
name = $.map(name.split(/(\[|\])/),function(v,ii){
|
||||
var vv = v;
|
||||
var num = Number.parseInt(vv);
|
||||
if(!Number.isNaN(num)){
|
||||
vv = i.toString();
|
||||
}
|
||||
return vv;
|
||||
}).join("");
|
||||
console.log(name)
|
||||
input.name = name;
|
||||
})
|
||||
var now_ele = ui_child.eq(i);
|
||||
var $inputs = now_ele.find('input');
|
||||
$inputs.each(function(input_index,input){
|
||||
var name = input.name;
|
||||
name = $.map(name.split(/(\[|\])/),function(v,ii){
|
||||
var vv = v;
|
||||
var num = Number.parseInt(vv);
|
||||
if(!Number.isNaN(num)){
|
||||
vv = i.toString();
|
||||
}
|
||||
return vv;
|
||||
}).join("");
|
||||
console.log(name)
|
||||
input.name = name;
|
||||
})
|
||||
}
|
||||
}
|
||||
$( ".sort_table > tbody" ).sortable({
|
||||
|
|
Loading…
Reference in New Issue