add admin_index and set form_show
This commit is contained in:
parent
d9be851646
commit
88b5a9bbed
|
@ -3,6 +3,7 @@ require 'rubyXL'
|
|||
class Admin::CancerpredictsController < OrbitAdminController
|
||||
#include Admin::CancerpredictsHelper
|
||||
before_action ->(module_app = @app_title) { set_variables module_app }
|
||||
before_action :create_first_field
|
||||
#before_action :load_access_levels
|
||||
def initialize
|
||||
super
|
||||
|
@ -18,4 +19,20 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
render :partial => "index"
|
||||
end
|
||||
end
|
||||
def create_first_field
|
||||
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
|
|
@ -7,10 +7,13 @@ class Cancerpredictfields
|
|||
include OrbitTag::Taggable
|
||||
include OrbitCategory::Categorizable
|
||||
field :title ,type:String ,default:""
|
||||
field :form_show , :type=> Hash ,default:{"cancer_form"=>{:names=>{'age'=>{:is_num=>1,:hint=>{'zh_tw'=>'從 18 歲(含)開始至 93 歲','en'=>}, :comment_text=>{'zh_tw'=>'年齡為該婦女於確診罹患乳癌時之年齡','en'=>''}, :fields=> [],range=[18,93]},
|
||||
'tumor_size'=>{:is_num=>1,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若有多個原發腫瘤,請輸入最大尺寸之原發腫瘤','en'=>''}, :fields=> [],range=[1]},
|
||||
'node-positive_ratio'=>{:is_num=>1,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'','en'=>''}, :fields=> [],range=[0,1]},
|
||||
'tumor_grade'=>{:is_num=>0,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'腫瘤級數代表腫瘤組織與正常組織間的分化程度,若無分化級數資訊,請選擇“未知”選項,將以級數 1 進行預測。','en'=>''}, :fields=> ['1','2','3'],range=[0,1],unknownable=>1},
|
||||
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]},
|
||||
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]},
|
||||
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]},
|
||||
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]},
|
||||
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]},
|
||||
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]},
|
||||
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]},
|
||||
}},
|
||||
# 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])}
|
||||
|
|
|
@ -2,42 +2,15 @@
|
|||
<% @i = 0 %>
|
||||
<button id="clickall"><%= (I18n.locale.to_s == "zh_tw") ? "全選" : "select all" %></button>
|
||||
<button id="unclickall"><%= (I18n.locale.to_s == "zh_tw") ? "取消全選" : "unselect all" %></button>
|
||||
<%=form_for @file_to_show ,:url=>{:controller=>"patchfiles" ,:action=>"edit"} do |file|%>
|
||||
<%=form_for @form_to_show ,:url=>{:controller=>"patchfiles" ,:action=>"edit"} do |file|%>
|
||||
<%= file.fields_for :file_show do |filefield|%>
|
||||
<div id="fileform">
|
||||
<div id="forms">
|
||||
|
||||
<% @form_to_show.file_show.each do |name,property| %>
|
||||
|
||||
<% @file_to_show.file_show.each do |name,property| %>
|
||||
<span style="clear:both;">
|
||||
<%if property[:status].to_i == 1%>
|
||||
<%=filefield.check_box name,{:checked=>true,:id=>"checkbox"+@i.to_s,:class=>"checkbox",:style=>"float:left;"}%>
|
||||
<%else%>
|
||||
<%=filefield.check_box name,{:checked=>false,:id=>"checkbox"+@i.to_s,:class=>"checkbox",:style=>"float:left;"}%>
|
||||
<%end%>
|
||||
<label for="<%="checkbox"+@i.to_s%>" class="checklabel" style="float:left;"><%=name%></label>
|
||||
<div style="clear:both;"></div>
|
||||
<% @i = @i+1 %>
|
||||
<% @j = 0 %>
|
||||
<%= file.fields_for :sub_file_fields do |each_files|%>
|
||||
<%= each_files.fields_for name do |each_file|%>
|
||||
<% property[:files].each do |file_name,sub_property| %>
|
||||
<%if sub_property[:status].to_i == 1%>
|
||||
<%=each_file.check_box file_name,{:checked=>true,:id=>"checkbox"+@i.to_s,:class=>"sub_checkbox",:style=>"float:left;margin-left:1em;",:index=>@j}%>
|
||||
<%else%>
|
||||
<%=each_file.check_box file_name,{:checked=>false,:id=>"checkbox"+@i.to_s,:class=>"sub_checkbox",:style=>"float:left;margin-left:1em;",:index=>@j}%>
|
||||
<%end%>
|
||||
<% file_name = file_name.gsub("@",".") %>
|
||||
<label for="<%="checkbox"+@i.to_s%>" class="sub_checklabel" style="float:left;"><%=file_name%></label>
|
||||
<div style="clear:both;"></div>
|
||||
<% @i = @i+1 %>
|
||||
<% @j = @j+1 %>
|
||||
<% end %>
|
||||
<%end%>
|
||||
<%end%>
|
||||
</span>
|
||||
<%end%>
|
||||
</div>
|
||||
<%end%>
|
||||
<%=file.submit "#{t(:updatefont)}",{:id=>"updatebtn",:onclick=>"return updatefcn()"}%>
|
||||
<%=file.text_field :recovery_btn, {:id=>"hidden-recovery",:type => "hidden",:value=>"false"} %>
|
||||
<%=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>
|
||||
|
@ -125,7 +98,7 @@
|
|||
}else{
|
||||
$('body').after("<div id='dialog-confirm' title='logs of prev update?'></div>");
|
||||
};
|
||||
$( "#dialog-confirm" ).append($.parseHTML("<%= @file_to_show.last_message.gsub("\"","\'").html_safe %>"));
|
||||
$( "#dialog-confirm" ).append($.parseHTML("<%= @form_to_show.last_message.gsub("\"","\'").html_safe %>"));
|
||||
$( "#dialog-confirm" ).dialog({
|
||||
resizable: true,
|
||||
height:200,
|
||||
|
|
Loading…
Reference in New Issue