Colon_Cancer_Predict2/app/views/admin/coloncancerpredict2s/_form.html.erb

38 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

2022-05-23 10:37:39 +00:00
<tr>
<td class="remove_div">❌</td>
<td class="sort_div"></td>
<% keys.each do |key| %>
<td class="<%=key%>">
<% if key.include? "_file" %>
<%= render :partial => 'form_file', :object => (ColoncancerPredictMappingFile2.where(:id=> property[key]).first rescue nil), :locals => {:f => make_fields, :key=>key} %>
<% else %>
<% value = property[key] %>
<% value_type = Coloncancerpredictfields2s::FIELDINFO[key] %>
<% value = "[]" if property == {} && value_type == 'Array' %>
<% is_localized = Coloncancerpredictfields2s::NonLoclaized.exclude?(key) %>
<% @value= value %>
<% if is_localized %>
<% @disp_value = @value[I18n.locale.to_s] rescue "" %>
<%else%>
<% @disp_value = @value %>
<%end%>
2024-08-20 15:41:42 +00:00
<% @disp_value = cc2_yaml_dump(@disp_value) if value_type == 'Array' %>
2022-05-23 10:37:39 +00:00
<% field_type = ((value_type == 'String' || value_type == 'Array' || value_type == 'Float') ? "text_field" : value_type) %>
<% if value_type == '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 is_localized %>
<%=make_fields.fields_for I18n.locale.to_s do |locale_fields|%>
<%= locale_fields.send(field_type, key,{:value=>@disp_value}) %>
<%end%>
<% else %>
<%= make_fields.send(field_type, key,{:value=>@disp_value})%>
<%end%>
<%end%>
</td>
<%end%>
<td><%= make_fields.hidden_field :old_num,:value=>num.to_s %></td>
</tr>