add a lot of things
This commit is contained in:
		
							parent
							
								
									88b5a9bbed
								
							
						
					
					
						commit
						741d440631
					
				|  | @ -0,0 +1 @@ | ||||||
|  | $('.cancer_help_btn') | ||||||
|  | @ -19,6 +19,8 @@ class Admin::CancerpredictsController < OrbitAdminController | ||||||
|       render :partial => "index" |       render :partial => "index" | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |   def edit | ||||||
|  |   end | ||||||
|   def create_first_field |   def create_first_field | ||||||
| 	if Cancerpredictfields.where("title"=>(@app_title + "_back")).take_while{true}.count == 0 | 	if Cancerpredictfields.where("title"=>(@app_title + "_back")).take_while{true}.count == 0 | ||||||
| 		@form_to_show = Cancerpredictfields.new() | 		@form_to_show = Cancerpredictfields.new() | ||||||
|  |  | ||||||
|  | @ -1,24 +0,0 @@ | ||||||
| # encoding: utf-8 |  | ||||||
| require 'rubyXL' |  | ||||||
| class CancerpredictsController < ApplicationController |  | ||||||
|   before_filter :set_I18n |  | ||||||
|   before_action ->(module_app = @app_title) { set_variables module_app } |  | ||||||
|   #before_action :load_access_levels |  | ||||||
|   def initialize |  | ||||||
|     super |  | ||||||
|     @app_title = "cancerpredict" |  | ||||||
|   end |  | ||||||
| 
 |  | ||||||
