Skip to content

Commit 23edda0

Browse files
authored
Merge pull request #219 from Yanchek99/upgrade-to-6-3-1
Upgrade to foundation-sites 6.3.1
2 parents 6da0778 + 3d95d8a commit 23edda0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+853
-346
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sudo: false
55
cache: bundler
66

77
rvm:
8-
- 2.2
8+
- 2.2.2
99

1010
notifications:
1111
email: false

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "foundation-rails",
3-
"version": "6.3.0.0",
3+
"version": "6.3.1.0",
44
"dependencies": {
5-
"foundation-sites": "6.3.0",
5+
"foundation-sites": "6.3.1",
66
"motion-ui": "1.2.2"
77
}
88
}

lib/foundation/rails/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Foundation
22
module Rails
3-
VERSION = "6.3.0.0"
3+
VERSION = "6.3.1.0"
44
end
55
end

lib/generators/foundation/templates/_settings.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,4 +618,3 @@ $topbar-submenu-background: $topbar-background;
618618
$topbar-title-spacing: 0.5rem 1rem 0.5rem 0;
619619
$topbar-input-width: 200px;
620620
$topbar-unstack-breakpoint: medium;
621-

vendor/assets/js/foundation.abide.js.es6

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,27 @@ class Abide {
110110
}
111111

112112
/**
113-
* Based on $el, get the first element with selector in this order:
114-
* 1. The element's direct sibling('s).
115-
* 3. The element's parent's children.
113+
* Get:
114+
* - Based on $el, the first element(s) corresponding to `formErrorSelector` in this order:
115+
* 1. The element's direct sibling('s).
116+
* 2. The element's parent's children.
117+
* - Element(s) with the attribute `[data-form-error-for]` set with the element's id.
116118
*
117119
* This allows for multiple form errors per input, though if none are found, no form errors will be shown.
118120
*
119121
* @param {Object} $el - jQuery object to use as reference to find the form error selector.
120122
* @returns {Object} jQuery object with the selector.
121123
*/
122124
findFormError($el) {
125+
var id = $el[0].id;
123126
var $error = $el.siblings(this.options.formErrorSelector);
124127

125128
if (!$error.length) {
126129
$error = $el.parent().find(this.options.formErrorSelector);
127130
}
128131

132+
$error = $error.add(this.$element.find(`[data-form-error-for="${id}"]`));
133+
129134
return $error;
130135
}
131136

@@ -237,7 +242,8 @@ class Abide {
237242
}
238243

239244
/**
240-
* Goes through a form to find inputs and proceeds to validate them in ways specific to their type
245+
* Goes through a form to find inputs and proceeds to validate them in ways specific to their type.
246+
* Ignores inputs with data-abide-ignore, type="hidden" or disabled attributes set
241247
* @fires Abide#invalid
242248
* @fires Abide#valid
243249
* @param {Object} element - jQuery object to validate, should be an HTML input
@@ -250,8 +256,8 @@ class Abide {
250256
validator = $el.attr('data-validator'),
251257
equalTo = true;
252258

253-
// don't validate ignored inputs or hidden inputs
254-
if ($el.is('[data-abide-ignore]') || $el.is('[type="hidden"]')) {
259+
// don't validate ignored inputs or hidden inputs or disabled inputs
260+
if ($el.is('[data-abide-ignore]') || $el.is('[type="hidden"]') || $el.is('[disabled]')) {
255261
return true;
256262
}
257263

@@ -472,49 +478,56 @@ Abide.defaults = {
472478
* The default event to validate inputs. Checkboxes and radios validate immediately.
473479
* Remove or change this value for manual validation.
474480
* @option
475-
* @example 'fieldChange'
481+
* @type {?string}
482+
* @default 'fieldChange'
476483
*/
477484
validateOn: 'fieldChange',
478485

479486
/**
480487
* Class to be applied to input labels on failed validation.
481488
* @option
482-
* @example 'is-invalid-label'
489+
* @type {string}
490+
* @default 'is-invalid-label'
483491
*/
484492
labelErrorClass: 'is-invalid-label',
485493

486494
/**
487495
* Class to be applied to inputs on failed validation.
488496
* @option
489-
* @example 'is-invalid-input'
497+
* @type {string}
498+
* @default 'is-invalid-input'
490499
*/
491500
inputErrorClass: 'is-invalid-input',
492501

493502
/**
494503
* Class selector to use to target Form Errors for show/hide.
495504
* @option
496-
* @example '.form-error'
505+
* @type {string}
506+
* @default '.form-error'
497507
*/
498508
formErrorSelector: '.form-error',
499509

500510
/**
501511
* Class added to Form Errors on failed validation.
502512
* @option
503-
* @example 'is-visible'
513+
* @type {string}
514+
* @default 'is-visible'
504515
*/
505516
formErrorClass: 'is-visible',
506517

507518
/**
508519
* Set to true to validate text inputs on any value change.
509520
* @option
510-
* @example false
521+
* @type {boolean}
522+
* @default false
511523
*/
512524
liveValidate: false,
513525

514526
/**
515527
* Set to true to validate inputs on blur.
516528
* @option
517-
* @example false
529+
* @type {boolean}
530+
* @default false
518531
*/
519532
validateOnBlur: false,
520533

vendor/assets/js/foundation.accordion.js.es6

