+ <% if ENV['LOGO'] %> + <%= image_tag ENV['LOGO'] %> + <% else %> + <%= ENV['TITLE'] %> + <% end %> +
++
<%= flash[:notice] %>
+ <%= yield %> +diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b266b3d..9106db1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -9,16 +9,44 @@ 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 def check_public_access - require_user unless ENV['public'] == 'true' + require_user unless ENV['PUBLIC'] == 'true' end def current_user_session diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb index d9f7028..f4ca3aa 100644 --- a/app/uploaders/file_uploader.rb +++ b/app/uploaders/file_uploader.rb @@ -57,7 +57,7 @@ class FileUploader < CarrierWave::Uploader::Base end end version :single do - process :resize_to_fit => [950, 950] + process :resize_to_limit => [950, 950] def store_dir "uploads/thumbs/#{model.album.path}" end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 70439fd..ff3862d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -3,7 +3,7 @@
-<%= flash[:notice] %>
+ <%= yield %> +