opsask 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.yardoc/checksums +4 -0
  4. data/.yardoc/object_types +0 -0
  5. data/.yardoc/objects/root.dat +0 -0
  6. data/.yardoc/proxy_types +0 -0
  7. data/Gemfile +15 -0
  8. data/Gemfile.lock +75 -0
  9. data/LICENSE +13 -0
  10. data/Rakefile +30 -0
  11. data/Readme.md +3 -0
  12. data/VERSION +1 -0
  13. data/bin/opsask +4 -0
  14. data/lib/opsask/app.rb +540 -0
  15. data/lib/opsask/main.rb +54 -0
  16. data/lib/opsask/metadata.rb +29 -0
  17. data/lib/opsask.rb +3 -0
  18. data/opsask.gemspec +29 -0
  19. data/public/css/foundation.css +5068 -0
  20. data/public/css/foundation.min.css +1 -0
  21. data/public/css/normalize.css +410 -0
  22. data/public/css/style.css +152 -0
  23. data/public/favicon.ico +0 -0
  24. data/public/fonts/DINMittelschriftStd.woff +0 -0
  25. data/public/img/.gitkeep +1 -0
  26. data/public/js/foundation/foundation.abide.js +256 -0
  27. data/public/js/foundation/foundation.accordion.js +49 -0
  28. data/public/js/foundation/foundation.alert.js +37 -0
  29. data/public/js/foundation/foundation.clearing.js +485 -0
  30. data/public/js/foundation/foundation.dropdown.js +208 -0
  31. data/public/js/foundation/foundation.equalizer.js +64 -0
  32. data/public/js/foundation/foundation.interchange.js +326 -0
  33. data/public/js/foundation/foundation.joyride.js +848 -0
  34. data/public/js/foundation/foundation.js +587 -0
  35. data/public/js/foundation/foundation.magellan.js +171 -0
  36. data/public/js/foundation/foundation.offcanvas.js +39 -0
  37. data/public/js/foundation/foundation.orbit.js +464 -0
  38. data/public/js/foundation/foundation.reveal.js +399 -0
  39. data/public/js/foundation/foundation.tab.js +58 -0
  40. data/public/js/foundation/foundation.tooltip.js +215 -0
  41. data/public/js/foundation/foundation.topbar.js +387 -0
  42. data/public/js/foundation/jquery.cookie.js +8 -0
  43. data/public/js/foundation.min.js +10 -0
  44. data/public/js/opsask.js +19 -0
  45. data/public/js/vendor/fastclick.js +9 -0
  46. data/public/js/vendor/jquery.cookie.js +8 -0
  47. data/public/js/vendor/jquery.js +26 -0
  48. data/public/js/vendor/modernizr.js +8 -0
  49. data/public/js/vendor/placeholder.js +2 -0
  50. data/tasks/generate-email-summary.rb +73 -0
  51. data/tasks/send-email-summary.sh +13 -0
  52. data/views/_components.erb +6 -0
  53. data/views/_count.erb +11 -0
  54. data/views/_flash.erb +3 -0
  55. data/views/_form.erb +37 -0
  56. data/views/_queue.erb +16 -0
  57. data/views/agile.erb +6 -0
  58. data/views/glance.erb +19 -0
  59. data/views/index.erb +27 -0
  60. data/views/layout.erb +43 -0
  61. data/views/stragglers.erb +6 -0
  62. data/views/untracked.erb +6 -0
  63. metadata +217 -0
