finish the table and add the post of submit_btn and return the lpv result

This commit is contained in:
BOHUNG 2019-12-03 21:17:09 +08:00
parent 296e19929c
commit d8d02fb590
10 changed files with 682 additions and 83 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -15,6 +15,109 @@ $(document).ready(function(){
$('#show_help_modal').modal('hide');
});
});
$('.btn-add').click(function(){
$(this).parent().find('.num_only').removeClass('cancertable_empty');
if($(this).parent().find('.num_only').val()!=""){
var input_value = Number($(this).parent().find('.num_only').val());
if(Array.isArray($(this).parent().find('.num_only').data('range'))){
var compare_value = $(this).parent().find('.num_only').data('range')[1];
if(compare_value != undefined){
if(input_value+1 <= Number(compare_value))
$(this).parent().find('.num_only').val(input_value+1);
else{
input_value = $(this).parent().find('.num_only').data('range')[0];
if(input_value != undefined)
$(this).parent().find('.num_only').val(input_value);
};
}else{
$(this).parent().find('.num_only').val(input_value+1);
};
};
}else{
try{
var input_value = $(this).parent().find('.num_only').data('range')[0];
if(input_value != undefined)
$(this).parent().find('.num_only').val(input_value);
}catch{
$(this).parent().find('.num_only').val(0);
};
};
});
$('.btn-sub').click(function(){
$(this).parent().find('.num_only').removeClass('cancertable_empty');
if($(this).parent().find('.num_only').val()!=""){
var input_value = Number($(this).parent().find('.num_only').val());
if(Array.isArray($(this).parent().find('.num_only').data('range'))){
var compare_value = $(this).parent().find('.num_only').data('range')[0];
if(compare_value != undefined){
if(input_value-1 >= Number(compare_value))
$(this).parent().find('.num_only').val(input_value-1);
else{
input_value = $(this).parent().find('.num_only').data('range')[1];
if(input_value != undefined)
$(this).parent().find('.num_only').val(input_value);
};
}else{
$(this).parent().find('.num_only').val(input_value-1);
};
};
}else{
try{
var input_value = $(this).parent().find('.num_only').data('range')[1];
if(input_value != undefined)
$(this).parent().find('.num_only').val(input_value);
}catch{
$(this).parent().find('.num_only').val(0);
};
};
});
$('.cancer_table_btn').click(function(){
var index = $(this).index()/2;
$(this).parent().find('>input').attr('value',0);
$(this).parent().find('>input').eq(index).attr('value',1);
$(this).parent().find('>button').removeClass('active');
$(this).addClass('active');
$(this).parent().removeClass('cancertable_empty');
});
$('#cancer_table_reset').click(function(){
$('.cancer_table_btn').removeClass('active');
$('.cancer-btn-group input').attr('value',0);
$('.num_only').val('');
$('.cancer_form_field').removeClass('cancertable_empty');
});
$('#cancer_table_submit').click(function(){
var flag = 1;
for(var i = 0;i < $('.cancer_form_field').length;i++){
if($('.cancer_form_field').eq(i).hasClass('num_only')){
if($('.cancer_form_field').eq(i).val()==""){
flag = 0;
$('.cancer_form_field').eq(i).addClass('cancertable_empty');
}else{
$('.cancer_form_field').eq(i).removeClass('cancertable_empty');
};
}else{
if($('.cancer_form_field').eq(i).find('[value="1"]').length == 0){
flag = 0;
$('.cancer_form_field').eq(i).addClass('cancertable_empty');
}else{
$('.cancer_form_field').eq(i).removeClass('cancertable_empty');
}
};
}
if(flag == 1){
var post_json= {};
for(var i = 0;i < $('.cancer_form_field').length;i++){
var name = $('.cancer_form_field').eq(i).attr('id')
if($('.cancer_form_field').eq(i).hasClass('num_only'))
post_json[name] = $('.cancer_form_field').eq(i).val();
else{
var index = ($('.cancer_form_field').eq(i).find('[value="1"]').index()+1)/2;
post_json[name] = index;
};
};
var result = $.post("/cancerpredictResult",{"data":post_json},function(data){console.log(data)});
}
});
$('.num_only').focus
for(var i=0;i<$('.num_only').length;i++)
$('.num_only').eq(i).data('range')