Lines changed: 94 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,48 @@ class Accordion {
5757
$content.attr({'role': 'tabpanel', 'aria-labelledby': linkId, 'aria-hidden': true, 'id': id});
5858
});
5959
var $initActive = this.$element.find('.is-active').children('[data-tab-content]');
60+
this.firstTimeInit = true;
6061
if($initActive.length){
61-
this.down($initActive, true);
62+
this.down($initActive, this.firstTimeInit);
63+
this.firstTimeInit = false;
6264
}
65+
66+
this._checkDeepLink = () => {
67+
var anchor = window.location.hash;
68+
//need a hash and a relevant anchor in this tabset
69+
if(anchor.length) {
70+
var $link = this.$element.find('[href$="'+anchor+'"]'),
71+
$anchor = $(anchor);
72+
73+
if ($link.length && $anchor) {
74+
if (!$link.parent('[data-accordion-item]').hasClass('is-active')) {
75+
this.down($anchor, this.firstTimeInit);
76+
this.firstTimeInit = false;
77+
};
78+
79+
//roll up a little to show the titles
80+
if (this.options.deepLinkSmudge) {
81+
var _this = this;
82+
$(window).load(function() {
83+
var offset = _this.$element.offset();
84+
$('html, body').animate({ scrollTop: offset.top }, _this.options.deepLinkSmudgeDelay);
85+
});
86+
}
87+
88+
/**
89+
* Fires when the zplugin has deeplinked at pageload
90+
* @event Accordion#deeplink
91+
*/
92+
this.$element.trigger('deeplink.zf.accordion', [$link, $anchor]);
93+
}
94+
}
95+
}
96+
97+
//use browser to open a tab, if it exists in this tabset
98+
if (this.options.deepLink) {
99+
this._checkDeepLink();
100+
}
101+
63102
this._events();
64103
}
65104

@@ -103,6 +142,9 @@ class Accordion {
103142
});
104143
}
105144
});
145+
if(this.options.deepLink) {
146+
$(window).on('popstate', this._checkDeepLink);
147+
}
106148
}
107149

108150
/**
@@ -116,6 +158,16 @@ class Accordion {
116158
} else {
117159
this.down($target);
118160
}
161+
//either replace or update browser history
162+
if (this.options.deepLink) {
163+
var anchor = $target.prev('a').attr('href');
164+
165+
if (this.options.updateHistory) {
166+
history.pushState({}, '', anchor);
167+
} else {
168+
history.replaceState({}, '', anchor);
169+
}
170+
}
119171
}
120172

121173
/**
@@ -194,6 +246,9 @@ class Accordion {
194246
destroy() {
195247
this.$element.find('[data-tab-content]').stop(true).slideUp(0).css('display', '');
196248
this.$element.find('a').off('.zf.accordion');
249+
if(this.options.deepLink) {
250+
$(window).off('popstate', this._checkDeepLink);
251+
}
197252

198253
Foundation.unregisterPlugin(this);
199254
}
@@ -203,21 +258,55 @@ Accordion.defaults = {
203258
/**
204259
* Amount of time to animate the opening of an accordion pane.
205260
* @option
206-
* @example 250
261+
* @type {number}
262+
* @default 250
207263
*/
208264
slideSpeed: 250,
209265
/**
210266
* Allow the accordion to have multiple open panes.
211267
* @option
212-
* @example false
268+
* @type {boolean}
269+
* @default false
213270
*/
214271
multiExpand: false,
215272
/**
216273
* Allow the accordion to close all panes.
217274
* @option
218-
* @example false
275+
* @type {boolean}
276+
* @default false
277+
*/
278+
allowAllClosed: false,
279+
/**
280+
* Allows the window to scroll to content of pane specified by hash anchor
281+
* @option
282+
* @type {boolean}
283+
* @default false
284+
*/
285+
deepLink: false,
286+
287+
/**
288+
* Adjust the deep link scroll to make sure the top of the accordion panel is visible
289+
* @option
290+
* @type {boolean}
291+
* @default false
292+
*/
293+
deepLinkSmudge: false,
294+
295+
/**
296+
* Animation time (ms) for the deep link adjustment
297+
* @option
298+
* @type {number}
299+
* @default 300
300+
*/
301+
deepLinkSmudgeDelay: 300,
302+
303+
/**
304+
* Update the browser history with the open accordion
305+
* @option
306+
* @type {boolean}
307+
* @default false
219308
*/
220-
allowAllClosed: false
309+
updateHistory: false
221310
};
222311

223312
// Window exports

vendor/assets/js/foundation.accordionMenu.js.es6

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,15 @@ AccordionMenu.defaults = {
264264
/**
265265
* Amount of time to animate the opening of a submenu in ms.
266266
* @option
267-
* @example 250
267+
* @type {number}
268+
* @default 250
268269
*/
269270
slideSpeed: 250,
270271
/**
271272
* Allow the menu to have multiple open panes.
272273
* @option
273-
* @example true
274+
* @type {boolean}
275+
* @default true
274276
*/
275277
multiOpen: true
276278
};

vendor/assets/js/foundation.core.js.es6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
"use strict";
44

5-
var FOUNDATION_VERSION = '6.3.0';
5+
var FOUNDATION_VERSION = '6.3.1';
66

77
// Global Foundation object
88
// This is attached to the window, or used as a module for AMD/Browserify

0 commit comments

Comments
 (0)