toggle mobile site, when mobile device

This commit is contained in:
maxwell 2011-02-03 18:36:42 -08:00
parent 35bc4e3aad
commit ee02a073cd
6 changed files with 19 additions and 5 deletions

View file

@ -95,12 +95,10 @@ class AspectsController < ApplicationController
end
def manage
Rails.logger.info("Controller time")
@aspect = :manage
@contacts = current_user.contacts.includes(:person => :profile).where(:pending => false)
@remote_requests = Request.where(:recipient_id => current_user.person.id).includes(:sender => :profile)
@aspects = @all_aspects.includes(:contacts => {:person => :profile})
Rails.logger.info("VIEW TIME!!!!!!")
end
def update

View file

@ -18,4 +18,13 @@ class HomeController < ApplicationController
render :show
end
end
def toggle_mobile
if session[:mobile_view]
session[:mobile_view] = false
else
session[:mobile_view] = true
end
redirect_to :back
end
end

View file

@ -99,6 +99,7 @@
%li= link_to t('layouts.header.blog'), "http://blog.joindiaspora.com"
%li= link_to t('layouts.header.code'), "#{root_url.chomp('/')}/source.tar.gz" unless request.url.match(/joindiaspora.com/)
%li= link_to t('.whats_new'), 'https://github.com/diaspora/diaspora/wiki/Changelog'
%li= link_to(t('layouts.application.toggle'), toggle_mobile_path) if is_mobile_device?
= image_tag 'powered_by_diaspora.png', :height => "11px", :width => "145px"
%br
= link_to t('.have_a_problem'), 'http://diaspora.shapado.com/'

View file

@ -60,6 +60,9 @@
%br
= link_to t('layouts.header.logout'), destroy_user_session_path
%br
%br
= link_to t('layouts.application.toggle'), toggle_mobile_path
-if current_user
#menu{:data => {:role => 'page'}}
@ -102,6 +105,8 @@
= link_to aspect, aspects_path('a_ids[]' => aspect.id)
|
%br
%br
= link_to t('layouts.header.logout'), destroy_user_session_path
%br
%br
= link_to t('layouts.application.toggle'), toggle_mobile_path

View file

@ -99,6 +99,7 @@ en:
have_a_problem: "Have a problem? Find an answer here"
your_aspects: "your aspects"
logged_in_as: "logged in as %{name}"
toggle: 'toggle mobile site'
shared:
publisher:
posting: "Posting..."

View file

@ -56,8 +56,8 @@ Diaspora::Application.routes.draw do
match 'receive/users/:guid', :to => 'publics#receive'
match 'hub', :to => 'publics#hub'
match 'localize', :to => "localize#show"
match'localize', :to => "localize#show"
match 'mobile/toggle', :to => 'home#toggle_mobile', :as => 'toggle_mobile'
#root
root :to => 'home#show'
end