facades 0.0.2 → 0.0.3

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.
Files changed (52) hide show
  1. data/README.md +52 -0
  2. data/app/helpers/facades_helper.rb +0 -26
  3. data/app/views/facades/_pagination.html.erb +20 -0
  4. data/facades.gemspec +2 -3
  5. data/lib/facades/builders/sprite.rb +50 -0
  6. data/lib/facades/builders/table.rb +76 -0
  7. data/lib/facades/helpers/builders.rb +24 -0
  8. data/lib/facades/helpers/elements.rb +2 -2
  9. data/lib/facades/helpers/layout.rb +25 -8
  10. data/lib/facades/helpers/mobile.rb +16 -0
  11. data/lib/facades/helpers/navigation.rb +13 -10
  12. data/lib/facades/helpers/pagination.rb +83 -0
  13. data/lib/facades/helpers/utility.rb +31 -0
  14. data/lib/facades/helpers.rb +13 -5
  15. data/lib/facades/sass_ext/color.rb +30 -0
  16. data/lib/facades/sass_ext/form_elements.rb +8 -2
  17. data/lib/facades/sass_ext.rb +3 -4
  18. data/lib/facades/stylesheets/facades/_common.scss +7 -0
  19. data/lib/facades/stylesheets/facades/_layout.scss +5 -1
  20. data/lib/facades/stylesheets/facades/_normalize.scss +5 -0
  21. data/lib/facades/stylesheets/facades/_setup.scss +67 -0
  22. data/lib/facades/stylesheets/facades/_typography.scss +2 -0
  23. data/lib/facades/stylesheets/facades/_ui.scss +3 -1
  24. data/lib/facades/stylesheets/facades/_utilities.scss +29 -15
  25. data/lib/facades/stylesheets/facades/layout/_debug.scss +18 -0
  26. data/lib/facades/stylesheets/facades/layout/_dropdown-list.scss +7 -0
  27. data/lib/facades/stylesheets/facades/layout/_forms.scss +31 -116
  28. data/lib/facades/stylesheets/facades/layout/_grid.scss +4 -20
  29. data/lib/facades/stylesheets/facades/legacy/_forms.scss +130 -0
  30. data/lib/facades/stylesheets/facades/{_reset.scss → legacy/_reset.scss} +40 -8
  31. data/lib/facades/stylesheets/facades/setup/_forms.scss +212 -0
  32. data/lib/facades/stylesheets/facades/setup/_ie.scss +12 -0
  33. data/lib/facades/stylesheets/facades/setup/_reset.scss +198 -0
  34. data/lib/facades/stylesheets/facades/typography/_baseline.scss +89 -0
  35. data/lib/facades/stylesheets/facades/typography/_lists.scss +34 -0
  36. data/lib/facades/stylesheets/facades/typography/_rhythm.scss +3 -1
  37. data/lib/facades/stylesheets/facades/typography/_shadow.scss +9 -0
  38. data/lib/facades/stylesheets/facades/ui/_buttons.scss +35 -0
  39. data/lib/facades/stylesheets/facades/ui/_flash-messages.scss +58 -0
  40. data/lib/facades/stylesheets/facades/ui/_tool-tip.scss +2 -1
  41. data/lib/facades/stylesheets/facades/utilities/_clearfix.scss +16 -0
  42. data/lib/facades/stylesheets/facades/utilities/_color.scss +7 -0
  43. data/lib/facades/stylesheets/facades/utilities/_cursors.scss +3 -0
  44. data/lib/facades/{engine.rb → support/rails.rb} +6 -0
  45. data/lib/facades/support/serve.rb +17 -0
  46. data/lib/facades/support/tipsy.rb +17 -0
  47. data/lib/facades/version.rb +1 -1
  48. data/lib/facades.rb +25 -4
  49. data/spec/facades/helpers/navigation_spec.rb +103 -0
  50. data/spec/spec_helper.rb +12 -0
  51. metadata +39 -25
  52. data/lib/facades/stylesheets/facades/utilities/_site-map.scss +0 -18
@@ -0,0 +1,3 @@
1
+ @mixin hand-cursor{
2
+ cursor:pointer; cursor:hand;
3
+ }
@@ -3,8 +3,14 @@ module Facades
3
3
  class Engine < Rails::Engine
4
4
 
5
5
  require 'facades/helpers'
