zurb-foundation 4.2.3 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTING.md +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +8 -0
- data/docs/CHANGELOG.md +17 -0
- data/docs/README.md +3 -1
- data/docs/_sidebar-components.html.erb +2 -1
- data/docs/_sidebar.html.erb +2 -1
- data/docs/compile.rb +8 -1
- data/docs/components/abide.html.erb +371 -0
- data/docs/components/alert-boxes.html.erb +12 -9
- data/docs/components/block-grid.html.erb +1 -1
- data/docs/components/breadcrumbs.html.erb +7 -5
- data/docs/components/button-groups.html.erb +4 -2
- data/docs/components/buttons.html.erb +13 -9
- data/docs/components/clearing.html.erb +2 -0
- data/docs/components/dropdown-buttons.html.erb +59 -55
- data/docs/components/dropdown.html.erb +34 -32
- data/docs/components/flex-video.html.erb +4 -2
- data/docs/components/forms.html.erb +16 -15
- data/docs/components/global.html.erb +27 -4
- data/docs/components/grid.html.erb +21 -3
- data/docs/components/inline-lists.html.erb +8 -3
- data/docs/components/joyride.html.erb +5 -3
- data/docs/components/keystrokes.html.erb +4 -2
- data/docs/components/kitchen-sink.html.erb +15 -40
- data/docs/components/labels.html.erb +4 -2
- data/docs/components/magellan.html.erb +4 -2
- data/docs/components/orbit.html.erb +39 -27
- data/docs/components/pagination.html.erb +10 -8
- data/docs/components/panels.html.erb +7 -3
- data/docs/components/pricing-tables.html.erb +12 -10
- data/docs/components/progress-bars.html.erb +6 -4
- data/docs/components/reveal.html.erb +7 -28
- data/docs/components/section.html.erb +15 -13
- data/docs/components/side-nav.html.erb +5 -3
- data/docs/components/split-buttons.html.erb +45 -43
- data/docs/components/sub-nav.html.erb +7 -5
- data/docs/components/switch.html.erb +3 -1
- data/docs/components/tables.html.erb +8 -6
- data/docs/components/thumbnails.html.erb +2 -0
- data/docs/components/tooltips.html.erb +6 -4
- data/docs/components/top-bar.html.erb +9 -8
- data/docs/components/type.html.erb +20 -18
- data/docs/config.ru +2 -1
- data/docs/css/_footer.scss +420 -0
- data/docs/css/_offcanvas.scss +140 -0
- data/docs/css/docs.scss +10 -1
- data/docs/fonts/ProximaNova-Reg-webfont.eot +0 -0
- data/docs/fonts/ProximaNova-Reg-webfont.svg +244 -0
- data/docs/fonts/ProximaNova-Reg-webfont.ttf +0 -0
- data/docs/fonts/ProximaNova-Reg-webfont.woff +0 -0
- data/docs/fonts/proximanovacond-bold-webfont.eot +0 -0
- data/docs/fonts/proximanovacond-bold-webfont.svg +247 -0
- data/docs/fonts/proximanovacond-bold-webfont.ttf +0 -0
- data/docs/fonts/proximanovacond-bold-webfont.woff +0 -0
- data/docs/img/demos/orbit/demo1.jpg +0 -0
- data/docs/img/demos/orbit/demo2.jpg +0 -0
- data/docs/img/demos/orbit/demo3.jpg +0 -0
- data/docs/img/icons/footer-icons.png +0 -0
- data/docs/img/icons/footer-top-icons.png +0 -0
- data/docs/img/icons/social.png +0 -0
- data/docs/img/offcanvas/footer-icons.png +0 -0
- data/docs/img/offcanvas/menu-wht.png +0 -0
- data/docs/img/offcanvas/search.png +0 -0
- data/docs/img/offcanvas/zurb-logo.png +0 -0
- data/docs/img/offcanvas/zurb-wht.png +0 -0
- data/docs/js/docs.js +1 -0
- data/docs/js/jquery.offcanvas.js +28 -0
- data/docs/layout.html.erb +226 -42
- data/docs/media-queries.html.erb +3 -3
- data/docs/sass.html.erb +142 -142
- data/docs/support.html.erb +1 -1
- data/js/foundation/foundation.abide.js +194 -0
- data/js/foundation/foundation.dropdown.js +8 -9
- data/js/foundation/foundation.forms.js +11 -3
- data/js/foundation/foundation.interchange.js +25 -16
- data/js/foundation/foundation.joyride.js +9 -3
- data/js/foundation/foundation.js +2 -3
- data/js/foundation/foundation.magellan.js +3 -2
- data/js/foundation/foundation.orbit.js +359 -344
- data/js/foundation/foundation.reveal.js +1 -1
- data/js/foundation/foundation.section.js +290 -311
- data/js/foundation/foundation.tooltips.js +2 -2
- data/js/foundation/foundation.topbar.js +20 -23
- data/js/foundation/index.js +1 -0
- data/js/vendor/jquery.js +103 -121
- data/lib/foundation/generators/templates/application.html.slim +15 -8
- data/lib/foundation/version.rb +1 -1
- data/scss/foundation.scss +2 -5
- data/scss/foundation/_variables.scss +326 -295
- data/scss/foundation/components/_alert-boxes.scss +10 -10
- data/scss/foundation/components/_block-grid.scss +1 -1
- data/scss/foundation/components/_breadcrumbs.scss +8 -8
- data/scss/foundation/components/_button-groups.scss +2 -2
- data/scss/foundation/components/_buttons.scss +18 -18
- data/scss/foundation/components/_custom-forms.scss +20 -14
- data/scss/foundation/components/_dropdown-buttons.scss +9 -9
- data/scss/foundation/components/_dropdown.scss +4 -4
- data/scss/foundation/components/_flex-video.scss +3 -3
- data/scss/foundation/components/_forms.scss +54 -24
- data/scss/foundation/components/_global.scss +28 -5
- data/scss/foundation/components/_grid-5.scss +214 -0
- data/scss/foundation/components/_grid.scss +3 -3
- data/scss/foundation/components/_inline-lists.scss +3 -3
- data/scss/foundation/components/_joyride.scss +6 -6
- data/scss/foundation/components/_keystrokes.scss +3 -3
- data/scss/foundation/components/_labels.scss +3 -3
- data/scss/foundation/components/_orbit.scss +34 -9
- data/scss/foundation/components/_pagination.scss +8 -6
- data/scss/foundation/components/_panels.scss +3 -3
- data/scss/foundation/components/_pricing-tables.scss +10 -10
- data/scss/foundation/components/_progress-bars.scss +3 -3
- data/scss/foundation/components/_reveal.scss +7 -7
- data/scss/foundation/components/_section.scss +252 -214
- data/scss/foundation/components/_side-nav.scss +3 -3
- data/scss/foundation/components/_split-buttons.scss +7 -7
- data/scss/foundation/components/_sub-nav.scss +7 -7
- data/scss/foundation/components/_switch.scss +4 -4
- data/scss/foundation/components/_tables.scss +6 -6
- data/scss/foundation/components/_tooltips.scss +4 -4
- data/scss/foundation/components/_top-bar.scss +14 -10
- data/scss/foundation/components/_type.scss +23 -23
- data/templates/project/index.html +4 -4
- data/templates/project/scss/app.scss +8 -0
- metadata +29 -4
data/CONTRIBUTING.md
CHANGED
@@ -48,7 +48,7 @@ bundle exec compass create -r zurb-foundation --using foundation --force
|
|
48
48
|
1. Fork it
|
49
49
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
50
50
|
3. Test your changes to the best of your ability. We've provided a test/ folder, feel free to add to it as necessary.
|
51
|
-
4. Update the documentation to reflect your changes if they add or changes current functionality.
|
51
|
+
4. Update the documentation to reflect your changes if they add or changes current functionality. Make sure you are in the docs folder, then run `bundle && bundle exec foreman start` to compile to documentation.
|
52
52
|
5. Commit your changes (`git commit -am 'Added some feature'`)
|
53
53
|
6. Push to the branch (`git push origin my-new-feature`)
|
54
54
|
7. Create new Pull Request
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -117,6 +117,10 @@ Templates
|
|
117
117
|
* [Desktop, Tablet and Phone Grid PSD Templates](http://foundation.zurb.com/files/foundation-psd-templates.zip ) by Bruce Abel at Portfolio Creative Services Group
|
118
118
|
* [HAML Web Templates](https://github.com/pbonnell/foundation_templates_haml) by Peter Bonnell
|
119
119
|
|
120
|
+
Rapid Prototyping
|
121
|
+
|
122
|
+
* [ditbi](https://github.com/roblevintennis/ditbi) by Rob Levin [4 Minute Demo Video](http://www.youtube.com/watch?v=ERgFCJFpq5E)
|
123
|
+
|
120
124
|
Grid Generator
|
121
125
|
|
122
126
|
* [Experimental Grid Generator](http://www.gridlover.net/foundation/) courtesy of [Ville Vanninen](http://foolproof.me)
|
@@ -140,6 +144,10 @@ Yeoman Generator
|
|
140
144
|
* [Yeoman 1.0-Foundation 4](https://github.com/lkbgift/foundation4-yeoman) by [Leonard Bogdonoff](http://twitter.com/lkbcc)
|
141
145
|
* [Yeoman-Foundation](https://npmjs.org/package/yeoman-foundation) by Vincent Mac
|
142
146
|
|
147
|
+
Meteor
|
148
|
+
|
149
|
+
* [Foundation Smart Package](https://atmosphere.meteor.com/package/zurb-foundation)
|
150
|
+
|
143
151
|
|
144
152
|
MIT Open Source License
|
145
153
|
=======================
|
data/docs/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
### 4.3- July 18, 2013
|
2
|
+
* Added [Abide](http://foundation.zurb.com/docs/components/abide.html), our new form validation plugin that works with simple data-attributes.
|
3
|
+
* Rewrote Orbit to include previous options and animations. We also made it possible to have variable height slides and separate animations.
|
4
|
+
* Top Bar JS updates to fix a scrollTop bug
|
5
|
+
* Fixed a positioning bug in custom forms when using the collapsed option
|
6
|
+
* Added custom section to custom forms
|
7
|
+
* Updated Interchance to support absolute URLs
|
8
|
+
* Updated the emCalc to be used unitlessly and with multiple values
|
9
|
+
* Created an early "opt-in" grid that we've built for Foundation 5. This includes 2 breakpoints and three grids (small, medium, large). Use this to start planning ahead to Foundation 5.
|
10
|
+
* Fixed a bug with Section deep linking in nested content
|
11
|
+
* Top Bar toggle bug fixes
|
12
|
+
* Fixed bugs with dropdown positioning and closing
|
13
|
+
* Updated visual style of bullets for Orbit
|
14
|
+
* General bug fixes, improvements and refinements.
|
15
|
+
|
16
|
+
You can compare the commits [here](https://github.com/zurb/foundation/compare/v4.2.3...v4.3.0).
|
17
|
+
|
1
18
|
### 4.2.3- June 26, 2013
|
2
19
|
* Made it to where custom switches work inside custom forms.
|
3
20
|
* Small update to breadcrumb styling so that defaults don't get overridden.
|
data/docs/README.md
CHANGED
@@ -1 +1,3 @@
|
|
1
|
-
From within the docs/ directory run `bundle install`.
|
1
|
+
From within the docs/ directory run `bundle install`.
|
2
|
+
To get the docs to compile during development you'll want to run `bundle exec foreman start`.
|
3
|
+
At that point you can access the docs by going to `http://localhost:4000`.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="docs section-container accordion" data-section
|
1
|
+
<div class="docs section-container accordion" data-section="accordion">
|
2
2
|
<section class="section <%= @side_nav == 'using' ? 'active': '' %>">
|
3
3
|
<p class="title"><a href="#">Using Foundation</a></p>
|
4
4
|
<div class="content">
|
@@ -87,6 +87,7 @@
|
|
87
87
|
<p class="title"><a href="#">Javascript</a></p>
|
88
88
|
<div class="content">
|
89
89
|
<ul class="side-nav">
|
90
|
+
<li><a class="<%= @page_title == 'Abide' ? 'active': '' %>" href="abide.html">Abide</a></li>
|
90
91
|
<li><a class="<%= @page_title == 'Clearing' ? 'active': '' %>" href="clearing.html">Clearing</a></li>
|
91
92
|
<li><a class="<%= @page_title == 'Dropdown' ? 'active': '' %>" href="dropdown.html">Dropdown</a></li>
|
92
93
|
<li><a class="<%= @page_title == 'Interchange' ? 'active': '' %>" href="interchange.html">Interchange</a></li>
|
data/docs/_sidebar.html.erb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="docs section-container accordion" data-section data-options="one_up: false">
|
1
|
+
<div class="docs section-container accordion" data-section="accordion" data-options="one_up: false">
|
2
2
|
<section class="section <%= @side_nav == 'using' ? 'active': '' %>">
|
3
3
|
<p class="title"><a href="#">Using Foundation</a></p>
|
4
4
|
<div class="content">
|
@@ -87,6 +87,7 @@
|
|
87
87
|
<p class="title"><a href="#">Javascript</a></p>
|
88
88
|
<div class="content">
|
89
89
|
<ul class="side-nav">
|
90
|
+
<li><a href="components/abide.html">Abide</a></li>
|
90
91
|
<li><a href="components/clearing.html">Clearing</a></li>
|
91
92
|
<li><a href="components/dropdown.html">Dropdown</a></li>
|
92
93
|
<li><a href="components/interchange.html">Interchange</a></li>
|
data/docs/compile.rb
CHANGED
@@ -15,6 +15,7 @@ class FoundationAssets
|
|
15
15
|
@env.append_path File.expand_path('../css', __FILE__)
|
16
16
|
@env.append_path File.expand_path('../../js', __FILE__)
|
17
17
|
@env.append_path File.expand_path('../js', __FILE__)
|
18
|
+
@env.append_path File.expand_path('../img', __FILE__)
|
18
19
|
end
|
19
20
|
|
20
21
|
def compile
|
@@ -26,9 +27,15 @@ class FoundationAssets
|
|
26
27
|
code = @env[bundle].to_s
|
27
28
|
File.open(pth, "w") {|f| f.puts code}
|
28
29
|
end
|
30
|
+
Dir["img/**/*.png"].each do |img_pth|
|
31
|
+
pth = "#{assets_path}/#{img_pth.split('img/').last}"
|
32
|
+
FileUtils.mkdir_p(File.dirname(pth))
|
33
|
+
File.delete(pth) if File.exists?(pth)
|
34
|
+
FileUtils.copy_file(img_pth,pth)
|
35
|
+
end
|
29
36
|
end
|
30
37
|
end
|
31
38
|
|
32
39
|
Stasis.new(File.expand_path('.'), File.expand_path('./public'), {:asset_path => "http://foundation.zurb.com/docs/assets"}).render
|
33
40
|
assets = FoundationAssets.new
|
34
|
-
assets.compile
|
41
|
+
assets.compile
|
@@ -0,0 +1,371 @@
|
|
1
|
+
<% @side_nav = "js" %>
|
2
|
+
|
3
|
+
<div class="row">
|
4
|
+
<div class="large-9 push-3 columns">
|
5
|
+
|
6
|
+
<% @page_title = "Abide" %>
|
7
|
+
<div class="row">
|
8
|
+
<div class="large-12 columns">
|
9
|
+
<h2><%= @page_title %></h2>
|
10
|
+
<h4 class="subheader">Abide is an HTML5 form validation library that supports the native API by using patterns and required attributes.</h4>
|
11
|
+
|
12
|
+
<form class="custom" data-abide>
|
13
|
+
<fieldset>
|
14
|
+
<legend>Fieldset</legend>
|
15
|
+
|
16
|
+
<div class="row">
|
17
|
+
<div class="large-12 columns">
|
18
|
+
<label for="password">Password <small>required</small></label>
|
19
|
+
<input type="password" id="password" placeholder="LittleW0men." name="password" required>
|
20
|
+
<small class="error" data-error-message>Passwords must be at least 8 characters with 1 capital letter, 1 number, and one special character.</small>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="row">
|
25
|
+
<div class="large-12 columns">
|
26
|
+
<label for="phone">Phone</label>
|
27
|
+
<input type="tel" id="phone" placeholder="1 234-567-8910">
|
28
|
+
<small class="error" data-error-message>Please enter a properly formatted telephone number.</small>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div class="row">
|
33
|
+
<div class="large-4 columns">
|
34
|
+
<label for="email">Email</label>
|
35
|
+
<input type="email" id="email" placeholder="foundation@zurb.com">
|
36
|
+
<small class="error">Valid email required.</small>
|
37
|
+
</div>
|
38
|
+
<div class="large-4 columns">
|
39
|
+
<label for="url">URL <small>required</small></label>
|
40
|
+
<input type="url" id="url" placeholder="http://zurb.com" required>
|
41
|
+
<small class="error" data-error-message>Valid URL required.</small>
|
42
|
+
</div>
|
43
|
+
<div class="large-4 columns">
|
44
|
+
<div class="row collapse">
|
45
|
+
<label for="customDropdown1">Hardest to find in grocery <small>required</small></label>
|
46
|
+
<select id="customDropdown1" class="medium" required>
|
47
|
+
<option value="">Select grocery item</option>
|
48
|
+
<option value="first">Green Chilies</option>
|
49
|
+
<option value="second">Raisins</option>
|
50
|
+
<option value="third">Panko bread crumbs</option>
|
51
|
+
<option value="fourth">Assistance</option>
|
52
|
+
</select>
|
53
|
+
<small class="error" data-error-message>Broke.</small>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div class="row">
|
59
|
+
<div class="large-12 columns">
|
60
|
+
<hr>
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<div class="row">
|
65
|
+
<div class="large-6 columns">
|
66
|
+
<label for="radio1"><input name="radio1" type="radio" id="radio1" required><span class="custom radio"></span> Radio Button 1</label>
|
67
|
+
<label for="radio1"><input name="radio1" type="radio" id="radio1" required><span class="custom radio"></span> Radio Button 2</label>
|
68
|
+
<label for="radio1"><input name="radio1" type="radio" id="radio1" required><span class="custom radio"></span> Radio Button 3</label>
|
69
|
+
</div>
|
70
|
+
<div class="large-6 columns">
|
71
|
+
<label for="checkbox1"><input type="checkbox" id="checkbox1" style="display: none;" required><span class="custom checkbox"></span> Label for Checkbox</label>
|
72
|
+
<label for="checkbox2"><input type="checkbox" id="checkbox2" CHECKED style="display: none;" required><span class="custom checkbox checked"></span> Label for Checkbox</label>
|
73
|
+
<label for="checkbox3"><input type="checkbox" CHECKED id="checkbox3" style="display: none;" required><span class="custom checkbox checked"></span> Label for Checkbox</label>
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
<div class="row">
|
78
|
+
<div class="large-12 columns">
|
79
|
+
<hr>
|
80
|
+
</div>
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<div class="row">
|
84
|
+
<div class="large-12 columns">
|
85
|
+
<label for="remarks">Closing Remarks</label>
|
86
|
+
<textarea id="remarks" name="remarks" placeholder="Leave your remarks here."></textarea>
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
<div class="row">
|
91
|
+
<div class="large-12 columns">
|
92
|
+
<button type="submit" class="medium button green">Submit</button>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
</fieldset>
|
97
|
+
</form>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div class="row">
|
103
|
+
<div class="large-12 columns">
|
104
|
+
<hr>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
<div class="row">
|
109
|
+
<div class="large-12 columns">
|
110
|
+
|
111
|
+
<h3>Setting up validation</h3>
|
112
|
+
<p>To enable validation with Abide add the <code>data-abide</code> attribute to your <code><form></code> element. Then add the <code>required</code> attribute to each input that you want to require. Additionaly, you can define a <code>pattern</code> to define restraints on what users can input.</p>
|
113
|
+
|
114
|
+
<%= code_example '
|
115
|
+
<form data-abide>
|
116
|
+
<div class="name-field">
|
117
|
+
<label>Your name <small>required</small></label>
|
118
|
+
<input type="number" required pattern="[a-zA-Z]+">
|
119
|
+
<small class="error">Name is required and must be a string.</small>
|
120
|
+
</div>
|
121
|
+
<div class="email-field">
|
122
|
+
<label>Email <small>required</small></label>
|
123
|
+
<input type="password" required>
|
124
|
+
<small class="error">An email address is required.</small>
|
125
|
+
</div>
|
126
|
+
<button type="submit">Submit</button>
|
127
|
+
</form>
|
128
|
+
', :html %>
|
129
|
+
|
130
|
+
<div class="row">
|
131
|
+
<div class="large-12 columns">
|
132
|
+
<hr>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
<h3>Predefined patterns</h3>
|
137
|
+
|
138
|
+
<p>Abide has several patterns common validation patterns built into the library:</p>
|
139
|
+
|
140
|
+
<table>
|
141
|
+
<thead>
|
142
|
+
<tr>
|
143
|
+
<th>Name</th>
|
144
|
+
<th>Valid Example or Format</th>
|
145
|
+
</tr>
|
146
|
+
</thead>
|
147
|
+
<tbody>
|
148
|
+
<tr>
|
149
|
+
<td>alpha</td>
|
150
|
+
<td>Foundation</td>
|
151
|
+
</tr>
|
152
|
+
<tr>
|
153
|
+
<td>alpha_numeric</td>
|
154
|
+
<td>A1 Sauce</td>
|
155
|
+
</tr>
|
156
|
+
<tr>
|
157
|
+
<td>integer</td>
|
158
|
+
<td>-1</td>
|
159
|
+
</tr>
|
160
|
+
<tr>
|
161
|
+
<td>number</td>
|
162
|
+
<td>2937</td>
|
163
|
+
</tr>
|
164
|
+
<tr>
|
165
|
+
<td>password</td>
|
166
|
+
<td>LittleW0men.</td>
|
167
|
+
</tr>
|
168
|
+
<tr>
|
169
|
+
<td>card</td>
|
170
|
+
<td>visa, ames, mastercard</td>
|
171
|
+
</tr>
|
172
|
+
<tr>
|
173
|
+
<td>cvv</td>
|
174
|
+
<td>384 or 3284</td>
|
175
|
+
</tr>
|
176
|
+
<tr>
|
177
|
+
<td>email</td>
|
178
|
+
<td>foundation@zurb.com</td>
|
179
|
+
</tr>
|
180
|
+
<tr>
|
181
|
+
<td>url</td>
|
182
|
+
<td>http://zurb.com</td>
|
183
|
+
</tr>
|
184
|
+
<tr>
|
185
|
+
<td>domain</td>
|
186
|
+
<td>zurb.com</td>
|
187
|
+
</tr>
|
188
|
+
<tr>
|
189
|
+
<td>datetime</td>
|
190
|
+
<td>YYYY-MM-DDThh:mm:ssTZD</td>
|
191
|
+
</tr>
|
192
|
+
<tr>
|
193
|
+
<td>date</td>
|
194
|
+
<td>YYYY-MM-DD</td>
|
195
|
+
</tr>
|
196
|
+
<tr>
|
197
|
+
<td>time</td>
|
198
|
+
<td>HH:MM:SS</td>
|
199
|
+
</tr>
|
200
|
+
<tr>
|
201
|
+
<td>dateISO</td>
|
202
|
+
<td>not sure yet</td>
|
203
|
+
</tr>
|
204
|
+
<tr>
|
205
|
+
<td>month_day_year</td>
|
206
|
+
<td>MM/DD/YYYY</td>
|
207
|
+
</tr>
|
208
|
+
<tr>
|
209
|
+
<td>color</td>
|
210
|
+
<td>#FFF or #FFFFFF</td>
|
211
|
+
</tr>
|
212
|
+
</tbody>
|
213
|
+
</table>
|
214
|
+
|
215
|
+
<p>You can also use these patterns by settings the input's type to the name of the pattern instead of using the pattern attribute:</p>
|
216
|
+
|
217
|
+
<%= code_example '
|
218
|
+
<input type="password" required>
|
219
|
+
<input type="email">
|
220
|
+
<input type="url">
|
221
|
+
', :html %>
|
222
|
+
|
223
|
+
<p>There is a good list of valid HTML5 input types on the <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input">Mozilla Developer Network</a>. Try to avoid using patterns defined by type that do not match the specification.</p>
|
224
|
+
|
225
|
+
<p>For named patterns that are not valid input types you can use the following shortcut:</p>
|
226
|
+
|
227
|
+
<%= code_example '
|
228
|
+
<input type="text" pattern="integer">
|
229
|
+
', :html %>
|
230
|
+
|
231
|
+
</div>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<div class="row">
|
235
|
+
<div class="large-12 columns">
|
236
|
+
<hr>
|
237
|
+
</div>
|
238
|
+
</div>
|
239
|
+
|
240
|
+
<div class="row">
|
241
|
+
<div class="large-12 columns">
|
242
|
+
<h3>Custom named patterns</h3>
|
243
|
+
<p>By overriding Abide during Foundation initilization, you can define your own custom patterns or override the default patterns to validate against.</p>
|
244
|
+
|
245
|
+
<%= code_example "
|
246
|
+
$(document)
|
247
|
+
.foundation()
|
248
|
+
.foundation('abide', {
|
249
|
+
patterns: {
|
250
|
+
dashes_only: /^[0-9-]*$/,
|
251
|
+
ip_address: /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/
|
252
|
+
}
|
253
|
+
})
|
254
|
+
", :js %>
|
255
|
+
|
256
|
+
<p>You can then use these custom patterns like you would the predfined patterns in your markup:</p>
|
257
|
+
|
258
|
+
<%= code_example '
|
259
|
+
<form class="custom" data-abide>
|
260
|
+
<label>Serial Number</label>
|
261
|
+
<input type="text" pattern="dashes_only" required>
|
262
|
+
</form>
|
263
|
+
', :html %>
|
264
|
+
|
265
|
+
<div class="row">
|
266
|
+
<div class="large-12 columns">
|
267
|
+
<hr>
|
268
|
+
</div>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
<h3>Error messages</h3>
|
272
|
+
|
273
|
+
<p>To display an error message for your invalid form element include a <code><small></code> tage with an <code>error</code> class as a sibling of your input.</p>
|
274
|
+
|
275
|
+
<%= code_example '
|
276
|
+
<div class="input-wrapper">
|
277
|
+
<label>Email Address <small>required</small></label>
|
278
|
+
<input type="email" required>
|
279
|
+
<small class="error">A valid email address is required.</small>
|
280
|
+
</div>
|
281
|
+
', :html %>
|
282
|
+
|
283
|
+
<p>In the above example we have wrapped our input in a <code>div</code>. This div will receive an <code>error</code> class when the input is invalid. This class will show our error message and style the label and input accordingly.</p>
|
284
|
+
|
285
|
+
<p>Invalid inputs inherit a <code>data-invalid</code> attribute.</p>
|
286
|
+
|
287
|
+
<div class="row">
|
288
|
+
<div class="large-12 columns">
|
289
|
+
<hr>
|
290
|
+
</div>
|
291
|
+
</div>
|
292
|
+
|
293
|
+
<h3>Events</h3>
|
294
|
+
|
295
|
+
<p>If a submit event is fired, a <code>valid</code> event is fired if the form is valid and an <code>invalid</code> event is fired if the form is invalid.</p>
|
296
|
+
|
297
|
+
<p>You can bind to these events and fire your own callback:</p>
|
298
|
+
|
299
|
+
<%= code_example "
|
300
|
+
$('#myForm')
|
301
|
+
.on('invalid', function () {
|
302
|
+
var invalid_fields = $(this).find('[data-invalid]');
|
303
|
+
console.log(invalid_fields);
|
304
|
+
});
|
305
|
+
.on('valid', function () {
|
306
|
+
console.log('valid!');
|
307
|
+
});
|
308
|
+
", :js %>
|
309
|
+
|
310
|
+
<div class="row">
|
311
|
+
<div class="large-12 columns">
|
312
|
+
<hr>
|
313
|
+
</div>
|
314
|
+
</div>
|
315
|
+
|
316
|
+
<h3>Using the JavaScript</h3>
|
317
|
+
<p>You'll need to include <code>foundation.abide.js</code> to get plugin to work. You'll also need to make sure to include <code>zepto.js</code> and <code>foundation.js</code> above the alert plugin. Above your closing <code></body></code> tag include the following line of code and make sure you have the JS in your directory.</p>
|
318
|
+
|
319
|
+
<p><a href="../javascript.html" title="How to install Foundation JavaScript">Read how to install Foundation JavaScript</a></p>
|
320
|
+
|
321
|
+
<p>Required Foundation Library: <code>foundation.abide.js</code></p>
|
322
|
+
|
323
|
+
<h5>Optional JavaScript Configuration</h5>
|
324
|
+
|
325
|
+
<%= code_example '
|
326
|
+
{
|
327
|
+
live_validate : true,
|
328
|
+
focus_on_invalid : true,
|
329
|
+
timeout : 1000,
|
330
|
+
patterns : {
|
331
|
+
alpha: /[a-zA-Z]+/,
|
332
|
+
alpha_numeric : /[a-zA-Z0-9]+/,
|
333
|
+
integer: /-?\d+/,
|
334
|
+
number: /-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?/,
|
335
|
+
|
336
|
+
// generic password: upper-case, lower-case, number/special character, and min 8 characters
|
337
|
+
password : /(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,
|
338
|
+
|
339
|
+
// amex, visa, diners
|
340
|
+
card : /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,
|
341
|
+
cvv : /^([0-9]){3,4}$/,
|
342
|
+
|
343
|
+
// http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
|
344
|
+
email : /^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,
|
345
|
+
|
346
|
+
url: /(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&\'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&\'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&\'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&\'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&\'\(\)\*\+,;=]|:|@)|\/|\?)*)?/,
|
347
|
+
// abc.de
|
348
|
+
domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/,
|
349
|
+
|
350
|
+
datetime: /([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))/,
|
351
|
+
// YYYY-MM-DD
|
352
|
+
date: /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))/,
|
353
|
+
// HH:MM:SS
|
354
|
+
time : /(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}/,
|
355
|
+
dateISO: /\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/,
|
356
|
+
// MM/DD/YYYY
|
357
|
+
month_day_year : /(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d/,
|
358
|
+
|
359
|
+
// #FFF or #FFFFFF
|
360
|
+
color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
|
361
|
+
}
|
362
|
+
}', :js %>
|
363
|
+
|
364
|
+
</div>
|
365
|
+
</div>
|
366
|
+
|
367
|
+
</div>
|
368
|
+
<div class="large-3 pull-9 columns">
|
369
|
+
<%= render "_sidebar-components.html.erb" %>
|
370
|
+
</div>
|
371
|
+
</div>
|