Reverted /app and changed redirect to responsive site if settings are turned off

This commit is contained in:
Saurabh Bhatia 2014-04-08 11:15:56 +08:00
parent a7084c9cde
commit 16e60dc697
2 changed files with 25 additions and 9 deletions

View File

@ -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

View File

@ -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'