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 end
def manage def manage
Rails.logger.info("Controller time")
@aspect = :manage @aspect = :manage
@contacts = current_user.contacts.includes(:person => :profile).where(:pending => false) @contacts = current_user.contacts.includes(:person => :profile).where(:pending => false)
@remote_requests = Request.where(:recipient_id => current_user.person.id).includes(:sender => :profile) @remote_requests = Request.where(:recipient_id => current_user.person.id).includes(:sender => :profile)
@aspects = @all_aspects.includes(:contacts => {:person => :profile}) @aspects = @all_aspects.includes(:contacts => {:person => :profile})
Rails.logger.info("VIEW TIME!!!!!!")
end end
def update def update

View file

@ -18,4 +18,13 @@ class HomeController < ApplicationController
render :show render :show
end end
end end
def toggle_mobile
if session[:mobile_view]
session[:mobile_view] = false
else
session[:mobile_view] = true
end
redirect_to :back
end
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.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('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('.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" = image_tag 'powered_by_diaspora.png', :height => "11px", :width => "145px"
%br %br
= link_to t('.have_a_problem'), 'http://diaspora.shapado.com/' = link_to t('.have_a_problem'), 'http://diaspora.shapado.com/'

View file

@ -60,6 +60,9 @@
%br %br
= link_to t('layouts.header.logout'), destroy_user_session_path = link_to t('layouts.header.logout'), destroy_user_session_path
%br
%br
= link_to t('layouts.application.toggle'), toggle_mobile_path
-if current_user -if current_user
#menu{:data => {:role => 'page'}} #menu{:data => {:role => 'page'}}
@ -102,6 +105,8 @@
= link_to aspect, aspects_path('a_ids[]' => aspect.id) = link_to aspect, aspects_path('a_ids[]' => aspect.id)
| |
%br %br
%br %br
= link_to t('layouts.header.logout'), destroy_user_session_path = 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" have_a_problem: "Have a problem? Find an answer here"
your_aspects: "your aspects" your_aspects: "your aspects"
logged_in_as: "logged in as %{name}" logged_in_as: "logged in as %{name}"
toggle: 'toggle mobile site'
shared: shared:
publisher: publisher:
posting: "Posting..." posting: "Posting..."

View file

@ -56,8 +56,8 @@ Diaspora::Application.routes.draw do
match 'receive/users/:guid', :to => 'publics#receive' match 'receive/users/:guid', :to => 'publics#receive'
match 'hub', :to => 'publics#hub' 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
root :to => 'home#show' root :to => 'home#show'
end end