diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a81c483..c9e3c86 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -467,10 +467,12 @@ class ApplicationController < ActionController::Base end def prepare_for_mobile - if (@site.mobile_on.eql?(true) && mobile_device?) - mobile_app_path = "/app" - mobile_path = "/mobile" - session[:mobile_param] = if request.path.eql?(mobile_path) + @mobile_app_path = "/mobile/app" + @mobile_path = "/mobile" + + if (@site.mobile_on.eql?(true) && @site.mobile_api_openness_on.eql?(true)) + + session[:mobile_param] = if request.path.eql?(@mobile_path) '1' elsif params[:mobile] params[:mobile] @@ -478,12 +480,12 @@ class ApplicationController < ActionController::Base session[:mobile_param] end request.format = :mobile if mobile_device? - elsif (@site.mobile_on.eql?(false) && mobile_device?) - mobile_app_path = "/app" + elsif (@site.mobile_on.eql?(false) && @site.mobile_api_openness_on.eql?(true)) + mobile_app_path = "/mobile/app" mobile_path = "/mobile" - session[:mobile_param] = if (request.path.eql?(mobile_app_path) && @site.mobile_api_openness_on.eql?(true)) + session[:mobile_param] = if (request.path.eql?(@mobile_app_path)) '1' - elsif request.path.eql?(mobile_path) + elsif request.path.eql?(@mobile_path) redirect_to root_path(mobile: 0) elsif params[:mobile] params[:mobile] @@ -491,6 +493,20 @@ class ApplicationController < ActionController::Base session[:mobile_param] end request.format = :mobile if mobile_device? + + elsif (@site.mobile_on.eql?(false) && @site.mobile_api_openness_on.eql?(false)) + mobile_app_path = "/mobile/app" + mobile_path = "/mobile" + session[:mobile_param] = if (request.path.eql?(@mobile_app_path)) + redirect_to root_path(mobile: 0) + elsif request.path.eql?(@mobile_path) + redirect_to root_path(mobile: 0) + elsif params[:mobile] + params[:mobile] + else + session[:mobile_param] + end + request.format = :mobile if mobile_device? end end diff --git a/config/routes.rb b/config/routes.rb index 5a099c1..b881e85 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -416,7 +416,7 @@ Orbit::Application.routes.draw do end end - scope '/:app' do + scope '/mobile/:app' do match '/announcement' => 'mobile#announcement', :as => 'mobile_announcement' match '/announcement_content/:id' => 'mobile#announcement_content', :as => 'mobile_announcement_content' match '/dialog_contact' => 'mobile#dialog_contact', :as => 'mobile_dialog_contact'