From be9c1f3d059570b93c20b54e4dff5a2b2aee1099 Mon Sep 17 00:00:00 2001 From: BOHUNG Date: Sat, 23 Nov 2019 17:49:18 +0800 Subject: [PATCH] finish a half of predict_tool --- app/assets/javascripts/cancer_predict.js | 19 ++++++++++++++++++- app/controllers/cancerpredicts_controller.rb | 11 +++++++---- app/models/cancerpredictfields.rb | 14 +++++++------- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/cancer_predict.js b/app/assets/javascripts/cancer_predict.js index 033118f..d1d3746 100644 --- a/app/assets/javascripts/cancer_predict.js +++ b/app/assets/javascripts/cancer_predict.js @@ -1 +1,18 @@ -$('.cancer_help_btn') \ No newline at end of file +$(document).ready(function(){ + $('.cancer_help_btn').append(''); + $('.cancer_help_btn').off("click").on('click',function(){ + var modal_head = ""; + try{ modal_head = $(this).parent().find(">label").html()}catch{}; + var modal_body = ""; + try{ modal_body = $(this).parent().find(">input.help_texts").attr('value')}catch{}; + $('#show_help_modal').html("") + $('#show_help_modal').modal('show'); + $('#show_help_modal .close').off("click").on('click',function(){ + $('#show_help_modal').modal('hide'); + }); + $('#show_help_modal .modal-footer button').off("click").on('click',function(){ + $('#show_help_modal').modal('hide'); + }); + }); +}); diff --git a/app/controllers/cancerpredicts_controller.rb b/app/controllers/cancerpredicts_controller.rb index e17d328..cecbdd3 100644 --- a/app/controllers/cancerpredicts_controller.rb +++ b/app/controllers/cancerpredicts_controller.rb @@ -11,7 +11,7 @@ class CancerpredictsController < ApplicationController tags = OrbitHelper.widget_tags categories = OrbitHelper.widget_categories || [] locale = OrbitHelper.get_site_locale.to_s - @table_str = '
' + @table_str = '
' create_first_field @form_to_show.form_show.each do |num,property| @table_str += '
' @@ -26,18 +26,21 @@ class CancerpredictsController < ApplicationController @field_property[key] = @disp_value end break if @field_property["name"] == "" - @table_str += '