2019-12-15 13:08:41 +00:00
|
|
|
<%= stylesheet_link_tag "lib/fileupload"%>
|
|
|
|
<%= javascript_include_tag 'lib/bootstrap-fileupload' %>
|
2019-11-15 00:44:28 +00:00
|
|
|
<div style="clear:both;"></div>
|
2019-12-11 15:59:17 +00:00
|
|
|
<%=form_for @form_to_show ,:url=>{:controller=>"cancerpredicts" ,:action=>"edit"} do |form|%>
|
2019-12-15 13:08:41 +00:00
|
|
|
<span class="show_span"><%= t('cancerpredict.title') %></span>
|
|
|
|
<div style="clear:both;"></div>
|
|
|
|
<label class="label_left" for="title_text"><%= t('cancerpredict.title_text')+':' %></label> <%=form.text_field :title_texts ,{:value => @form_to_show.title_texts,:id=>"title_text"} %>
|
|
|
|
<% if @title_images.length != 0%>
|
|
|
|
<% @title_images.each_with_index do |temp_image,i| %>
|
|
|
|
<%= form.fields_for "title_images" do |image_fields| %>
|
|
|
|
<div class="image_field title_images" value="<%=(i+1).to_s%>">
|
|
|
|
<%= image_fields.fields_for i.to_s do |image_field| %>
|
|
|
|
<%= render :partial => 'image_form', :object => temp_image, :locals => {:f => image_field, :i => i} %>
|
|
|
|
<% if i.to_i == @title_images.length - 1%>
|
|
|
|
<script>
|
|
|
|
$(document).on('click', '#add_file.title_images', function(){
|
|
|
|
var old_id = $('.image_field.title_images').eq(-1).attr('value');
|
|
|
|
if( old_id == undefined)
|
|
|
|
old_id = 0;
|
|
|
|
else
|
|
|
|
old_id = Number(old_id);
|
|
|
|
var new_id = old_id + 1;
|
|
|
|
var html = "<%= escape_javascript(render :partial => 'image_form', :object => @head_new_image, :locals => {:f => image_field, :i => i}).gsub("\"","\'").html_safe %>"
|
|
|
|
$(this).parent().siblings('.add-target.title_images').before(('<div class="image_field title_images" value="'+new_id+'">'+html.replace(old_id, new_id)+'</div>'));
|
|
|
|
var name = $('.image_field.title_images').eq(-1).find('[type="file"]').attr('name');
|
|
|
|
$('.image_field.title_images').eq(-1).find('[type="file"]').attr('name',name.replace("<%=i%>",new_id-1));
|
|
|
|
name = $('.image_field.title_images').eq(-1).find('input.sort_num').attr('name');
|
|
|
|
$('.image_field.title_images').eq(-1).find('input.sort_num').attr('name',name.replace("<%=i%>",new_id-1));
|
|
|
|
new_id = $('.image_field.title_images').eq(-2).find('input.sort_num').val();
|
|
|
|
$('.image_field.title_images').eq(-1).find('input.sort_num').val(Number(new_id)+1);
|
|
|
|
formTip();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<%= form.fields_for "title_images" do |image_fields| %>
|
|
|
|
<%= image_fields.fields_for "0" do |image_field| %>
|
|
|
|
<script>
|
|
|
|
$(document).on('click', '#add_file.title_images', function(){
|
|
|
|
var old_id = $('.image_field.title_images').eq(-1).attr('value');
|
|
|
|
if( old_id == undefined)
|
|
|
|
old_id = 0;
|
|
|
|
else
|
|
|
|
old_id = Number(old_id);
|
|
|
|
var new_id = old_id + 1;
|
|
|
|
var html = "<%= escape_javascript(render :partial => 'image_form', :object => @head_new_image, :locals => {:f => image_field, :i => 0}).gsub("\"","\'").html_safe %>"
|
|
|
|
$(this).parent().siblings('.add-target.title_images').before(('<div class="image_field title_images" value="'+new_id+'">'+html.replace(old_id, new_id)+'</div>'));
|
|
|
|
var name = $('.image_field.title_images').eq(-1).find('[type="file"]').attr('name');
|
|
|
|
$('.image_field.title_images').eq(-1).find('[type="file"]').attr('name',name.replace("0",new_id-1));
|
|
|
|
name = $('.image_field.title_images').eq(-1).find('input.sort_num').attr('name');
|
|
|
|
$('.image_field.title_images').eq(-1).find('input.sort_num').attr('name',name.replace("0",new_id-1));
|
|
|
|
new_id = $('.image_field.title_images').eq(-2).find('input.sort_num').val();
|
|
|
|
if(new_id != undefined)
|
|
|
|
$('.image_field.title_images').eq(-1).find('input.sort_num').val(Number(new_id)+1);
|
|
|
|
else
|
|
|
|
$('.image_field.title_images').eq(-1).find('input.sort_num').val(1);
|
|
|
|
formTip();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<div class="add-target title_images"></div>
|
|
|
|
<p class="add-btn">
|
|
|
|
<%= hidden_field_tag 'title_images_count', @title_images.count %>
|
|
|
|
<a id="add_file" class="title_images trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t('cancerpredict.add_image') %></a>
|
|
|
|
</p>
|
|
|
|
<span class="show_span"><%= t('cancerpredict.tool_head_pictures') %></span>
|
|
|
|
<div style="clear:both;"></div>
|
|
|
|
<% if @head_images.length != 0%>
|
|
|
|
<% @head_images.each_with_index do |temp_image,i| %>
|
|
|
|
<%= form.fields_for "head_images" do |image_fields| %>
|
|
|
|
<div class="head_images image_field" value="<%=(i+1).to_s%>">
|
|
|
|
<%= image_fields.fields_for i.to_s do |image_field| %>
|
|
|
|
<%= render :partial => 'image_form', :object => temp_image, :locals => {:f => image_field, :i => i} %>
|
|
|
|
<% if i.to_i == @head_images.length - 1%>
|
|
|
|
<script>
|
|
|
|
$(document).on('click', '#add_file.head_images', function(){
|
|
|
|
var old_id = $('.image_field').eq(-1).attr('value');
|
|
|
|
if( old_id == undefined)
|
|
|
|
old_id = 0;
|
|
|
|
else
|
|
|
|
old_id = Number(old_id);
|
|
|
|
var new_id = old_id + 1;
|
|
|
|
var html = "<%= escape_javascript(render :partial => 'image_form', :object => @head_new_image, :locals => {:f => image_field, :i => i}).gsub("\"","\'").html_safe %>"
|
|
|
|
$(this).parent().siblings('.add-target.head_images').before(('<div class="image_field" value="'+new_id+'">'+html.replace(old_id, new_id)+'</div>'));
|
|
|
|
var name = $('.image_field').eq(-1).find('[type="file"]').attr('name');
|
|
|
|
$('.image_field').eq(-1).find('[type="file"]').attr('name',name.replace("<%=i%>",new_id-1));
|
|
|
|
name = $('.image_field').eq(-1).find('input.sort_num').attr('name');
|
|
|
|
$('.image_field').eq(-1).find('input.sort_num').attr('name',name.replace("<%=i%>",new_id-1));
|
|
|
|
new_id = $('.image_field').eq(-2).find('input.sort_num').val();
|
|
|
|
$('.image_field').eq(-1).find('input.sort_num').val(Number(new_id)+1);
|
|
|
|
formTip();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<%= form.fields_for "head_images" do |image_fields| %>
|
|
|
|
<%= image_fields.fields_for "0" do |image_field| %>
|
|
|
|
<script>
|
|
|
|
$(document).on('click', '#add_file.head_images', function(){
|
|
|
|
var old_id = $('.image_field.head_images').eq(-1).attr('value');
|
|
|
|
if( old_id == undefined)
|
|
|
|
old_id = 0;
|
|
|
|
else
|
|
|
|
old_id = Number(old_id);
|
|
|
|
var new_id = old_id + 1;
|
|
|
|
var html = "<%= escape_javascript(render :partial => 'image_form', :object => @head_new_image, :locals => {:f => image_field, :i => 0}).gsub("\"","\'").html_safe %>"
|
|
|
|
$(this).parent().siblings('.add-target.head_images').before(('<div class="image_field head_images" value="'+new_id+'">'+html.replace(old_id, new_id)+'</div>'));
|
|
|
|
var name = $('.image_field.head_images').eq(-1).find('[type="file"]').attr('name');
|
|
|
|
$('.image_field.head_images').eq(-1).find('[type="file"]').attr('name',name.replace("0",new_id-1));
|
|
|
|
name = $('.image_field.head_images').eq(-1).find('input.sort_num').attr('name');
|
|
|
|
$('.image_field.head_images').eq(-1).find('input.sort_num').attr('name',name.replace("0",new_id-1));
|
|
|
|
new_id = $('.image_field.head_images').eq(-2).find('input.sort_num').val();
|
|
|
|
if(new_id != undefined)
|
|
|
|
$('.image_field.head_images').eq(-1).find('input.sort_num').val(Number(new_id)+1);
|
|
|
|
else
|
|
|
|
$('.image_field.head_images').eq(-1).find('input.sort_num').val(1);
|
|
|
|
formTip();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<div class="add-target head_images"></div>
|
|
|
|
<p class="add-btn">
|
|
|
|
<%= hidden_field_tag 'head_images_count', @head_images.count %>
|
|
|
|
<a id="add_file" class="head_images trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t('cancerpredict.add_image') %></a>
|
|
|
|
</p>
|
2019-12-14 04:21:09 +00:00
|
|
|
<span class="show_span"><%= t('cancerpredict.text_descibe') %></span>
|
|
|
|
<div style="clear:both;"></div>
|
|
|
|
<%= form.text_field 'text_descibe',{:value=> @form_to_show.text_descibe[I18n.locale.to_s],:style=>'width:100%;'} %>
|
|
|
|
<span class="show_span"><%= t('cancerpredict.font_size') %></span>
|
|
|
|
<div style="clear:both;"></div>
|
|
|
|
<% @size=['small','medium','large'] %>
|
|
|
|
<% @size.each do |size|%>
|
|
|
|
<div><label class="label_left" for=<%='font_'+size%>><%=t('cancerpredict.'+size)+':'%></label><%= form.text_field size,{:value=> @form_to_show[size],:id=>'font_'+size} %></div>
|
|
|
|
<%end%>
|
|
|
|
<span class="show_span"><%= t('cancerpredict.Input_fields') %></span>
|
|
|
|
<div style="clear:both;"></div>
|
2019-12-11 15:59:17 +00:00
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<% @form_to_show.form_show.values[1].each do |key,vlaue|%>
|
|
|
|
<th><%=key%></th>
|
|
|
|
<%end%>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2019-11-23 08:14:56 +00:00
|
|
|
<tbody>
|
|
|
|
<%= form.fields_for :form_show do |formfield|%>
|
|
|
|
<% @form_to_show.form_show.each do |num,property| %>
|
2019-12-11 15:59:17 +00:00
|
|
|
<%=formfield.fields_for num.to_s do |make_fields|%>
|
|
|
|
<tr>
|
|
|
|
<% property.each do |key,value|%>
|
|
|
|
<% @value= value %>
|
|
|
|
<% if @value.class == BSON::Document || @value.class == Hash %>
|
|
|
|
<% @disp_value = @value[I18n.locale.to_s] rescue "" %>
|
|
|
|
<%else%>
|
|
|
|
<% @disp_value = @value %>
|
|
|
|
<%end%>
|
|
|
|
<% if @value.class == 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 %>
|
|
|
|
<%=make_fields.fields_for I18n.locale.to_s do |locale_fields|%>
|
|
|
|
<td><%= locale_fields.text_field key,{:value=>@disp_value}%></td>
|
|
|
|
<%end%>
|
|
|
|
<% else %>
|
|
|
|
<td><%= make_fields.text_field key,{:value=>@disp_value}%></td>
|
|
|
|
<%end%>
|
2019-11-23 08:14:56 +00:00
|
|
|
<%end%>
|
2019-12-11 15:59:17 +00:00
|
|
|
</tr>
|
2019-11-23 08:14:56 +00:00
|
|
|
<%end%>
|
|
|
|
<%end%>
|
|
|
|
<%end%>
|
|
|
|
</tbody>
|
2019-12-11 15:59:17 +00:00
|
|
|
</table>
|
|
|
|
<span class="show_span"><%=t('cancerpredict.table.Results')%></span>
|
|
|
|
<div style="clear:both;"></div>
|
2019-12-14 04:21:09 +00:00
|
|
|
<label for="form_result_is_right" style="float: left;"><%= t('cancerpredict.result_is_right') %></label>
|
2019-12-11 15:59:17 +00:00
|
|
|
<% if @form_to_show.form_result_is_right.to_i == 1%>
|
|
|
|
<div><%= form.check_box "form_result_is_right",{:checked=>true,:class=>"checkbox",:style=>"float: left;position: relative;left: 0;transform: none!important;margin-left: 1em;",:id=>"form_result_is_right"}%></div>
|
|
|
|
<% else%>
|
|
|
|
<div><%= form.check_box "form_result_is_right",{:checked=>false,:class=>"checkbox",:style=>"float: left;position: relative;left: 0;transform: none!important;margin-left: 1em;",:id=>"form_result_is_right"}%></div>
|
2019-11-15 00:44:28 +00:00
|
|
|
<%end%>
|
2019-12-11 15:59:17 +00:00
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<% @form_to_show.form_show_in_result.values[1].each do |key,vlaue|%>
|
|
|
|
<th><%=key%></th>
|
|
|
|
<%end%>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<%= form.fields_for :form_show_in_result do |formfield|%>
|
|
|
|
<% @form_to_show.form_show_in_result.each do |num,property| %>
|
|
|
|
<%=formfield.fields_for num.to_s do |make_fields|%>
|
|
|
|
<tr>
|
|
|
|
<% property.each do |key,value|%>
|
|
|
|
<% @value= value %>
|
|
|
|
<% if @value.class == BSON::Document || @value.class == Hash %>
|
|
|
|
<% @disp_value = @value[I18n.locale.to_s] rescue "" %>
|
|
|
|
<%else%>
|
|
|
|
<% @disp_value = @value %>
|
|
|
|
<%end%>
|
|
|
|
<% if @value.class == 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 %>
|
|
|
|
<%=make_fields.fields_for I18n.locale.to_s do |locale_fields|%>
|
|
|
|
<td><%= locale_fields.text_field key,{:value=>@disp_value}%></td>
|
|
|
|
<%end%>
|
|
|
|
<% else %>
|
|
|
|
<td><%= make_fields.text_field key,{:value=>@disp_value}%></td>
|
|
|
|
<%end%>
|
|
|
|
<%end%>
|
|
|
|
</tr>
|
|
|
|
<%end%>
|
|
|
|
<%end%>
|
|
|
|
<%end%>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<%=form.submit "#{t(:updatefont)}",{:id=>"updatebtn"}%>
|
|
|
|
<%end%>
|
2019-11-15 00:44:28 +00:00
|
|
|
<style type="text/css">
|
2019-11-23 08:14:56 +00:00
|
|
|
thead > tr > th{
|
|
|
|
border:1px solid;
|
|
|
|
background: bisque;
|
|
|
|
}
|
|
|
|
tbody{
|
|
|
|
background:white;
|
|
|
|
}
|
|
|
|
tbody > tr > td{
|
|
|
|
border:1px solid;
|
2019-12-11 15:59:17 +00:00
|
|
|
position: relative;
|
2019-11-23 08:14:56 +00:00
|
|
|
}
|
2019-11-15 00:44:28 +00:00
|
|
|
.show_li,.show_li *{
|
|
|
|
list-style:none;
|
|
|
|
color:balck;
|
|
|
|
}
|
|
|
|
.show_li ul{
|
|
|
|
display:none;
|
|
|
|
}
|
|
|
|
#clicktosee{
|
|
|
|
color:blue;
|
|
|
|
cursor:pointer;
|
|
|
|
}
|
2019-12-11 15:59:17 +00:00
|
|
|
.checkbox{
|
|
|
|
left: 50%;
|
|
|
|
position: absolute;
|
|
|
|
transform: translate(-50%, -50%) !important;
|
|
|
|
top: 50%;
|
|
|
|
}
|
|
|
|
#updatebtn{
|
|
|
|
margin-top: 1em;
|
|
|
|
right: 1em;
|
2019-12-14 04:21:09 +00:00
|
|
|
background-color: #0088cc;
|
2019-12-11 15:59:17 +00:00
|
|
|
color: white;
|
|
|
|
border: 0em;
|
|
|
|
padding: 0.125em 0.5em;
|
|
|
|
border-radius: 0.5em;
|
|
|
|
}
|
|
|
|
.show_span{
|
|
|
|
margin: 1em;
|
|
|
|
float: left;
|
|
|
|
background-color: rgb(210, 105, 0);
|
|
|
|
color: white;
|
|
|
|
border: 0em;
|
|
|
|
padding: 0.125em 0.5em;
|
|
|
|
border-radius: 0.5em;
|
|
|
|
width: fit-content;
|
|
|
|
}
|
2019-12-14 04:21:09 +00:00
|
|
|
.label_left{
|
|
|
|
float: left;
|
|
|
|
padding-right: 0.5em;
|
|
|
|
}
|
2019-11-23 08:14:56 +00:00
|
|
|
</style>
|