diff options
author | Jonne Hass <mrzyx@mrzyx.de> | 2011-09-06 21:40:45 +0400 |
---|---|---|
committer | Jonne Hass <mrzyx@mrzyx.de> | 2011-09-06 22:13:56 +0400 |
commit | 292b1e746593e69fba97ac1fa775f23851924be4 (patch) | |
tree | 2781b1fabd94e7b3c8d6d9e68245a723dacd8dd9 /vendor/plugins/mobile-fu | |
parent | 7beb2bb7e59912f24b19e1b3e3740e9bd377cb01 (diff) |
small cleanup
Diffstat (limited to 'vendor/plugins/mobile-fu')
-rw-r--r-- | vendor/plugins/mobile-fu/CHANGELOG | 113 | ||||
-rw-r--r-- | vendor/plugins/mobile-fu/MIT-LICENSE | 20 | ||||
-rw-r--r-- | vendor/plugins/mobile-fu/README.rdoc | 99 | ||||
-rw-r--r-- | vendor/plugins/mobile-fu/Rakefile | 22 | ||||
-rw-r--r-- | vendor/plugins/mobile-fu/init.rb | 7 | ||||
-rw-r--r-- | vendor/plugins/mobile-fu/install.rb | 0 | ||||
-rw-r--r-- | vendor/plugins/mobile-fu/lib/mobile_fu.rb | 105 | ||||
-rw-r--r-- | vendor/plugins/mobile-fu/lib/mobile_fu_helper.rb | 24 | ||||
-rw-r--r-- | vendor/plugins/mobile-fu/lib/mobilized_styles.rb | 70 | ||||
-rw-r--r-- | vendor/plugins/mobile-fu/spec/mobilized_styles_spec.rb | 39 | ||||
-rw-r--r-- | vendor/plugins/mobile-fu/spec/spec.opts | 0 | ||||
-rw-r--r-- | vendor/plugins/mobile-fu/spec/spec_helper.rb | 1 | ||||
-rw-r--r-- | vendor/plugins/mobile-fu/uninstall.rb | 0 |
13 files changed, 0 insertions, 500 deletions
diff --git a/vendor/plugins/mobile-fu/CHANGELOG b/vendor/plugins/mobile-fu/CHANGELOG deleted file mode 100644 index 89bf9c530..000000000 --- a/vendor/plugins/mobile-fu/CHANGELOG +++ /dev/null @@ -1,113 +0,0 @@ -commit a46e0d5ff0a95407bbd8f3437a372ced53d90c9b -Author: Brendan G. Lim <brendan@intridea.com> -Date: Sat Dec 20 20:59:49 2008 -0500 - - Added a helper method to determine if a device is JavaScript enabled and one to output the XHTML Mobile 1.0 doctype - -commit f4b29b2e2c68a79b8904dddb7a91efd4341540ee -Author: Brendan G. Lim <brendan@intridea.com> -Date: Sun Sep 21 21:39:10 2008 -0400 - - Fixes issue with 'in_mobile_view' instead of 'is_mobile_view' helper method - -commit 29e8e8b407dd3dc8d5f3248183223d11c6a78843 -Author: Brendan G. Lim <brendan@intridea.com> -Date: Wed Sep 10 12:51:12 2008 -0400 - - Updating CHANGELOG - -commit 0aac5bd7f0d2f71e6af7b144a04a18dad9f5aca5 -Author: Brendan G. Lim <brendan@intridea.com> -Date: Wed Sep 10 12:50:50 2008 -0400 - - Styling overrides for iPods - -commit f30c97c794ba74e737856aa9226328469c8395b6 -Author: Brendan G. Lim <brendan@intridea.com> -Date: Mon Sep 8 00:07:27 2008 -0400 - - Adding in some comments to the latest changes - -commit 78dae861e46d383356d7e4d6dfdaefbf60072e27 -Author: Brendan G. Lim <brendan@intridea.com> -Date: Mon Sep 8 00:06:16 2008 -0400 - - Updating README - -commit 1a66ccd2142e387f6d3138acb688a58df4687fcd -Author: Brendan G. Lim <brendan@intridea.com> -Date: Mon Sep 8 00:05:48 2008 -0400 - - Adding in a helper method to check for a specific mobile device and adding in 'ipod' to the list of mobile user agents - -commit cbb26fff3287e16a757ee2aed2dcc8e98cbfb369 -Author: Brendan G. Lim <brendan@intridea.com> -Date: Fri Aug 22 22:16:19 2008 -0400 - - Updating the CHANGELOG - -commit ee49945b593b1c55bf546da1d595a0941d071f94 -Author: Brendan G. Lim <brendan@intridea.com> -Date: Fri Aug 22 22:16:00 2008 -0400 - - Updating README - -commit 02c12a8563466f7cef6aba8e53915dc2efec908c -Author: Brendan G. Lim <brendan@intridea.com> -Date: Mon Aug 18 16:08:51 2008 -0400 - - Adding in support for Android - -commit 2dffa5958905c0419288d03a0650127a0734b41a -Author: Brendan G. Lim <brendan@intridea.com> -Date: Sat Jul 26 14:08:56 2008 -0400 - - Adding in other phone user agents, including some Japanese and French manufacturers - -commit e8f9f1a9c2e668d639690f4f1beb4f701f742cfa -Author: Brendan G. Lim <brendan@intridea.com> -Date: Fri Jul 18 11:15:52 2008 -0400 - - Adding in CHANGELOG - -commit a3122b40c0c722b2942e9cb5341614d0e0d834a5 -Author: Brendan G. Lim <brendan@intridea.com> -Date: Fri Jul 18 11:14:35 2008 -0400 - - Changes to README - -commit 64a24e36b6a770757963eb2d961262fb8a14ec1b -Author: Brendan G. Lim <brendan@intridea.com> -Date: Fri Jul 18 11:10:40 2008 -0400 - - Quick fix - -commit 116fa5b7c1168471cf56cb9961b98f0b73fc3308 -Author: Brendan G. Lim <brendan@intridea.com> -Date: Fri Jul 18 10:04:41 2008 -0400 - - Fixed issue with mobile view session variable getting set incorrectly, when forcing mobile format - -commit d172665c9d0458801fd672076e269a3c0ee9d80d -Author: Brendan G. Lim <brendan@intridea.com> -Date: Fri Jul 18 01:04:19 2008 -0400 - - Adding in more MIT license goodness - -commit a6c947d684d2d9abdbe354dc1ea757f23cd5a633 -Author: Brendan G. Lim <brendan@intridea.com> -Date: Fri Jul 18 01:00:55 2008 -0400 - - Change to the README - -commit dad4f4db1f3cb816283069a91c01982c953ff8a5 -Author: Brendan G. Lim <brendan@intridea.com> -Date: Fri Jul 18 01:00:16 2008 -0400 - - Change to the README - -commit c5ec9de6ef19e48a66917d8f6f3a59771295765b -Author: Brendan G. Lim <brendan@intridea.com> -Date: Fri Jul 18 00:59:36 2008 -0400 - - Releasing Mobile Fu to the world diff --git a/vendor/plugins/mobile-fu/MIT-LICENSE b/vendor/plugins/mobile-fu/MIT-LICENSE deleted file mode 100644 index d0ac82e98..000000000 --- a/vendor/plugins/mobile-fu/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2008 Brendan G. Lim, Intridea, Inc. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/plugins/mobile-fu/README.rdoc b/vendor/plugins/mobile-fu/README.rdoc deleted file mode 100644 index 36ae110b1..000000000 --- a/vendor/plugins/mobile-fu/README.rdoc +++ /dev/null @@ -1,99 +0,0 @@ -= Mobile Fu - -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. - -== Rails 3 Compatibility - -The master branch of this plugin is Rails 3 compatible. - -To use the Rails 3 compatible version of this plugin, please install it like so: - - rails plugin install git://github.com/brendanlim/mobile-fu.git - -== Rails 2 Compatibility - -You will need to install this plugin from the 2.x branch. - -To use the Rails 2 compatible version of this plugin, please install it like so: - - script/plugin install git://github.com/brendanlim/mobile-fu.git -r 2.x - -== Usage - -Add this this one line to the controller. - - class ApplicationController < ActionController::Base - has_mobile_fu - end - -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. - -Then add the line below to config/initializers/mime_types.rb - - Mime::Type.register_alias "text/html", :mobile - -I recommend that you setup a before_filter that will redirect to a specific page -depending on whether or not it is a mobile request. How can you check this? - - is_mobile_device? # => Returns true or false depending on the device - -You can also determine which format is currently set in by calling the following: - - is_mobile_view? # => Returns true or false depending on current req. format - -Also, if you want the ability to allow a user to switch between 'mobile' and -'standard' format (:html), you can just adjust the mobile_view session variable -in a custom controller action. - - session[:mobile_view] # => Set to true if request format is :mobile and false - if set to :html - -So, different devices need different styling. Don't worry, we've got this -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. - - e.g., Accessing a page from a Blackberry. - - ... stylesheet_link_tag 'mobile.css' ... - - This loads mobile.css, and mobile_blackberry.css if the file exists. - -Supported stylesheet override device extensions at the moment are: - - blackberry - iphone (iphone,ipod) - ipad - android - mobileexplorer - nokia - palm - -The stylesheet awesomeness was derived from Michael Bleigh's browserized styles: -http://www.intridea.com/2007/12/9/announcing-browserized-styles - -Inspiration for Mobile Fu came from Noel Rappin's rails_iui: -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. - - class ApplicationController < ActionController::Base - has_mobile_fu(true) - end - - -Copyright (c) 2008 Brendan G. Lim, Intridea, Inc., released under the MIT license diff --git a/vendor/plugins/mobile-fu/Rakefile b/vendor/plugins/mobile-fu/Rakefile deleted file mode 100644 index de861ddc5..000000000 --- a/vendor/plugins/mobile-fu/Rakefile +++ /dev/null @@ -1,22 +0,0 @@ -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -desc 'Default: run unit tests.' -task :default => :test - -desc 'Test the sms_fu plugin.' -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.pattern = 'test/**/*_test.rb' - t.verbose = true -end - -desc 'Generate documentation for the sms_fu plugin.' -Rake::RDocTask.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'SmsFu' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('lib/**/*.rb') -end diff --git a/vendor/plugins/mobile-fu/init.rb b/vendor/plugins/mobile-fu/init.rb deleted file mode 100644 index d34defd36..000000000 --- a/vendor/plugins/mobile-fu/init.rb +++ /dev/null @@ -1,7 +0,0 @@ -require File.dirname(__FILE__) + '/lib/mobile_fu_helper.rb' -require File.dirname(__FILE__) + '/lib/mobilized_styles' -require File.dirname(__FILE__) + '/lib/mobile_fu' - -ActionView::Base.send(:include, MobileFuHelper) -ActionView::Base.send(:include, MobilizedStyles) -ActionView::Base.send(:alias_method_chain, :stylesheet_link_tag, :mobilization)
\ No newline at end of file diff --git a/vendor/plugins/mobile-fu/install.rb b/vendor/plugins/mobile-fu/install.rb deleted file mode 100644 index e69de29bb..000000000 --- a/vendor/plugins/mobile-fu/install.rb +++ /dev/null diff --git a/vendor/plugins/mobile-fu/lib/mobile_fu.rb b/vendor/plugins/mobile-fu/lib/mobile_fu.rb deleted file mode 100644 index c83af4a02..000000000 --- a/vendor/plugins/mobile-fu/lib/mobile_fu.rb +++ /dev/null @@ -1,105 +0,0 @@ -module ActionController - module MobileFu - # These are various strings that can be found in mobile devices. Please feel free - # to add on to this list. - MOBILE_USER_AGENTS = 'palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|' + - 'audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|' + - 'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' + - 'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' + - 'webos|amoi|novarra|cdm|alcatel|pocket|iphone|mobileexplorer|' + - 'mobile' - - def self.included(base) - base.extend(ClassMethods) - end - - module ClassMethods - - # Add this to one of your controllers to use MobileFu. - # - # class ApplicationController < ActionController::Base - # has_mobile_fu - # end - # - # You can also force mobile mode by passing in 'true' - # - # class ApplicationController < ActionController::Base - # has_mobile_fu(true) - # end - - def has_mobile_fu(test_mode = false) - include ActionController::MobileFu::InstanceMethods - - if test_mode - before_filter :force_mobile_format - else - before_filter :set_mobile_format - end - - helper_method :is_mobile_device? - helper_method :in_mobile_view? - helper_method :is_device? - end - - def is_mobile_device? - @@is_mobile_device - end - - def in_mobile_view? - @@in_mobile_view - end - - def is_device?(type) - @@is_device - end - end - - module InstanceMethods - - # Forces the request format to be :mobile - - def force_mobile_format - request.format = :mobile - session[:mobile_view] = true if session[:mobile_view].nil? - end - - # Determines the request format based on whether the device is mobile or if - # the user has opted to use either the 'Standard' view or 'Mobile' view. - - def set_mobile_format - if is_mobile_device? && ['/','text/html'].include?(request.format) - request.format = session[:mobile_view] == false ? :html : :mobile - session[:mobile_view] = true if session[:mobile_view].nil? - end - end - - # Returns either true or false depending on whether or not the format of the - # request is either :mobile or not. - - def in_mobile_view? - request.format.to_sym == :mobile - end - - # Returns either true or false depending on whether or not the user agent of - # the device making the request is matched to a device in our regex. - - def is_mobile_device? - # hack for ipad - req = request.user_agent.to_s.downcase - req =~ Regexp.new(ActionController::MobileFu::MOBILE_USER_AGENTS) && !req.match('ipad') - end - - # Can check for a specific user agent - # e.g., is_device?('iphone') or is_device?('mobileexplorer') - - def is_device?(type) - request.user_agent.to_s.downcase.include?(type.to_s.downcase) - end - end - - end - -end - -ActionController::Base.send(:include, ActionController::MobileFu) - diff --git a/vendor/plugins/mobile-fu/lib/mobile_fu_helper.rb b/vendor/plugins/mobile-fu/lib/mobile_fu_helper.rb deleted file mode 100644 index 207ba2cc4..000000000 --- a/vendor/plugins/mobile-fu/lib/mobile_fu_helper.rb +++ /dev/null @@ -1,24 +0,0 @@ -module MobileFuHelper - ACCEPTABLE_TYPES = [:mobile, :basic] - - def mobile_xhtml_doctype(type = :mobile, version = '1.0') - raise Exception.new("MobileFu: XHTML DOCTYPE type must either be ':mobile' or ':basic'") unless ACCEPTABLE_TYPES.include?(type) - raise Exception.new("MobileFu: XHTML DOCTYPE version must be in the format of '1.0' or '1.1', etc.") unless version.include?('.') - - doc_type = "<?xml version=\"1.0\" charset=\"UTF-8\" ?>\n" - doc_type += "<!DOCTYPE html PUBLIC " - doc_type += case type - when :mobile - "\"-//WAPFORUM//DTD XHTML Mobile #{version}//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile#{version.gsub('.','')}.dtd\">" - when :basic - "\"-//W3C//DTD XHTML Basic #{version}//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic#{version.gsub('.','')}.dtd\">" - end - doc_type - end - - def js_enabled_mobile_device? - is_device?('iphone') || is_device?('ipod') || is_device?('ipad') || is_device?('mobileexplorer') || is_device?('android') - end -end - -ActionView::Base.send(:include, MobileFuHelper)
\ No newline at end of file diff --git a/vendor/plugins/mobile-fu/lib/mobilized_styles.rb b/vendor/plugins/mobile-fu/lib/mobilized_styles.rb deleted file mode 100644 index 8c16e0bed..000000000 --- a/vendor/plugins/mobile-fu/lib/mobilized_styles.rb +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright (c) 2008 Brendan G. Lim (brendan@intridea.com) -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -module MobilizedStyles - - # This logic was taken from Michael Bleigh's browserized styles - # with modification to work for mobile browsers. - - def user_agent_device_name - @user_agent_device_name ||= begin - - ua = request.user_agent - return nil if ua.nil? - ua.downcase! - - if ua.index('mobileexplorer') || ua.index('windows ce') - 'mobileexplorer' - elsif ua.index('blackberry') - 'blackberry' - elsif ua.index('iphone') || ua.index('ipod') - 'iphone' - elsif ua.index('ipad') - 'ipad' - elsif ua.index('android') - 'android' - elsif ua.index('nokia') - 'nokia' - elsif ua.index('palm') - 'palm' - end - end - end - - def stylesheet_link_tag_with_mobilization(*sources) - mobilized_sources = Array.new - sources.each do |source| - subbed_source = source.to_s.gsub(".css","") - - possible_sources = ["#{subbed_source.to_s}_#{user_agent_device_name}"] - - mobilized_sources << source - - for possible_source in possible_sources - path = File.join(config.stylesheets_dir,"#{possible_source}.css") - sass_path = File.join(config.stylesheets_dir,"sass","#{possible_source}.sass") - mobilized_sources << possible_source if File.exist?(path) || File.exist?(sass_path) - end - end - - stylesheet_link_tag_without_mobilization(*mobilized_sources) - end -end
\ No newline at end of file diff --git a/vendor/plugins/mobile-fu/spec/mobilized_styles_spec.rb b/vendor/plugins/mobile-fu/spec/mobilized_styles_spec.rb deleted file mode 100644 index 7625fb251..000000000 --- a/vendor/plugins/mobile-fu/spec/mobilized_styles_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ - -require File.dirname(__FILE__) + '/spec_helper' - -module ActionView - module Helpers - module AssetTagHelper - STYLESHEETS_DIR = "stylesheets" - end - end -end - -describe MobilizedStyles do - - before(:each) do - @view = mock(:ActionView) - @request = mock(:ActionRequest) - @view.extend(MobilizedStyles) - @view.stub!(:request).and_return(@request) - @request.stub!(:user_agent) - end - - def ua(str) - @request.stub!(:user_agent).and_return(str) - end - - it "will include a mobilized css file if it recognizes a string in the user agent" do - ua "iphone" - File.should_receive(:exist?).with("stylesheets/style_iphone.css").and_return(true) - @view.should_receive(:stylesheet_link_tag_without_mobilization).with("style", "style_iphone") - @view.stylesheet_link_tag_with_mobilization("style") - end - - it "includes mobiziled css files whether or not the original call to stylesheet_link_tag used a file extension" do - ua "blackberry" - File.should_receive(:exist?).with("stylesheets/style_blackberry.css").and_return(true) - @view.should_receive(:stylesheet_link_tag_without_mobilization).with("style.css", "style_blackberry") - @view.stylesheet_link_tag_with_mobilization("style.css") - end -end
\ No newline at end of file diff --git a/vendor/plugins/mobile-fu/spec/spec.opts b/vendor/plugins/mobile-fu/spec/spec.opts deleted file mode 100644 index e69de29bb..000000000 --- a/vendor/plugins/mobile-fu/spec/spec.opts +++ /dev/null diff --git a/vendor/plugins/mobile-fu/spec/spec_helper.rb b/vendor/plugins/mobile-fu/spec/spec_helper.rb deleted file mode 100644 index 7c41baa39..000000000 --- a/vendor/plugins/mobile-fu/spec/spec_helper.rb +++ /dev/null @@ -1 +0,0 @@ -require File.dirname(__FILE__) + "/../lib/mobilized_styles"
\ No newline at end of file diff --git a/vendor/plugins/mobile-fu/uninstall.rb b/vendor/plugins/mobile-fu/uninstall.rb deleted file mode 100644 index e69de29bb..000000000 --- a/vendor/plugins/mobile-fu/uninstall.rb +++ /dev/null |