This repository has been archived by the owner on Aug 15, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed a bug in the page metadata stuff I did
- Loading branch information
Josh Adams
committed
Nov 14, 2008
1 parent
a5d8585
commit 43a12b0
Showing
16 changed files
with
416 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<h1>Powered by Ansuz</h1> | ||
Ansuz CMS is published under GPLV2<br/> | ||
Ansuz CMS is published under the BSD license<br/> | ||
Written using the Rails framework and various other components, copyright held by original authors.<br/> | ||
Content of this website is held by content owners. | ||
Content of this website is held by content owners. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body{ | ||
background-color: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
= 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, Nokia, etc. and it will automatically adjust the format of | ||
the request from :html to :mobile. | ||
|
||
== 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 | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require File.dirname(__FILE__) + '/lib/mobilized_styles' | ||
require File.dirname(__FILE__) + '/lib/mobile_fu' | ||
|
||
ActionView::Base.send(:include, MobilizedStyles) | ||
ActionView::Base.send(:alias_method_chain, :stylesheet_link_tag, :mobilization) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
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|palmos|palmsource|iphone|blackberry|nokia|phone|midp|mobi|pda|' + | ||
'wap|java|nokia|hand|symbian|chtml|wml|ericsson|lg|audiovox|motorola|' + | ||
'samsung|sanyo|sharp|telit|tsm|mobile|mini|windows ce|smartphone|' + | ||
'240x320|320x320|mobileexplorer|j2me|sgh|portable|sprint|vodafone|' + | ||
'docomo|kddi|softbank|pdxgw|j-phone|astel|minimo|plucker|netfront|' + | ||
'xiino|mot-v|mot-e|portalmmm|sagem|sie-s|sie-m|android|ipod' | ||
|
||
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? | ||
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? | ||
request.user_agent.to_s.downcase =~ Regexp.new(ActionController::MobileFu::MOBILE_USER_AGENTS) | ||
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) |
Oops, something went wrong.