Fix bug for mobile app routes

This commit is contained in:
chris 2013-01-16 08:14:42 +08:00
parent c33a723a2a
commit 87a89f81ce
9 changed files with 25 additions and 25 deletions

View File

@ -130,7 +130,7 @@ class ApplicationController < ActionController::Base
respond_to do |format|
format.html { render :text => parse_page_content(@item), :layout => 'page_layout' }
format.rss { render_main_rss }
format.mobile { redirect_to mobile_path }
format.mobile { redirect_to mobile_path(:app => params[:app]) }
end
else
render :text => '404 Not Found'

View File

@ -54,7 +54,7 @@ class MobileController < ApplicationController
protected
def no_footer_for_app
@no_footer = true if request.path.starts_with?("/app")
@no_footer = true if request.path =~ /app/
end
end

View File

@ -7,12 +7,12 @@
<% end %>
</li>
<li>
<%= link_to mobile_map_path, {"data-transition" => "flip"} do %>
<%= link_to mobile_map_path(:app => params[:app]), {"data-transition" => "flip"} do %>
<i class="icons-location"></i>
<% end %>
</li>
<li>
<%= link_to mobile_dialog_contact_path, {"data-rel" => "dialog"} do %>
<%= link_to mobile_dialog_contact_path(:app => params[:app]), {"data-rel" => "dialog"} do %>
<i class="icons-phone"></i>
<% end %>
</li>

View File

@ -3,7 +3,7 @@
<%= image_tag asset_path('mobile/logo.png') %>
</h1>
<i class="openmenu icons-arrow-down-5"></i>
<%= link_to mobile_dialog_language_path, {:class => "ui-btn-right language", "data-iconpos" => "notext", "data-icon" => "search", "data-rel" => "dialog"} do %>
<%= link_to mobile_dialog_language_path(:app => params[:app]), {:class => "ui-btn-right language", "data-iconpos" => "notext", "data-icon" => "search", "data-rel" => "dialog"} do %>
<i class="icons-earth"></i>
<% end %>
</header>

View File

@ -1,7 +1,7 @@
<section class="main-menu">
<ul class="clear">
<li><%= link_to content_tag(:i, nil, :class => "icons-house") + content_tag(:span, t('mobile.home')), mobile_path %></li>
<li><%= link_to content_tag(:i, nil, :class => "icons-megaphone") + content_tag(:span, t('mobile.bulletin')), mobile_announcement_path %></li>
<li><%= link_to content_tag(:i, nil, :class => "icons-newspaper") + content_tag(:span, t('mobile.page')), mobile_page_path %></li>
<li><%= link_to content_tag(:i, nil, :class => "icons-house") + content_tag(:span, t('mobile.home')), mobile_path(:app => params[:app]) %></li>
<li><%= link_to content_tag(:i, nil, :class => "icons-megaphone") + content_tag(:span, t('mobile.bulletin')), mobile_announcement_path(:app => params[:app]) %></li>
<li><%= link_to content_tag(:i, nil, :class => "icons-newspaper") + content_tag(:span, t('mobile.page')), mobile_page_path(:app => params[:app]) %></li>
</ul>
</section>

View File

@ -1,7 +1,7 @@
<ul data-role="listview" class="list">
<% @bulletins.each do |bulletin| %>
<li data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-icon="arrow-r" data-iconpos="right" data-theme="c">
<%= link_to mobile_announcement_content_path(bulletin), :class => "ui-link-inherit" do %>
<%= link_to mobile_announcement_content_path(:app => params[:app], :id => bulletin), :class => "ui-link-inherit" do %>
<%= image_tag bulletin.image.url, :class => "ui-li-thumb" %>
<h3><%= bulletin.title %></h3>
<p class="ui-li-aside ui-li-desc"><%= display_date(bulletin.postdate) %></p>

View File

@ -12,7 +12,7 @@
<%= image_tag bulletin.image.url %>
</div>
<h3 class="newstitle">
<%= link_to bulletin.title, mobile_announcement_content_path(bulletin) %>
<%= link_to bulletin.title, mobile_announcement_content_path(:app => params[:app], :id => bulletin) %>
</h3>
<p class="newsDate"><%= display_date(bulletin.postdate) %></p>
<div class="newsummary"><%= bulletin.subtitle %></div>

View File

@ -1,7 +1,7 @@
<ul data-role="listview" class="list">
<% @page_contexts.each do |page_context| %>
<li>
<%= link_to mobile_page_content_path(page_context) do %>
<%= link_to mobile_page_content_path(:app => params[:app], :id => page_context) do %>
<h3><%= page_context.page.title %></h3>
<% end %>
</li>

View File

@ -244,7 +244,7 @@ Orbit::Application.routes.draw do
#match '/desktop_orbit/eventajaxload' => 'desktop_publications#delete_journal'
# match '/desktop_orbit/eventajaxload' => 'desktop_publications#update_journal'
def controller_paths(controller, actions)
def controller_paths(controller, actions, scope=nil)
actions.each do |action|
if action.eql? 'index'
match "#{controller}" => "#{controller}##{action}", :as => "#{controller}"
@ -255,21 +255,21 @@ Orbit::Application.routes.draw do
end
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]
# 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
# scope 'app' do
# controller_paths :mobile, %w[index announcement announcement_content dialog_contact dialog_copyright dialog_language map page page_content]
# 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'
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'
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'
end