2020-01-13 11:35:30 +00:00
|
|
|
|
<%= stylesheet_link_tag "lib/fileupload"%>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<%= stylesheet_link_tag "lib/togglebox"%>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
|
|
|
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
|
|
|
|
<%#= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
|
|
|
|
<%#= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
|
|
|
|
<%= javascript_include_tag "lib/file-type" %>
|
2022-01-22 04:52:03 +00:00
|
|
|
|
<%= javascript_include_tag "lib/module-area" %>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
<%= javascript_include_tag "form" %>
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
.sort_div:before{
|
|
|
|
|
content: "\e096";
|
|
|
|
|
font-family: 'entypo';
|
2022-01-22 04:52:03 +00:00
|
|
|
|
cursor: pointer;
|
2020-10-23 02:52:23 +00:00
|
|
|
|
}
|
|
|
|
|
.sort_div{
|
|
|
|
|
padding: 1em;
|
|
|
|
|
}
|
|
|
|
|
.sort_table tbody td:last-child{
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
.remove_div{
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
.remove_div:hover{
|
|
|
|
|
font-size: 1.3em;
|
|
|
|
|
}
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<% Cancerpredictfields::AdvanceFields.each do |field| %>
|
|
|
|
|
table .<%=field%>{
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
table.advance_mode .<%=field%>{
|
2022-02-07 11:00:39 +00:00
|
|
|
|
display: inherit;
|
2022-01-26 11:19:28 +00:00
|
|
|
|
}
|
|
|
|
|
<% end%>
|
|
|
|
|
.solid_line_hr{
|
|
|
|
|
margin: 0.3em;
|
|
|
|
|
border-top: 0.2em dashed;
|
|
|
|
|
}
|
|
|
|
|
.sort_table input, .sort_table textarea{
|
|
|
|
|
font-family: sans-serif;
|
|
|
|
|
}
|
|
|
|
|
.advance_mode_help_btn{
|
|
|
|
|
float:left;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
padding: 0em 0.475em;
|
|
|
|
|
font-size: 1.25em;
|
|
|
|
|
border-radius: 1.5em;
|
|
|
|
|
background-color: rgb(210, 106, 2);
|
|
|
|
|
border-color: rgb(210, 106, 2);
|
|
|
|
|
color: white;
|
|
|
|
|
width: 1.8em;
|
|
|
|
|
height: 1.8em;
|
|
|
|
|
line-height: 1em;
|
|
|
|
|
}
|
2022-01-26 11:40:14 +00:00
|
|
|
|
#show_advance_mode_modal {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
2020-10-23 02:52:23 +00:00
|
|
|
|
</style>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<div id="show_advance_mode_modal" class="modal fade">
|
|
|
|
|
<div class='modal-dialog'>
|
|
|
|
|
<div class='modal-content'>
|
|
|
|
|
<div class='modal-header'>
|
|
|
|
|
<button type='button' aria-hidden='true' class='close'>×</button>
|
|
|
|
|
<h4 class='modal-title'>
|
|
|
|
|
<%= t("cancerpredict.module_mode") %>
|
|
|
|
|
</h4>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<%= t("cancerpredict.advance_mode_hint2").html_safe %>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<button type="button" class="btn btn-default">Close</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-11-15 00:44:28 +00:00
|
|
|
|
<div style="clear:both;"></div>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<%=form_for @form_to_show ,:url=>{:controller=>"cancerpredicts" ,:action=>"edit"} do |form|%>
|
|
|
|
|
<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.fields_for :title_texts do |locale_fields|%>
|
|
|
|
|
<%=locale_fields.text_field I18n.locale.to_s ,{:value => @form_to_show.title_texts[I18n.locale.to_s],:id=>"title_text"} %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% 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>
|
|
|
|
|
<span class="show_span"><%= t('cancerpredict.text_descibe') %></span>
|
|
|
|
|
<div style="clear:both;"></div>
|
2020-02-03 07:26:04 +00:00
|
|
|
|
<textarea class="ckeditor" id="cancerpredictfields_text_descibe_<%=I18n.locale.to_s%>" name="cancerpredictfields[text_descibe][<%=I18n.locale.to_s%>]">
|
|
|
|
|
<%= @form_to_show.text_descibe[I18n.locale.to_s] %>
|
|
|
|
|
</textarea>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<span class="show_span"><%= t('cancerpredict.font_size') %></span>
|
|
|
|
|
<div style="clear:both;"></div>
|
|
|
|
|
<% @size=['small','medium','large'] %>
|
|
|
|
|
<% @size.each do |size|%>
|
|
|
|
|
<%= form.fields_for size do |make_size| %>
|
|
|
|
|
<div><label class="label_left" for=<%='font_'+size%>><%=t('cancerpredict.'+size)+':'%></label><%= make_size.text_field 'font_size',{:value=> @form_to_show[size]['font_size'],:id=>'font_'+size} %>
|
|
|
|
|
<% if @form_to_show[size]['active'].to_i == 1%>
|
|
|
|
|
<%= make_size.check_box 'active',{:checked=>true,:class=>"checkbox text_choice",:style=>"float:left;"}%></div>
|
|
|
|
|
<% else%>
|
|
|
|
|
<%= make_size.check_box 'active',{:checked=>false,:class=>"checkbox text_choice",:style=>"float:left;"}%></div>
|
|
|
|
|
<%end%>
|
|
|
|
|
<%end%>
|
|
|
|
|
<%end%>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<span class="show_span"><%= t('cancerpredict.module_mode') %></span>
|
|
|
|
|
<div style="clear:both;"></div>
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<label class="control-label" for="advance_mode" style="float: left; line-height: 30px;margin-right: 1em;">
|
|
|
|
|
<span style="float: left;"><%= t('cancerpredict.advance_mode') %></span>
|
|
|
|
|
<button type="button" class="advance_mode_help_btn" data-target="#show_advance_mode_modal"><i aria-hidden="true" class="fa fa-question"></i></button>
|
|
|
|
|
</label>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<input id="advance_mode" name="<%=form.object_name%>[advance_mode]" type="checkbox" class="toggle-check" data-disabled="<%=form.object.advance_mode == false%>">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="clear:both;"></div>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<span class="show_span"><%= t('cancerpredict.Input_fields') %></span>
|
|
|
|
|
<div style="clear:both;"></div>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<table id="fields_table" class="sort_table <%=@form_to_show.advance_mode ? 'advance_mode' : '' %>">
|
|
|
|
|
<% keys = Cancerpredictfields::FIELDINFO.keys - Cancerpredictfields::TherapyOnly %>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
<th></th>
|
|
|
|
|
<th></th>
|
|
|
|
|
<% keys.each do |key|%>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<th class="<%=key%>"><%=t("cancerpredict.table.#{key}")%></th>
|
2019-11-15 00:44:28 +00:00
|
|
|
|
<%end%>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
<%= form.fields_for :form_show do |formfield|%>
|
|
|
|
|
<% @form_to_show.form_show.each do |num,property| %>
|
|
|
|
|
<%=formfield.fields_for num.to_s do |make_fields|%>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
<%= render :partial => 'form', :locals=>{:make_fields=>make_fields,:property=>property,:num=>num,:keys => keys} %>
|
2019-11-15 00:44:28 +00:00
|
|
|
|
<%end%>
|
|
|
|
|
<%end%>
|
|
|
|
|
<%end%>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
<button id="add_field" type="button" class="btn btn-primary"><%= t('cancerpredict.table.add_field') %></button>
|
|
|
|
|
<div style="clear:both;"></div>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<span class="show_span"><%=t('cancerpredict.table.Results')%></span>
|
|
|
|
|
<div style="clear:both;"></div>
|
|
|
|
|
<label for="form_result_is_right" style="float: left;"><%= t('cancerpredict.result_is_right') %></label>
|
|
|
|
|
<% 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%>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<div style="clear:both;"></div>
|
2020-01-28 10:29:04 +00:00
|
|
|
|
<% @create_items = ['years','table_above_texts','text_above_texts','surgery_only_texts','extra_texts','extra_therapy_texts','danger_texts','texts_between_Result_and_result_block'] %>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<% @create_items.each do |item|%>
|
2020-02-03 07:26:04 +00:00
|
|
|
|
<label for="<%=item%>" style="float: left;margin-right:1em;width:11em;"><%= t('cancerpredict.'+item)+':' %></label>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<% if @form_to_show[item].class == BSON::Document || @form_to_show[item].class == Hash %>
|
|
|
|
|
<%= form.fields_for item do |locale_fields|%>
|
2020-02-03 07:26:04 +00:00
|
|
|
|
<%= locale_fields.text_field I18n.locale.to_s,{:value=>@form_to_show[item][I18n.locale.to_s] ,:id=> item,:style=>'width:calc(100% - 16em)'} %>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<% end %>
|
|
|
|
|
<% else %>
|
2020-02-03 07:26:04 +00:00
|
|
|
|
<%= form.text_field item,{:value=>@form_to_show[item],:id=> item,:style=>'width:calc(100% - 16em)'} %>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<% end %>
|
|
|
|
|
<div style="clear:both;"></div>
|
|
|
|
|
<% end %>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<table id="therapies_table" class="sort_table <%=@form_to_show.advance_mode ? 'advance_mode' : '' %>">
|
2020-10-23 02:52:23 +00:00
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th></th>
|
|
|
|
|
<th></th>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<% keys = Cancerpredictfields::TherapyFields %>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
<% keys.each do |key,vlaue|%>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<th class="<%=key%>"><%=t("cancerpredict.table.#{key}")%></th>
|
2020-03-04 07:37:59 +00:00
|
|
|
|
<%end%>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
</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|%>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<%= render :partial => 'form', :locals=>{:make_fields=>make_fields,:property=>property,:num=>num,:keys => Cancerpredictfields::TherapyFields} %>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<%end%>
|
|
|
|
|
<%end%>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
<%end%>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
<button id="add_therapy" type="button" class="btn btn-primary"><%= t('cancerpredict.table.add_therapy') %></button>
|
|
|
|
|
<div style="clear:both;"></div>
|
|
|
|
|
<span class="show_span"><%=t('cancerpredict.table.calculate_settings')%></span>
|
|
|
|
|
<div style="clear:both;"></div>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<div class="control-group">
|
|
|
|
|
<div class="control-label" style="float: left;margin-right: 1em;width: 11em;">
|
|
|
|
|
<label><%= t('cancerpredict.hidden_variables') %></label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= form.text_area :hidden_variables, :rows=>"5", :style=> 'width: 100%;font-family: sans-serif;' %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="clear:both;"></div>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
<div class="control-group">
|
|
|
|
|
<div class="control-label" style="float: left;margin-right: 1em;width: 11em;">
|
|
|
|
|
<label><%= t('cancerpredict.table.prediction_formula') %></label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="controls">
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<%= form.text_area :prediction_formula, :rows=>"5", :style=> 'width: 100%;font-family: sans-serif;' %>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="years_settings">
|
|
|
|
|
<% years = @form_to_show.years %>
|
|
|
|
|
<% years.each_with_index do |year,i| %>
|
|
|
|
|
<div data-year="<%= year.to_s.strip %>">
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<div class="control-label" style="float: left;margin-right: 1em;width: 13em;">
|
|
|
|
|
<label style="font-family: sans-serif;"><%=t("cancerpredict.Overall_Survival")%>(t=<%=year%> Year)</label>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="controls">
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<textarea name="<%= form.object_name %>[years_settings][]" style= "width: calc(100% - 16em);" value="<%= @form_to_show.years_settings[i] rescue '' %>"><%= @form_to_show.years_settings[i] rescue '' %></textarea>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<%=form.submit "#{t(:updatefont)}",{:id=>"updatebtn"}%>
|
2019-11-15 00:44:28 +00:00
|
|
|
|
<%end%>
|
2020-01-13 11:35:30 +00:00
|
|
|
|
<link href="/assets/admin/cancerpredict.css" media="screen" rel="stylesheet">
|
2019-11-15 00:44:28 +00:00
|
|
|
|
<script>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
$(".advance_mode_help_btn").click(function(){
|
|
|
|
|
$("#show_advance_mode_modal").modal();
|
|
|
|
|
})
|
|
|
|
|
$("#show_advance_mode_modal button").click(function(){
|
|
|
|
|
$("#show_advance_mode_modal").modal("hide");
|
|
|
|
|
})
|
|
|
|
|
$("#advance_mode").click(function(){
|
|
|
|
|
if(window.confirm("<%=t('cancerpredict.advance_mode_hint1').gsub("\n","\\n")%>")){
|
|
|
|
|
$("#fields_table,#therapies_table").toggleClass("advance_mode");
|
|
|
|
|
}else{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
})
|
2020-01-13 11:35:30 +00:00
|
|
|
|
$('.text_choice').click(function(){
|
|
|
|
|
$('.text_choice').prop('checked' , false);
|
|
|
|
|
$(this).prop('checked' , true);
|
2019-11-15 00:44:28 +00:00
|
|
|
|
});
|
2020-10-23 02:52:23 +00:00
|
|
|
|
$("#add_field").click(function(){
|
|
|
|
|
var index = $("#fields_table tbody tr").length.toString();
|
|
|
|
|
<%= fields_for :cancerpredictfields do |form|%>
|
|
|
|
|
<%= form.fields_for :form_show do |formfield|%>
|
|
|
|
|
<%=formfield.fields_for :new_index do |make_fields|%>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<% keys = Cancerpredictfields::FIELDINFO.keys - Cancerpredictfields::TherapyOnly %>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
var html = "<%= "#{render :partial => 'form', :locals=>{:make_fields=>make_fields,:property=>{},:num=>'',:keys => keys}}".gsub(/(\r\n|\n)/,"").gsub("\"","\\\"").html_safe %>";
|
|
|
|
|
$("#fields_table tbody").append(html.replaceAll('new_index',index));
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
$(".remove_div").off("click").on("click",function(){
|
|
|
|
|
$el = $(this).parent().siblings("tr").not($(this)).eq(0);
|
|
|
|
|
$(this).parent().remove();
|
|
|
|
|
update_key($el);
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
$("#add_therapy").click(function(){
|
|
|
|
|
var index = $("#therapies_table tbody tr").length.toString();
|
|
|
|
|
<%= fields_for :cancerpredictfields do |form|%>
|
|
|
|
|
<%= form.fields_for :form_show_in_result do |formfield|%>
|
|
|
|
|
<%=formfield.fields_for :new_index do |make_fields|%>
|
2022-01-26 11:19:28 +00:00
|
|
|
|
<% keys = Cancerpredictfields::TherapyFields %>
|
2020-10-23 02:52:23 +00:00
|
|
|
|
var html = "<%= "#{render :partial => 'form', :locals=>{:make_fields=>make_fields,:property=>{},:num=>'',:keys => keys}}".gsub(/(\r\n|\n)/,"").gsub("\"","\\\"").html_safe %>";
|
|
|
|
|
$("#therapies_table tbody").append(html.replaceAll('new_index',index));
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
$(".remove_div").off("click").on("click",function(){
|
|
|
|
|
$el = $(this).parent().siblings("tr").not($(this)).eq(0);
|
|
|
|
|
$(this).parent().remove();
|
|
|
|
|
update_key($el);
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
function update_key(ele){
|
|
|
|
|
console.log($(ele))
|
|
|
|
|
var ui_child=$(ele).parent().find('> tr');
|
|
|
|
|
console.log(ui_child);
|
|
|
|
|
for (var i=0;i<ui_child.length;i++){
|
2022-01-22 04:52:03 +00:00
|
|
|
|
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;
|
|
|
|
|
})
|
2020-10-23 02:52:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$( ".sort_table > tbody" ).sortable({
|
|
|
|
|
axis: "y",
|
|
|
|
|
revert: true,
|
|
|
|
|
placeholder: "sortable-placeholder",
|
|
|
|
|
handle: ".sort_div",
|
|
|
|
|
update: function(event, ui) {
|
|
|
|
|
update_key($(ui.item[0]))
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
$(".remove_div").click(function(){
|
|
|
|
|
$el = $(this).parent().siblings("tr").not($(this)).eq(0);
|
|
|
|
|
$(this).parent().remove();
|
|
|
|
|
update_key($el);
|
|
|
|
|
})
|
|
|
|
|
$(".remove_existing_record").click(function(){
|
|
|
|
|
if(window.confirm("Are you sure want to remove this file?")){
|
|
|
|
|
$(this).find(".should_destroy").val("1");
|
|
|
|
|
$(this).parent().siblings(".file-link").remove();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
$("#years").on('blur',function(){
|
|
|
|
|
var years = [];
|
|
|
|
|
try{
|
|
|
|
|
years = $(this).val().split(/\[|,|\]/).filter(function(aa){return aa !="" && aa != undefined}).map(function(aa){return aa.trim()});
|
|
|
|
|
}catch(e){};
|
|
|
|
|
var index = 0;
|
|
|
|
|
years.forEach(function(year){
|
|
|
|
|
if($("#years_settings [data-year='"+year+"']").length == 0){
|
|
|
|
|
var year_text = ('<div data-year="'+year+'">'+
|
2022-01-26 11:19:28 +00:00
|
|
|
|
'<div class="control-label" style="float: left;margin-right: 1em;width: 13em;">'+
|
|
|
|
|
'<label style="font-family: sans-serif;"><%=t("cancerpredict.Overall_Survival")%>(t='+year+' Year)</label>'+
|
2020-10-23 02:52:23 +00:00
|
|
|
|
'</div>'+
|
|
|
|
|
'<div class="controls">'+
|
2022-01-26 11:19:28 +00:00
|
|
|
|
'<textarea name="cancerpredictfields[years_settings][]" style= "width: calc(100% - 16em);"></textarea>'+
|
2020-10-23 02:52:23 +00:00
|
|
|
|
'</div>'+
|
|
|
|
|
'</div>');
|
|
|
|
|
if(index != 0){
|
|
|
|
|
$("#years_settings [data-year='"+years[index - 1]+"']").after(year_text);
|
|
|
|
|
}else{
|
|
|
|
|
$("#years_settings").html(year_text+$("#years_settings").html());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
index++;
|
|
|
|
|
})
|
|
|
|
|
var all_years = $("#years_settings [data-year]").map(function(i,aa){return $(aa).attr("data-year").toString().trim() }).toArray();
|
|
|
|
|
all_years.forEach(function(a_year){
|
|
|
|
|
if(years.indexOf(a_year) == -1){
|
|
|
|
|
$("#years_settings [data-year='"+a_year+"']").remove()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
2019-11-15 00:44:28 +00:00
|
|
|
|
</script>
|