|   def index |  | ||||||
| 	@tags = @module_app.tags |  | ||||||
|     @categories = @module_app.categories.enabled |  | ||||||
|     @filter_fields = filter_fields(@categories, @tags) |  | ||||||
|     @table_fields = [:status, :category, :title, :start_date, :end_date, :last_modified] |  | ||||||
|     if request.xhr? |  | ||||||
|       render :partial => "index" |  | ||||||
|     end |  | ||||||
|   end |  | ||||||
|   def set_I18n |  | ||||||
|     I18n.locale = params[:lang] if params[:lang].present? |  | ||||||
|   end |  | ||||||
| end |  | ||||||
|  | @ -1,9 +1,6 @@ | ||||||
| # encoding: utf-8 | # encoding: utf-8 | ||||||
| require 'rubyXL' | require 'rubyXL' | ||||||
| class CancerpredictsController < ApplicationController | class CancerpredictsController < ApplicationController | ||||||
|   before_filter :set_I18n |  | ||||||
|   before_action ->(module_app = @app_title) { set_variables module_app } |  | ||||||
|   #before_action :load_access_levels |  | ||||||
|   def initialize |   def initialize | ||||||
|     super |     super | ||||||
|     @app_title = "cancerpredict" |     @app_title = "cancerpredict" | ||||||
|  | @ -14,6 +11,47 @@ class CancerpredictsController < ApplicationController | ||||||
| 	tags = OrbitHelper.widget_tags | 	tags = OrbitHelper.widget_tags | ||||||
| 	categories = OrbitHelper.widget_categories || [] | 	categories = OrbitHelper.widget_categories || [] | ||||||
| 	locale = OrbitHelper.get_site_locale.to_s | 	locale = OrbitHelper.get_site_locale.to_s | ||||||
|  | 	@table_str = '<div id="cancer_table">' | ||||||
|  | 	create_first_field | ||||||
|  | 	@form_to_show.form_show.each do |num,property|  | ||||||
|  | 		@table_str += '<div data-key='+num.to_s+'>' | ||||||
|  | 		@field_property = {} | ||||||
|  | 		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 | ||||||
|  | 			@field_property[key] = @disp_value | ||||||
|  | 		end | ||||||
|  | 		break if @field_property["name"] == "" | ||||||
|  | 		@table_str += '<label for="'+@field_property["variable"]+'" style="float:left;" class="cencer_table_name">' | ||||||
|  | 		@table_str += @field_property["name"] | ||||||
|  | 		@table_str += '</label>' | ||||||
|  | 		if @field_property["comment_text"] != "" | ||||||
|  | 			@table_str += '<button tabindex="0" class="cancer_help_btn" data-target="#show_help_modal" style="float:left;"></button>' | ||||||
|  | 		end | ||||||
|  | 		if @field_property["is_num"] == 1 | ||||||
|  | 			@table_str += '<input class="num_only" id="'+@field_property["variable"]+'" style="float:left;clear:right;"></input>' | ||||||
|  | 		else | ||||||
|  | 			@table_str += '<div id="'+@field_property["variable"]+'" style="float:left;clear:right;">' | ||||||
|  | 			@field_property["choice_fields"].each do |create_choice| | ||||||
|  | 				@table_str += '<button class="cancer_table_btn">'+create_choice+'</button>' | ||||||
|  | 				@table_str += '<input type="hidden" value="0" name="'+create_choice+'"></input>' | ||||||
|  | 			end | ||||||
|  | 			@table_str += '' | ||||||
|  | 		end | ||||||
|  | 		if @field_property["hint"].to_s != "" | ||||||
|  | 			@table_str +='<div style="color: rgb(104, 104, 104);font-size:0.75em;clear:both;">'+@field_property["hint"]+'</div>' | ||||||
|  | 		end | ||||||
|  | 		@table_str += '</div><div style="clear:both;"></div>' | ||||||
|  | 	end | ||||||
|  | 	@table_str+='</div>' | ||||||
|  | 	{ | ||||||
|  |       "cancerpredict" => [], | ||||||
|  | 	  "extras"=>{"table"=> @table_str} | ||||||
|  | 	} | ||||||
|   end |   end | ||||||
|   def widget |   def widget | ||||||
| 	uid = OrbitHelper.params[:uid] rescue "" | 	uid = OrbitHelper.params[:uid] rescue "" | ||||||
|  | @ -21,7 +59,20 @@ class CancerpredictsController < ApplicationController | ||||||
| 	categories = OrbitHelper.widget_categories || [] | 	categories = OrbitHelper.widget_categories || [] | ||||||
| 	locale = OrbitHelper.get_site_locale.to_s | 	locale = OrbitHelper.get_site_locale.to_s | ||||||
|   end |   end | ||||||
|   def set_I18n |   def create_first_field | ||||||
|     I18n.locale = params[:lang] if params[:lang].present? | 	if Cancerpredictfields.where("title"=>(@app_title + "_back")).take_while{true}.count == 0 | ||||||
|  | 		@form_to_show = Cancerpredictfields.new() | ||||||
|  | 		@form_to_show.title = @app_title +"_back" | ||||||
|  | 		@form_to_show.save | ||||||
|  | 	end | ||||||
|  | 	@form_to_show | ||||||
|  | 	if Cancerpredictfields.where("title"=>@app_title).take_while{true}.count == 0 | ||||||
|  | 		@form_to_show = Cancerpredictfields.new() | ||||||
|  | 		@form_to_show.title=@app_title | ||||||
|  | 		@form_to_show.save | ||||||
|  | 		@form_to_show = Cancerpredictfields.where("title"=>@app_title).first | ||||||
|  | 	else | ||||||
|  | 		@form_to_show = Cancerpredictfields.where("title"=>@app_title).first | ||||||
|  | 	end | ||||||
|   end |   end | ||||||
| end | end | ||||||
|  | @ -7,30 +7,18 @@ class Cancerpredictfields | ||||||
|   include OrbitTag::Taggable |   include OrbitTag::Taggable | ||||||
|   include OrbitCategory::Categorizable |   include OrbitCategory::Categorizable | ||||||
|   field :title ,type:String ,default:"" |   field :title ,type:String ,default:"" | ||||||
|   field :form_show ,  :type=> Hash ,default:{"cancer_form"=>{:names=>{0=>{:variable=>"age",:name=>{"zh_tw"=>"年齡","en"=>"age"},:is_num=>1,:hint=>{'zh_tw'=>'從 18 歲(含)開始至 93 歲','en'=>}, :comment_text=>{'zh_tw'=>'年齡為該婦女於確診罹患乳癌時之年齡','en'=>''}, :fields=> {"zh_tw"=>[],"en"=>[]},range=[18,93]}, |   field :form_show ,  :type=> Hash ,default:{0=>{:variable=>"age",:name=>{"zh_tw"=>"年齡","en"=>"age"},:is_num=>1, :hint=>{'zh_tw'=>'從 18 歲(含)開始至 93 歲','en'=>''} , :comment_text=>{'zh_tw'=>'年齡為該婦女於確診罹患乳癌時之年齡','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[18,93]}, | ||||||
|                                                                        1=>{:variable=>"size",:name=>{"zh_tw"=>"腫瘤大小","en"=>"tumor size"},:is_num=>1,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若有多個原發腫瘤,請輸入最大尺寸之原發腫瘤','en'=>''}, :fields=> {"zh_tw"=>[],"en"=>[]},range=[1]}, | 											   1=>{:variable=>"size",:name=>{"zh_tw"=>"腫瘤大小","en"=>"tumor size"},:is_num=>1,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若有多個原發腫瘤,請輸入最大尺寸之原發腫瘤','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[1]}, | ||||||
|                                                                        2=>{:variable=>"ratio",:name=>{"zh_tw"=>"淋巴結陽性比例","en"=>"node-positive ratio"},:is_num=>1,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :fields=> {"zh_tw"=>[],"en"=>[]},range=[0,1]}, | 											   2=>{:variable=>"ratio",:name=>{"zh_tw"=>"淋巴結陽性比例","en"=>"node-positive ratio"},:is_num=>1,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[0,1]}, | ||||||
|                                                                        3=>{:variable=>"grade",:name=>{"zh_tw"=>"腫瘤級數","en"=>"tumor grade"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'腫瘤級數代表腫瘤組織與正常組織間的分化程度,若無分化級數資訊,請選擇“未知”選項,將以級數 1 進行預測。','en'=>''}, :fields=> {"zh_tw"=>['1','2','3','未知'],"en"=>['1','2','3','unknown']},range=[0,1]}, | 											   3=>{:variable=>"grade",:name=>{"zh_tw"=>"腫瘤級數","en"=>"tumor grade"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'腫瘤級數代表腫瘤組織與正常組織間的分化程度,若無分化級數資訊,請選擇“未知”選項,將以級數 1 進行預測。','en'=>''}, :choice_fields=> {"zh_tw"=>['1','2','3','未知'],"en"=>['1','2','3','unknown']},:range=>[]}, | ||||||
| 																	   4=>{:variable=>"subtype",:name=>{"zh_tw"=>"乳癌分型","en"=>"breast cancer subtype"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無分型資訊,請選擇“未知”選項,將以佔多數比例的管腔類進行預測。','en'=>''}, :fields=> {"zh_tw"=>['分管腔類','人類第二型表皮接受體','三陰型','未知'],"en"=>['Luminal-like','HER2','Triple negative','unknown']},range=[0,1]}, | 											   4=>{:variable=>"subtype",:name=>{"zh_tw"=>"乳癌分型","en"=>"breast cancer subtype"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無分型資訊,請選擇“未知”選項,將以佔多數比例的管腔類進行預測。','en'=>''}, :choice_fields=> {"zh_tw"=>['分管腔類','人類第二型表皮接受體','三陰型','未知'],"en"=>['Luminal-like','HER2','Triple negative','unknown']},:range=>[]}, | ||||||
| 																	   5=>{:variable=>"pstage",:name=>{"zh_tw"=>"病理分期","en"=>"pathologic stage"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無分期資訊,請選擇“未知”選項,將以病理分期第 1 期進行預測。','en'=>''}, :fields=> {"zh_tw"=>['1','2','3','4','未知'],"en"=>['1','2','3','4','unknown']},range=[0,1]}, | 											   5=>{:variable=>"pstage",:name=>{"zh_tw"=>"病理分期","en"=>"pathologic stage"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無分期資訊,請選擇“未知”選項,將以病理分期第 1 期進行預測。','en'=>''}, :choice_fields=> {"zh_tw"=>['1','2','3','4','未知'],"en"=>['1','2','3','4','unknown']},:range=>[]}, | ||||||
| 																	   6=>{:variable=>"lvi",:name=>{"zh_tw"=>"淋巴管或血管侵犯","en"=>"lymph vessel or vascular invasion, LVI"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無淋巴管或血管侵犯資訊,請選擇“未知”選項,將以佔多數比例的淋巴管或血管未侵犯進行預測','en'=>''}, :fields=> {"zh_tw"=>['是','否','未知'],"en"=>['yes','no','unknown']},range=[0,1]}, | 											   6=>{:variable=>"lvi",:name=>{"zh_tw"=>"淋巴管或血管侵犯","en"=>"lymph vessel or vascular invasion, LVI"},:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若無淋巴管或血管侵犯資訊,請選擇“未知”選項,將以佔多數比例的淋巴管或血管未侵犯進行預測','en'=>''}, :choice_fields=> {"zh_tw"=>['是','否','未知'],"en"=>['yes','no','unknown']},:range=>[]} | ||||||
|   }}, |   } | ||||||
| #  before_destroy :destroy_email | #  before_destroy :destroy_email | ||||||
|   scope :can_display, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil}).order_by([:is_top, :desc],[:postdate, :desc])} |   scope :can_display, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil}).order_by([:is_top, :desc],[:postdate, :desc])} | ||||||
|   scope :is_approved, ->{where(:approved => true)} |   scope :is_approved, ->{where(:approved => true)} | ||||||
|   before_create :delete_empty_font ,:get_font_to_store,:set_un_used_font , :set_used_font |  | ||||||
|   before_update :delete_empty_font ,:get_font_to_store,:set_un_used_font , :set_used_font |  | ||||||
|   before_save :delete_empty_font ,:get_font_to_store,:set_un_used_font , :set_used_font |  | ||||||
|   after_update :set_config |  | ||||||
|   after_save :set_config |  | ||||||
|   #before_create :set_expire |   #before_create :set_expire | ||||||
|   def delete_empty_font |  | ||||||
| 	self.font_array.each do |font,istrue| |  | ||||||
| 		if font.strip == "" |  | ||||||
| 			self.font_array.delete(font) |  | ||||||
| 		end |  | ||||||
| 	end |  | ||||||
|   end |  | ||||||
|   def update_user |   def update_user | ||||||
|     User.find(update_user_id) rescue nil |     User.find(update_user_id) rescue nil | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  | @ -1,35 +1,45 @@ | ||||||
| <div style="clear:both;"></div> | <div style="clear:both;"></div> | ||||||
| <% @i = 0 %> | <% @i = 0 %> | ||||||
| <button id="clickall"><%= (I18n.locale.to_s == "zh_tw") ? "全選" : "select all" %></button> | <table> | ||||||
| <button id="unclickall"><%= (I18n.locale.to_s == "zh_tw") ? "取消全選" : "unselect all" %></button> | 	<thead> | ||||||
| <%=form_for @form_to_show ,:url=>{:controller=>"patchfiles" ,:action=>"edit"} do |file|%> | 	<tr> | ||||||
| 	<%= file.fields_for :file_show do |filefield|%> | 	<% @form_to_show.form_show.values[1].each do |key,vlaue|%> | ||||||
| 		<div id="forms"> | 	<th><%=key%></th> | ||||||
| 		 |  | ||||||
| 		<% @form_to_show.file_show.each do |name,property| %> |  | ||||||
| 			 |  | ||||||
| 	<%end%> | 	<%end%> | ||||||
| 		</div> | 	</tr> | ||||||
|  | 	</thead> | ||||||
|  | 	<%=form_for @form_to_show ,:url=>{:controller=>"cancerpredicts" ,:action=>"edit"} do |form|%> | ||||||
|  | 		<tbody> | ||||||
|  | 		<%= form.fields_for :form_show do |formfield|%> | ||||||
|  | 			<% @form_to_show.form_show.each do |num,property| %> | ||||||
|  | 				<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%> | ||||||
|  | 					<%Fixnum%> | ||||||
|  | 					<% @disp_value = @value %> | ||||||
| 					<%end%> | 					<%end%> | ||||||
| 	<%=file.text_field :recovery_btn, {:id=>"hidden-recovery",:type => "hidden",:value=>"false"} %> | 					<td><%= formfield.text_field key,{:value=>@disp_value}%></td> | ||||||
| 	<%=file.text_field :refresh_btn, {:id=>"hidden-refresh",:type => "hidden",:value=>"false"} %> |  | ||||||
| 	<button id="seemessage" onclick="return seelogfcn()"><%=(I18n.locale.to_s =="zh_tw") ? "查看上次更新的logs" : "see logs of prev update "%></button> |  | ||||||
| 	<button id="recoverybtn" onclick="return recoveryfcn()"><%=(I18n.locale.to_s =="zh_tw") ? "復原到上次更新的檔案狀態" : "recovery to prev file status"%></button> |  | ||||||
| 	<button id="destroy_mongofield" onclick="return destroy_mongofield_fcn()"><%=(I18n.locale.to_s =="zh_tw") ? "刷新可更新的檔案狀態" : "refresh the status of the update files"%></button> |  | ||||||
| <%end%> |  | ||||||
| <a>網站目錄根路徑:<%=Dir.pwd.to_s%></a> |  | ||||||
| <li id ="ckeditorFont" class="show_li"> |  | ||||||
| 	<a title="CKEDITOR現有字形">CKEDITOR現有字形</a> |  | ||||||
| 	<% @ckicktosee_str = (I18n.locale.to_s == "en") ? "click me to see all font which CKEDITOR have now" : "點擊我來查看編輯器所有目前擁有的字形" %> |  | ||||||
| 	<a id="clicktosee" title="<%= @ckicktosee_str %>" class="Toggleclass"><%= @ckicktosee_str %></a> |  | ||||||
| 	<ul> |  | ||||||
| 	<% @font_array.each do |font|%> |  | ||||||
| 		<li><a title="<%= font %>"><%= font %></a></li> |  | ||||||
| 				<%end%> | 				<%end%> | ||||||
| 	</ul> | 				</tr> | ||||||
| </li> | 			<%end%> | ||||||
| <a></a> | 		<%end%> | ||||||
|  | 		</tbody> | ||||||
|  | 	<%end%> | ||||||
|  | </table> | ||||||
| <style type="text/css"> | <style type="text/css"> | ||||||
|  | 	thead > tr > th{ | ||||||
|  | 		border:1px solid; | ||||||
|  | 		background: bisque; | ||||||
|  | 	} | ||||||
|  | 	tbody{ | ||||||
|  | 		background:white; | ||||||
|  | 	} | ||||||
|  | 	tbody > tr > td{ | ||||||
|  | 		border:1px solid; | ||||||
|  | 	} | ||||||
| 	.show_li,.show_li *{ | 	.show_li,.show_li *{ | ||||||
| 		list-style:none; | 		list-style:none; | ||||||
| 		color:balck; | 		color:balck; | ||||||
|  | @ -42,157 +52,3 @@ | ||||||
| 		cursor:pointer; | 		cursor:pointer; | ||||||
| 	} | 	} | ||||||
| </style> | </style> | ||||||
| <script> |  | ||||||
| 	$('.Toggleclass').off("click").on("click",function(){ |  | ||||||
| 		$(this).parent().find(">ul").slideToggle(); |  | ||||||
| 	}); |  | ||||||
| 	$('.checkbox').off('click').on('click',function(){ |  | ||||||
| 		for(var i = 0;i<$(this).parent().find('.sub_checkbox').length;i++){ |  | ||||||
| 			if($(this).is(":checked") == false){ |  | ||||||
| 				if($(this).parent().find('.sub_checkbox').eq(i).is(":checked") == true) |  | ||||||
| 					$(this).parent().find('.sub_checkbox').eq(i).click(); |  | ||||||
| 			}else{ |  | ||||||
| 				if($(this).parent().find('.sub_checkbox').eq(i).is(":checked") == false) |  | ||||||
| 					$(this).parent().find('.sub_checkbox').eq(i).click(); |  | ||||||
| 			}; |  | ||||||
| 		}; |  | ||||||
| 	}); |  | ||||||
| 	$('.sub_checkbox').off('click').on('click',function(){ |  | ||||||
| 		var num = 0; |  | ||||||
| 		var index = 0; |  | ||||||
| 		for(var i = 0;i<$(this).parent().find('.sub_checkbox').length;i++){ |  | ||||||
| 			if($(this).parent().find('.sub_checkbox').eq(i).is(":checked") == true){ |  | ||||||
| 				num += 1; |  | ||||||
| 			}; |  | ||||||
| 		}; |  | ||||||
| 		if( num == $(this).parent().find('.sub_checkbox').length){ |  | ||||||
| 			if( $(this).parent().find('.checkbox').is(":checked") == false) |  | ||||||
| 				$(this).parent().find('.checkbox').click(); |  | ||||||
| 		}else{ |  | ||||||
| 			if( $(this).parent().find('.checkbox').is(":checked") == true){ |  | ||||||
| 				$(this).parent().find('.checkbox').click(); |  | ||||||
| 				for(var i = 0;i<$(this).parent().find('.sub_checkbox').length;i++){ |  | ||||||
| 					if($(this).parent().find('.sub_checkbox').eq(i).attr('id') != $(this).attr('id')) |  | ||||||
| 						$(this).parent().find('.sub_checkbox').eq(i).click(); |  | ||||||
| 				} |  | ||||||
| 			}; |  | ||||||
| 		} |  | ||||||
| 	}); |  | ||||||
| 	$("#clickall").off("click").on("click",function(){ |  | ||||||
| 		for(var i =0;i<$(".sub_checkbox").length ; i++){ |  | ||||||
| 			if($(".checkbox").eq(i).is(":checked") == false) |  | ||||||
| 				$(".checkbox").eq(i).click(); |  | ||||||
| 		} |  | ||||||
| 	}); |  | ||||||
| 	$("#unclickall").off("click").on("click",function(){ |  | ||||||
| 		for(var i =0;i<$(".sub_checkbox").length ; i++){ |  | ||||||
| 			if($(".checkbox").eq(i).is(":checked") == true) |  | ||||||
| 				$(".checkbox").eq(i).click(); |  | ||||||
| 		} |  | ||||||
| 	}); |  | ||||||
| 	function seelogfcn(){ |  | ||||||
| 		if($( "#dialog-confirm" ).length != 0) |  | ||||||
| 			$( "#dialog-confirm" ).remove(); |  | ||||||
| 		if(I18n.locale == "zh_tw"){ |  | ||||||
| 			$('body').after("<div id='dialog-confirm' title='上次更新的logs'></div>"); |  | ||||||
| 		}else{ |  | ||||||
| 			$('body').after("<div id='dialog-confirm' title='logs of prev update?'></div>"); |  | ||||||
| 		}; |  | ||||||
| 		$( "#dialog-confirm" ).append($.parseHTML("<%= @form_to_show.last_message.gsub("\"","\'").html_safe %>")); |  | ||||||
| 		$( "#dialog-confirm" ).dialog({ |  | ||||||
| 		  resizable: true, |  | ||||||
| 		  height:200, |  | ||||||
| 		  modal: true, |  | ||||||
| 		  buttons: { |  | ||||||
| 			<%=(I18n.locale == "zh_tw") ? "確認" : "confirm"%>: function(){ |  | ||||||
| 				$( this ).dialog( "close" ); |  | ||||||
| 			}, |  | ||||||
| 			<%=(I18n.locale == "zh_tw") ? "取消" : "Cancel"%>: function() { |  | ||||||
| 			  $( this ).dialog( "close" ); |  | ||||||
| 			} |  | ||||||
| 		  } |  | ||||||
| 		}); |  | ||||||
| 		return false; |  | ||||||
| 	}; |  | ||||||
| 	function updatefcn(){ |  | ||||||
| 		var str=""; |  | ||||||
| 		var num =1; |  | ||||||
| 		for(var i =0;i<$(".sub_checkbox").length ; i++){ |  | ||||||
| 			if($(".sub_checkbox").eq(i).is(":checked") == true){ |  | ||||||
| 				str += ("</br><i style='color:red;'>"+num+". "+$(".sub_checklabel").eq(i).html()+"</i>"); |  | ||||||
| 				num += 1; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		if($( "#dialog-confirm" ).length != 0) |  | ||||||
| 			$( "#dialog-confirm" ).remove(); |  | ||||||
| 		if(I18n.locale == "zh_tw"){ |  | ||||||
| 			$('body').after("<div id='dialog-confirm' title='你確定要更新嗎?'>"+ |  | ||||||
| 										"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 0 0;'></span>"+ |  | ||||||
| 										"按下確認鍵後,你將更新你所選的檔案。"+str+"</p>" |  | ||||||
| 										+"</div>"); |  | ||||||
| 		}else{ |  | ||||||
| 			$('body').after("<div id='dialog-confirm' title='Are you sure to update?'>"+ |  | ||||||
| 										"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 0 0;'></span>"+ |  | ||||||
| 										"After click confirm button,you will update the selected file."+str+"</p>" |  | ||||||
| 										+"</div>"); |  | ||||||
| 		}; |  | ||||||
| 		$( "#dialog-confirm" ).dialog({ |  | ||||||
| 		  resizable: true, |  | ||||||
| 		  height:200, |  | ||||||
| 		  modal: true, |  | ||||||
| 		  buttons: { |  | ||||||
| 			<%=(I18n.locale == "zh_tw") ? "確認" : "confirm"%>: function(){ |  | ||||||
| 				$( this ).dialog( "close" ); |  | ||||||
| 				$('.edit_filefield').submit(); |  | ||||||
| 			}, |  | ||||||
| 			<%=(I18n.locale == "zh_tw") ? "取消" : "Cancel"%>: function() { |  | ||||||
| 			  $( this ).dialog( "close" ); |  | ||||||
| 			} |  | ||||||
| 		  } |  | ||||||
| 		}); |  | ||||||
| 		return false; |  | ||||||
| 	}; |  | ||||||
| 	function recoveryfcn(){ |  | ||||||
| 		var str=""; |  | ||||||
| 		var num =1; |  | ||||||
| 		for(var i =0;i<$(".sub_checkbox").length ; i++){ |  | ||||||
| 			if($(".sub_checkbox").eq(i).is(":checked") == true){ |  | ||||||
| 				str += ("</br><i style='color:red;'>"+num+". "+$(".sub_checklabel").eq(i).html()+"</i>"); |  | ||||||
| 				num += 1; |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		if($( "#dialog-confirm" ).length != 0) |  | ||||||
| 			$( "#dialog-confirm" ).remove(); |  | ||||||
| 		if(I18n.locale == "zh_tw"){ |  | ||||||
| 			$('body').after("<div id='dialog-confirm' title='你確定要還原嗎?'>"+ |  | ||||||
| 										"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 0 0;'></span>"+ |  | ||||||
| 										"按下確認鍵後,你將還原你所選的檔案。"+str+"</p>" |  | ||||||
| 										+"</div>"); |  | ||||||
| 		}else{ |  | ||||||
| 			$('body').after("<div id='dialog-confirm' title='Are you sure to recover?'>"+ |  | ||||||
| 										"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 0 0;'></span>"+ |  | ||||||
| 										"After click confirm button,you will recover the selected file."+str+"</p>" |  | ||||||
| 										+"</div>"); |  | ||||||
| 		} |  | ||||||
| 		$( "#dialog-confirm" ).dialog({ |  | ||||||
| 		  resizable: true, |  | ||||||
| 		  height:200, |  | ||||||
| 		  modal: true, |  | ||||||
| 		  buttons: { |  | ||||||
| 			<%=(I18n.locale == "zh_tw") ? "確認" : "confirm"%>: function(){ |  | ||||||
| 				$('#hidden-recovery').val("true"); |  | ||||||
| 				$( this ).dialog( "close" ); |  | ||||||
| 				$('.edit_filefield').submit(); |  | ||||||
| 			}, |  | ||||||
| 			<%=(I18n.locale == "zh_tw") ? "取消" : "Cancel"%>: function() { |  | ||||||
| 			  $('#hidden-recovery').val("false"); |  | ||||||
| 			  $( this ).dialog( "close" ); |  | ||||||
| 			} |  | ||||||
| 		  } |  | ||||||
| 		}); |  | ||||||
| 		return false; |  | ||||||
| 	}; |  | ||||||
| 	function destroy_mongofield_fcn(){ |  | ||||||
| 		$('#hidden-refresh').val('true'); |  | ||||||
| 	}; |  | ||||||
| </script> |  | ||||||
|  | @ -5,7 +5,7 @@ Rails.application.routes.draw do | ||||||
|   scope "(:locale)", locale: Regexp.new(locales.join("|")) do |   scope "(:locale)", locale: Regexp.new(locales.join("|")) do | ||||||
|    namespace :admin do  |    namespace :admin do  | ||||||
| 	  get 'cancerpredicts' , to:  'cancerpredicts#index' | 	  get 'cancerpredicts' , to:  'cancerpredicts#index' | ||||||
| 	   | 	  get 'editCancerpredicts' , to:  'cancerpredicts#edit' | ||||||
|       resources :cancerpredicts |       resources :cancerpredicts | ||||||
|    end |    end | ||||||
|   end |   end | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue