Fix bugs for mobile page

This commit is contained in:
manson 2014-05-29 11:44:35 +08:00
parent cb69ea5c5c
commit 8ced18ad01
2 changed files with 4 additions and 4 deletions

View File

@ -35,7 +35,7 @@ class PagesController < ApplicationController
def show
path = request.path.split('/')
if path.size <= 2 or path.last.eql?("mobile")
if path.size <= 2
redirect_to root_path
else
if path.last.include? '-'
@ -237,7 +237,7 @@ class PagesController < ApplicationController
def get_view
page = Page.find(params[:id]) rescue Page.root
if page == Page.root
@view = File.join(Rails.root, 'app', 'templates', "#{@key}", 'home#{$mobile}/index.html.erb')
@view = File.join(Rails.root, 'app', 'templates', "#{@key}", "home#{$mobile}/index.html.erb")
else
module_name = page.module.downcase.singularize
@view = File.join(Rails.root, 'app', 'templates', "#{@key}", "modules#{$mobile}/#{module_name}/index.html.erb")
@ -266,7 +266,7 @@ class PagesController < ApplicationController
if page.page_id == "" || page.page_id == nil
false
else
File.join("../../templates", "#{@key}", "/#{@home}#{$mobile}/page.html.erb")
File.join("../../templates", "#{@key}", "/home#{$mobile}/page.html.erb")
end
# elsif request[:action] == "show" || request[:action] == "moduleShow"
# File.join("../../templates", "themes", "#{@key}", '/home/page.html.erb')

View File

@ -279,7 +279,7 @@ module ApplicationHelper
if loc != locale
url = url.gsub("/#{locale.to_s}/","/#{loc.to_s}/")
url = url.gsub("locale=#{locale.to_s}","locale=#{loc.to_s}") if url == request.original_fullpath
url = url + "?locale=#{loc.to_s}" if url == request.original_fullpath
url = url + "#{url.include?("?") ? "&" : "?"}locale=#{loc.to_s}" if url == request.original_fullpath
end
url
end