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.
- data/.gitignore +1 -0
- data/.rbenv-gemsets +1 -0
- data/.rvmrc +1 -0
- data/.travis.yml +6 -0
- data/Gemfile +12 -0
- data/Guardfile +19 -0
- data/README.md +115 -101
- data/Rakefile +8 -0
- data/app/assets/javascripts/facades/debug/grid.js +0 -0
- data/app/helpers/facades_helper.rb +1 -0
- data/config.ru +7 -0
- data/facades.gemspec +9 -2
- data/lib/facades/helpers/layout.rb +36 -73
- data/lib/facades/helpers/navigation.rb +182 -110
- data/lib/facades/helpers/{elements.rb → notifications.rb} +9 -36
- data/lib/facades/helpers.rb +6 -17
- data/lib/facades/patterns/tabs.rb +75 -0
- data/lib/facades/patterns.rb +7 -0
- data/lib/facades/{sass_ext → sass_extensions}/color.rb +5 -13
- data/lib/facades/sass_extensions/conversions.rb +27 -0
- data/lib/facades/sass_extensions/functions.rb +84 -0
- data/lib/facades/sass_extensions/icons.rb +66 -0
- data/lib/facades/sass_extensions.rb +21 -0
- data/lib/facades/support/compass/project/MIT-LICENSE.txt +20 -0
- data/lib/facades/support/compass/project/humans.txt +8 -0
- data/lib/facades/support/compass/project/index.html +45 -0
- data/lib/facades/support/compass/project/manifest.rb +18 -0
- data/lib/facades/support/compass/project/robots.txt +4 -0
- data/lib/facades/support/compass.rb +9 -0
- data/lib/facades/support/rails.rb +12 -15
- data/lib/facades/support/simple_form.rb +32 -0
- data/lib/facades/version.rb +1 -1
- data/lib/facades.rb +21 -44
- data/spec/internal/app/helpers/application_helper.rb +3 -0
- data/spec/internal/app/views/navigation/_multi_list.html.erb +11 -0
- data/spec/internal/app/views/navigation/_multi_option_list.html.erb +14 -0
- data/spec/internal/app/views/navigation/_single_list.html.erb +9 -0
- data/spec/internal/config/database.yml +3 -0
- data/spec/internal/config/routes.rb +3 -0
- data/spec/internal/db/schema.rb +3 -0
- data/spec/internal/log/.gitignore +1 -0
- data/spec/internal/public/favicon.ico +0 -0
- data/spec/spec_helper.rb +16 -6
- data/spec/unit/helpers/layout_spec.rb +4 -0
- data/spec/unit/helpers/navigation_spec.rb +384 -0
- data/spec/unit/helpers/notifications_spec.rb +4 -0
- data/spec/unit/patterns/tabs_spec.rb +58 -0
- data/src/icons/facades.yml +105 -0
- data/src/icons/font-awesome.yml +210 -0
- data/src/scss/facades/_buttons.scss +10 -0
- data/src/scss/facades/_config.scss +99 -0
- data/src/scss/facades/_debug.scss +8 -0
- data/src/scss/facades/_forms.scss +228 -0
- data/src/scss/facades/_global.scss +104 -0
- data/src/scss/facades/_icons.scss +61 -0
- data/src/scss/facades/_mixins.scss +115 -0
- data/src/scss/facades/_mobile.scss +3 -0
- data/src/scss/facades/_setup.scss +191 -0
- data/src/scss/facades/_typography.scss +220 -0
- data/src/scss/facades/buttons/_glossy.scss +29 -0
- data/src/scss/facades/buttons/_gradient.scss +36 -0
- data/src/scss/facades/buttons/_shared.scss +33 -0
- data/src/scss/facades/buttons/_simple.scss +28 -0
- data/src/scss/facades/icons/_classes.scss +37 -0
- data/src/scss/facades/icons/_legacy.scss +27 -0
- data/src/scss/facades/layout/_lists.scss +43 -0
- data/src/scss/facades/mixins/_gradients.scss +30 -0
- data/src/scss/facades/mixins/_rhythm.scss +37 -0
- data/src/scss/facades/mobile/_buttons.scss +97 -0
- data/src/scss/facades/mobile/_config.scss +30 -0
- data/src/scss/facades/mobile/_global.scss +81 -0
- data/src/scss/facades/mobile/_mixins.scss +49 -0
- data/src/scss/facades/mobile/_setup.scss +50 -0
- data/src/scss/facades/mobile/patterns/_navbar.scss +21 -0
- data/src/scss/facades/mobile/patterns/_panel.scss +37 -0
- data/src/scss/facades/mobile/patterns/_stage.scss +20 -0
- data/src/scss/facades/mobile/patterns/_toolbar.scss +25 -0
- data/src/scss/facades/mobile/themes/_apple.scss +17 -0
- data/src/scss/facades/patterns/_labels.scss +50 -0
- data/src/scss/facades/patterns/_navbar.scss +4 -0
- data/src/scss/facades/patterns/_notifications.scss +82 -0
- data/src/scss/facades/patterns/_pagination.scss +4 -0
- data/src/scss/facades/patterns/_pills.scss +50 -0
- data/src/scss/facades/patterns/_tabs.scss +83 -0
- data/src/scss/facades/patterns/_twipsy.scss +84 -0
- data/src/scss/facades/typography/_tables.scss +95 -0
- metadata +201 -58
- data/app/views/facades/_pagination.html.erb +0 -20
- data/lib/facades/builders/form/base.rb +0 -212
- data/lib/facades/builders/form/elements.rb +0 -112
- data/lib/facades/builders/form/helper.rb +0 -29
- data/lib/facades/builders/form.rb +0 -22
- data/lib/facades/builders/sprite.rb +0 -50
- data/lib/facades/builders/table.rb +0 -76
- data/lib/facades/debug/html.rb +0 -6
- data/lib/facades/helpers/builders.rb +0 -24
- data/lib/facades/helpers/mobile.rb +0 -57
- data/lib/facades/helpers/pagination.rb +0 -83
- data/lib/facades/helpers/utility.rb +0 -31
- data/lib/facades/sass_ext/form_elements.rb +0 -52
- data/lib/facades/sass_ext/funcs.rb +0 -33
- data/lib/facades/sass_ext.rb +0 -14
- data/lib/facades/stylesheets/facades/_common.scss +0 -7
- data/lib/facades/stylesheets/facades/_css3.scss +0 -93
- data/lib/facades/stylesheets/facades/_layout.scss +0 -5
- data/lib/facades/stylesheets/facades/_normalize.scss +0 -5
- data/lib/facades/stylesheets/facades/_setup.scss +0 -104
- data/lib/facades/stylesheets/facades/_typography.scss +0 -2
- data/lib/facades/stylesheets/facades/_ui.scss +0 -3
- data/lib/facades/stylesheets/facades/_utilities.scss +0 -32
- data/lib/facades/stylesheets/facades/layout/_dropdown-list.scss +0 -7
- data/lib/facades/stylesheets/facades/layout/_forms.scss +0 -53
- data/lib/facades/stylesheets/facades/layout/_grid.scss +0 -49
- data/lib/facades/stylesheets/facades/layout/_responsive_grid.scss +0 -164
- data/lib/facades/stylesheets/facades/setup/_forms.scss +0 -284
- data/lib/facades/stylesheets/facades/setup/_ie.scss +0 -12
- data/lib/facades/stylesheets/facades/setup/_reset.scss +0 -255
- data/lib/facades/stylesheets/facades/typography/_baseline.scss +0 -91
- data/lib/facades/stylesheets/facades/typography/_lists.scss +0 -34
- data/lib/facades/stylesheets/facades/typography/_shadow.scss +0 -8
- data/lib/facades/stylesheets/facades/ui/_buttons.scss +0 -34
- data/lib/facades/stylesheets/facades/ui/_flash-messages.scss +0 -29
- data/lib/facades/stylesheets/facades/ui/_tabbed.scss +0 -5
- data/lib/facades/stylesheets/facades/ui/_tool-tip.scss +0 -44
- data/lib/facades/stylesheets/facades/utilities/_clearfix.scss +0 -20
- data/lib/facades/stylesheets/facades/utilities/_color.scss +0 -7
- data/lib/facades/stylesheets/facades/utilities/_cursors.scss +0 -4
- data/lib/facades/support/serve.rb +0 -17
- data/lib/facades/support/tipsy.rb +0 -17
- data/spec/facades/helpers/elements_spec.rb +0 -86
- data/spec/facades/helpers/layout_helpers_spec.rb +0 -5
- data/spec/facades/helpers/navigation_spec.rb +0 -107
data/.gitignore
CHANGED
data/.rbenv-gemsets
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
global
|
data/.rvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rvm use 1.9.3@facades --create
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
source "http://rubygems.org"
|
|
2
2
|
|
|
3
|
+
group :development do
|
|
4
|
+
gem 'combustion', '~> 0.3.1'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
group :test do
|
|
8
|
+
gem 'guard-coffeescript'
|
|
9
|
+
gem 'rake'
|
|
10
|
+
gem 'growl'
|
|
11
|
+
gem 'guard', '0.8.8'
|
|
12
|
+
gem "guard-rspec"
|
|
13
|
+
end
|
|
14
|
+
|
|
3
15
|
# Specify your gem's dependencies in facades.gemspec
|
|
4
16
|
gemspec
|
data/Guardfile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# A sample Guardfile
|
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
|
3
|
+
require 'growl'
|
|
4
|
+
|
|
5
|
+
guard 'rspec', {
|
|
6
|
+
cli: '--colour --format documentation --fail-fast',
|
|
7
|
+
version: 2,
|
|
8
|
+
all_after_pass: false,
|
|
9
|
+
all_on_start: false,
|
|
10
|
+
notify: true } do
|
|
11
|
+
|
|
12
|
+
watch(%r{^spec/.+_spec\.rb$})
|
|
13
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
|
14
|
+
watch('spec/spec_helper.rb') { "spec" }
|
|
15
|
+
watch(%r{/lib/facades/helpers/(.+)\.rb$}) { |m| "spec/unit/helpers/#{m[1]}_spec.rb" }
|
|
16
|
+
watch(%r{/lib/facades/patterns/(.+)\.rb$}) { |m| "spec/unit/patterns/#{m[1]}_spec.rb" }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
guard 'coffeescript', :input => 'src/javascript', :output => 'app/assets/javascripts/', :all_on_start => true
|
data/README.md
CHANGED
|
@@ -1,83 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
Facades
|
|
1
|
+
==================================================================================================================
|
|
2
|
+
Facades
|
|
3
|
+
==================================================================================================================
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
Facades is a framework, written in SASS (.scss) designed to assist with front-end development rapid prototyping. It includes a number of base classes, patterns and mixins,
|
|
6
|
+
focused on semantic html, and styled around a consistent vertical rhythm.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
**Another one? Come on**
|
|
9
|
+
Theres tons of css / rapid dev frameworks around, and some pretty awesome ones including [Twitter's Bootstrap](http://bootstrap.io) and [foundation](http://foundation.zurb.com). We took inspiration from
|
|
10
|
+
each of these to create a more standards based solution writtenfor HTML5 and designed around a clean baseline rhythm.
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
**Why not just use one of the existing frameworks then?**
|
|
13
|
+
We wanted something that was more standards friendly where at all possible, and felt as though a lot of what was out there missed the mark. We've
|
|
14
|
+
utilized the concepts that worked, and scrapped a few that didn't. Keeping a clean vertical rhythm was also important, which
|
|
15
|
+
wasn't available with anything existing at the time.
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@import 'facades/reset'; // Will automatically setup the vertical rhythm
|
|
17
|
+
Facades also utilizes the fantastic [Compass](https://github.com/chriseppstein/compass) library to add additional function and flexiblity.
|
|
18
|
+
This helps increase the functionality and reliability of the framework as a whole.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
Most of the patterns included here are written using sass mixins, with configuration options for fonts, sizes, and colors.
|
|
21
|
+
For instance, the notifications pattern (alerts/flash messages) is implemented as a mixin, allowing the developer to decide their own node and class
|
|
22
|
+
scheme to use. This makes facades easier to implement in existing projects, without having to change existing classes or html format.
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
$grid-width: 960px; // Full width of the container
|
|
25
|
-
$grid-columns: 24; // Total number of columns
|
|
26
|
-
$grid-gutter-width: 10px; // Spacing between each column
|
|
27
|
-
|
|
28
|
-
@import 'facades/layout/grid'; /( or include 'facades/layout')
|
|
29
|
-
#wrapper{ @include container; }
|
|
24
|
+
When implementing patterns color schemes are provided as an option, for those instances where you'd prefer your own class names and design.
|
|
30
25
|
|
|
31
|
-
|
|
26
|
+
For those who just want to import and go, theres also a `_globals.scss` which creates all of the defaults, with classes and all. To utilize, import it into your main css file.
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
``` scss
|
|
29
|
+
@import 'facades/global';
|
|
30
|
+
```
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
Text
|
|
66
|
-
----------------------
|
|
67
|
-
leading (shortcut to Compass adjust-leading-to)
|
|
68
|
-
font-size (shortcut to Compass adjust-font-size-to)
|
|
69
|
-
inset-text (text-shadow text insetting)
|
|
70
|
-
|
|
71
|
-
Utility
|
|
72
|
-
----------------------
|
|
73
|
-
position (shorthand position relative/fixed/absolute)
|
|
74
|
-
luminance ( return a colors lightness in terms of 'light' or 'dark' )
|
|
75
|
-
tint (tint a color with white)
|
|
76
|
-
shade (darken a color with black)
|
|
77
|
-
|
|
78
|
-
##Helpers
|
|
32
|
+
If you'd like to configure any particular variables such as sizes or line heights, do so before importing the global file.
|
|
33
|
+
|
|
34
|
+
Reset and Configuration
|
|
35
|
+
------------------------------
|
|
36
|
+
|
|
37
|
+
Facades implements the awesome [HTML5 Boilerplate](https://github.com/h5bp/html5-boilerplate) reset/normalize stylesheet to establish a
|
|
38
|
+
grounds for which to expand upon. Common colors, sizes and line-heights are fully configurable using the variables found in `_config.scss`.
|
|
39
|
+
The more common options you probably want to configure are:
|
|
40
|
+
|
|
41
|
+
`$font-color`: The body/default font color.
|
|
42
|
+
|
|
43
|
+
`$font-size`: The base font size, also used when calculating vertical rhythm
|
|
44
|
+
|
|
45
|
+
`$line-height`: The base line-height, combined with `$font-size` establishes a baseline and sets up the vertical-rhythm
|
|
46
|
+
|
|
47
|
+
`$font-family`: The base font-family
|
|
48
|
+
|
|
49
|
+
`$notice-color`: The color used for .notice alerts labels, blue by default
|
|
50
|
+
|
|
51
|
+
`$success-color`: The color used for .success labels and alerts, green by default
|
|
52
|
+
|
|
53
|
+
`$error-color`: The color used for :invalid fields, .error labels and alerts, red by default
|
|
54
|
+
|
|
55
|
+
`$warning-color`: The color used for .warning labels and alerts, yellow by default
|
|
56
|
+
|
|
57
|
+
`$input-border-color`: The default color used for form elements, grey by default.
|
|
58
|
+
|
|
59
|
+
`$input-focus-color`: The font color used when an input is focused, defaults to `$font-color`
|
|
60
|
+
|
|
61
|
+
`$input-focus-border-color`: The border color used for inputs when in a :focus state. Defaults to `$notice-color`
|
|
79
62
|
|
|
80
|
-
|
|
63
|
+
`$input-error-color`: The font color used for inputs in an :invalid or .error state. Defaults to red.
|
|
64
|
+
|
|
65
|
+
`$input-error-border-color`: The border color used for inputs in an :invalid or .error state. Defaults to `$error-color`.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
Layout Helpers
|
|
69
|
+
------------------------------
|
|
81
70
|
|
|
82
71
|
**Variables**
|
|
83
72
|
Setup variables via templates to be used within your layout.
|
|
@@ -90,7 +79,7 @@ Setup variables via templates to be used within your layout.
|
|
|
90
79
|
To assign variables, pass their value to the method. To display, use the method without any arguments
|
|
91
80
|
|
|
92
81
|
# index.html.erb
|
|
93
|
-
|
|
82
|
+
<% page_id('home') %>
|
|
94
83
|
|
|
95
84
|
# In your layout
|
|
96
85
|
body id="<%= page_id %>"
|
|
@@ -109,53 +98,78 @@ To assign variables, pass their value to the method. To display, use the method
|
|
|
109
98
|
# In production
|
|
110
99
|
<%= robot_meta_tag %> #=> <meta name="robots" content="index, follow" />
|
|
111
100
|
|
|
112
|
-
`
|
|
101
|
+
`browser_name` Returns the name of the user's browser (ie webkit, mozilla, ie8, ie9, etc)
|
|
113
102
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
###Pagination Helper
|
|
117
|
-
|
|
118
|
-
Any model which responds to current_page and total_pages can utilize the pagination helper.
|
|
103
|
+
Navigation Helpers
|
|
104
|
+
------------------------------
|
|
119
105
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
Will render a link based list with the current collection pagination. If `Facades.enable_html5` is set to `true` items will be wrapped in a HTMl5 `<nav>` tag, otherwise a div will be used. The class 'pagination' is added to that top level element.
|
|
123
|
-
By default the included partial facades/pagination is rendered. To customize output simply override this in your application. See app/views/facades/_pagination.html.erb for more info.
|
|
106
|
+
Facades provides a navigation helper for creating nested navigation lists. Syntax is similar to other Rails helpers such as `form_for`
|
|
124
107
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<%= nav do %>
|
|
130
|
-
<%= nav_link 'About Me', about_path %>
|
|
131
|
-
<%= nav_link 'Top Level', some_path do %>
|
|
132
|
-
<%= nav_link 'Sub Item', some_sub_path %>
|
|
108
|
+
<%= nav do |n| %>
|
|
109
|
+
<%= n.link 'About Me', about_path %>
|
|
110
|
+
<%= n.link 'Top Level', some_path do |s| %>
|
|
111
|
+
<%= s.link 'Sub Item', some_sub_path %>
|
|
133
112
|
<% end %>
|
|
134
113
|
<% end %>
|
|
135
114
|
|
|
136
115
|
Will output
|
|
137
116
|
|
|
138
117
|
<nav>
|
|
139
|
-
<
|
|
118
|
+
<ul>
|
|
140
119
|
<li><a href='/about-path'>About Me</a></li>
|
|
141
120
|
<li><a href='/some-path'>Top Level</a>
|
|
142
|
-
<
|
|
121
|
+
<ul>
|
|
143
122
|
<li><a href="/some-sub-path">Sub Item</a></li>
|
|
144
|
-
</
|
|
123
|
+
</ul>
|
|
145
124
|
</li>
|
|
146
|
-
</
|
|
125
|
+
</ul>
|
|
147
126
|
</nav>
|
|
148
127
|
|
|
149
128
|
Note: The `<nav>` tag is only included if `Facades.enable_html5` is set to true.
|
|
150
|
-
|
|
151
|
-
As a convenience, the class `
|
|
152
|
-
When using a proc/lambda, returning true will set the `
|
|
129
|
+
|
|
130
|
+
As a convenience, the class `active` will be added to a link when the current url matches that link. This can be overridden by using one of three ways:
|
|
131
|
+
1. Assigning a `:proc` attribute. When using a proc/lambda, returning true will set the `active` class.
|
|
153
132
|
|
|
154
133
|
# Current path /home
|
|
155
|
-
<%=
|
|
156
|
-
|
|
157
|
-
When using `:matcher`, pass a string or regular expression in which the request.path should match to be `on`.
|
|
134
|
+
<%= n.link 'Path', some_path, proc: lambda{ |current_path| true } %> #=> <a href='/anything' class='active'>Path</a>
|
|
158
135
|
|
|
159
|
-
|
|
160
|
-
|
|
136
|
+
2. Passing a `:match` attribute as one of `:exact`, `:after`, or `:before` will match all urls based on that formula. `:exact` matches only the exact
|
|
137
|
+
url defined in the link's href attribute. `:before` matches any path matching a "parent" url, while `:after` matches any url starting with the specified path.
|
|
138
|
+
The latter is useful for when you'd like to match sub-pages or paths in nested navigations.
|
|
139
|
+
|
|
140
|
+
3. Assigning a `:matcher` attribute, containing a regular expression in which the request.path should match to be `active`.
|
|
161
141
|
|
|
142
|
+
<%= n.link 'Path', '/something-else', matcher: /something/ %> #=> <a href='/something-else' class='active'>Path</a>
|
|
143
|
+
|
|
144
|
+
In addition to the `nav` helper, a `nav_link` helper is also provided, for use when creating single links, which should also track 'active' state.
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
Contributing
|
|
148
|
+
------------------------------
|
|
149
|
+
|
|
150
|
+
Fork and create. When coding styles or ruby libs, adhere to a 2 space indention. Patterns should be written as mixins, with a
|
|
151
|
+
default class construction in `_global.scss`. Colors should be configurable, either by using one of the colors included in `_config.scss`
|
|
152
|
+
(preferred) or by 'namespaced' variable (ie: $patternname-border-color).
|
|
153
|
+
|
|
154
|
+
Pre-built classes / styles should be as lightweight as possible and avoid css hacks. We encourage support of Paul Irish's class conventions
|
|
155
|
+
found [here](http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/). CSS overrides for IE should utilize this technique.
|
|
156
|
+
Styles should confirm to a vertical-rhythm as much as possible (some things seem to always be off a hair in IE (who would have thought)).
|
|
157
|
+
|
|
158
|
+
Document patterns with html examples, which should utilize HTML5 elements, in an intended/semantic manner.
|
|
159
|
+
|
|
160
|
+
Thanks
|
|
161
|
+
------------------------------
|
|
162
|
+
|
|
163
|
+
Thanks to the fine folks who work on the HTML5 Boilerplate, the Compass library and contributors, and the hundreds of
|
|
164
|
+
random people who've blogged the tons and tons of google search results we've read in creating this library.
|
|
165
|
+
|
|
166
|
+
License
|
|
167
|
+
------------------------------
|
|
168
|
+
|
|
169
|
+
Copyright 2012 kurb media llc.
|
|
170
|
+
MIT/GPL ( do whatever you want, but check the licenses below )
|
|
171
|
+
|
|
172
|
+
**Components:**
|
|
173
|
+
|
|
174
|
+
Compass: MIT (modified)
|
|
175
|
+
HTML5 Boilerplate reset.css: Public Domain
|
data/Rakefile
CHANGED
|
File without changes
|
data/config.ru
ADDED
data/facades.gemspec
CHANGED
|
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
|
|
8
8
|
s.authors = ["Brent Kirby"]
|
|
9
9
|
s.email = ["brent@kurbmedia.com"]
|
|
10
10
|
s.homepage = "https://github.com/kurbmedia/facades"
|
|
11
|
-
s.summary = %q{Front-end development awesome-ness}
|
|
12
|
-
s.description = %q{Facades is a front-end
|
|
11
|
+
s.summary = %q{Front-end development awesome-ness with Compass and Sass.}
|
|
12
|
+
s.description = %q{Facades is a collection of front-end patterns and libraries designed to speed up development of web sites and applications.}
|
|
13
13
|
|
|
14
14
|
s.rubyforge_project = "facades"
|
|
15
15
|
|
|
@@ -19,5 +19,12 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.require_paths = ["lib"]
|
|
20
20
|
|
|
21
21
|
s.add_dependency('sass', ['~> 3.1'])
|
|
22
|
+
s.add_dependency('compass', ['>= 0.11.7'])
|
|
23
|
+
|
|
24
|
+
s.add_development_dependency('combustion', '~> 0.3.1')
|
|
25
|
+
s.add_development_dependency("rspec", ">= 2.7.0")
|
|
26
|
+
s.add_development_dependency("sass-rails", "~> 3.1")
|
|
27
|
+
s.add_development_dependency("webrat", "~> 0.7")
|
|
28
|
+
s.add_development_dependency("rspec-rails", ">= 2.11.0")
|
|
22
29
|
|
|
23
30
|
end
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
module Facades
|
|
2
2
|
module Helpers
|
|
3
3
|
##
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
4
|
+
# Convenience helpers generally used in layout files
|
|
5
|
+
#
|
|
7
6
|
module Layout
|
|
8
|
-
|
|
9
7
|
##
|
|
10
8
|
# Returns a short-hand string identifying the current browser
|
|
11
9
|
#
|
|
@@ -28,37 +26,28 @@ module Facades
|
|
|
28
26
|
# @param [String] content The content to be used in the meta tag
|
|
29
27
|
# @return [String] A html meta tag with the name and content attributes set
|
|
30
28
|
#
|
|
31
|
-
def meta_tag(name, content
|
|
32
|
-
|
|
33
|
-
content = tag(:meta, :name => name, :content => content)
|
|
34
|
-
_create_variable(:"__#{name}", content, false)
|
|
35
|
-
content
|
|
29
|
+
def meta_tag(name, content)
|
|
30
|
+
tag(:meta, :name => name, :content => content)
|
|
36
31
|
end
|
|
37
|
-
|
|
32
|
+
|
|
38
33
|
##
|
|
39
34
|
# Create a script tag for activating google analytics
|
|
40
35
|
# @param [String] site_id The site ID provided by google analytics
|
|
41
36
|
# @return [String] script tag
|
|
42
37
|
#
|
|
43
38
|
def google_analytics(site_id, &block)
|
|
44
|
-
return "" if defined?(Rails) && Rails.env != "production"
|
|
45
|
-
additional = capture(&block) if block_given?
|
|
46
|
-
additional ||= ""
|
|
39
|
+
return "" if defined?(Rails) && Rails.env != "production"
|
|
47
40
|
content_tag(:script) do
|
|
48
41
|
%Q{
|
|
49
|
-
var _gaq
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
(
|
|
54
|
-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
55
|
-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
56
|
-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
57
|
-
})();
|
|
42
|
+
var _gaq=[['_setAccount','#{site_id}'],['_trackPageview']];
|
|
43
|
+
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
|
44
|
+
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
|
|
45
|
+
s.parentNode.insertBefore(g,s)}(document,'script'));
|
|
46
|
+
#{(block_given? ? capture(&block) : "")}
|
|
58
47
|
}
|
|
59
48
|
end.html_safe
|
|
60
49
|
end
|
|
61
|
-
|
|
50
|
+
|
|
62
51
|
##
|
|
63
52
|
#
|
|
64
53
|
# Creates a page id to be used for identifying a page for CSS/design purposes. If a variable
|
|
@@ -77,21 +66,13 @@ module Facades
|
|
|
77
66
|
#
|
|
78
67
|
#
|
|
79
68
|
def page_id(content = nil)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
result = if defined?(controller)
|
|
83
|
-
cname = controller.class.to_s.gsub(/controller$/i,'').underscore.split("/").join('_')
|
|
84
|
-
aname = controller.action_name
|
|
85
|
-
"#{cname}_#{aname}"
|
|
86
|
-
elsif defined?(request) && request.respond_to?(:path_info)
|
|
87
|
-
::File.basename(request.path_info).to_s
|
|
88
|
-
end
|
|
89
|
-
result
|
|
69
|
+
return (@view_flow.get(:page_id) || default_page_title_for_view) unless content
|
|
70
|
+
provide(:page_id, content) if content
|
|
90
71
|
end
|
|
91
72
|
|
|
92
73
|
##
|
|
93
74
|
#
|
|
94
|
-
#
|
|
75
|
+
# Convenience method to create a page title for the <title></title> tag.
|
|
95
76
|
#
|
|
96
77
|
# @param [String] content The text for the page title
|
|
97
78
|
# @return [String] The provided content
|
|
@@ -102,29 +83,11 @@ module Facades
|
|
|
102
83
|
# <title><%= page_title %></title> #=> <title>This is my page title</title>
|
|
103
84
|
#
|
|
104
85
|
def page_title(content = nil)
|
|
105
|
-
|
|
106
|
-
return
|
|
107
|
-
|
|
86
|
+
provide(:page_title, content) and return if content
|
|
87
|
+
return @view_flow.get(:page_title) unless content
|
|
88
|
+
""
|
|
108
89
|
end
|
|
109
|
-
|
|
110
|
-
##
|
|
111
|
-
#
|
|
112
|
-
# Convenience method for content_for allowing for single-line variable creation. Also defines a method that can be
|
|
113
|
-
# re-used within a template.
|
|
114
|
-
#
|
|
115
|
-
# @param [Symbol] var_name The name of the variable to create
|
|
116
|
-
# @param [String] content The content that variable defines
|
|
117
|
-
# @return [String] An empty string. Use the newly created method from +var_name+ to return the value
|
|
118
|
-
#
|
|
119
|
-
# @example Setting a "page_class" variable
|
|
120
|
-
# <% set_var(:page_class, 'cool') %>
|
|
121
|
-
# <%= page_class %> #=> 'cool'
|
|
122
|
-
#
|
|
123
|
-
#
|
|
124
|
-
def set_var(var_name, content)
|
|
125
|
-
_create_variable("#{var_name}", content) and return ''
|
|
126
|
-
end
|
|
127
|
-
|
|
90
|
+
|
|
128
91
|
##
|
|
129
92
|
#
|
|
130
93
|
# Configures a "robots" meta tag based on the rails environment. In environments other than 'production'
|
|
@@ -136,26 +99,26 @@ module Facades
|
|
|
136
99
|
def robot_meta_tag
|
|
137
100
|
tag(:meta, :name => 'robots', :content => (Rails.env.eql?('production') ? 'index, follow' : 'noindex, nofollow'))
|
|
138
101
|
end
|
|
102
|
+
|
|
139
103
|
|
|
140
104
|
private
|
|
141
105
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
106
|
+
##
|
|
107
|
+
# Constructs a default page title from the current
|
|
108
|
+
# controller and action
|
|
109
|
+
#
|
|
110
|
+
def default_page_title_for_view
|
|
111
|
+
if defined?(controller)
|
|
112
|
+
cname = controller.class.to_s.gsub(/controller$/i,'').underscore.split("/").join('_')
|
|
113
|
+
aname = controller.action_name
|
|
114
|
+
"#{cname}_#{aname}"
|
|
115
|
+
elsif defined?(request) && request.respond_to?(:path_info)
|
|
116
|
+
::File.basename(request.path_info).to_s
|
|
117
|
+
end
|
|
118
|
+
""
|
|
155
119
|
end
|
|
156
120
|
|
|
157
|
-
end
|
|
158
|
-
|
|
121
|
+
end # Layout
|
|
159
122
|
|
|
160
|
-
end
|
|
161
|
-
end
|
|
123
|
+
end # Helpers
|
|
124
|
+
end # Facades
|