This commit is contained in:
BoHung Chiu 2022-01-26 19:26:56 +08:00
parent 4b4c960d14
commit 6a1cac01aa
2 changed files with 13 additions and 14 deletions

View File

@ -378,14 +378,14 @@ class Admin::CancerpredictsController < OrbitAdminController
@table_str_left += '<label for="'+@field_property["variable"]+'" style="float:left;'+(@field_property["comment_text"] == "" ? "margin-right: 2.125em;" : "")+'" class="cencer_table_name">' @table_str_left += '<label for="'+@field_property["variable"]+'" style="float:left;'+(@field_property["comment_text"] == "" ? "margin-right: 2.125em;" : "")+'" class="cencer_table_name">'
@table_str_left += @field_property["name"] @table_str_left += @field_property["name"]
@table_str_left += '</label>' @table_str_left += '</label>'
if @field_property["comment_text"] != "" if @field_property["comment_text"].present?
@table_str_left += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>' @table_str_left += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
@table_str_left += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'/>' @table_str_left += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'/>'
else else
@site_locales = current_site.in_use_locales @site_locales = current_site.in_use_locales
@site_locales.delete(current_locale) @site_locales.delete(current_locale)
@site_locales.each do |locale| @site_locales.each do |locale|
next if property["comment_text"][locale.to_s] == "" next if property["comment_text"][locale.to_s].blank?
@field_property["comment_text"] = property["comment_text"][locale.to_s] @field_property["comment_text"] = property["comment_text"][locale.to_s]
break break
end end
@ -444,11 +444,11 @@ class Admin::CancerpredictsController < OrbitAdminController
@site_locales = current_site.in_use_locales @site_locales = current_site.in_use_locales
@site_locales.delete(current_locale) @site_locales.delete(current_locale)
@site_locales.each do |locale| @site_locales.each do |locale|
next if property["comment_text"][locale.to_s] == "" next if property["comment_text"][locale.to_s].blank?
@field_property["comment_text"] = property["comment_text"][locale.to_s] @field_property["comment_text"] = property["comment_text"][locale.to_s]
break break
end end
if @field_property["comment_text"] != "" if @field_property["comment_text"].present?
@table_str_right += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>' @table_str_right += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
@table_str_right += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'/>' @table_str_right += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'/>'
else else
@ -528,18 +528,18 @@ class Admin::CancerpredictsController < OrbitAdminController
@table_result_choice_fileds += '<label for="'+@field_property["variable"]+'" style="float:left;'+(@field_property["comment_text"] == "" ? "margin-right: 2.125em;" : "")+'" class="cencer_table_name">' @table_result_choice_fileds += '<label for="'+@field_property["variable"]+'" style="float:left;'+(@field_property["comment_text"] == "" ? "margin-right: 2.125em;" : "")+'" class="cencer_table_name">'
@table_result_choice_fileds += @field_property["name"] @table_result_choice_fileds += @field_property["name"]
@table_result_choice_fileds += '</label>' @table_result_choice_fileds += '</label>'
if @field_property["comment_text"] != "" if @field_property["comment_text"].present?
@table_result_choice_fileds += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>' @table_result_choice_fileds += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
@table_result_choice_fileds += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'></input>' @table_result_choice_fileds += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'></input>'
else else
@site_locales = current_site.in_use_locales @site_locales = current_site.in_use_locales
@site_locales.delete(current_locale) @site_locales.delete(current_locale)
@site_locales.each do |locale| @site_locales.each do |locale|
next if property["comment_text"][locale.to_s] == "" next if property["comment_text"][locale.to_s].blank?
@field_property["comment_text"] = property["comment_text"][locale.to_s] @field_property["comment_text"] = property["comment_text"][locale.to_s]
break break
end end
if @field_property["comment_text"] != "" if @field_property["comment_text"].present?
@table_result_choice_fileds += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>' @table_result_choice_fileds += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 15px;background-color: rgb(210, 106, 2);border-color: rgb(210, 106, 2);color: white;"><i aria-hidden="true" class="fa fa-question"></i></button>'
@table_result_choice_fileds += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'/>' @table_result_choice_fileds += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'/>'
else else

View File

@ -139,21 +139,20 @@ class Cancerpredictfields
end end
self.tmp_hidden_variables_for_js = tmp_hidden_variables.rstrip.gsub(/\n\s+/,"\n ").gsub("\n",";\n") + ";" self.tmp_hidden_variables_for_js = tmp_hidden_variables.rstrip.gsub(/\n\s+/,"\n ").gsub("\n",";\n") + ";"
self.fix_hidden_variables = [] self.fix_hidden_variables = []
self.tmp_hidden_variables_for_ruby = tmp_hidden_variables.split(/^([^=]+)=([^=])/).select{|s| s.present?}.each_slice(2).map do |a,b| self.tmp_hidden_variables_for_ruby = tmp_hidden_variables.split(/^([^=!]+)=([^=!])/).select{|s| s.present?}.each_slice(2).map do |a,b|
a = a.strip a = a.strip
self.fix_hidden_variables << a self.fix_hidden_variables << a
if b if b
puts ("result[\"#{a}\"]=" + b) ("result[\"#{a}\"]=" + b.gsub("\n",""))
("result[\"#{a}\"]=" + b)
else else
a a
end end
end.join("\n") end.join("\n")
self.fix_hidden_variables = self.fix_hidden_variables.uniq self.fix_hidden_variables = self.fix_hidden_variables.uniq
formula = formula.split(/^([^=]+)=([^=])/).select{|s| s.present?}.each_slice(2).map do |a,b| formula = formula.split(/^([^=!]+)=([^=!])/).select{|s| s.present?}.each_slice(2).map do |a,b|
a = a.strip a = a.strip
if b if b
("result[\"#{a}\"]=" + b) ("result[\"#{a}\"]=" + b.gsub("\n",""))
else else
a a
end end
@ -282,10 +281,10 @@ class Cancerpredictfields
if (mapping_data_from_csv != {} && !mapping_data_from_csv[@variable].blank?) if (mapping_data_from_csv != {} && !mapping_data_from_csv[@variable].blank?)
js_code += " mapping_hash = mapping_data_from_csv['#{@variable}'];\r\n" js_code += " mapping_hash = mapping_data_from_csv['#{@variable}'];\r\n"
js_code += " temp_index = 0;\r\n" js_code += " temp_index = 0;\r\n"
js_code += " temp_value = result[#{@variable}];\r\n" js_code += " temp_value = result['#{@variable}'];\r\n"
js_code += " index = 0; js_code += " index = 0;
$.each(mapping_hash,function(k,v){ $.each(mapping_hash,function(k,v){
if( i == 0 ){ if( index == 0 ){
var index_val = v.indexOf(temp_value); var index_val = v.indexOf(temp_value);
if( index_val != -1 ){ if( index_val != -1 ){
temp_index = index_val; temp_index = index_val;