facades 0.1.0 → 1.0.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.
Files changed (132) hide show
  1. data/.gitignore +1 -0
  2. data/.rbenv-gemsets +1 -0
  3. data/.rvmrc +1 -0
  4. data/.travis.yml +6 -0
  5. data/Gemfile +12 -0
  6. data/Guardfile +19 -0
  7. data/README.md +115 -101
  8. data/Rakefile +8 -0
  9. data/app/assets/javascripts/facades/debug/grid.js +0 -0
  10. data/app/helpers/facades_helper.rb +1 -0
  11. data/config.ru +7 -0
  12. data/facades.gemspec +9 -2
  13. data/lib/facades/helpers/layout.rb +36 -73
  14. data/lib/facades/helpers/navigation.rb +182 -110
  15. data/lib/facades/helpers/{elements.rb → notifications.rb} +9 -36
  16. data/lib/facades/helpers.rb +6 -17
  17. data/lib/facades/patterns/tabs.rb +75 -0
  18. data/lib/facades/patterns.rb +7 -0
  19. data/lib/facades/{sass_ext → sass_extensions}/color.rb +5 -13
  20. data/lib/facades/sass_extensions/conversions.rb +27 -0
  21. data/lib/facades/sass_extensions/functions.rb +84 -0
  22. data/lib/facades/sass_extensions/icons.rb +66 -0
  23. data/lib/facades/sass_extensions.rb +21 -0
  24. data/lib/facades/support/compass/project/MIT-LICENSE.txt +20 -0
  25. data/lib/facades/support/compass/project/humans.txt +8 -0
  26. data/lib/facades/support/compass/project/index.html +45 -0
  27. data/lib/facades/support/compass/project/manifest.rb +18 -0
  28. data/lib/facades/support/compass/project/robots.txt +4 -0
  29. data/lib/facades/support/compass.rb +9 -0
  30. data/lib/facades/support/rails.rb +12 -15
  31. data/lib/facades/support/simple_form.rb +32 -0
  32. data/lib/facades/version.rb +1 -1
  33. data/lib/facades.rb +21 -44
  34. data/spec/internal/app/helpers/application_helper.rb +3 -0
  35. data/spec/internal/app/views/navigation/_multi_list.html.erb +11 -0
  36. data/spec/internal/app/views/navigation/_multi_option_list.html.erb +14 -0
  37. data/spec/internal/app/views/navigation/_single_list.html.erb +9 -0
  38. data/spec/internal/config/database.yml +3 -0
  39. data/spec/internal/config/routes.rb +3 -0
  40. data/spec/internal/db/schema.rb +3 -0
  41. data/spec/internal/log/.gitignore +1 -0
  42. data/spec/internal/public/favicon.ico +0 -0
  43. data/spec/spec_helper.rb +16 -6
  44. data/spec/unit/helpers/layout_spec.rb +4 -0
  45. data/spec/unit/helpers/navigation_spec.rb +384 -0
  46. data/spec/unit/helpers/notifications_spec.rb +4 -0
  47. data/spec/unit/patterns/tabs_spec.rb +58 -0
  48. data/src/icons/facades.yml +105 -0
  49. data/src/icons/font-awesome.yml +210 -0
  50. data/src/scss/facades/_buttons.scss +10 -0
  51. data/src/scss/facades/_config.scss +99 -0
  52. data/src/scss/facades/_debug.scss +8 -0
  53. data/src/scss/facades/_forms.scss +228 -0
  54. data/src/scss/facades/_global.scss +104 -0
  55. data/src/scss/facades/_icons.scss +61 -0
  56. data/src/scss/facades/_mixins.scss +115 -0
  57. data/src/scss/facades/_mobile.scss +3 -0
  58. data/src/scss/facades/_setup.scss +191 -0
  59. data/src/scss/facades/_typography.scss +220 -0
  60. data/src/scss/facades/buttons/_glossy.scss +29 -0
  61. data/src/scss/facades/buttons/_gradient.scss +36 -0
  62. data/src/scss/facades/buttons/_shared.scss +33 -0
  63. data/src/scss/facades/buttons/_simple.scss +28 -0
  64. data/src/scss/facades/icons/_classes.scss +37 -0
  65. data/src/scss/facades/icons/_legacy.scss +27 -0
  66. data/src/scss/facades/layout/_lists.scss +43 -0
  67. data/src/scss/facades/mixins/_gradients.scss +30 -0
  68. data/src/scss/facades/mixins/_rhythm.scss +37 -0
  69. data/src/scss/facades/mobile/_buttons.scss +97 -0
  70. data/src/scss/facades/mobile/_config.scss +30 -0
  71. data/src/scss/facades/mobile/_global.scss +81 -0
  72. data/src/scss/facades/mobile/_mixins.scss +49 -0
  73. data/src/scss/facades/mobile/_setup.scss +50 -0
  74. data/src/scss/facades/mobile/patterns/_navbar.scss +21 -0
  75. data/src/scss/facades/mobile/patterns/_panel.scss +37 -0
  76. data/src/scss/facades/mobile/patterns/_stage.scss +20 -0
  77. data/src/scss/facades/mobile/patterns/_toolbar.scss +25 -0
  78. data/src/scss/facades/mobile/themes/_apple.scss +17 -0
  79. data/src/scss/facades/patterns/_labels.scss +50 -0
  80. data/src/scss/facades/patterns/_navbar.scss +4 -0
  81. data/src/scss/facades/patterns/_notifications.scss +82 -0
  82. data/src/scss/facades/patterns/_pagination.scss +4 -0
  83. data/src/scss/facades/patterns/_pills.scss +50 -0
  84. data/src/scss/facades/patterns/_tabs.scss +83 -0
  85. data/src/scss/facades/patterns/_twipsy.scss +84 -0
  86. data/src/scss/facades/typography/_tables.scss +95 -0
  87. metadata +201 -58
  88. data/app/views/facades/_pagination.html.erb +0 -20
  89. data/lib/facades/builders/form/base.rb +0 -212
  90. data/lib/facades/builders/form/elements.rb +0 -112
  91. data/lib/facades/builders/form/helper.rb +0 -29
  92. data/lib/facades/builders/form.rb +0 -22
  93. data/lib/facades/builders/sprite.rb +0 -50
  94. data/lib/facades/builders/table.rb +0 -76
  95. data/lib/facades/debug/html.rb +0 -6
  96. data/lib/facades/helpers/builders.rb +0 -24
  97. data/lib/facades/helpers/mobile.rb +0 -57
  98. data/lib/facades/helpers/pagination.rb +0 -83
  99. data/lib/facades/helpers/utility.rb +0 -31
  100. data/lib/facades/sass_ext/form_elements.rb +0 -52
  101. data/lib/facades/sass_ext/funcs.rb +0 -33
  102. data/lib/facades/sass_ext.rb +0 -14
  103. data/lib/facades/stylesheets/facades/_common.scss +0 -7
  104. data/lib/facades/stylesheets/facades/_css3.scss +0 -93
  105. data/lib/facades/stylesheets/facades/_layout.scss +0 -5
  106. data/lib/facades/stylesheets/facades/_normalize.scss +0 -5
  107. data/lib/facades/stylesheets/facades/_setup.scss +0 -104
  108. data/lib/facades/stylesheets/facades/_typography.scss +0 -2
  109. data/lib/facades/stylesheets/facades/_ui.scss +0 -3
  110. data/lib/facades/stylesheets/facades/_utilities.scss +0 -32
  111. data/lib/facades/stylesheets/facades/layout/_dropdown-list.scss +0 -7
  112. data/lib/facades/stylesheets/facades/layout/_forms.scss +0 -53
  113. data/lib/facades/stylesheets/facades/layout/_grid.scss +0 -49
  114. data/lib/facades/stylesheets/facades/layout/_responsive_grid.scss +0 -164
  115. data/lib/facades/stylesheets/facades/setup/_forms.scss +0 -284
  116. data/lib/facades/stylesheets/facades/setup/_ie.scss +0 -12
  117. data/lib/facades/stylesheets/facades/setup/_reset.scss +0 -255
  118. data/lib/facades/stylesheets/facades/typography/_baseline.scss +0 -91
  119. data/lib/facades/stylesheets/facades/typography/_lists.scss +0 -34
  120. data/lib/facades/stylesheets/facades/typography/_shadow.scss +0 -8
  121. data/lib/facades/stylesheets/facades/ui/_buttons.scss +0 -34
  122. data/lib/facades/stylesheets/facades/ui/_flash-messages.scss +0 -29
  123. data/lib/facades/stylesheets/facades/ui/_tabbed.scss +0 -5
  124. data/lib/facades/stylesheets/facades/ui/_tool-tip.scss +0 -44
  125. data/lib/facades/stylesheets/facades/utilities/_clearfix.scss +0 -20
  126. data/lib/facades/stylesheets/facades/utilities/_color.scss +0 -7
  127. data/lib/facades/stylesheets/facades/utilities/_cursors.scss +0 -4
  128. data/lib/facades/support/serve.rb +0 -17
  129. data/lib/facades/support/tipsy.rb +0 -17
  130. data/spec/facades/helpers/elements_spec.rb +0 -86
  131. data/spec/facades/helpers/layout_helpers_spec.rb +0 -5
  132. data/spec/facades/helpers/navigation_spec.rb +0 -107
