no need for iphone layout. will use css media queries

This commit is contained in:
Espen Antonsen 2011-04-13 16:22:48 +08:00
parent f57ae4c0d7
commit 3078837544
3 changed files with 3 additions and 29 deletions

View file

@ -3,7 +3,7 @@ source 'http://rubygems.org'
gem 'rails'
gem 'mime-types', :require => 'mime/types'
gem "carrierwave", :git => 'git://github.com/jnicklas/carrierwave.git'
gem "carrierwave", :git => 'git://github.com/jnicklas/carrierwave.git'
# MySQL:
#gem 'mysql2'
# PostgreSQL:

View file

@ -8,38 +8,10 @@ class ApplicationController < ActionController::Base
helper_method :current_user, :current_user_session
before_filter :setup
#before_filter :adjust_format
layout :application_layout
private
def application_layout
@browser_name ||= begin
if iphone_request?
'application.iphone'
else
'application'
end
end
end
# Set iPhone format if request to iphone.trawlr.com
def adjust_format
request.format = :iphone if iphone_request?
request.format = :ipad if ipad_request?
end
# Return true for requests to iphone.trawlr.com
def iphone_request?
return (request.subdomains.first == "iphone" || request.env['HTTP_USER_AGENT'].downcase.include?('iphone') )
end
# Return true for requests to iphone.trawlr.com
def ipad_request?
return (request.subdomains.first == "iphone" || request.env['HTTP_USER_AGENT'].downcase.include?('ipad') )
end
def setup
redirect_to new_account_path if User.all.length == 0
end

View file

@ -3,6 +3,8 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%= ENV['TITLE'] || "Photos" %></title>
<meta name = "viewport" content = "width = device-width">
<meta name = "viewport" content = "initial-scale = 1.0, user-scalable=no">
<%= yield :head %>
<%= stylesheet_link_tag 'application' %>
<%= csrf_meta_tag %>