@@ -0,0 +1,485 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.clearing = {
5
+ name : 'clearing',
6
+
7
+ version: '5.1.1',
8
+
9
+ settings : {
10
+ templates : {
11
+ viewing : '<a href="#" class="clearing-close">&times;</a>' +
12
+ '<div class="visible-img" style="display: none"><div class="clearing-touch-label"></div><img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D" alt="" />' +
13
+ '<p class="clearing-caption"></p><a href="#" class="clearing-main-prev"><span></span></a>' +
14
+ '<a href="#" class="clearing-main-next"><span></span></a></div>'
15
+ },
16
+
17
+ // comma delimited list of selectors that, on click, will close clearing,
18
+ // add 'div.clearing-blackout, div.visible-img' to close on background click
19
+ close_selectors : '.clearing-close',
20
+
21
+ touch_label : '&larr;&nbsp;Swipe to Advance&nbsp;&rarr;',
22
+
23
+ // event initializers and locks
24
+ init : false,
25
+ locked : false
26
+ },
27
+
28
+ init : function (scope, method, options) {
29
+ var self = this;
30
+ Foundation.inherit(this, 'throttle image_loaded');
31
+
32
+ this.bindings(method, options);
33
+
34
+ if (self.S(this.scope).is('[' + this.attr_name() + ']')) {
35
+ this.assemble(self.S('li', this.scope));
36
+ } else {
37
+ self.S('[' + this.attr_name() + ']', this.scope).each(function () {
38
+ self.assemble(self.S('li', this));
39
+ });
40
+ }
41
+ },
42
+
43
+ events : function (scope) {
44
+ var self = this,
45
+ S = self.S;
46
+
47
+ S(this.scope)
48
+ .off('.clearing')
49
+ .on('click.fndtn.clearing', 'ul[' + this.attr_name() + '] li',
50
+ function (e, current, target) {
51
+ var current = current || S(this),
52
+ target = target || current,
53
+ next = current.next('li'),
54
+ settings = current.closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init'),
55
+ image = S(e.target);
56
+
57
+ e.preventDefault();
58
+
59
+ if (!settings) {
60
+ self.init();
61
+ settings = current.closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
62
+ }
63
+
64
+ // if clearing is open and the current image is
65
+ // clicked, go to the next image in sequence
66
+ if (target.hasClass('visible') &&
67
+ current[0] === target[0] &&
68
+ next.length > 0 && self.is_open(current)) {
69
+ target = next;
70
+ image = S('img', target);
71
+ }
72
+
73
+ // set current and target to the clicked li if not otherwise defined.
74
+ self.open(image, current, target);
75
+ self.update_paddles(target);
76
+ })
77
+
78
+ .on('click.fndtn.clearing', '.clearing-main-next',
79
+ function (e) { self.nav(e, 'next') })
80
+ .on('click.fndtn.clearing', '.clearing-main-prev',
81
+ function (e) { self.nav(e, 'prev') })
82
+ .on('click.fndtn.clearing', this.settings.close_selectors,
83
+ function (e) { Foundation.libs.clearing.close(e, this) })
84
+ .on('keydown.fndtn.clearing',
85
+ function (e) { self.keydown(e) });
86
+
87
+ S(window).off('.clearing').on('resize.fndtn.clearing',
88
+ function () { self.resize() });
89
+
90
+ this.swipe_events(scope);
91
+ },
92
+
93
+ swipe_events : function (scope) {
94
+ var self = this,
95
+ S = self.S;
96
+
97
+ S(this.scope)
98
+ .on('touchstart.fndtn.clearing', '.visible-img', function(e) {
99
+ if (!e.touches) { e = e.originalEvent; }
100
+ var data = {
101
+ start_page_x: e.touches[0].pageX,
102
+ start_page_y: e.touches[0].pageY,
103
+ start_time: (new Date()).getTime(),
104
+ delta_x: 0,
105
+ is_scrolling: undefined
106
+ };
107
+
108
+ S(this).data('swipe-transition', data);
109
+ e.stopPropagation();
110
+ })
111
+ .on('touchmove.fndtn.clearing', '.visible-img', function(e) {
112
+ if (!e.touches) { e = e.originalEvent; }
113
+ // Ignore pinch/zoom events
114
+ if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
115
+
116
+ var data = S(this).data('swipe-transition');
117
+
118
+ if (typeof data === 'undefined') {
119
+ data = {};
120
+ }
121
+
122
+ data.delta_x = e.touches[0].pageX - data.start_page_x;
123
+
124
+ if ( typeof data.is_scrolling === 'undefined') {
125
+ data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
126
+ }
127
+
128
+ if (!data.is_scrolling && !data.active) {
129
+ e.preventDefault();
130
+ var direction = (data.delta_x < 0) ? 'next' : 'prev';
131
+ data.active = true;
132
+ self.nav(e, direction);
133
+ }
134
+ })
135
+ .on('touchend.fndtn.clearing', '.visible-img', function(e) {
136
+ S(this).data('swipe-transition', {});
137
+ e.stopPropagation();
138
+ });
139
+ },
140
+
141
+ assemble : function ($li) {
142
+ var $el = $li.parent();
143
+
144
+ if ($el.parent().hasClass('carousel')) return;
145
+ $el.after('<div id="foundationClearingHolder"></div>');
146
+
147
+ var holder = this.S('#foundationClearingHolder'),
148
+ settings = $el.data(this.attr_name(true) + '-init'),
149
+ grid = $el.detach(),
150
+ data = {
151
+ grid: '<div class="carousel">' + grid[0].outerHTML + '</div>',
152
+ viewing: settings.templates.viewing
153
+ },
154
+ wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
155
+ data.grid + '</div></div>',
156
+ touch_label = this.settings.touch_label;
157
+
158
+ if (Modernizr.touch) {
159
+ wrapper = $(wrapper).find('.clearing-touch-label').html(touch_label).end();
160
+ }
161
+
162
+ holder.after(wrapper).remove();
163
+ },
164
+
165
+ open : function ($image, current, target) {
166
+ var self = this,
167
+ root = target.closest('.clearing-assembled'),
168
+ container = self.S('div', root).first(),
169
+ visible_image = self.S('.visible-img', container),
170
+ image = self.S('img', visible_image).not($image),
171
+ label = self.S('.clearing-touch-label', container);
172
+
173
+ if (!this.locked()) {
174
+ // set the image to the selected thumbnail
175
+ image
176
+ .attr('src', this.load($image))
177
+ .css('visibility', 'hidden');
178
+
179
+ this.image_loaded(image, function () {
180
+ image.css('visibility', 'visible');
181
+ // toggle the gallery
182
+ root.addClass('clearing-blackout');
183
+ container.addClass('clearing-container');
184
+ visible_image.show();
185
+ this.fix_height(target)
186
+ .caption(self.S('.clearing-caption', visible_image), $image)
187
+ .center_and_label(image,label)
188
+ .shift(current, target, function () {
189
+ target.siblings().removeClass('visible');
190
+ target.addClass('visible');
191
+ });
192
+ }.bind(this));
193
+ }
194
+ },
195
+
196
+ close : function (e, el) {
197
+ e.preventDefault();
198
+
199
+ var root = (function (target) {
200
+ if (/blackout/.test(target.selector)) {
201
+ return target;
202
+ } else {
203
+ return target.closest('.clearing-blackout');
204
+ }
205
+ }($(el))), container, visible_image;
206
+
207
+ if (el === e.target && root) {
208
+ container = $('div', root).first();
209
+ visible_image = $('.visible-img', container);
210
+ this.settings.prev_index = 0;
211
+ $('ul[' + this.attr_name() + ']', root)
212
+ .attr('style', '').closest('.clearing-blackout')
213
+ .removeClass('clearing-blackout');
214
+ container.removeClass('clearing-container');
215
+ visible_image.hide();
216
+ }
217
+
218
+ return false;
219
+ },
220
+
221
+ is_open : function (current) {
222
+ return current.parent().prop('style').length > 0;
223
+ },
224
+
225
+ keydown : function (e) {
226
+ var clearing = $('ul[' + this.attr_name() + ']', '.clearing-blackout'),
227
+ NEXT_KEY = this.rtl ? 37 : 39,
228
+ PREV_KEY = this.rtl ? 39 : 37,
229
+ ESC_KEY = 27;
230
+
231
+ if (e.which === NEXT_KEY) this.go(clearing, 'next');
232
+ if (e.which === PREV_KEY) this.go(clearing, 'prev');
233
+ if (e.which === ESC_KEY) this.S('a.clearing-close').trigger('click');
234
+ },
235
+
236
+ nav : function (e, direction) {
237
+ var clearing = $('ul[' + this.attr_name() + ']', '.clearing-blackout');
238
+
239
+ e.preventDefault();
240
+ this.go(clearing, direction);
241
+ },
242
+
243
+ resize : function () {
244
+ var image = $('img', '.clearing-blackout .visible-img'),
245
+ label = $('.clearing-touch-label', '.clearing-blackout');
246
+
247
+ if (image.length) {
248
+ this.center_and_label(image, label);
249
+ }
250
+ },
251
+
252
+ // visual adjustments
253
+ fix_height : function (target) {
254
+ var lis = target.parent().children(),
255
+ self = this;
256
+
257
+ lis.each(function () {
258
+ var li = self.S(this),
259
+ image = li.find('img');
260
+
261
+ if (li.height() > image.outerHeight()) {
262
+ li.addClass('fix-height');
263
+ }
264
+ })
265
+ .closest('ul')
266
+ .width(lis.length * 100 + '%');
267
+
268
+ return this;
269
+ },
270
+
271
+ update_paddles : function (target) {
272
+ var visible_image = target
273
+ .closest('.carousel')
274
+ .siblings('.visible-img');
275
+
276
+ if (target.next().length > 0) {
277
+ this.S('.clearing-main-next', visible_image)
278
+ .removeClass('disabled');
279
+ } else {
280
+ this.S('.clearing-main-next', visible_image)
281
+ .addClass('disabled');
282
+ }
283
+
284
+ if (target.prev().length > 0) {
285
+ this.S('.clearing-main-prev', visible_image)
286
+ .removeClass('disabled');
287
+ } else {
288
+ this.S('.clearing-main-prev', visible_image)
289
+ .addClass('disabled');
290
+ }
291
+ },
292
+
293
+ center_and_label : function (target, label) {
294
+ if (!this.rtl) {
295
+ target.css({
296
+ marginLeft : -(target.outerWidth() / 2),
297
+ marginTop : -(target.outerHeight() / 2)
298
+ });
299
+ label.css({
300
+ marginLeft : -(label.outerWidth() / 2),
301
+ marginTop : -(target.outerHeight() / 2)-label.outerHeight()-10
302
+ });
303
+ } else {
304
+ target.css({
305
+ marginRight : -(target.outerWidth() / 2),
306
+ marginTop : -(target.outerHeight() / 2),
307
+ left: 'auto',
308
+ right: '50%'
309
+ });
310
+ label.css({
311
+ marginRight : -(label.outerWidth() / 2),
312
+ marginTop : -(target.outerHeight() / 2)-label.outerHeight()-10,
313
+ left: 'auto',
314
+ right: '50%'
315
+ });
316
+ }
317
+ return this;
318
+ },
319
+
320
+ // image loading and preloading
321
+
322
+ load : function ($image) {
323
+ if ($image[0].nodeName === "A") {
324
+ var href = $image.attr('href');
325
+ } else {
326
+ var href = $image.parent().attr('href');
327
+ }
328
+
329
+ this.preload($image);
330
+
331
+ if (href) return href;
332
+ return $image.attr('src');
333
+ },
334
+
335
+ preload : function ($image) {
336
+ this
337
+ .img($image.closest('li').next())
338
+ .img($image.closest('li').prev());
339
+ },
340
+
341
+ img : function (img) {
342
+ if (img.length) {
343
+ var new_img = new Image(),
344
+ new_a = this.S('a', img);
345
+
346
+ if (new_a.length) {
347
+ new_img.src = new_a.attr('href');
348
+ } else {
349
+ new_img.src = this.S('img', img).attr('src');
350
+ }
351
+ }
352
+ return this;
353
+ },
354
+
355
+ // image caption
356
+
357
+ caption : function (container, $image) {
358
+ var caption = $image.data('caption');
359
+
360
+ if (caption) {
361
+ container
362
+ .html(caption)
363
+ .show();
364
+ } else {
365
+ container
366
+ .text('')
367
+ .hide();
368
+ }
369
+ return this;
370
+ },
371
+
372
+ // directional methods
373
+
374
+ go : function ($ul, direction) {
375
+ var current = this.S('.visible', $ul),
376
+ target = current[direction]();
377
+
378
+ if (target.length) {
379
+ this.S('img', target)
380
+ .trigger('click', [current, target]);
381
+ }
382
+ },
383
+
384
+ shift : function (current, target, callback) {
385
+ var clearing = target.parent(),
386
+ old_index = this.settings.prev_index || target.index(),
387
+ direction = this.direction(clearing, current, target),
388
+ dir = this.rtl ? 'right' : 'left',
389
+ left = parseInt(clearing.css('left'), 10),
390
+ width = target.outerWidth(),
391
+ skip_shift;
392
+
393
+ var dir_obj = {};
394
+
395
+ // we use jQuery animate instead of CSS transitions because we
396
+ // need a callback to unlock the next animation
397
+ // needs support for RTL **
398
+ if (target.index() !== old_index && !/skip/.test(direction)){
399
+ if (/left/.test(direction)) {
400
+ this.lock();
401
+ dir_obj[dir] = left + width;
402
+ clearing.animate(dir_obj, 300, this.unlock());
403
+ } else if (/right/.test(direction)) {
404
+ this.lock();
405
+ dir_obj[dir] = left - width;
406
+ clearing.animate(dir_obj, 300, this.unlock());
407
+ }
408
+ } else if (/skip/.test(direction)) {
409
+ // the target image is not adjacent to the current image, so
410
+ // do we scroll right or not
411
+ skip_shift = target.index() - this.settings.up_count;
412
+ this.lock();
413
+
414
+ if (skip_shift > 0) {
415
+ dir_obj[dir] = -(skip_shift * width);
416
+ clearing.animate(dir_obj, 300, this.unlock());
417
+ } else {
418
+ dir_obj[dir] = 0;
419
+ clearing.animate(dir_obj, 300, this.unlock());
420
+ }
421
+ }
422
+
423
+ callback();
424
+ },
425
+
426
+ direction : function ($el, current, target) {
427
+ var lis = this.S('li', $el),
428
+ li_width = lis.outerWidth() + (lis.outerWidth() / 4),
429
+ up_count = Math.floor(this.S('.clearing-container').outerWidth() / li_width) - 1,
430
+ target_index = lis.index(target),
431
+ response;
432
+
433
+ this.settings.up_count = up_count;
434
+
435
+ if (this.adjacent(this.settings.prev_index, target_index)) {
436
+ if ((target_index > up_count)
437
+ && target_index > this.settings.prev_index) {
438
+ response = 'right';
439
+ } else if ((target_index > up_count - 1)
440
+ && target_index <= this.settings.prev_index) {
441
+ response = 'left';
442
+ } else {
443
+ response = false;
444
+ }
445
+ } else {
446
+ response = 'skip';
447
+ }
448
+
449
+ this.settings.prev_index = target_index;
450
+
451
+ return response;
452
+ },
453
+
454
+ adjacent : function (current_index, target_index) {
455
+ for (var i = target_index + 1; i >= target_index - 1; i--) {
456
+ if (i === current_index) return true;
457
+ }
458
+ return false;
459
+ },
460
+
461
+ // lock management
462
+
463
+ lock : function () {
464
+ this.settings.locked = true;
465
+ },
466
+
467
+ unlock : function () {
468
+ this.settings.locked = false;
469
+ },
470
+
471
+ locked : function () {
472
+ return this.settings.locked;
473
+ },
474
+
475
+ off : function () {
476
+ this.S(this.scope).off('.fndtn.clearing');
477
+ this.S(window).off('.fndtn.clearing');
478
+ },
479
+
480
+ reflow : function () {
481
+ this.init();
482
+ }
483
+ };
484
+
485
+ }(jQuery, this, this.document));
@@ -0,0 +1,208 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.dropdown = {
5
+ name : 'dropdown',
6
+
7
+ version : '5.1.1',
8
+
9
+ settings : {
10
+ active_class: 'open',
11
+ is_hover: false,
12
+ opened: function(){},
13
+ closed: function(){}
14
+ },
15
+
16
+ init : function (scope, method, options) {
17
+ Foundation.inherit(this, 'throttle');
18
+
19
+ this.bindings(method, options);
20
+ },
21
+
22
+ events : function (scope) {
23
+ var self = this,
24
+ S = self.S;
25
+
26
+ S(this.scope)
27
+ .off('.dropdown')
28
+ .on('click.fndtn.dropdown', '[' + this.attr_name() + ']', function (e) {
29
+ var settings = S(this).data(self.attr_name(true) + '-init') || self.settings;
30
+ e.preventDefault();
31
+ if (!settings.is_hover || Modernizr.touch) self.toggle(S(this));
32
+ })
33
+ .on('mouseenter.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
34
+ var $this = S(this);
35
+ clearTimeout(self.timeout);
36
+
37
+ if ($this.data(self.data_attr())) {
38
+ var dropdown = S('#' + $this.data(self.data_attr())),
39
+ target = $this;
40
+ } else {
41
+ var dropdown = $this;
42
+ target = S("[" + self.attr_name() + "='" + dropdown.attr('id') + "']");
43
+ }
44
+
45
+ var settings = target.data(self.attr_name(true) + '-init') || self.settings;
46
+
47
+ if(S(e.target).data(self.data_attr()) && settings.is_hover) {
48
+ self.closeall.call(self);
49
+ }
50
+
51
+ if (settings.is_hover) self.open.apply(self, [dropdown, target]);
52
+ })
53
+ .on('mouseleave.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
54
+ var $this = S(this);
55
+ self.timeout = setTimeout(function () {
56
+ if ($this.data(self.data_attr())) {
57
+ var settings = $this.data(self.data_attr(true) + '-init') || self.settings;
58
+ if (settings.is_hover) self.close.call(self, S('#' + $this.data(self.data_attr())));
59
+ } else {
60
+ var target = S('[' + self.attr_name() + '="' + S(this).attr('id') + '"]'),
61
+ settings = target.data(self.attr_name(true) + '-init') || self.settings;
62
+ if (settings.is_hover) self.close.call(self, $this);
63
+ }
64
+ }.bind(this), 150);
65
+ })
66
+ .on('click.fndtn.dropdown', function (e) {
67
+ var parent = S(e.target).closest('[' + self.attr_name() + '-content]');
68
+
69
+ if (S(e.target).data(self.data_attr()) || S(e.target).parent().data(self.data_attr())) {
70
+ return;
71
+ }
72
+ if (!(S(e.target).data('revealId')) &&
73
+ (parent.length > 0 && (S(e.target).is('[' + self.attr_name() + '-content]') ||
74
+ $.contains(parent.first()[0], e.target)))) {
75
+ e.stopPropagation();
76
+ return;
77
+ }
78
+
79
+ self.close.call(self, S('[' + self.attr_name() + '-content]'));
80
+ })
81
+ .on('opened.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
82
+ self.settings.opened.call(this);
83
+ })
84
+ .on('closed.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
85
+ self.settings.closed.call(this);
86
+ });
87
+
88
+ S(window)
89
+ .off('.dropdown')
90
+ .on('resize.fndtn.dropdown', self.throttle(function () {
91
+ self.resize.call(self);
92
+ }, 50)).trigger('resize');
93
+ },
94
+
95
+ close: function (dropdown) {
96
+ var self = this;
97
+ dropdown.each(function () {
98
+ if (self.S(this).hasClass(self.settings.active_class)) {
99
+ self.S(this)
100
+ .css(Foundation.rtl ? 'right':'left', '-99999px')
101
+ .removeClass(self.settings.active_class);
102
+ self.S(this).trigger('closed');
103
+ }
104
+ });
105
+ },
106
+
107
+ closeall: function() {
108
+ var self = this;
109
+ $.each(self.S('[' + this.attr_name() + '-content]'), function() {
110
+ self.close.call(self, self.S(this))
111
+ });
112
+ },
113
+
114
+ open: function (dropdown, target) {
115
+ this
116
+ .css(dropdown
117
+ .addClass(this.settings.active_class), target);
118
+ dropdown.trigger('opened');
119
+ },
120
+
121
+ data_attr: function () {
122
+ if (this.namespace.length > 0) {
123
+ return this.namespace + '-' + this.name;
124
+ }
125
+
126
+ return this.name;
127
+ },
128
+
129
+ toggle : function (target) {
130
+ var dropdown = this.S('#' + target.data(this.data_attr()));
131
+ if (dropdown.length === 0) {
132
+ // No dropdown found, not continuing
133
+ return;
134
+ }
135
+
136
+ this.close.call(this, this.S('[' + this.attr_name() + '-content]').not(dropdown));
137
+
138
+ if (dropdown.hasClass(this.settings.active_class)) {
139
+ this.close.call(this, dropdown);
140
+ } else {
141
+ this.close.call(this, this.S('[' + this.attr_name() + '-content]'))
142
+ this.open.call(this, dropdown, target);
143
+ }
144
+ },
145
+
146
+ resize : function () {
147
+ var dropdown = this.S('[' + this.attr_name() + '-content].open'),
148
+ target = this.S("[" + this.attr_name() + "='" + dropdown.attr('id') + "']");
149
+
150
+ if (dropdown.length && target.length) {
151
+ this.css(dropdown, target);
152
+ }
153
+ },
154
+
155
+ css : function (dropdown, target) {
156
+ var offset_parent = dropdown.offsetParent(),
157
+ position = target.offset();
158
+
159
+ position.top -= offset_parent.offset().top;
160
+ position.left -= offset_parent.offset().left;
161
+
162
+ if (this.small()) {
163
+ dropdown.css({
164
+ position : 'absolute',
165
+ width: '95%',
166
+ 'max-width': 'none',
167
+ top: position.top + target.outerHeight()
168
+ });
169
+ dropdown.css(Foundation.rtl ? 'right':'left', '2.5%');
170
+ } else {
171
+ if (!Foundation.rtl && this.S(window).width() > dropdown.outerWidth() + target.offset().left) {
172
+ var left = position.left;
173
+ if (dropdown.hasClass('right')) {
174
+ dropdown.removeClass('right');
175
+ }
176
+ } else {
177
+ if (!dropdown.hasClass('right')) {
178
+ dropdown.addClass('right');
179
+ }
180
+ var left = position.left - (dropdown.outerWidth() - target.outerWidth());
181
+ }
182
+
183
+ dropdown.attr('style', '').css({
184
+ position : 'absolute',
185
+ top: position.top + target.outerHeight(),
186
+ left: left
187
+ });
188
+ }
189
+
190
+ return dropdown;
191
+ },
192
+
193
+ small : function () {
194
+ return matchMedia(Foundation.media_queries.small).matches &&
195
+ !matchMedia(Foundation.media_queries.medium).matches;
196
+ },
197
+
198
+ off: function () {
199
+ this.S(this.scope).off('.fndtn.dropdown');
200
+ this.S('html, body').off('.fndtn.dropdown');
201
+ this.S(window).off('.fndtn.dropdown');
202
+ this.S('[data-dropdown-content]').off('.fndtn.dropdown');
203
+ this.settings.init = false;
204
+ },
205
+
206
+ reflow : function () {}
207
+ };
208
+ }(jQuery, this, this.document));