@@ -0,0 +1,384 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Navigation helpers', :type => :view do
4
+
5
+ def stub_path(path)
6
+ view.controller.request.stub!(:path).and_return(path)
7
+ end
8
+
9
+ it 'creates a nav method' do
10
+ view.respond_to?(:nav).should be_true
11
+ end
12
+
13
+ it 'aliases .navigation to nav' do
14
+ view.respond_to?(:navigation).should be_true
15
+ end
16
+
17
+ describe 'single level list' do
18
+
19
+ before do
20
+ render('navigation/single_list')
21
+ end
22
+
23
+ it 'should create a nav element' do
24
+ rendered.should have_selector(:nav)
25
+ end
26
+
27
+ it 'should create a single unordered list' do
28
+ rendered.should have_selector(:ul,
29
+ :count => 1
30
+ )
31
+ end
32
+
33
+ it 'should create list items for each call to .link' do
34
+ rendered.should have_selector(:li,
35
+ :count => 2
36
+ )
37
+ end
38
+
39
+ it 'should create links for each call to .link' do
40
+ rendered.should have_selector(:a,
41
+ :count => 2
42
+ )
43
+ end
44
+
45
+ end
46
+
47
+ describe 'multi-level lists' do
48
+
49
+ it 'creates a nested list within any link containing a block' do
50
+ render('navigation/multi_list')
51
+ rendered.should have_selector("li > ul")
52
+ end
53
+
54
+ describe 'active state' do
55
+
56
+ before do
57
+ stub_path("/about/sub-path")
58
+ render('navigation/multi_list')
59
+ end
60
+
61
+ it 'adds active to the parent tag' do
62
+ rendered.should have_xpath('//a',
63
+ :href => '/about',
64
+ :class => 'active'
65
+ )
66
+ end
67
+
68
+ it 'adds active to the matching child tag' do
69
+ rendered.should have_xpath('//a',
70
+ :href => '/about/sub-path',
71
+ :class => 'active'
72
+ )
73
+ end
74
+
75
+ end
76
+
77
+ context 'when no links are passed to the sub-navigation' do
78
+
79
+ before do
80
+ assign(:subnav, [])
81
+ render('navigation/multi_option_list')
82
+ end
83
+
84
+ it 'does not render the nested list' do
85
+ rendered.should_not have_selector("li > ul")
86
+ end
87
+ end
88
+
89
+ context 'when links are passed to the sub-navigation' do
90
+
91
+ before do
92
+ assign(:subnav, ['Sublink'])
93
+ render('navigation/multi_option_list')
94
+ end
95
+
96
+ it 'renders the nested list' do
97
+ rendered.should have_selector("li > ul")
98
+ end
99
+ end
100
+ end
101
+
102
+ describe 'options' do
103
+
104
+ context 'when setting :wrapper to a tag' do
105
+
106
+ before do
107
+ assign(:options, { :wrapper => :ol })
108
+ render('navigation/single_list')
109
+ end
110
+
111
+ it 'wraps the list in the tag passed to :wrapper' do
112
+ rendered.should have_selector('nav > ol')
113
+ end
114
+
115
+ end # wrapper
116
+
117
+ context 'when setting options to :wrapper' do
118
+
119
+ before do
120
+ assign(:options, {
121
+ :wrapper => {
122
+ :id => 'main_navigation' },
123
+ :id => 'main_nav_list'
124
+ })
125
+ render('navigation/single_list')
126
+ end
127
+
128
+ it 'adds any options passed to :wrapper to the wrapping tag' do
129
+ rendered.should have_xpath('//nav', :id => 'main_navigation')
130
+ end
131
+
132
+ it 'adds any options passed to the wrapping list' do
133
+ rendered.should have_xpath('//ul', :id => 'main_nav_list')
134
+ end
135
+
136
+ end # options
137
+
138
+ end
139
+
140
+ describe 'links matching request.path' do
141
+
142
+ before do
143
+ stub_path("/about")
144
+ render('navigation/single_list')
145
+ end
146
+
147
+ describe 'by default' do
148
+
149
+ context 'when the link path matches' do
150
+
151
+ it 'adds .active to the link matching the path' do
152
+ rendered.should have_xpath('//a',
153
+ :count => 1,
154
+ :href => '/about',
155
+ :class => 'active'
156
+ )
157
+ end
158
+ end # path match
159
+
160
+ context 'when the link path does not match' do
161
+
162
+ it 'does not add .active to the link matching the path' do
163
+ rendered.should_not have_xpath('//a',
164
+ :href => '/',
165
+ :class => 'active'
166
+ )
167
+ end
168
+ end # mismatch
169
+ end # default
170
+
171
+ context 'when a proc is passed in the options' do
172
+
173
+ context 'and the proc is true' do
174
+
175
+ before do
176
+ assign(:link_options, {
177
+ :home => {
178
+ :proc => lambda{ |x| true }
179
+ }})
180
+ render('navigation/single_list')
181
+ end
182
+
183
+ it 'adds active to the link' do
184
+ rendered.should have_xpath('//a',
185
+ :href => '/',
186
+ :class => 'active'
187
+ )
188
+ end
189
+
190
+ end # true proc
191
+
192
+ context 'and the proc is false' do
193
+
194
+ before do
195
+ assign(:link_options, {
196
+ :home => {
197
+ :proc => lambda{ |x| false }
198
+ }})
199
+ render('navigation/single_list')
200
+ end
201
+
202
+ it 'does not active to the link' do
203
+ rendered.should_not have_xpath('//a',
204
+ :href => '/',
205
+ :class => 'active'
206
+ )
207
+ end
208
+ end # false proc
209
+ end # proc
210
+
211
+ context 'when a matcher is passed in the options' do
212
+
213
+ context 'and the matcher is a match' do
214
+
215
+ before do
216
+ assign(:link_options, {
217
+ :about => { :matcher => %r{^/about/?} }
218
+ })
219
+ render('navigation/single_list')
220
+ end
221
+
222
+ it 'adds active to the link' do
223
+ rendered.should have_xpath('//a',
224
+ :href => '/about',
225
+ :class => 'active'
226
+ )
227
+ end
228
+ end # matches
229
+
230
+ context 'and the matcher is not a match' do
231
+
232
+ before do
233
+ assign(:link_options, {
234
+ :home => { :matcher => /^not-home/ }
235
+ })
236
+ render('navigation/single_list')
237
+ end
238
+
239
+ it 'does not active to the link' do
240
+ rendered.should_not have_xpath('//a',
241
+ :href => '/',
242
+ :class => 'active'
243
+ )
244
+ end
245
+ end # does not match
246
+ end # matcher
247
+ end
248
+
249
+ describe 'sub-path matching' do
250
+
251
+ describe 'by default' do
252
+
253
+ before do
254
+ stub_path("/about/sub-path")
255
+ render('navigation/single_list')
256
+ end
257
+
258
+ it 'adds .active to the link' do
259
+ rendered.should have_xpath('//a',
260
+ :href => '/about',
261
+ :class => 'active'
262
+ )
263
+ end
264
+ end
265
+
266
+ describe 'when :match => :exact' do
267
+
268
+ before do
269
+ assign(:link_options, {
270
+ :about => { :match => :exact }
271
+ })
272
+ end
273
+
274
+ context 'and the path exactly matches the url' do
275
+
276
+ before do
277
+ stub_path("/about")
278
+ render('navigation/single_list')
279
+ end
280
+
281
+ it 'adds .active to the link' do
282
+ rendered.should have_xpath('//a',
283
+ :href => '/about',
284
+ :class => 'active'
285
+ )
286
+ end
287
+ end
288
+
289
+ context 'and the path does not exactly match the url' do
290
+
291
+ before do
292
+ stub_path("/about/sub-path")
293
+ render('navigation/single_list')
294
+ end
295
+
296
+ it 'does not add .active to the link' do
297
+ rendered.should_not have_xpath('//a',
298
+ :href => '/about',
299
+ :class => 'active'
300
+ )
301
+ end
302
+ end
303
+ end
304
+
305
+ describe 'when :match => :after' do
306
+
307
+ before do
308
+ assign(:link_options, {
309
+ :about => { :match => :after }
310
+ })
311
+ end
312
+
313
+ context 'and the path matches link + *' do
314
+
315
+ before do
316
+ stub_path("/prefix/about/sub-path")
317
+ render('navigation/single_list')
318
+ end
319
+
320
+ it 'adds .active to the link' do
321
+ rendered.should have_xpath('//a',
322
+ :href => '/about',
323
+ :class => 'active'
324
+ )
325
+ end
326
+ end
327
+
328
+ context 'and the path does not match link + *' do
329
+
330
+ before do
331
+ stub_path("/prefix/another/sub-path")
332
+ render('navigation/single_list')
333
+ end
334
+
335
+ it 'does not add .active to the link' do
336
+ rendered.should_not have_xpath('//a',
337
+ :href => '/about',
338
+ :class => 'active'
339
+ )
340
+ end
341
+ end
342
+ end
343
+
344
+ describe 'when :match => :before' do
345
+
346
+ before do
347
+ assign(:link_options, {
348
+ :about => { :match => :before }
349
+ })
350
+ end
351
+
352
+ context 'and the path matches * + link$' do
353
+
354
+ before do
355
+ stub_path("/prefix/about")
356
+ render('navigation/single_list')
357
+ end
358
+
359
+ it 'adds .active to the link' do
360
+ rendered.should have_xpath('//a',
361
+ :href => '/about',
362
+ :class => 'active'
363
+ )
364
+ end
365
+ end
366
+
367
+ context 'and the path contains text after the match' do
368
+
369
+ before do
370
+ stub_path("/prefix/about/sub-path")
371
+ render('navigation/single_list')
372
+ end
373
+
374
+ it 'does not add .active to the link' do
375
+ rendered.should_not have_xpath('//a',
376
+ :href => '/about',
377
+ :class => 'active'
378
+ )
379
+ end
380
+ end
381
+ end
382
+ end
383
+
384
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Notification helpers', :type => :helper do
4
+ end
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Tabbed areas', :type => :helper do
4
+
5
+ def tabbed_area(opts = {})
6
+ result = helper.tabbed do |tab|
7
+ tab.panel('First Tab', opts) do
8
+ "First tab content"
9
+ end
10
+ tab.panel('Second Tab') do
11
+ "Second tab content"
12
+ end
13
+ end
14
+ result.to_s
15
+ end
16
+
17
+ let(:result) do
18
+ tabbed_area
19
+ end
20
+
21
+ it 'adds a .tabbed method' do
22
+ helper.respond_to?(:tabbed).should be_true
23
+ end
24
+
25
+ describe 'navigation' do
26
+
27
+ it 'renders a list item for each tab' do
28
+ result.should have_selector('ul > li', :count => 2)
29
+ end
30
+
31
+ it 'renders a section.tab for each tab' do
32
+ result.should have_selector('section.tab', :count => 2)
33
+ end
34
+
35
+ context 'when no id is passed to the panel' do
36
+
37
+ it 'sets the links href to a id formatted string of the title' do
38
+ result.should have_xpath('//a', :href => '#first_tab')
39
+ end
40
+
41
+ end
42
+
43
+ context 'when an id is passed to the panel' do
44
+
45
+ let(:result) do
46
+ tabbed_area(:id => 'tab1')
47
+ end
48
+
49
+ it 'sets the links href to match the id' do
50
+ result.should have_xpath('//a', :href => '#tab1')
51
+ end
52
+
53
+ end
54
+
55
+ end
56
+
57
+
58
+ end
@@ -0,0 +1,105 @@
1
+ spinner: 'e001'
2
+ transfer: 'e002'
3
+ reload: 'e003'
4
+ refresh: 'e004'
5
+ arrow_right: 'e005'
6
+ arrow_down: 'e006'
7
+ arrow_left: 'e007'
8
+ arrow_up: 'e008'
9
+ arrow_right_dark: 'e009'
10
+ arrow_down_dark: 'e00a'
11
+ arrow_left_dark: 'e00b'
12
+ arrow_up_dark: 'e00c'
13
+ arrow_right_light: 'e00d'
14
+ arrow_down_light: 'e00e'
15
+ arrow_left_light: 'e00f'
16
+ arrow_up_light: 'e010'
17
+ play: 'e011'
18
+ pause: 'e012'
19
+ fast_forward: 'e013'
20
+ rewind: 'e014'
21
+ stop: 'e015'
22
+ eject: 'e016'
23
+ play_button: 'e017'
24
+ plus: 'e018'
25
+ minus: 'e019'
26
+ delete: 'e01a'
27
+ delete_round: 'e01b'
28
+ plus_round: 'e01c'
29
+ minus_round: 'e01d'
30
+ cancel: 'e01e'
31
+ check: 'e01f'
32
+ check_dark: 'e020'
33
+ check_light: 'e021'
34
+ search: 'e022'
35
+ zoom_in: 'e023'
36
+ zoom_out: 'e024'
37
+ pie_chart: 'e025'
38
+ bar_chart: 'e026'
39
+ ribbon: 'e027'
40
+ info: 'e028'
41
+ mail: 'e029'
42
+ mail_open: 'e02a'
43
+ rss_dark: 'e02b'
44
+ rss: 'e02c'
45
+ warning: 'e02d'
46
+ calendar: 'e02e'
47
+ lock: 'e02f'
48
+ unlock: 'e030'
49
+ globe: 'e031'
50
+ document: 'e032'
51
+ add_document: 'e033'
52
+ delete_document: 'e034'
53
+ edit_document: 'e035'
54
+ folder: 'e036'
55
+ folder_open: 'e037'
56
+ print: 'e038'
57
+ pencil: 'e039'
58
+ wrench: 'e03a'
59
+ tools: 'e03b'
60
+ volume_off: 'e03c'
61
+ volume_low: 'e03d'
62
+ volume_high: 'e03e'
63
+ clock: 'e03f'
64
+ iphone: 'e040'
65
+ ipod: 'e041'
66
+ battery: 'e042'
67
+ battery_half_charge: 'e043'
68
+ battery_full_charge: 'e044'
69
+ battery_charging: 'e045'
70
+ paperclip: 'e046'
71
+ trash: 'e047'
72
+ gear: 'e048'
73
+ star: 'e049'
74
+ heart: 'e04a'
75
+ link: 'e04b'
76
+ camera: 'e04c'
77
+ tag: 'e04d'
78
+ tag_alt: 'e04e'
79
+ quote_left: 'e04f'
80
+ quote_right: 'e050'
81
+ comment: 'e051'
82
+ comment_dark: 'e052'
83
+ gift: 'e053'
84
+ headphones: 'e054'
85
+ book: 'e055'
86
+ binder: 'e056'
87
+ vcard: 'e057'
88
+ news: 'e058'
89
+ person: 'e059'
90
+ cart: 'e05a'
91
+ flag: 'e05b'
92
+ scissors: 'e05c'
93
+ push_pin: 'e05d'
94
+ pin: 'e05e'
95
+ image: 'e05f'
96
+ align_left: 'e060'
97
+ align_right: 'e061'
98
+ align_center: 'e062'
99
+ list: 'e063'
100
+ minimize: 'e064'
101
+ maximize: 'e065'
102
+ facebook_dark: 'e066'
103
+ facebook: 'e067'
104
+ twitter_dark: 'e068'
105
+ twitter: 'e069'