6
+ require 'facades/builders/sprite'
7
+
8
+ Facades::Builders::Sprite
6
9
 
7
10
  initializer 'facades assets' do |app|
11
+ app.config.assets.instance_eval do
12
+ register_mime_type 'image/png', '.png'
13
+ end
8
14
  end
9
15
 
10
16
  end
@@ -0,0 +1,17 @@
1
+ require 'facades/helpers'
2
+ require File.expand_path("../../../../app/helpers/", __FILE__) << '/facades_helper'
3
+
4
+ module Facades
5
+ module Support
6
+ # Enable facades helpers and files within serve projects
7
+ # see get-serve.com for more info.
8
+ module Serve
9
+ extend ActiveSupport::Concern
10
+
11
+ included do
12
+ include ::FacadesHelper
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require 'facades/helpers'
2
+ require File.expand_path("../../../../app/helpers/", __FILE__) << '/facades_helper'
3
+
4
+ module Facades
5
+ module Support
6
+ # Enable facades helpers and files within serve projects
7
+ # see github.com/kurbmedia/tipsy for more info.
8
+ module Tipsy
9
+ extend ActiveSupport::Concern
10
+
11
+ included do
12
+ include ::FacadesHelper
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module Facades
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/facades.rb CHANGED
@@ -1,14 +1,38 @@
1
1
  require 'active_support'
2
+ require 'active_support/core_ext/object'
2
3
  require 'facades/version'
3
4
 
4
5
  module Facades
5
6
 
7
+ module Support
8
+ autoload :Serve, 'facades/support/serve'
9
+ end
10
+
6
11
  module Debug
7
12
  autoload :Html, 'facades/debug/html'
8
13
  end
9
14
 
15
+ module Builders
16
+ autoload :Sprite, 'facades/builders/sprite'
17
+ end
18
+
19
+ # When enabled, HTML5 elements are used within helpers
20
+ # This includes things like using <nav> within pagination
21
+ # and the nav helper.
22
+ #
10
23
  mattr_accessor :enable_html5
24
+ @@enable_html5 = true
25
+
26
+ # When enabled, a div is added to each HTML page which displays
27
+ # errors with the resulting html. This includes things like missing page titles,
28
+ # missing keywords, etc.
29
+ #
11
30
  mattr_accessor :debug_html
31
+ @@debug_html = false
32
+
33
+ def self.helpers
34
+ Facades::Helpers
35
+ end
12
36
 
13
37
  def setup(&block)
14
38
  yield self
@@ -16,13 +40,10 @@ module Facades
16
40
 
17
41
  end
18
42
 
19
- Facades.enable_html5 = true
20
- Facades.debug_html = true
21
-
22
43
  require 'facades/sass_ext'
23
44
  require 'compass'
24
45
  Compass::Frameworks.register('facades',
25
46
  :stylesheets_directory => File.join(File.dirname(__FILE__), 'facades/stylesheets'),
26
47
  :templates_directory => File.join(File.dirname(__FILE__), 'facades/templates'))
27
48
 
