facades 0.0.7 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  #Facades
2
2
  Facades is a gem designed to assist with front-end development and misc design. It includes a compass plugin / mixins, and various Rails view helpers to help with common development tasks.
3
3
 
4
+ **Note** With version 1.0 there are a number of changes in functionality setup. Check [here](https://github.com/kurbmedia/facades/tree/1.0) for more info. Currently master
5
+ tracks the released version.
6
+
4
7
  ##CSS / SASS
5
8
  Facades includes several mixins and includes for setting up a few defaults within your css.
6
9
 
data/facades.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.email = ["brent@kurbmedia.com"]
10
10
  s.homepage = "https://github.com/kurbmedia/facades"
11
11
  s.summary = %q{Front-end development awesome-ness}
12
- s.description = %q{Facades is a front-end development framework which takes }
12
+ s.description = %q{Facades is a front-end development framework which supplies a few helpers, stylesheets and sass extensions for easier front-end development.}
13
13
 
14
14
  s.rubyforge_project = "facades"
15
15
 
@@ -6,6 +6,21 @@ module Facades
6
6
  #
7
7
  module Layout
8
8
 
9
+ ##
10
+ # Returns a short-hand string identifying the current browser
11
+ #
12
+ def browser_name
13
+ uastr = request.user_agent.to_s
14
+ return "webkit" if uastr =~ /(webkit)[ \/]([\w.]+)/i
15
+ return "opera" if uastr =~ /(opera)(?:.*version)?[ \/]([\w.]+)/i
16
+ if matches = uastr.match(/(msie) ([\w.]+)/i)
17
+ version = (matches[2]||0).to_i
18
+ return "ie#{version}"
19
+ end
20
+ return "mozilla" if uastr =~ /(mozilla)(?:.*? rv:([\w.]+))?/i
21
+ "unknown"
22
+ end
23
+
9
24
  ##
10
25
  #
11
26
  # Allows easy assigning of meta tags from templates
@@ -5,12 +5,53 @@ module Facades
5
5
  module Mobile
6
6
 
7
7
  def mobile_meta_tags
8
- [ tag(:meta, {"http-equiv" => 'cleartype', 'content' => 'on' }), # IE Cleartype
8
+ tags = [ tag(:meta, {"http-equiv" => 'cleartype', 'content' => 'on' }), # IE Cleartype
9
9
  meta_tag('HandheldFriendly', 'True'),
10
10
  meta_tag('viewport', "width=device-width, minimum-scale=1.0, initial-scale=1.0")
11
11
  ].join("\n")
12
+ tags = tags.html_safe if tags.respond_to?(:html_safe)
13
+ end
14
+
15
+ def mobile_only(&block)
16
+ return "" unless mobile_device?
17
+ capture(&block)
18
+ end
19
+
20
+ def unless_mobile_device(&block)
21
+ return "" if mobile_device?
22
+ capture(&block)
23
+ end
24
+
25
+ end
26
+
27
+ module MobileController
28
+ extend ActiveSupport::Concern
29
+
30
+ included do
31
+ helper_method :mobile_device?, :iphone?, :android?
32
+ end
33
+
34
+ def mobile_device_user_agent_regexp
35
+ Regexp.new(['palm','blackberry','nokia','phone','midp','mobi','symbian','chtml','ericsson','minimo',
36
+ 'audiovox','motorola','samsung','telit','upg1','windows ce','ucweb','astel','plucker',
37
+ 'x320','x240','j2me','sgh','portable','sprint','docomo','kddi','softbank','android','mmp',
38
+ 'pdxgw','netfront','xiino','vodafone','portalmmm','sagem','mot-','sie-','ipod','up\\.b',
39
+ 'webos','amoi','novarra','cdm','alcatel','pocket','ipad','iphone','mobileexplorer','mobile'].join('|'))
40
+ end
41
+
42
+ def iphone?
43
+ request.user_agent.to_s.downcase.include?("iphone")
44
+ end
45
+
46
+ def android?
47
+ request.user_agent.to_s.downcase.include?("android")
48
+ end
49
+
50
+ def mobile_device?
51
+ request.user_agent.to_s.downcase =~ mobile_device_user_agent_regexp
12
52
  end
13
53
 
14
54
  end
55
+
15
56
  end
16
57
  end
@@ -12,6 +12,10 @@ module Facades
12
12
  config.sass.load_paths << File.expand_path("../../stylesheets", __FILE__)
13
13
  Facades::Builders::Sprite
14
14
 
15
+ ActiveSupport.on_load(:action_controller) do
16
+ include Facades::Helpers::MobileController
17
+ end
18
+
15
19
  initializer 'facades assets' do |app|
16
20
  app.config.assets.instance_eval do
17
21
  register_mime_type 'image/png', '.png'
@@ -1,3 +1,3 @@
1
1
  module Facades
2
- VERSION = "0.0.7"
2
+ VERSION = "0.1.0"
3
3
  end
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facades
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-10 00:00:00.000000000 Z
12
+ date: 2012-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sass
16
- requirement: &70286004139240 !ruby/object:Gem::Requirement
16
+ requirement: &70228226739680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,8 +21,9 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70286004139240
25
- description: ! 'Facades is a front-end development framework which takes '
24
+ version_requirements: *70228226739680
25
+ description: Facades is a front-end development framework which supplies a few helpers,
26
+ stylesheets and sass extensions for easier front-end development.
26
27
  email:
27
28
  - brent@kurbmedia.com
28
29
  executables: []
@@ -88,6 +89,7 @@ files:
88
89
  - spec/facades/helpers/elements_spec.rb
89
90
  - spec/facades/helpers/layout_helpers_spec.rb
90
91
  - spec/facades/helpers/navigation_spec.rb
92
+ - spec/internal/log/test.log
91
93
  - spec/spec_helper.rb
92
94
  homepage: https://github.com/kurbmedia/facades
93
95
  licenses: []
@@ -109,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
111
  version: '0'
110
112
  requirements: []
111
113
  rubyforge_project: facades
112
- rubygems_version: 1.8.10
114
+ rubygems_version: 1.8.16
113
115
  signing_key:
114
116
  specification_version: 3
115
117
  summary: Front-end development awesome-ness
@@ -117,4 +119,5 @@ test_files:
117
119
  - spec/facades/helpers/elements_spec.rb
118
120
  - spec/facades/helpers/layout_helpers_spec.rb
119
121
  - spec/facades/helpers/navigation_spec.rb
122
+ - spec/internal/log/test.log
120
123
  - spec/spec_helper.rb