Remove bottom padding if no footer in mobile

Add a method in routes
Copy mobile routes under the scope 'app' for app usage
This commit is contained in:
chris 2013-01-11 19:14:48 +08:00
parent 91d1487a04
commit 4e2cbac027
3 changed files with 28 additions and 19 deletions

View File

@ -2,6 +2,8 @@ class MobileController < ApplicationController
layout 'mobile'
before_filter :no_footer_for_app
def index
date_now = Time.now
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15)
@ -49,4 +51,10 @@ class MobileController < ApplicationController
@page_title = @page_context.page.title
end
protected
def no_footer_for_app
@no_footer = true if request.path.starts_with?("/app")
end
end

View File

@ -44,7 +44,13 @@
<!-- iPad icon (Retina) -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="<%= asset_path 'mobile/apple-touch-icon-ipad@2x.png' %>">
<% if @no_footer %>
<style type="text/css">
.global {
padding-bottom: 0px;
}
</style>
<% end %>
</head>
<body>
<div data-role="page" data-url="<%= request.fullpath %>" id="<%= params[:action] %>" data-add-back-btn="<%= params[:action].eql?('index')? nil : 'true' %>">

View File

@ -231,26 +231,21 @@ Orbit::Application.routes.draw do
#match '/desktop_orbit/eventajaxload' => 'desktop_publications#delete_journal'
# match '/desktop_orbit/eventajaxload' => 'desktop_publications#update_journal'
scope '/front' do
match 'show_banner/:id' => 'front#show_banner', :as => :front_show_banner
match 'show_footer' => 'front#show_footer', :as => :front_show_footer
match 'show_menu/:id' => 'front#show_menu', :as => :front_show_menu
match 'show_page_sub_menu' => 'front#show_page_sub_menu', :as => :front_show_page_sub_menu
match 'show_site_sub_menu' => 'front#show_site_sub_menu', :as => :front_show_site_sub_menu
match 'show_sitemap' => 'front#show_sitemap', :as => :front_show_sitemap
def controller_paths(controller, actions)
actions.each do |action|
if action.eql? 'index'
match "#{controller}" => "#{controller}##{action}", :as => "#{controller}"
else
match "#{controller}/#{action}(/:id)" => "#{controller}##{action}", :as => "#{controller}_#{action}"
end
end
end
scope '/mobile' 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'
match 'dialog_copyright' => 'mobile#dialog_copyright', :as => 'mobile_dialog_copyright'
match 'dialog_language' => 'mobile#dialog_language', :as => 'mobile_dialog_language'
match 'map' => 'mobile#map', :as => 'mobile_map'
match 'page' => 'mobile#page', :as => 'mobile_page'
match 'page_content/:id' => 'mobile#page_content', :as => 'mobile_page_content'
root :to => 'mobile#index', :as => 'mobile'
controller_paths :front, %w[show_banner show_footer show_menu show_page_sub_menu show_site_sub_menu show_sitemap]
controller_paths :mobile, %w[index announcement announcement_content dialog_contact dialog_copyright dialog_language map page page_content]
scope 'app' do
controller_paths :mobile, %w[index announcement announcement_content dialog_contact dialog_copyright dialog_language map page page_content]
end