Permalink
Browse files

merged mobilized styles + gem stuff from the 2.x branch

  • Loading branch information...
2 parents 78b0be8 + 1e97bf4 commit e878f109b236490c03476e2b8b4e4f75f0c61c77 @thomaslundstrom committed Jan 5, 2011
Showing with 55 additions and 25 deletions.
  1. +1 −0 .gitignore
  2. +19 −16 README.rdoc
  3. +5 −8 Rakefile
  4. +3 −1 lib/mobilized_styles.rb
  5. +27 −0 mobile-fu.gemspec
View
@@ -1 +1,2 @@
*.gemspec
+pkg
View
@@ -1,23 +1,23 @@
= Mobile Fu
-Want to automatically detect mobile devices that access your Rails application?
+Want to automatically detect mobile devices that access your Rails application?
Mobile Fu allows you to do just that. People can access your site from a Palm,
Blackberry, iPhone, iPad, Nokia, etc. and it will automatically adjust the format
-of the request from :html to :mobile.
+of the request from :html to :mobile.
== Rails 3 Compatibility
-The master branch of this plugin is Rails 3 compatible.
+You will need to install this gem from the master branch.
-To use the Rails 3 compatible version of this plugin, please install it like so:
+Please install it like a Rails Plugin:
- rails plugin install git://github.com/brendanlim/mobile-fu.git
+ script/plugin install git://github.com/brendanlim/mobile-fu.git
== Rails 2 Compatibility
-You will need to install this plugin from the 2.x branch.
+You will need to install this gem from the 2.x branch.
-To use the Rails 2 compatible version of this plugin, please install it like so:
+Please install it like a Rails Plugin:
script/plugin install git://github.com/brendanlim/mobile-fu.git -r 2.x
@@ -29,7 +29,7 @@ Add this this one line to the controller.
has_mobile_fu
end
-Once this is in place, any request that comes from a mobile device will be be
+Once this is in place, any request that comes from a mobile device will be be
set as :mobile format. It is up to you to determine how you want to handle
these requests. It is also up to you to create the .mobile.erb versions of
your views that are to be requested.
@@ -59,14 +59,17 @@ baked in to Mobile Fu.
If you are including a css or sass file via stylesheet_link_tag, all you have
to do is add _device to the name of one of your files to override your styling
-for a certain device. The stylesheet that is loaded is dependant on which device
-is making the request.
+for a certain device. The stylesheet that is loaded is dependant on which device
+is making the request. Additionally, a generic mobile stylesheet is loaded.
e.g., Accessing a page from a Blackberry.
- ... stylesheet_link_tag 'mobile.css' ...
+ ... stylesheet_link_tag 'stylesheet.css' ...
- This loads mobile.css, and mobile_blackberry.css if the file exists.
+ This loads stylesheet.css, stylesheet_mobile.css and stylesheet_blackberry.css if the file exists.
+
+ Styles in stylesheet_blackberry.css has highest precedence, with
+ stylesheet_mobile.css as second, and stylesheet.css third.
Supported stylesheet override device extensions at the moment are:
@@ -87,12 +90,12 @@ http://blogs.pathf.com/agileajax/2008/05/rails-developme.html
Hopefully this should help you create some awesome mobile applications.
== Testing Mobile Interface
-
-If you want to force the mobile interface for testing, you can either use a
-mobile device emulator, or you can pass 'true' to has_mobile_fu.
+
+If you want to force the mobile interface for testing, you can either use a
+mobile device emulator, or you can pass 'true' to has_mobile_fu.
class ApplicationController < ActionController::Base
- has_mobile_fu(true)
+ has_mobile_fu(true)
end
View
@@ -1,7 +1,6 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
-require 'gemspec'
require "rake/gempackagetask"
desc 'Default: run unit tests.'
@@ -31,9 +30,9 @@ spec = Gem::Specification.new do |s|
s.version = "3.0.0"
s.platform = Gem::Platform::RUBY
- s.authors = ["Thomas Lundström"]
- s.email = ["thomas.lundstrom@gmail.com"]
- s.homepage = "https://github.com/thomaslundstrom/mobile-fu/"
+ s.authors = ["The Author's Name"]
+ s.email = ["the.authors@email.address.com"]
+ s.homepage = "https://github.com/brendanlim/mobile-fu/"
s.summary = "Automatically detect mobile requests from mobile devices in your Rails application."
s.description = "Want to automatically detect mobile devices that access your Rails application? Mobile Fu allows you to do just that. People can access your site from a Palm, Blackberry, iPhone, iPad, Nokia, etc. and it will automatically adjust the format of the request from :html to :mobile."
@@ -44,12 +43,10 @@ spec = Gem::Specification.new do |s|
# s.rubyforge_project = "mobile-fu"
# If you have other dependencies, add them here
-# do we need a dep to Rails?
- # s.add_dependency "another", "~>; 1.2"
#todo: here, add development dep to rspec
#s.add_development_dependency("rspec")
- s.files = Dir["{lib}/**/*.rb", "MIT-LICENSE", "README.rdoc", "CHANGELOG"]
+ s.files = Dir["{lib}/**/*.rb", "rails/init.rb", "MIT-LICENSE", "README.rdoc", "CHANGELOG"]
s.require_path = 'lib'
end
@@ -73,4 +70,4 @@ task :clean => [:clobber] do
end
desc "Package the library and generates the gemspec"
-task :package => [:gemspec]
+task :package => [:gemspec]
View
@@ -54,7 +54,9 @@ def stylesheet_link_tag_with_mobilization(*sources)
sources.each do |source|
subbed_source = source.to_s.gsub(".css","")
- possible_sources = ["#{subbed_source.to_s}_#{user_agent_device_name}"]
+ possible_sources = []
+ possible_sources << ["#{subbed_source.to_s}_mobile"] if session[:mobile_view]
+ possible_sources << ["#{subbed_source.to_s}_#{user_agent_device_name}"]
mobilized_sources << source
View
@@ -0,0 +1,27 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{mobile-fu}
+ s.version = "2.0.1"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Thomas Lundstr\303\266m"]
+ s.date = %q{2010-12-28}
+ s.description = %q{Want to automatically detect mobile devices that access your Rails application? Mobile Fu allows you to do just that. People can access your site from a Palm, Blackberry, iPhone, iPad, Nokia, etc. and it will automatically adjust the format of the request from :html to :mobile.}
+ s.email = ["thomas.lundstrom@gmail.com"]
+ s.files = ["lib/mobile-fu.rb", "lib/mobile_fu_helper.rb", "lib/mobilized_styles.rb", "rails/init.rb", "MIT-LICENSE", "README.rdoc", "CHANGELOG"]
+ s.homepage = %q{https://github.com/thomaslundstrom/mobile-fu/}
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.3.7}
+ s.summary = %q{Automatically detect mobile requests from mobile devices in your Rails application.}
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ else
+ end
+ else
+ end
+end

0 comments on commit e878f10

Please sign in to comment.