28
- require 'facades/engine' if defined?(Rails)
49
+ require 'facades/support/rails' if defined?(Rails)
@@ -1,4 +1,107 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Facades::Helpers::Navigation, :type => :helper do
4
+
5
+ module HelperMethods
6
+ def stub_path(path)
7
+ before do
8
+ helper.controller.request.stubs(:path).returns(path)
9
+ end
10
+ end
11
+ end
12
+ extend HelperMethods
13
+
14
+ def link(*args)
15
+ resp = helper.nav_link(*['test link', '/home'].concat(args).flatten).to_html
16
+ resp.stubs(:classes).returns((resp.first('a')[:class] || []))
17
+ resp.stubs(:wrapper).returns(resp.first('li'))
18
+ resp.stubs(:wrapper_classes).returns((resp.first('li')[:class] || []))
19
+ resp
20
+ end
21
+
22
+ describe '.nav_link' do
23
+
24
+ subject{ link }
25
+
26
+ it { should have_selector('a') }
27
+ it { should have_selector('li') }
28
+
29
+ describe 'its class attribute' do
30
+
31
+ subject{ link.classes }
32
+
33
+ context 'when the current path' do
34
+ context 'does not match the link path' do
35
+ stub_path('/nothing')
36
+
37
+ it { should_not include("on") }
38
+ end
39
+ context 'matches the link path' do
40
+ stub_path('/home')
41
+
42
+ it { should include("on") }
43
+ end
44
+ end
45
+
46
+ context 'when the current path is a sub-path' do
47
+ context 'and matches the root of the link path' do
48
+ stub_path('/home/child')
49
+
50
+ it { should include("on") }
51
+ end
52
+ context 'does not match the root of' do
53
+ stub_path('/nothing/child')
54
+
55
+ it { should_not include("on") }
56
+ end
57
+ end
58
+
59
+ context 'when passed a regex' do
60
+
61
+ subject{ link(:matcher => /nothing/i).classes }
62
+
63
+ context 'matching the request path' do
64
+ stub_path("/nothing")
65
+
66
+ it { should include("on") }
67
+ end
68
+ context 'not matching the request path' do
69
+ stub_path("/massive-fail")
70
+
71
+ it { should_not include("on") }
72
+ end
73
+ end
74
+
75
+ context 'when passed a proc returning true' do
76
+
77
+ subject{ link(:proc => lambda{ |path| true }).classes }
78
+
79
+ it { should include('on') }
80
+ end
81
+
82
+ context 'when passed a proc returning false' do
83
+
84
+ subject{ link(:proc => lambda{ |path| false }).classes }
85
+
86
+ it { should_not include('on') }
87
+ end
88
+
89
+ context 'with a passed class attribute' do
90
+ describe 'the link' do
91
+
92
+ subject{ link(:class => 'existing_class', :proc => lambda{ |path| true }).classes }
93
+
94
+ it { should include('existing_class') }
95
+ end
96
+
97
+ describe 'the wrapper' do
98
+
99
+ subject{ link(:wrapper => { :class => 'existing_class' }, :proc => lambda{ |path| true }).wrapper_classes }
100
+
101
+ it { should include('existing_class') }
102
+ end
103
+ end
104
+ end
105
+
106
+ end
4
107
  end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
+
4
+ require 'facades'
5
+ require 'facades/helpers'
6
+ require 'rspec'
7
+ require 'sass'
8
+ require 'compass'
9
+
10
+
11
+ RSpec.configure do |config|
12
+ end
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.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-01 00:00:00.000000000 -04:00
13
- default_executable:
12
+ date: 2011-09-30 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: sass
17
- requirement: &70254468244960 !ruby/object:Gem::Requirement
16
+ requirement: &70151854513160 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ~>
@@ -22,20 +21,8 @@ dependencies:
22
21
  version: '3.1'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *70254468244960
26
- - !ruby/object:Gem::Dependency
27
- name: compass
28
- requirement: &70254468244340 !ruby/object:Gem::Requirement
29
- none: false
30
- requirements:
31
- - - ! '>='
32
- - !ruby/object:Gem::Version
33
- version: '0.11'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: *70254468244340
37
- description: Facades includes various helpers, methods, and compass/sass mixins for
38
- simplifying frontend development.
24
+ version_requirements: *70151854513160
25
+ description: ! 'Facades is a front-end development framework which takes '
39
26
  email:
40
27
  - brent@kurbmedia.com
41
28
  executables: []
@@ -47,30 +34,57 @@ files:
47
34
  - README.md
48
35
  - Rakefile
49
36
  - app/helpers/facades_helper.rb
37
+ - app/views/facades/_pagination.html.erb
50
38
  - facades.gemspec
51
39
  - lib/facades.rb
40
+ - lib/facades/builders/sprite.rb
41
+ - lib/facades/builders/table.rb
52
42
  - lib/facades/debug/html.rb
53
- - lib/facades/engine.rb
54
43
  - lib/facades/helpers.rb
44
+ - lib/facades/helpers/builders.rb
55
45
  - lib/facades/helpers/elements.rb
56
46
  - lib/facades/helpers/layout.rb
47
+ - lib/facades/helpers/mobile.rb
57
48
  - lib/facades/helpers/navigation.rb
49
+ - lib/facades/helpers/pagination.rb
50
+ - lib/facades/helpers/utility.rb
58
51
  - lib/facades/sass_ext.rb
52
+ - lib/facades/sass_ext/color.rb
59
53
  - lib/facades/sass_ext/form_elements.rb
54
+ - lib/facades/stylesheets/facades/_common.scss
60
55
  - lib/facades/stylesheets/facades/_layout.scss