View File

@ -3104,7 +3104,7 @@ if (typeof Math.imul == "undefined" || (Math.imul(0xffffffff, 5) == 0)) {
null), React.createElement("p", null, "Which ", React.createElement("strong", null, "result tab"), " should appear first?"), Y(OQ(NB))), React.createElement("div", { className: "modal-footer" }, React.createElement("button", { type: "button", onClick: function () { return $("#settingsModal").modal("hide") }, className: "btn btn-default" }, "Close")))))
}, new R(null, 1, 5, S, [aH], null), "settings-modal"); var $W = QG(function () { return Y(p(bH(FQ)) ? function () { sU("tool-postamble"); return new R(null, 4, 5, S, [gB, new m(null, 4, [ps, "button", nu, function () { return zQ.ma(null, "print") }, lC, function (a) { return B.h("Enter", a.nativeEvent.code) ? zQ.ma(null, "print") : null }, Ru, ni([Bn, Do, cp, dr, Fr, xt, $t, Gx, jy, xz, Uz], ["#ffffff", 16, 300, "#444466", 70, 10, 10, .5, "0.9375em 5px 0.9375em 5px", -1, "fixed"])], null), function () { var a = new m(null, 1, [Qm, DF], null); return XQ.h ? XQ.h(a, "print") : XQ.call(null, a, "print") }(), " Print"], null) }() : null) }, new R(null,
1, 5, S, [aH], null), "results-footer"),is_submit={flag: true , submit_func: function(){var a = bH(FQ);return (cc(E(a)) || null == a)}} , aX = QG(function () {
var a = bH(FQ); console.log(cc(E(a)) || null == a);return is_submit.flag ? React.createElement("div", { className: "row" }, React.createElement("div", { className: "col-sm-10 col-sm-offset-1 col-xs-12" }, React.createElement("div", { style: { backgroundColor: "#d3e7fd", padding: "0.625em 0.625em 3px 0.625em", marginBottom: 20 } }, React.createElement("div", { style: { color: "#002e5d", fontSize: "1.25em" } }, React.createElement("p", { style: { paddingBottom: 0 } }, Y(function () {
var a = bH(FQ); /*important it's result*/return cc(E(a)) || null == a ? React.createElement("div", { className: "row" }, React.createElement("div", { className: "col-sm-10 col-sm-offset-1 col-xs-12" }, React.createElement("div", { style: { backgroundColor: "#d3e7fd", padding: "0.625em 0.625em 3px 0.625em", marginBottom: 20 } }, React.createElement("div", { style: { color: "#002e5d", fontSize: "1.25em" } }, React.createElement("p", { style: { paddingBottom: 0 } }, Y(function () {
var a = new m(null, 2, [Qm, DF, Ru, new m(null, 2, [Do, 35, iu, 8],
null)], null); return XQ.h ? XQ.h(a, "info-circle") : XQ.call(null, a, "info-circle")
}()), " Treatment options and results will appear here when you have filled in all the information needed above."))))) : React.createElement("div", null, React.createElement("div", { className: "row" }, React.createElement("div", { className: "col-md-6 clearfix" }, React.createElement("h3", null, "Treatment Options"), Y(VW.l ? VW.l() : VW.call(null))), function () {

View File

@ -5,88 +5,153 @@ class CancerpredictsController < ApplicationController
super
@app_title = "cancerpredict"
end
def calculate
uid = OrbitHelper.params[:uid] rescue ""
tags = OrbitHelper.widget_tags
categories = OrbitHelper.widget_categories || []
locale = OrbitHelper.get_site_locale.to_s
result = {:result=>"123"}
result['age1'] = -(params['data']['age'].to_f/100)**(-0.5)
result['age2'] = -(params['data']['age'].to_f/100)**(-0.5)*Math.log(params['data']['age'].to_f/100,10)
result['size1'] = -Math.log(params['data']['size'].to_f/10,10)
result['nposit'] = -((params['data']['ratio'].to_f+0.1)/0.1)**0.5
if params['data']['grade'].to_i == 2
result['grade_2'] = 1
else
result['grade_2'] = 0
end
if params['data']['grade'].to_i == 3
result['grade_3'] = 1
else
result['grade_3'] = 0
end
if params['data']['subtype'].to_i == 2
result['subtype_HER2'] = 1
else
result['subtype_HER2'] = 0
end
if params['data']['subtype'].to_i == 3
result['subtype_triple'] = 1
else
result['subtype_triple'] = 0
end
if params['data']['pstage'].to_i == 2
result['pstage_2'] = 1
else
result['pstage_2'] = 0
end
if params['data']['pstage'].to_i == 3
result['pstage_3'] = 1
else
result['pstage_3'] = 0
end
if params['data']['pstage'].to_i == 4
result['pstage_4'] = 1
else
result['pstage_4'] = 0
end
if params['data']['lvi'].to_i == 1
result['lvi_yes'] = 1
else
result['lvi_yes'] = 0
end
result['lpv'] = ((result['age1']-0.7276655)*(-10.87)+(result['age2']-0.4540707)*8.968+(result['size1']-0.643632)*0.7678+(result['nposit']-1.346932)*0.5339+
result['grade_2']*0.4795+result['grade_3']*0.818+result['subtype_HER2']*0.1806+result['subtype_triple']*0.6457+result['pstage_2']*0.5311+
result['pstage_3']*1.134+result['pstage_4']*2.172+result['lvi_yes']*0.3321-0.04 rescue 0)
result['table'] = '<a id="cancer_table_texts">此分析微針對已接受手術後病人下表為此病人分別在第1年、3及5年下根據選定的術後治療所估計的存活率</a>'
result = result.merge(params)
render :json=> result
end
def index
uid = OrbitHelper.params[:uid] rescue ""
tags = OrbitHelper.widget_tags
categories = OrbitHelper.widget_categories || []
locale = OrbitHelper.get_site_locale.to_s
@table_str = '<div id="cancer_table"><div id="show_help_modal" class="modal fade"></div>'
@table_str_left = '<div id="cancer_table_left">'
@table_str_right = '<div id="cancer_table_right">'
create_first_field
@form_to_show.form_show.each do |num,property|
@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
if @field_property['right'] == 0
@table_str_left += '<div data-key='+num.to_s+'>'
break if @field_property["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 += '</label>'
if @field_property["comment_text"] != ""
@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;"></button>'
@table_str_left += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'>'
else
@table_str_left += '<div style="margin-right: 2.125em;"></div>'
end
if @field_property["is_num"] == 1
@table_str_left += '<input class="num_only" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"></input>'
else
@table_str_left += '<div id="'+@field_property["variable"]+'" style="float:left;clear:right;">'
@field_property["choice_fields"].each do |create_choice|
@table_str_left += '<button class="cancer_table_btn btn btn-default btn-sm">'+create_choice+'</button>'
@table_str_left += '<input type="hidden" value="0" name="'+create_choice+'"></input>'
if (OrbitHelper.params[:result] == nil rescue true)
@table_str = '<div id="cancer_table"><div id="show_help_modal" class="modal fade"></div>'
@table_str_left = '<div id="cancer_table_left">'
@table_str_right = '<div id="cancer_table_right">'
create_first_field
@form_to_show.form_show.each do |num,property|
@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
@table_str_left += '</div>'
@field_property[key] = @disp_value
end
if @field_property["hint"].to_s != ""
@table_str_left +='<div style="color: rgb(104, 104, 104);font-size:0.75em;clear:both;">'+@field_property["hint"]+'</div>'
end
@table_str_left += '</div><div style="clear:both;"></div>'
else
@table_str_right += '<div data-key='+num.to_s+'>'
break if @field_property["name"] == ""
@table_str_right += '<label for="'+@field_property["variable"]+'" style="float:left;'+(@field_property["comment_text"] == "" ? "margin-right: 2.125em;" : "")+'" class="cencer_table_name">'
@table_str_right += @field_property["name"]
@table_str_right += '</label>'
if @field_property["comment_text"] != ""
@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;"></button>'
@table_str_right += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'>'
else
@table_str_right += '<div style="margin-right: 2.125em;"></div>'
end
if @field_property["is_num"] == 1
@table_str_right += '<input class="num_only" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"></input>'
else
@table_str_right += '<div id="'+@field_property["variable"]+'" style="float:left;clear:right;">'
@field_property["choice_fields"].each do |create_choice|
@table_str_right += '<button class="cancer_table_btn btn btn-default btn-sm">'+create_choice+'</button>'
@table_str_right += '<input type="hidden" value="0" name="'+create_choice+'"></input>'
if @field_property['right'] == 0
@table_str_left += '<div data-key='+num.to_s+'>'
break if @field_property["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 += '</label>'
if @field_property["comment_text"] != ""
@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;"></button>'
@table_str_left += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'></input>'
else
@table_str_left += '<div style="margin-right: 2.125em;"></div>'
end
@table_str_right += '</div>'
if @field_property["is_num"] == 1
@table_str_left += '<input class="num_only cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"></input><button class="btn-sub"></button><button class="btn-add"></button>'
else
@table_str_left += '<div class= "cancer-btn-group cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;">'
@field_property["choice_fields"].each do |create_choice|
@table_str_left += '<button class="cancer_table_btn btn btn-default btn-sm">'+create_choice+'</button>'
@table_str_left += '<input type="hidden" value="0" name="'+create_choice+'"></input>'
end
@table_str_left += '</div>'
end
if @field_property["hint"].to_s != ""
@table_str_left +='<div style="color: rgb(104, 104, 104);font-size:0.75em;clear:both;">'+@field_property["hint"]+'</div>'
end
@table_str_left += '</div><div style="clear:both;"></div>'
else
@table_str_right += '<div data-key='+num.to_s+'>'
break if @field_property["name"] == ""
@table_str_right += '<label for="'+@field_property["variable"]+'" style="float:left;'+(@field_property["comment_text"] == "" ? "margin-right: 2.125em;" : "")+'" class="cencer_table_name">'
@table_str_right += @field_property["name"]
@table_str_right += '</label>'
if @field_property["comment_text"] != ""
@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;"></button>'
@table_str_right += '<input class="help_texts" type="hidden" value="'+@field_property["comment_text"]+'" name='+@field_property["variable"]+'></input>'
else
@table_str_right += '<div style="margin-right: 2.125em;"></div>'
end
if @field_property["is_num"] == 1
@table_str_right += '<input class="num_only cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;" data-range="'+@field_property["range"].to_s+'"></input><button class="btn-sub"></button><button class="btn-add"></button>'
else
@table_str_right += '<div class= "cancer-btn-group cancer_form_field" id="'+@field_property["variable"]+'" style="float:left;clear:right;">'
@field_property["choice_fields"].each do |create_choice|
@table_str_right += '<button class="cancer_table_btn btn btn-default btn-sm">'+create_choice+'</button>'
@table_str_right += '<input type="hidden" value="0" name="'+create_choice+'"></input>'
end
@table_str_right += '</div>'
end
if @field_property["hint"].to_s != ""
@table_str_right +='<div style="color: rgb(104, 104, 104);font-size:0.75em;clear:both;">'+@field_property["hint"]+'</div>'
end
@table_str_right += '</div><div style="clear:both;"></div>'
end
if @field_property["hint"].to_s != ""
@table_str_right +='<div style="color: rgb(104, 104, 104);font-size:0.75em;clear:both;">'+@field_property["hint"]+'</div>'
end
@table_str_right += '</div><div style="clear:both;"></div>'
end
@table_str_left += '</div>'
@table_str_right += '</div>'
@table_str += (@table_str_left+@table_str_right)
@table_str +='<div style="clear:both;"></div>'
@table_result_str = '<div id="cancer_predict_result" style="display:block;"><span id="result_title">'+t("cancerpredict.table.result").to_s+'</span><div style="clear:both;"></div>'
@table_result_str += '<div class="result_tab_group">'
@table_result_str += '<div id="result_table" class="result_tab"><a>'+t("cancerpredict.table.table").to_s+'</a></div><div style="clear:both;"></div>'
@table_result_str += '<div id="result_curve" class="result_tab"><a>'+t("cancerpredict.table.curve").to_s+'</a></div><div style="clear:both;"></div>'
@table_result_str += '<div id="result_text" class="result_tab"><a>'+t("cancerpredict.table.text").to_s+'<a></div><div style="clear:both;"></div></div></div>'
@submit_btn_str='<button id="cancer_table_submit">'+t('cancerpredict.table.Submit').to_s+'</button>'
@reset_btn_str='<button id="cancer_table_reset">'+t('cancerpredict.table.Reset').to_s+'</button>'
@table_str += (@submit_btn_str+@reset_btn_str+@table_result_str+'</div>')
else
@table_str = OrbitHelper.params.to_s
end
@table_str_left += '</div>'
@table_str_right += '</div>'
@table_str += (@table_str_left+@table_str_right)
@table_str +='<div style="clear:both;"></div>'
@submit_btn_str='<button id="cancer_table_submit">'+t('cancerpredict.table.Submit').to_s+'</button>'
@reset_btn_str='<button id="cancer_table_reset">'+t('cancerpredict.table.Reset').to_s+'</button>'
@table_str += (@submit_btn_str+@reset_btn_str+'</div>')
{
"cancerpredict" => [],
"extras"=>{"table"=> @table_str}

View File

@ -1,9 +0,0 @@
<script src="/assets/react.js"></script>
<script type="text/javascript" src="/assets/jquery.smartmenus.min.js"></script>
<script type="text/javascript" src="/assets/jquery.smartmenus.bootstrap.min.js"></script>
<div id="app">
<div class="loader-overlay">
<div class="loader" id="loader-1">&nbsp;</div>
<div class="loader-text" id="id-loader-text">Loading...</div>
</div>
</div>

View File

@ -24,4 +24,9 @@ en:
Surgeryonly: Surgery only
Hormonetherapy: Hormone therapy
Chemotherapy: Chemotherapy
years: years
years: years
result: result
table: Table
curve: Curves
text: Texts

View File

@ -25,4 +25,8 @@ zh_tw:
Surgeryonly: 純手術
Hormonetherapy: 賀爾蒙治療
Chemotherapy: 化學治療
years:
years:
result: 結果
table: 列表
curve: 曲線
text: 文字

View File

@ -3,13 +3,20 @@
<script type="text/javascript" src="/assets/cancer_predict.js"></script>
{{table}}
<style>
#cancer_table *[data-key]{
padding: 0.375em 0;
}
.cencer_table_name{
display: inline-block;
vertical-align: middle;
width: 6.25em;
color:#5d7ca2;
}
.cancer_table_btn{
margin-right: 0.5em;
color:#5d7ca2;
border-color: #5d7ca2;
font-weight: 600;
}
.cancer_table_btn:last-child{
margin-right:auto;
@ -53,4 +60,67 @@
padding: 0.125em 0.5em;
border-radius: 0.5em;
}
.btn-sub{
background:url("/assets/cancerpredict/triangle_sub.png") no-repeat top transparent;
position: relative;
width: 1.875em;
border: 0;
height: 1.875em;
background-size: contain;
top:1em;
bottom: -0.7em;
padding: 0;
}
.btn-add{
background:url("/assets/cancerpredict/triangle_add.png") no-repeat top transparent;
position: relative;
width: 1.875em;
border: 0;
height: 1.875em;
background-size: contain;
right: 1.815em;
top: -0.3em;
padding: 0;
}
.cancer_table_btn.active{
color: #333;
background-color: #e6e6e6;
border-color: #8c8c8c;
}
.cancertable_empty{
border: 3px solid pink !important;
border-radius: 5px !important;
padding: 2px !important;
}
#result_title{
background-color: rgb(210, 105, 0);
color: white;
border: 0em;
padding: 0.125em 0.5em;
border-radius: 0.5em;
}
.result_tab{
background: #023d79;
background: linear-gradient(135deg, transparent 0.3em, #023d79 0);
border: none;
float:left;
padding: 0.5em 0.125em 0.5em 0.5em;
margin-top: 0.5em;
cursor: pointer;
}
.result_tab:hover{
background: #d16801;
background: linear-gradient(135deg, transparent 0.3em, #d16801 0);
padding: 0.8em 0.125em 0.5em 1em;
margin-left: -0.5em;
}
.result_tab > a{
writing-mode: vertical-lr;
-webkit-writing-mode: vertical-lr;
color: white;
}
.result_tab_group{
width:20%;
margin:0;
}
</style>

361
routes.rb Normal file
View File

@ -0,0 +1,361 @@
Orbit::Application.routes.draw do
mount Ckeditor::Engine => '/ckeditor'
resources :sessions
get "logout", to: "sessions#destroy", as: "logout"
get "cancerpredictResult",to: "cancerpredicts#calculate"
post "cancerpredictResult",to: "cancerpredicts#calculate"
get "/pages/edit_view" => "pages#edit_view"
get "/pages/preview" => "pages#preview"
get "/pages/get_categories" => "pages#get_categories"
get "/pages/get_member_attributes" => 'pages#get_member_attributes'
post "/pages/update_item_position" => "pages#update_item_position"
post "/pages/save_member_frontend_fields" => 'pages#save_member_frontend_fields'
get "/page_parts/getwidgets" => "page_parts#getwidgets"
get "/page_parts/info" => "page_parts#info"
get "/page_parts/edit_sub_part" => "page_parts#edit_sub_part"
get "/admin/license_denied" => "store_api#render_license_denied"
#routes for google to callback after omniauth
get 'auth/:provider/callback', to: 'sessions#google_callback'
get 'auth/:provider/remove', to: 'sessions#google_remove'
get 'auth/google/result', to: 'sessions#google_result'
get 'auth/google/result', to: 'sessions#google_result'
get 'auth/failure', to: 'sessions#google_faliure'
post "pages/:id/import_widgets", to: 'pages#import_widgets'
resources :pages
resources :page_parts do
member do
patch 'update_sub_part'
end
end
get "/module/:name" => "home#index"
get "/module/:name/show" => "home#show"
post "/store/confirmation" => "store_api#confirmation"
post "/store/install_module" => "store_api#install_module"
post "/store/uninstall_module" => "store_api#uninstall_module"
post "/store/restart_srever_after_install" => "store_api#restart_server_after_install"
post "/store/ticket_response_update" => "store_api#ticket_response_update"
get "/feeds/channel_lists" => 'store_api#get_channel_lists'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'pages#home'
get 'admin/authorizations/modal_select/:module' => 'admin/authorizations#modal_select', :as => :modal_select_authorizations
match 'admin/authorizations/add_users/:module' => 'admin/authorizations#add_users', :as => :add_users_authorizations, via: [:get, :post]
match 'admin/authorizations/add_roles/:module' => 'admin/authorizations#add_roles', :as => :add_roles_authorizations, via: [:get, :post]
match 'admin/authorizations/remove_users/:module' => 'admin/authorizations#remove_users', :as => :remove_users_authorizations, via: [:delete]
locales = Site.first.in_use_locales rescue I18n.available_locales
scope "(:locale)", locale: Regexp.new((locales+[:zh_cn]).join("|")) do
get "sitemap.xml" => "sitemaps#sitemap_xml", as: "sitemap", defaults: { format: "xml" }
# get 'users/form' => "users#form_page"
get 'users/role_page' => "users#role_page"
get 'users/check_availability' => "users#check_availability"
get 'users/connect_google' => "users#connect_google"
get 'users/confirmation' => "users#confirmation"
get 'users/skip_google' => 'users#skip_google'
get 'users/registration_complete' => 'users#registration_complete'
patch 'users/member_roles_update' => 'users#member_roles_update'
# get 'users/connect_google_account' => 'users#connect_google_account'
# get 'users/get_role_statuses' => "users#get_role_statuses"
# patch 'users/role_update' => "users#role_update"
# patch 'users/basic_info_update' => "users#basic_info_update"
resources :users do
collection do
get 'confirm_user'
get 'post_confirmation'
end
end
# Facebook routes
get "/facebook/register_fb" => "facebook#register_fb"
get "/facebook/get_friends" => "facebook#get_friends"
get "/facebook/get_feed" => "facebook#get_feed"
get "/facebook/disconnect" => "facebook#disconnect"
get "/facebook/server" => "facebook#server_redirect"
get "/facebook/profile_import" => "facebook#profile_import"
resources :passwords
# resources :members do
# collection do
# get ':name-:uid', to: 'members#show', as: :display
# end
# end
namespace :admin do
resources :dashboards do
collection do
get 'reload_all_content'
get 'reload_most_visited'
get 'reload_recent_update'
get 'get_system_stats'
get 'get_month_traffic'
end
end
# routes for playground
get "playground", to: 'playground#index'
post "playground/command", to: 'playground#command'
get "playground/console_output", to: 'playground#console_output'
post "playground/generatefakedata", to: 'playground#generatefakedata'
post "playground/deletefakedata", to: 'playground#deletefakedata'
# routes for tickets
resources :tickets
post "ticket/close" => 'tickets#close'
post "ticket/reopen" => 'tickets#reopen'
post "tickets/tourcomplete" => 'tickets#tourcomplete'
get "members/get_role_fields/:id" => "members#get_role_fields", :as => :get_role_fields
get "members/import_members" => "members#import_members"
get "members/unapproved_members" => "members#unapproved_members"
post "members/save_autobiography" => "members#save_autobiography"
post "members/new_tag" => "members#new_tag"
post "members/set_privacy" => "members#set_privacy"
resources :members do
collection do
get 'edit_order_card'
get 'edit_order_list'
post 'update_order_card'
post 'update_order_list'
post 'import_members'
post 'download_export'
end
match "setting_account" => "members#setting_account" ,:as => :setting_account, via: [:get, :post]
match "edit_passwd" => "members#edit_passwd" ,:as => :edit_passwd, via: [:get, :post]
match "accept_member" => "members#accept_member" ,:as => :accept_member, via: [:get, :post]
match "edit_privilege" => "members#edit_privilege" ,:as => :edit_privilege, via: [:get, :post]
end
resources :member_dashboards do
collection do
get 'window'
end
end
# GROUPS START HERE
get "groups/categories" => 'groups#categories'
post "groups/create_category" => 'groups#create_category'
post "groups/:group_id/remove_user" => 'groups#remove_user'
get "groups/:group_id/get_members_to_add" => 'groups#get_members_to_add'
post "groups/:group_id/join" => 'groups#join'
post "groups/:group_id/leave" => 'groups#leave'
get "groups/:group_id/requests" => 'groups#requests'
post "groups/approveuser" => 'groups#approveuser'
post "groups/approveall" => 'groups#approveall'
post "groups/:group_id/toggle_admin" => 'groups#toggle_admin'
get "groups/existing_member_template" => 'groups#get_existing_member_template'
get "groups/get_role_members" => 'groups#get_role_members'
get "groups/public" => 'groups#public_groups'
patch "groups/updatecategory/:category_id" => 'groups#update_category'
get "posts/:id" => 'groups#showpost'
post "posts/image" => 'groups#upload_photo'
post "posts/file" => 'groups#upload_file'
get "posts/file/:id" => "groups#download_file"
delete "posts/:id" => "groups#deletepost"
get "post/:id/edit" => "groups#editpost"
patch "post/:id/updatepost" => "groups#updatepost"
post "posts/comment" => 'groups#new_comment'
delete "comments/:id" => 'groups#delete_comment'
resources :groups do
get "newpost" => 'groups#newpost'
post "createpost" => 'groups#createpost'
get "members" => 'groups#members'
get "joingroup" => 'groups#joingroup'
end
get 'members/:name-:uid/:show_plugin_profile' => "members#show", :as=> :show_plugin_profile
resources :personal_plugins
post "/personal_plugins/save_order" => 'personal_plugins#save_order'
resources :roles do
get 'role_field'
get 'add_attribute_field'
post 'toggle'
end
resources :member_infos
resources :role_statuses do
post 'toggle'
end
get 'select_emails' => 'member_selects#select_emails', :as => "select_emails"
resources :module_apps do
resources :categories do
collection do
post 'create_in_form'
end
member do
post 'toggle'
end
end
resources :tags do
collection do
post 'add_to_default'
post 'add_from_default'
post 'create_in_form'
post 'delete_tags'
post 'merge'
post 'remove_default'
post 'update_included_default'
end
end
end
resources :assets do
collection do
post 'file_upload'
get 'delete'
post 'delete_files'
end
end
get 'authorizations(/:module)' => 'authorizations#index', :as => :authorizations
resources :authorizations
resources :items
resources :categories do
member do
post 'toggle'
end
end
resources :tags do
collection do
post 'add_to_default'
post 'add_from_default'
post 'delete_tags'
post 'merge'
post 'remove_default'
post 'update_included_default'
end
end
resources :sites do
get 'mail_setting'
get 'site_info'
get 'responsive_setting'
get 'search_engine'
get 'sitemap'
get 'sitemap_frontend'
get 'sitemap_toggle', :on => :member
get 'system_info'
get 'ui_theme'
get 'change_design'
get 'reset_default_locale'
get 'preference'
get 'update_manager'
get 'get_update_history'
get 'check_updates'
get 'update_orbit'
get 'bundle_install'
get 'restart_server'
get 'delete_mail_log'
end
resources :designs do
collection do
get 'upload_package'
get 'delete'
post 'upload_package'
end
member do
post 'edit_file' => 'designs#edit_file'
post 'update_file' => 'designs#update_file'
post 'upload_image' => 'designs#upload_image'
end
end
get 'design_list' => 'designs#design_list'
get 'module_store' => 'module_store#index'
get 'module_store/show' => 'module_store#show'
post 'module_store/update_module' => 'module_store#update_module'
get 'module_store/download' => 'module_store#download'
get 'module_store/remove_module' => 'module_store#remove_module'
get 'module_store/toggle_module' => 'module_store#toggle_module'
post 'module_store/restart' => 'module_store#restart'
get 'module_store/modules_to_update' => 'module_store#modules_to_update'
#store routes
get "/store/check_credentials" => "store#check_credentials"
get "/store/register_form" => "store#register_form"
post "/store/register_site" => "store#register_site"
post "/store/authorize_default_modules" => "store#authorize_default_modules"
get "/store/check_permissions" => "store#check_permissions"
get "/store/template_store" => "store#template_store"
get "/store/app_store" => "store#app_store"
get "/store/send_email" => "store#send_email"
post "/store/re_register_url" => "store#re_register_url"
get "import" => "import#index"
get "import/check_url" => "import#check_url"
get "import/module_categories" => "import#module_categories"
get "import/module_data_list" => "import#module_data_list"
get "import/module_data" => "import#module_data"
post "import/rss2_news" => "import#rss2_news"
post "import/rss2_archive" => "import#rss2_archive"
get "import/rss2_pages" => "import#rss2_pages"
post "import/rss2_child_page" => "import#rss2_child_page"
get "import/rss2_pages_info" => "import#rss2_pages_info"
get "import/get_import_status" => "import#get_import_status"
post "import/rss2_galleries" => "import#rss2_galleries"
post "import/rss2_album_image" => "import#rss2_album_image"
post "import/rss2_links" => "import#rss2_links"
post "import/rss2_members" => "import#rss2_members"
post "import/rss2_members_info" => "import#rss2_members_info"
get "import/import_plugin" => "import#import_plugin"
post "import/clean_old_data" => "import#clean_old_data"
get "import/rss2_rikis" => "import#rss2_rikis"
get "import/rss2_rikis_info" => "import#rss2_rikis_info"
get "import/convert_riki_link" => "import#convert_riki_link"
#sync routes
post "/sync_handler/initiate_sync", to: 'sync_handler#initiate_sync'
post "/sync_handler/blacklist", to: 'sync_handler#blacklist'
post "/sync_handler/whitelist", to: 'sync_handler#whitelist'
end
get 'mobile', to: 'pages#home'
get 'mobile/:page(/:page)(/:page)(/:page)', to: 'pages#show', constraints: KeywordConstraint.new
get ':page(/:page)(/:page)(/:page)', to: 'pages#show', constraints: KeywordConstraint.new
get '(/:page)(/:page)(/:page)/members(/:name-:uid)', to: 'pages#show'
get '(/:page)(/:page)(/:page)/member(/:name-:uid)', to: 'pages#show'
resources :pages
end
namespace :admin do
# Directs /admin/products/* to Admin::ProductsController
# (app/controllers/admin/products_controller.rb)
resources :users
end
end