codelation_ui 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +327 -0
- data/Rakefile +8 -0
- data/app/assets/javascripts/codelation_ui/_base_resources/app.js +91 -0
- data/app/assets/javascripts/codelation_ui/_base_resources/components/has_grid.js +24 -0
- data/app/assets/javascripts/codelation_ui/_base_resources/components/link.js +22 -0
- data/app/assets/javascripts/codelation_ui/_base_resources/progress_bar.js +5 -0
- data/app/assets/javascripts/codelation_ui/base.js +8 -0
- data/app/assets/javascripts/codelation_ui/extended/slider.js +654 -0
- data/app/assets/javascripts/codelation_ui/extended.js +1 -0
- data/app/assets/javascripts/codelation_ui/forms/components/input.js +497 -0
- data/app/assets/javascripts/codelation_ui/forms/index.js +2 -0
- data/app/assets/javascripts/codelation_ui/forms/interfaces/form.js +71 -0
- data/app/assets/javascripts/codelation_ui/forms/interfaces/form_validation.js +31 -0
- data/app/assets/javascripts/codelation_ui/forms.js +2 -0
- data/app/assets/javascripts/codelation_ui/std/index.js +2 -0
- data/app/assets/javascripts/codelation_ui/std/interfaces/content_formatters.js +27 -0
- data/app/assets/javascripts/codelation_ui/std/interfaces/content_validators.js +50 -0
- data/app/assets/javascripts/codelation_ui/std/interfaces/helpers.js +10 -0
- data/app/assets/javascripts/codelation_ui/std.js +1 -0
- data/app/assets/javascripts/codelation_ui/vue.js +12 -0
- data/app/assets/javascripts/codelation_ui/vue_pages.js +11 -0
- data/app/assets/javascripts/codelation_ui.js +6 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/_normalize.scss +427 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/_bourbon-deprecated-upcoming.scss +411 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/_bourbon.scss +87 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_border-color.scss +26 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_border-radius.scss +48 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_border-style.scss +25 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_border-width.scss +25 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_buttons.scss +64 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_clearfix.scss +25 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_ellipsis.scss +30 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_font-stacks.scss +31 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_hide-text.scss +27 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_margin.scss +26 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_padding.scss +26 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_position.scss +48 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_prefixer.scss +66 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_retina-image.scss +25 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_size.scss +51 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_text-inputs.scss +113 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_timing-functions.scss +34 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_triangle.scss +63 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/addons/_word-wrap.scss +29 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_animation.scss +43 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_appearance.scss +3 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_backface-visibility.scss +3 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_background-image.scss +42 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_background.scss +55 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_border-image.scss +59 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_calc.scss +4 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_columns.scss +47 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_filter.scss +4 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_flex-box.scss +287 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_font-face.scss +24 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_font-feature-settings.scss +4 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_hidpi-media-query.scss +10 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_hyphens.scss +4 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_image-rendering.scss +14 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_keyframes.scss +36 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_linear-gradient.scss +38 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_perspective.scss +8 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_placeholder.scss +8 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_radial-gradient.scss +39 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_selection.scss +42 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_text-decoration.scss +19 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_transform.scss +15 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_transition.scss +71 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/css3/_user-select.scss +3 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_assign-inputs.scss +11 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_contains-falsy.scss +20 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_contains.scss +26 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_is-length.scss +11 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_is-light.scss +21 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_is-number.scss +11 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_is-size.scss +13 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_modular-scale.scss +69 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_px-to-em.scss +13 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_px-to-rem.scss +15 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_shade.scss +24 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_strip-units.scss +17 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_tint.scss +24 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_transition-property-name.scss +22 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/functions/_unpack.scss +27 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_convert-units.scss +21 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_directional-values.scss +96 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_font-source-declaration.scss +43 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_gradient-positions-parser.scss +13 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_linear-angle-parser.scss +25 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_linear-gradient-parser.scss +41 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_linear-positions-parser.scss +61 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_linear-side-corner-parser.scss +31 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_radial-arg-parser.scss +69 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_radial-gradient-parser.scss +50 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_radial-positions-parser.scss +18 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_render-gradients.scss +26 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_shape-size-stripper.scss +10 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/helpers/_str-to-num.scss +50 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/settings/_asset-pipeline.scss +7 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/settings/_prefixer.scss +9 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/bourbon/settings/_px-to-em.scss +1 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/functions/color.scss +162 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/functions/text_color.scss +41 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/mixins/button.scss +47 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/mixins/center_children.scss +9 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/mixins/col_span.scss +16 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/mixins/has_cards.scss +43 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/mixins/has_columns.scss +66 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/mixins/has_grid.scss +80 -0
- data/app/assets/stylesheets/codelation_ui/_base_resources/mixins/outer_container.scss +10 -0
- data/app/assets/stylesheets/codelation_ui/base.scss +27 -0
- data/app/assets/stylesheets/codelation_ui/extended/slider.scss +222 -0
- data/app/assets/stylesheets/codelation_ui/extended.scss +1 -0
- data/app/assets/stylesheets/codelation_ui/forms/input.scss +72 -0
- data/app/assets/stylesheets/codelation_ui/forms.scss +1 -0
- data/app/assets/stylesheets/codelation_ui/std.scss +1 -0
- data/app/assets/stylesheets/codelation_ui.scss +4 -0
- data/lib/codelation_ui.rb +7 -0
- data/vendor/assets/javascripts/autonumeric/autoNumeric-1.9.39.js +1465 -0
- data/vendor/assets/javascripts/autonumeric/autonumeric_ujs.js +94 -0
- data/vendor/assets/javascripts/autonumeric.js +2 -0
- data/vendor/assets/javascripts/awesomplete.js +392 -0
- data/vendor/assets/javascripts/moment.js +4301 -0
- data/vendor/assets/javascripts/numeral.js +679 -0
- data/vendor/assets/javascripts/pikaday.js +1081 -0
- data/vendor/assets/javascripts/summernote.js +7300 -0
- data/vendor/assets/javascripts/vue.js +10237 -0
- metadata +242 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f97606cf9ffd98f399e9719284f2c72f6fee0ea5
|
4
|
+
data.tar.gz: ae329ffe089132a60b234039846fb573953ae3b1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e05fa15e019fbe9fe30df4ab6c73918a1b3b1d3fa2585e8e49d7761bfae6b4fc03bf053cca639e8cad50a3e69056f9021d9541bccf050098d1aa97538db1d62
|
7
|
+
data.tar.gz: fbc4f9fae6050f8767d9bc555bd720d8e946535d81ee585d3aeefb6d4e7ed53cbb180414a34ff5b80a374ac25369961d260ed9b0b1f610071d86e77fed313d86
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 Jake Humphrey
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,327 @@
|
|
1
|
+
# Codelation Assets
|
2
|
+
|
3
|
+
A collection of SCSS mixins and JavaScript helpers used by
|
4
|
+
[Codelation](https://codelation.com) for building awesome Rails apps quickly.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem "codelation_assets"
|
12
|
+
```
|
13
|
+
|
14
|
+
Install the Codelation Assets gem with Bundler:
|
15
|
+
|
16
|
+
```bash
|
17
|
+
bundle install
|
18
|
+
```
|
19
|
+
|
20
|
+
## JavaScript
|
21
|
+
|
22
|
+
Add to `application.js`:
|
23
|
+
|
24
|
+
```javascript
|
25
|
+
//= require codelation
|
26
|
+
```
|
27
|
+
|
28
|
+
### App Functions
|
29
|
+
|
30
|
+
The `App` object is used in Codelation's Rails projects to register components that
|
31
|
+
need to be initialized on every page and to sprinkle in JavaScript on specific pages.
|
32
|
+
|
33
|
+
#### Registering JavaScript Components
|
34
|
+
|
35
|
+
By using `App.register('component')`, you can fire some JavaScript on every page load.
|
36
|
+
|
37
|
+
The function passed to `enter` will fire for `$(document).on('ready page:load')`, so
|
38
|
+
it will work with or without Turbolinks.
|
39
|
+
|
40
|
+
The function passed to `exit` will fire for `$(document).on('page:before-unload')`,
|
41
|
+
so it will only work with Turbolinks, but will not be needed when not using Turbolinks.
|
42
|
+
|
43
|
+
Example:
|
44
|
+
|
45
|
+
```javascript
|
46
|
+
(function() {
|
47
|
+
"use strict"
|
48
|
+
|
49
|
+
var body, links;
|
50
|
+
|
51
|
+
App.register('component').enter(function() {
|
52
|
+
body = $('body');
|
53
|
+
links = $('a[href]:not([href^="#"]):not([target="_blank"])');
|
54
|
+
|
55
|
+
// Add 'loading' class to the body when a link is clicked,
|
56
|
+
// add add 'active' class to the clicked link.
|
57
|
+
links.click(function() {
|
58
|
+
links.removeClass('active');
|
59
|
+
body.addClass('loading');
|
60
|
+
$(this).addClass('active');
|
61
|
+
});
|
62
|
+
}).exit(function() {
|
63
|
+
// Remove the classes when the body is unloaded
|
64
|
+
body.removeClass('loading');
|
65
|
+
links.removeClass('active');
|
66
|
+
});
|
67
|
+
})();
|
68
|
+
```
|
69
|
+
|
70
|
+
#### Registering Per Page JavaScript Snippets
|
71
|
+
|
72
|
+
You can use `App.register('[controller-name].[action-name]')` to fire some JavaScript any time
|
73
|
+
that page is loaded and unloaded. The `enter` and `exit` functions work the same as components.
|
74
|
+
|
75
|
+
This assumes you are using a helper to set the body class to include the dasherized controller
|
76
|
+
name and dasherized action.
|
77
|
+
|
78
|
+
Example:
|
79
|
+
|
80
|
+
```javascript
|
81
|
+
(function() {
|
82
|
+
"use strict"
|
83
|
+
|
84
|
+
var refreshInterval;
|
85
|
+
|
86
|
+
// This will only fire when entering and exiting the `AwesomeStatsController#index` page.
|
87
|
+
App.register('awesome-stats.index').enter(function() {
|
88
|
+
// Poll a URL for new data at a set interval
|
89
|
+
refreshInterval = setInterval(pollStats, 5000);
|
90
|
+
}).exit(function() {
|
91
|
+
// Clear the interval when the page is unloaded
|
92
|
+
clearInterval(refreshInterval);
|
93
|
+
});
|
94
|
+
})();
|
95
|
+
```
|
96
|
+
|
97
|
+
You can also use `App.register('[controller-name]')` to fire JavaScript on all pages
|
98
|
+
for the given controller name.
|
99
|
+
|
100
|
+
## Sass
|
101
|
+
|
102
|
+
Add to `application.scss`:
|
103
|
+
|
104
|
+
```scss
|
105
|
+
@import "codelation";
|
106
|
+
```
|
107
|
+
|
108
|
+
### Included Sass/CSS Libraries
|
109
|
+
|
110
|
+
- [Bourbon](http://bourbon.io) - A simple and lightweight mixin library for Sass.
|
111
|
+
- [Normalize.css](https://necolas.github.io/normalize.css/) - A modern, HTML5-ready alternative to CSS resets
|
112
|
+
|
113
|
+
### Additional Functions and Mixins
|
114
|
+
|
115
|
+
A handful of useful Sass functions and mixins written by Codelation are also included.
|
116
|
+
|
117
|
+
#### Sass Functions
|
118
|
+
|
119
|
+
##### color($color, $number: 500)
|
120
|
+
|
121
|
+
The [Google Material Design Colors](https://www.google.com/design/spec/style/color.html) come in handy when you
|
122
|
+
need a color for creating application interfaces. They are a much better alternative to CSS's named colors
|
123
|
+
(blue, green, red, etc.), but just as easy to use.
|
124
|
+
|
125
|
+
Examples:
|
126
|
+
|
127
|
+
```scss
|
128
|
+
// The named colors are available as variables of the same name
|
129
|
+
.warning {
|
130
|
+
color: $amber;
|
131
|
+
}
|
132
|
+
|
133
|
+
// You can also use the different shades available
|
134
|
+
.error {
|
135
|
+
color: color($red, 700);
|
136
|
+
}
|
137
|
+
|
138
|
+
// @see https://www.google.com/design/spec/style/color.html
|
139
|
+
.success {
|
140
|
+
color: color($green, 600);
|
141
|
+
}
|
142
|
+
```
|
143
|
+
|
144
|
+
##### text-color($color)
|
145
|
+
|
146
|
+
This function is useful for creating mixins where you have a background color as a variable
|
147
|
+
and need to display either black or white text on top of the given color.
|
148
|
+
|
149
|
+
#### Sass Mixins
|
150
|
+
|
151
|
+
##### button($background-color: color($grey, 100), $color: color($grey, 800), $active-background-color: $accent-color, $active-color: text-color($accent-color))
|
152
|
+
|
153
|
+
By default, `@include button;` will create a plain grey button. It looks a lot like the default button in some
|
154
|
+
browsers, but it will be rendered to look the same across all browsers. Useful for applications that need to
|
155
|
+
be obvious about a button looking like a button.
|
156
|
+
|
157
|
+
##### center-children
|
158
|
+
|
159
|
+
This mixin uses flexbox to center the child elements horizontally and vertically inside the element.
|
160
|
+
A good use case is centering an image of unknown height inside a container with a fixed height.
|
161
|
+
|
162
|
+
##### has-cards($columns, $margin: 0)
|
163
|
+
|
164
|
+
This mixin uses flexbox to create a cards layout like that used by Google Material Design. The
|
165
|
+
mixin is used on the container element. This will create a fixed margin between each card element
|
166
|
+
and adds padding around the outside of the cards. Useful for creating a dashboard widgets look.
|
167
|
+
|
168
|
+
Example:
|
169
|
+
|
170
|
+
**HTML**
|
171
|
+
|
172
|
+
```html
|
173
|
+
<div class="dashboard">
|
174
|
+
<div class="card"><div>
|
175
|
+
<div class="card"><div>
|
176
|
+
<div class="card"><div>
|
177
|
+
<div class="card"><div>
|
178
|
+
</div>
|
179
|
+
```
|
180
|
+
|
181
|
+
**SCSS**
|
182
|
+
|
183
|
+
```scss
|
184
|
+
// This will create a cards layout with two cards per row.
|
185
|
+
// There will be a fixed margin of 1em between and around the cards.
|
186
|
+
// The cards in each row will stretch to be the same height.
|
187
|
+
.dashboard {
|
188
|
+
@include has-cards(2, 1em);
|
189
|
+
background-color: #ccc;
|
190
|
+
|
191
|
+
.card {
|
192
|
+
background-color: #fff;
|
193
|
+
border-radius: 2px;
|
194
|
+
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
```
|
198
|
+
|
199
|
+
##### has-columns($columns: 0, $gutter: 0, $grow: true)
|
200
|
+
|
201
|
+
This mixin uses flexbox to create a layout with the specified number of columns that
|
202
|
+
stretch to fill the container's height. The given gutter size will the margin between
|
203
|
+
the columns. The container must be a single row of columns.
|
204
|
+
|
205
|
+
When the column count is given, the columns will all be the same width. If no column
|
206
|
+
count is given, the row will behave like a table row. The entire width will be used
|
207
|
+
and each column width will be determined by its content. `$grow` can be set to false
|
208
|
+
if you don't want the columns to take up the entire width of the container.
|
209
|
+
|
210
|
+
Example:
|
211
|
+
|
212
|
+
**HTML**
|
213
|
+
|
214
|
+
```html
|
215
|
+
<div class="row">
|
216
|
+
<div>Column 1<div>
|
217
|
+
<div>Column 2<div>
|
218
|
+
<div>Column 3<div>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<div class="table">
|
222
|
+
<div>Column 1</div>
|
223
|
+
<div>Column 2</div>
|
224
|
+
<div>Column 3</div>
|
225
|
+
<div>Column 4</div>
|
226
|
+
<div>Column 5</div>
|
227
|
+
</div>
|
228
|
+
```
|
229
|
+
|
230
|
+
**SCSS**
|
231
|
+
|
232
|
+
```scss
|
233
|
+
// This will create a row with three columns.
|
234
|
+
// The columns will all fill the container height.
|
235
|
+
// There will be a fixed gutter of 12px between the columns.
|
236
|
+
.row {
|
237
|
+
@include has-columns(3, 12px);
|
238
|
+
}
|
239
|
+
|
240
|
+
// This will create a row with five columns.
|
241
|
+
// The columns will all fill the container height and width.
|
242
|
+
// The width of each column will be determined by its content.
|
243
|
+
// There will be a fixed gutter of 10px between the columns.
|
244
|
+
.table {
|
245
|
+
@include has-columns($gutter: 10px);
|
246
|
+
}
|
247
|
+
```
|
248
|
+
|
249
|
+
###### col-span($columns of $container-columns, $gutter: 0)
|
250
|
+
|
251
|
+
When the `has-columns` mixin is used properly, you can create columns in a row that
|
252
|
+
span the width of multiple columns in another row. In order to use the `col-span`
|
253
|
+
mixin, you must use a percentage value or zero for your gutter width. There is no way
|
254
|
+
to have a fixed gutter width, flexible column widths, and match up with the columns
|
255
|
+
in another row.
|
256
|
+
|
257
|
+
Example:
|
258
|
+
|
259
|
+
**HTML**
|
260
|
+
|
261
|
+
```html
|
262
|
+
<div class="row">
|
263
|
+
<div>Column 1<div>
|
264
|
+
<div>Column 2<div>
|
265
|
+
<div>Column 3<div>
|
266
|
+
</div>
|
267
|
+
<div class="row">
|
268
|
+
<div class="wide-column">Column 4<div>
|
269
|
+
<div>Column 5<div>
|
270
|
+
</div>
|
271
|
+
```
|
272
|
+
|
273
|
+
**SCSS**
|
274
|
+
|
275
|
+
```scss
|
276
|
+
.row {
|
277
|
+
@include has-columns(3, 3%);
|
278
|
+
}
|
279
|
+
|
280
|
+
// Column 4 will span across two columns. Its left side will match up with
|
281
|
+
// column 1's left side, and its right side will match up with column 2's right
|
282
|
+
// side. Column 5's right margin will be set to 0 without any extra SCSS.
|
283
|
+
.wide-column {
|
284
|
+
@include col-span(2 of 3, 3%)
|
285
|
+
}
|
286
|
+
```
|
287
|
+
|
288
|
+
##### has-grid($columns, $gutter: 0)
|
289
|
+
|
290
|
+
This mixin uses flexbox to create a grid layout with an unknown number of child elements.
|
291
|
+
Each child element will have the same width and they will stretch to be the same height.
|
292
|
+
The gutter size is the width between each column and the height between each row. Unlike
|
293
|
+
the `has-cards` mixin, there will not be a margin around the child elements, only between.
|
294
|
+
This mixin is perfect for a product category page.
|
295
|
+
|
296
|
+
Example:
|
297
|
+
|
298
|
+
**HTML**
|
299
|
+
|
300
|
+
```html
|
301
|
+
<div class="products">
|
302
|
+
<div>Product 1<div>
|
303
|
+
<div>Product 2<div>
|
304
|
+
<div>Product 3<div>
|
305
|
+
<div>Product 4<div>
|
306
|
+
<div>Product 5<div>
|
307
|
+
</div>
|
308
|
+
```
|
309
|
+
|
310
|
+
**SCSS**
|
311
|
+
|
312
|
+
```scss
|
313
|
+
// Products 1 - 3 will be on the first row and there will be a margin of 1em between them.
|
314
|
+
// Products 4 & 5 will be on the second row and will match up with products 1 & 2.
|
315
|
+
// There will be a margin of 1em between the rows.
|
316
|
+
.products {
|
317
|
+
@include has-grid(3, 1em);
|
318
|
+
}
|
319
|
+
```
|
320
|
+
|
321
|
+
## Contributing
|
322
|
+
|
323
|
+
1. Fork it
|
324
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
325
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
326
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
327
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
(function() {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var app = window.App;
|
5
|
+
var bodyClass, bodyElement;
|
6
|
+
|
7
|
+
if (app === undefined) {
|
8
|
+
app = window.App = {};
|
9
|
+
}
|
10
|
+
|
11
|
+
app.enterFunctions = { component: [] };
|
12
|
+
app.exitFunctions = { component: [] };
|
13
|
+
|
14
|
+
// Register functions to run when any page or specific pages are loaded.
|
15
|
+
//
|
16
|
+
// Example for running code only when `pages#home` loads:
|
17
|
+
//
|
18
|
+
// App.register('pages.home').enter(function() {
|
19
|
+
// // Set up
|
20
|
+
// }).exit(function() {
|
21
|
+
// // Tear down (Might be needed for Turbolinks)
|
22
|
+
// });
|
23
|
+
//
|
24
|
+
// Example for running code on every page load:
|
25
|
+
//
|
26
|
+
// App.register('component').enter(function() {
|
27
|
+
// // Set up
|
28
|
+
// }).exit(function() {
|
29
|
+
// // Tear down (Might be needed for Turbolinks)
|
30
|
+
// });
|
31
|
+
app.register = function(mixed) {
|
32
|
+
return {
|
33
|
+
enter: function(callback) {
|
34
|
+
app.registerEnter(mixed, callback);
|
35
|
+
return this;
|
36
|
+
},
|
37
|
+
|
38
|
+
exit: function(callback) {
|
39
|
+
app.registerExit(mixed, callback);
|
40
|
+
return this;
|
41
|
+
}
|
42
|
+
};
|
43
|
+
};
|
44
|
+
|
45
|
+
app.registerEnter = function(key, callback) {
|
46
|
+
if (app.enterFunctions[key] === undefined) {
|
47
|
+
app.enterFunctions[key] = [];
|
48
|
+
}
|
49
|
+
app.enterFunctions[key].push(callback);
|
50
|
+
};
|
51
|
+
|
52
|
+
app.registerExit = function(key, callback) {
|
53
|
+
if (app.exitFunctions[key] === undefined) {
|
54
|
+
app.exitFunctions[key] = [];
|
55
|
+
}
|
56
|
+
app.exitFunctions[key].push(callback);
|
57
|
+
};
|
58
|
+
|
59
|
+
// Fires off any callbacks registered for enter, with or without Turbolinks.
|
60
|
+
$(document).on('ready page:load page:restore', function() {
|
61
|
+
bodyElement = $('body');
|
62
|
+
|
63
|
+
// Determine which functions should be fired
|
64
|
+
var fireFunctions = [];
|
65
|
+
$.each(app.enterFunctions, function(key, functions) {
|
66
|
+
bodyClass = key.split('.').join(' ');
|
67
|
+
if (bodyClass === 'component' || bodyElement.hasClass(bodyClass)) {
|
68
|
+
fireFunctions = fireFunctions.concat(functions);
|
69
|
+
}
|
70
|
+
});
|
71
|
+
|
72
|
+
// Fire off each function
|
73
|
+
$.each(fireFunctions, function() { this.call(); });
|
74
|
+
});
|
75
|
+
|
76
|
+
// Fires off any callbacks registered for exit, ONLY if using Turbolinks.
|
77
|
+
$(document).on('page:before-unload', function() {
|
78
|
+
var fireFunctions = [];
|
79
|
+
|
80
|
+
// Determine which functions should be fired
|
81
|
+
$.each(app.exitFunctions, function(key, functions) {
|
82
|
+
bodyClass = key.split('.').join(' ');
|
83
|
+
if (bodyClass === 'component' || bodyElement.hasClass(bodyClass)) {
|
84
|
+
fireFunctions = fireFunctions.concat(functions);
|
85
|
+
}
|
86
|
+
});
|
87
|
+
|
88
|
+
// Fire off each function
|
89
|
+
$.each(fireFunctions, function() { this.call(); });
|
90
|
+
});
|
91
|
+
})();
|
@@ -0,0 +1,24 @@
|
|
1
|
+
(function() {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
// Used with the `has-grid` and `has-cards` Sass mixins,
|
5
|
+
// it appends an extra span element for each missing column
|
6
|
+
// based on the number of columns defined in the CSS.
|
7
|
+
App.register('component').enter(function() {
|
8
|
+
var columns, children, container, missingColumns;
|
9
|
+
|
10
|
+
$('body *').each(function() {
|
11
|
+
container = $(this);
|
12
|
+
columns = container.css('column-count');
|
13
|
+
|
14
|
+
// Ignore elements without column-count
|
15
|
+
if (columns === 'auto') { return; }
|
16
|
+
|
17
|
+
children = container.children().length;
|
18
|
+
missingColumns = columns - (children % columns);
|
19
|
+
for (var i = 0; i < missingColumns; i++) {
|
20
|
+
container.append('<div></div>');
|
21
|
+
}
|
22
|
+
});
|
23
|
+
});
|
24
|
+
})();
|
@@ -0,0 +1,22 @@
|
|
1
|
+
(function() {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var body, links;
|
5
|
+
|
6
|
+
App.register('component').enter(function() {
|
7
|
+
body = $('body');
|
8
|
+
links = $('a[href]:not([href^="#"]):not([target="_blank"])');
|
9
|
+
|
10
|
+
// Add 'loading' class to the body when a link is clicked,
|
11
|
+
// add add 'active' class to the clicked link.
|
12
|
+
links.click(function() {
|
13
|
+
links.removeClass('active');
|
14
|
+
body.addClass('loading');
|
15
|
+
$(this).addClass('active');
|
16
|
+
});
|
17
|
+
}).exit(function() {
|
18
|
+
// Remove the classes when the body is unloaded
|
19
|
+
body.removeClass('loading');
|
20
|
+
links.removeClass('active');
|
21
|
+
});
|
22
|
+
})();
|