61
- - lib/facades/stylesheets/facades/_reset.scss
56
+ - lib/facades/stylesheets/facades/_normalize.scss
57
+ - lib/facades/stylesheets/facades/_setup.scss
58
+ - lib/facades/stylesheets/facades/_typography.scss
62
59
  - lib/facades/stylesheets/facades/_ui.scss
63
60
  - lib/facades/stylesheets/facades/_utilities.scss
61
+ - lib/facades/stylesheets/facades/layout/_debug.scss
62
+ - lib/facades/stylesheets/facades/layout/_dropdown-list.scss
64
63
  - lib/facades/stylesheets/facades/layout/_forms.scss
65
64
  - lib/facades/stylesheets/facades/layout/_grid.scss
65
+ - lib/facades/stylesheets/facades/legacy/_forms.scss
66
+ - lib/facades/stylesheets/facades/legacy/_reset.scss
67
+ - lib/facades/stylesheets/facades/setup/_forms.scss
68
+ - lib/facades/stylesheets/facades/setup/_ie.scss
69
+ - lib/facades/stylesheets/facades/setup/_reset.scss
70
+ - lib/facades/stylesheets/facades/typography/_baseline.scss
71
+ - lib/facades/stylesheets/facades/typography/_lists.scss
66
72
  - lib/facades/stylesheets/facades/typography/_rhythm.scss
73
+ - lib/facades/stylesheets/facades/typography/_shadow.scss
74
+ - lib/facades/stylesheets/facades/ui/_buttons.scss
75
+ - lib/facades/stylesheets/facades/ui/_flash-messages.scss
67
76
  - lib/facades/stylesheets/facades/ui/_tool-tip.scss
68
- - lib/facades/stylesheets/facades/utilities/_site-map.scss
77
+ - lib/facades/stylesheets/facades/utilities/_clearfix.scss
78
+ - lib/facades/stylesheets/facades/utilities/_color.scss
79
+ - lib/facades/stylesheets/facades/utilities/_cursors.scss
80
+ - lib/facades/support/rails.rb
81
+ - lib/facades/support/serve.rb
82
+ - lib/facades/support/tipsy.rb
69
83
  - lib/facades/version.rb
70
84
  - spec/facades/helpers/elements_spec.rb
71
85
  - spec/facades/helpers/layout_helpers_spec.rb
72
86
  - spec/facades/helpers/navigation_spec.rb
73
- has_rdoc: true
87
+ - spec/spec_helper.rb
74
88
  homepage: https://github.com/kurbmedia/facades
75
89
  licenses: []
76
90
  post_install_message:
@@ -91,12 +105,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
105
  version: '0'
92
106
  requirements: []
93
107
  rubyforge_project: facades
94
- rubygems_version: 1.6.2
108
+ rubygems_version: 1.8.7
95
109
  signing_key:
96
110
  specification_version: 3
97
- summary: Mixins, utilities, and helpers for front-end design/development with Compass
98
- / Rails
111
+ summary: Front-end development awesome-ness
99
112
  test_files:
100
113
  - spec/facades/helpers/elements_spec.rb
101
114
  - spec/facades/helpers/layout_helpers_spec.rb
102
115
  - spec/facades/helpers/navigation_spec.rb
116
+ - spec/spec_helper.rb
@@ -1,18 +0,0 @@
1
- #sitemap{ @include inline-block-list(0); text-align:center; width:100%; padding-top:25px;
2
- ol{ margin:0; padding:0; @include clearfix; }
3
- li{ vertical-align:top; margin:0 10px 15px 10px; }
4
- li.single{ float:left !important;
5
- ol{ text-align:left !important; padding-top:15px; margin:0 -10px;
6
- li{ display:block !important; float:none !important; }
7
- }
8
- }
9
- li.multi{ float:left;
10
- ol{ white-space:nowrap; padding-top:15px; margin:0 -10px;
11
- li{ float:left; }
12
- }
13
- }
14
- a{ @include inline-block; margin:0px; padding:2px 15px; @include border-radius(3px); @include box-shadow(rgba(100,100,100,0.5), 2px, 2px, 1px, 0);
15
- @include background(linear-gradient(top, #b2cd23, darken(#b2cd23, 7%))); border:2px solid darken(#b2cd23, 5%); color:white; text-decoration:none;
16
- font-weight:bold; @include single-text-shadow(darken(#b2cd23, 15%), 1px, 1px, 1px);
17
- }
18
- }