mobilicious 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +35 -0
- data/lib/mobilicious/rails_ext.rb +3 -4
- metadata +5 -7
- data/README +0 -13
- data/install.rb +0 -1
- data/uninstall.rb +0 -1
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
Mobilicious
|
2
|
+
==========
|
3
|
+
|
4
|
+
A very simple rails gem - adds the might_be_mobile method to ActionController::Base.
|
5
|
+
|
6
|
+
Call it from any of your controllers (though usually just from application controller),
|
7
|
+
and it will make the controller method `is_mobile?` available, and declare it a helper
|
8
|
+
(so it can be used from views).
|
9
|
+
|
10
|
+
More features are incoming as I learn how to interact with the rails template path resolvers.
|
11
|
+
|
12
|
+
Example
|
13
|
+
=======
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
class ApplicationController < ActionController::Base
|
17
|
+
might_be_mobile
|
18
|
+
end
|
19
|
+
```
|
20
|
+
|
21
|
+
The most common usage of `is_mobile?` is to add an extra stylesheet for mobile users:
|
22
|
+
|
23
|
+
```haml
|
24
|
+
# layouts/application.haml.html
|
25
|
+
|
26
|
+
%html
|
27
|
+
%head
|
28
|
+
%meta{ :charset => 'utf-8' }
|
29
|
+
= stylesheet_link_tag('screen.css', :media => 'screen, projection')
|
30
|
+
= stylesheet_link_tag('mobile.css', :media => 'screen, projection') if is_mobile?
|
31
|
+
|
32
|
+
```
|
33
|
+
|
34
|
+
|
35
|
+
Copyright (c) 2011 Eric Mueller, released under the MIT license
|
@@ -1,12 +1,11 @@
|
|
1
1
|
require 'action_pack'
|
2
2
|
|
3
3
|
module MightBeMobile
|
4
|
-
|
5
|
-
|
6
|
-
end
|
4
|
+
|
5
|
+
MOBILE_REGEX = /mobile/i
|
7
6
|
|
8
7
|
def is_mobile?
|
9
|
-
return request.headers['User-Agent'] =~
|
8
|
+
return request.headers['User-Agent'] =~ MOBILE_REGEX
|
10
9
|
end
|
11
10
|
|
12
11
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Eric Mueller
|
@@ -25,17 +25,15 @@ executables: []
|
|
25
25
|
extensions: []
|
26
26
|
|
27
27
|
extra_rdoc_files:
|
28
|
-
- README
|
28
|
+
- README.md
|
29
29
|
files:
|
30
30
|
- init.rb
|
31
|
-
- install.rb
|
32
31
|
- lib/mobilicious/rails_ext.rb
|
33
32
|
- lib/mobilicious.rb
|
34
33
|
- MIT-LICENSE
|
35
34
|
- Rakefile
|
36
|
-
- README
|
37
|
-
|
38
|
-
has_rdoc: true
|
35
|
+
- README.md
|
36
|
+
has_rdoc: false
|
39
37
|
homepage: http://github.com/nevinera/mobilicious
|
40
38
|
licenses: []
|
41
39
|
|
data/README
DELETED
data/install.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Install hook code here
|
data/uninstall.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Uninstall hook code here
|