From 63bfb834acfc056a7e448c9ac83d8ba305ee6ced Mon Sep 17 00:00:00 2001 From: BOHUNG Date: Mon, 9 Dec 2019 09:47:53 +0800 Subject: [PATCH] vrsion 1 --- app/assets/javascripts/cancer_predict.js | 92 ++++- app/assets/stylesheets/cancer_predict.css | 253 ++++++++++++ app/controllers/cancerpredicts_controller.rb | 2 +- cancerpredict.gemspec | 24 +- modules/_head.html.erb | 27 -- .../built_in_extensions.rb | 2 +- .../_cancer_predict_widget.html.erb | 37 +- .../cancer_predict_index.html.erb | 256 +------------ routes.rb | 361 ------------------ 9 files changed, 361 insertions(+), 693 deletions(-) create mode 100644 app/assets/stylesheets/cancer_predict.css delete mode 100644 modules/_head.html.erb rename built_in_extensions.rb => modules/built_in_extensions.rb (99%) delete mode 100644 routes.rb diff --git a/app/assets/javascripts/cancer_predict.js b/app/assets/javascripts/cancer_predict.js index 581ef9c..059dc36 100644 --- a/app/assets/javascripts/cancer_predict.js +++ b/app/assets/javascripts/cancer_predict.js @@ -20,7 +20,6 @@ $(document).ready(function(){ }; }; }; - console.log(this) result_array.push = this.push; result_array.remove_item_from_array = this.remove_item_from_array; return result_array; @@ -58,6 +57,22 @@ $(document).ready(function(){ }else{ $(this).parent().find('.num_only').val(input_value+1); }; + compare_value = $(this).parent().find('.num_only').data('range')[0]; + if(compare_value != undefined){ + if($(this).parent().find('.num_only').val() >= compare_value){ + $(this).parent().find('.num_only').removeClass('cancertable_empty'); + $(this).parent().find('.num_only').css('color','#333'); + }; + if($('.cancertable_empty').length == 0){ + $('#danger_texts').remove(); + }; + }else{ + $(this).parent().find('.num_only').removeClass('cancertable_empty'); + $(this).parent().find('.num_only').css('color','#333'); + if($('.cancertable_empty').length == 0){ + $('#danger_texts').remove(); + }; + }; }; }else{ try{ @@ -67,10 +82,13 @@ $(document).ready(function(){ }catch{ $(this).parent().find('.num_only').val(0); }; + if($(this).parent().find('.num_only').val() != ""){ + $(this).parent().find('.num_only').removeClass('cancertable_empty'); + $(this).parent().find('.num_only').css('color','#333'); + }; }; }); $('.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'))){ @@ -86,15 +104,43 @@ $(document).ready(function(){ }else{ $(this).parent().find('.num_only').val(input_value-1); }; + compare_value = $(this).parent().find('.num_only').data('range')[1]; + if(compare_value != undefined){ + if($(this).parent().find('.num_only').val() <= compare_value){ + $(this).parent().find('.num_only').removeClass('cancertable_empty'); + $(this).parent().find('.num_only').css('color','#333'); + }; + if($('.cancertable_empty').length == 0){ + $('#danger_texts').remove(); + }; + }else{ + $(this).parent().find('.num_only').removeClass('cancertable_empty'); + $(this).parent().find('.num_only').css('color','#333'); + if($('.cancertable_empty').length == 0){ + $('#danger_texts').remove(); + }; + }; }; }else{ try{ var input_value = $(this).parent().find('.num_only').data('range')[1]; - if(input_value != undefined) + if(input_value != undefined){ $(this).parent().find('.num_only').val(input_value); + }else{ + 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); }; + if($(this).parent().find('.num_only').val() != ""){ + $(this).parent().find('.num_only').removeClass('cancertable_empty'); + $(this).parent().find('.num_only').css('color','#333'); + }; + }; + if($('.cancertable_empty').length == 0){ + $('#danger_texts').remove(); }; }); $('.cancer_table_btn').off('click').on('click',function(){ @@ -104,6 +150,9 @@ $(document).ready(function(){ $(this).parent().find('>input').eq(index).attr('value',1); $(this).parent().find('>button').removeClass('active'); $(this).parent().removeClass('cancertable_empty'); + if($('.cancertable_empty').length == 0){ + $('#danger_texts').remove(); + }; }catch{}; $(this).addClass('active'); }); @@ -133,6 +182,13 @@ $(document).ready(function(){ } }; } + if($('.cancertable_empty').length != 0){ + flag = 0; + $('#cancer_table_submit').parent().before('請注意紅框的輸入資料是否符合要求'); + $('#danger_texts').css('margin-left',$(window).width()/2-$('#danger_texts').width()/2); + }else{ + $('#danger_texts').remove(); + }; if(flag == 1){ var post_json= {}; for(var i = 0;i < $('#cancer_table .cancer_form_field').length;i++){ @@ -181,6 +237,8 @@ $(document).ready(function(){ $('.surgery_year').html($(this).html()); $('#current_year').change(); }); + $('#cancer_table_right_result .cancer-btn-group .cancer_table_btn').removeClass('active'); + $('#cancer_table_right_result .cancer-btn-group >input').attr('value',"0"); for(var i = 0;i < $('#cancer_table_left_result .cancer-btn-group').length;i++){ $('#cancer_table_right_result .cancer-btn-group').eq(i).find('.cancer_table_btn').eq(0).addClass('active'); $('#cancer_table_right_result .cancer-btn-group').eq(i).find('>input').eq(0).attr('value',"1"); @@ -196,7 +254,8 @@ $(document).ready(function(){ var yes = (I18n.locale=="zh_tw") ? "是" : "yes"; var year = $('#current_year').attr('value'); var active_treatment = ['Surgery_only']; - $('.'+active_treatment[0]+' .Overall_Survival').html(servive_ratio_arr[0]); + $('tr.'+active_treatment[0]+' .Overall_Survival').html(servive_ratio_arr[0]+'%'); + $('#cancer_predict_result_block').css('display','block'); var lpv_real = [result.responseJSON['lpv']]; var lpv_dict={} var lpv_calc={1:-0.001476145,3:-0.01261639,5:-0.02519608} @@ -272,13 +331,11 @@ $(document).ready(function(){ $('tr.'+arguments[0]).removeClass('tr_show'); $('a.'+arguments[0]).eq(0).parent().remove(); lpv_real = lpv_real.remove_item_from_array(lpv_real[index]); - console.log(lpv_real); servive_ratio_arr = servive_ratio_arr.remove_item_from_array(servive_ratio_arr[index]); if(this.length == 2){ $('.addition').css('display','none'); $('#result_text_content .extra-text').css('display','none'); }; - console.log(arguments[0]); return Array.prototype.remove_item_from_array.apply(this, arguments); }else{ return Array.prototype.remove_item_from_array.apply(this, arguments); @@ -289,13 +346,11 @@ $(document).ready(function(){ $('#'+treatmeny_method[i]+' .cancer_table_btn').eq(1).click(function(){ if(!active_treatment.includes($(this).parent().attr('id'))){ active_treatment.push($(this).parent().attr('id')) - console.log($(this).parent().attr('id')) }; }); $('#'+treatmeny_method[i]+' .cancer_table_btn').eq(0).click(function(){ if(active_treatment.includes($(this).parent().attr('id'))){ active_treatment = active_treatment.remove_item_from_array($(this).parent().attr('id')); - console.log(active_treatment); }; }); }; @@ -338,13 +393,20 @@ $(document).ready(function(){ $('.result_content[index="'+index+'"]').css('display','block'); }) $('.num_only').keypress(function(event){ - console.log(event.keyCode) + return event.keyCode>=48&&event.keyCode<=57||(this.value.indexOf('.')<0?event.keyCode==46:false); }); - /*$('.num_only').attr("onpaste","{console.log(clipboardData.getData('text'));return !event.clipboardData.getData('text').match(/\D/)}");*/ - /*$('.num_only').keyup(function(){ - $(this).val($(this).val().replace(/\D/g,'')); - });*/ - for(var i=0;i<$('.num_only').length;i++) - $('.num_only').eq(i).data('range') + $('.num_only').blur(function(){ + if( Number($(this).val()) < $(this).data('range')[0]){ + $(this).css('color','#f24a69'); + $(this).addClass('cancertable_empty'); + console.log($(this).val()) + }else{ + $(this).css('color','#333'); + $(this).removeClass('cancertable_empty'); + if($('.cancertable_empty').length == 0){ + $('#danger_texts').remove(); + }; + } + }) }); diff --git a/app/assets/stylesheets/cancer_predict.css b/app/assets/stylesheets/cancer_predict.css new file mode 100644 index 0000000..30fc5b6 --- /dev/null +++ b/app/assets/stylesheets/cancer_predict.css @@ -0,0 +1,253 @@ +#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-of-type{ + margin-right:auto; +} +#cancer_table{ + font-size:0.825em; +} +input.num_only{ + color: black; + border-top: 0.125em solid rgb(221, 221, 221); + width: 4.125em; + padding: 0em 0em 0.25em; + border-left: 0.125em solid rgb(221, 221, 221); + text-align: center; + font-size: 0.875em; + background-color: rgb(255, 255, 255); + height: 2.25em; +} +#cancer_table_left{ + float:left; + width:50%; +} +#cancer_table_right{ + float:right; + width:50%; +} +#cancer_table_submit{ + margin-left: 1em; + float: right; + background-color: rgb(210, 105, 0); + color: white; + border: 0em; + padding: 0.125em 0.5em; + border-radius: 0.5em; +} +#cancer_table_reset{ + float: right; + background-color: rgb(210, 105, 0); + color: white; + border: 0em; + 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:focus{ + color: #5d7ca2 !important; + background-color: #9dc3e6 !important; + border-color: #8c8c8c !important; +} +.cancer_table_btn:hover{ + color: #5d7ca2 !important; + background-color: #9dc3e6 !important; + border-color: #8c8c8c !important; +} +.cancer_table_btn.active{ + color: #5d7ca2; + background-color: #9dc3e6; + 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:right; + padding: 0.5em 0.125em 0.5em 0.5em; + margin-top: 0.5em; + cursor: pointer; +} +#cancer_table a:hover{ + text-decoration: none; + color: #5d7ca2; +} +#result_contents{ + padding-top: 2em; +} +#choice_fields{ + padding: 2em 0 0 calc(20% - 1.625em); +} +.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.active{ + 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; + float: left; +} +#cancer_predict_result{ + width: 50%; + float: left; +} +#cancer_table_left_result{ + width: 50%; + float: left; +} +#cancer_table_right_result{ + width: 50%; + float: right; +} +.result_content_group{ + width: 80%; + margin: 0; + float: right; +} +.result_content{ + display: none; + min-height: 25em; + border: 0.125em solid #c0cbdd; + padding: 0.5em; +} +.result_content:first-of-type{ + display: block; +} +.result_content a{ + color: #5d7ca2; +} +.result_content p{ + color: #5d7ca2; +} +.cancer_years{ + float:left; + color: #5d7ca2; + background-color: #fff; + border-color: #5d7ca2; + border-width: 0.125em; + margin: 0em; +} +.cancer_years:first-of-type{ + margin-left: 1em; +} +.cancer_years:last-of-type{ + margin-right: 1em; +} +.cancer_form_field{ + margin-left: 1em; +} +#result_table_content a{ + float:left; +} +.hint-texts{ + color: rgb(104, 104, 104); + font-size: 0.75em; + clear: both; + padding: 0.5em 0; +} +#result_text_content a{ + float:left; +} +#result_table_content table{ + clear: both; + width:100%; + table-layout: fixed; + overflow-wrap: break-word; +} +#result_table_content table tbody tr{ + display: none; +} +#result_table_content table tbody tr:first-of-type{ + display: table-row; +} +.cancer_th{ + color: white; + background-color: #003d79; + border-right: 0.375em solid white; + border-top: 0.375em solid white; +} +.cancer_td { + background-color: #e9eaf5; + border-right: 0.375em solid white; + border-top: 0.375em solid white; +} +#cancer_predict_result_block{ + display:none; + font-size: 0.825em; +} +p.texts_show{ + display: list-item; + margin-left: 1.5em; + clear: both; +} +div.texts_show{ + display: block; + margin-left: 0; +} +.addition{ + display: none; +} +#cancer_table_right_result .cancer_table_btn{ + padding: 0.25em 1em; +} +#cancer_table_left_result .cancer_table_btn{ + padding: 0.25em 1em; +} \ No newline at end of file diff --git a/app/controllers/cancerpredicts_controller.rb b/app/controllers/cancerpredicts_controller.rb index 96fd9b0..e3cca2b 100644 --- a/app/controllers/cancerpredicts_controller.rb +++ b/app/controllers/cancerpredicts_controller.rb @@ -171,7 +171,7 @@ class CancerpredictsController < ApplicationController @table_str_right += '' @table_str += (@table_str_left+@table_str_right) @table_str +='
' - @table_result_str = '
'+t("cancerpredict.table.result").to_s+'
' + @table_result_str = '
'+t("cancerpredict.table.result").to_s+'
' @tab_name = ['table','text'] @table_result_str += '
' @tab_name.each_with_index{|name,index| @table_result_str += ('
')} diff --git a/cancerpredict.gemspec b/cancerpredict.gemspec index 80a062a..8cd83fa 100644 --- a/cancerpredict.gemspec +++ b/cancerpredict.gemspec @@ -1,5 +1,27 @@ $:.push File.expand_path("../lib", __FILE__) - +app_path = File.expand_path(__dir__) +template_path = ENV['PWD'] + '/app/templates' +all_template = Dir.glob(template_path+'/*/') +puts 'copying module' +all_template.each do |folder| + if folder.split('/')[-1] != 'mobile' + begin + system ('cp -r '+ app_path + '/modules/ ' + folder) + rescue + puts 'error copy' + end + end +end +filedata = File.read(ENV['PWD']+"/config/routes.rb") +exist_str = ['get "cancerpredictResult",to: "cancerpredicts#calculate"','post "cancerpredictResult",to: "cancerpredicts#calculate"'] +exist_str.each do |str| + if !filedata.include? str + @file = ENV['PWD']+"/config/routes.rb" + open(@file, 'a') { |f| + f.puts exist_str + } + end +end # Maintain your gem's version: require "cancerpredict/version" # Describe your gem and declare its dependencies: diff --git a/modules/_head.html.erb b/modules/_head.html.erb deleted file mode 100644 index da07846..0000000 --- a/modules/_head.html.erb +++ /dev/null @@ -1,27 +0,0 @@ - - - <%= favicon_link_tag (current_site.favicon.blank? ? 'favicon.ico' : current_site.favicon.url) %> - <%= render_site_title %> - <%= stylesheet_link_tag "//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css"%> - <%= stylesheet_link_tag "bootstrap/bootstrap.min.css"%> - <%= stylesheet_link_tag "template/template"%> - - <%= javascript_include_tag "plugin/modernizr.js"%> - <%= javascript_include_tag "plugin/picturefill.min.js"%> - <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js"%> - <%= javascript_include_tag "plugin/jquery.mobile.custom.min.js"%> - <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"%> - <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20140415/jquery.cycle2.min.js"%> - <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20140415/jquery.cycle2.carousel.min.js"%> - <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20140415/jquery.cycle2.scrollVert.min.js"%> - <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20140415/jquery.cycle2.tile.min.js"%> - <%= javascript_include_tag "plugin/jquery.cycle2.video.min.js"%> - <%= javascript_include_tag "plugin/jquery-bullseye-min.js"%> - <%= javascript_include_tag "app"%> - <%= javascript_include_tag "#{@dataApi}" if @dataApi != nil%> - - <%= render_google_analytics %> - diff --git a/built_in_extensions.rb b/modules/built_in_extensions.rb similarity index 99% rename from built_in_extensions.rb rename to modules/built_in_extensions.rb index e2a032d..bd4c098 100644 --- a/built_in_extensions.rb +++ b/modules/built_in_extensions.rb @@ -23,4 +23,4 @@ gem "breadcrumb_widget", git: "http://gitlab.tp.rulingcom.com/saurabh/breadcrumb gem "announcement_link_widget", git: "http://gitlab.tp.rulingcom.com/harry/announcement-link-widget.git" gem 'patchfile', git: 'http://gitlab.tp.rulingcom.com/chiu/patch_file.git' -gem 'cancerpredict', git: 'http://gitlab.tp.rulingcom.com/chiu/cancer_predict.git' \ No newline at end of file +gem 'cancerpredict', git: 'http://gitlab.tp.rulingcom.com/chiu/cancer_predict.git' diff --git a/modules/cancerpredict/_cancer_predict_widget.html.erb b/modules/cancerpredict/_cancer_predict_widget.html.erb index 9de2038..8cf5c99 100644 --- a/modules/cancerpredict/_cancer_predict_widget.html.erb +++ b/modules/cancerpredict/_cancer_predict_widget.html.erb @@ -1,32 +1,5 @@ -
- <%= javascript_include_tag "react.js"%> - - -

- {{widget-title}} -

-
-
-
-
-
-
 
-
Loading...
-
-
-
-
-
-
- \ No newline at end of file + + + +{{table}} + \ No newline at end of file diff --git a/modules/cancerpredict/cancer_predict_index.html.erb b/modules/cancerpredict/cancer_predict_index.html.erb index 65f90df..8cf5c99 100644 --- a/modules/cancerpredict/cancer_predict_index.html.erb +++ b/modules/cancerpredict/cancer_predict_index.html.erb @@ -2,258 +2,4 @@ {{table}} - \ No newline at end of file + \ No newline at end of file diff --git a/routes.rb b/routes.rb deleted file mode 100644 index 5387f1b..0000000 --- a/routes.rb +++ /dev/null @@ -1,361 +0,0 @@ -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