locomotivecms_wagon 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +1 -1
  3. data/README.md +1 -1
  4. data/Rakefile +2 -2
  5. data/generators/blank/Gemfile.tt +3 -1
  6. data/generators/blank/config/deploy.yml +4 -1
  7. data/generators/bootstrap/Gemfile.tt +3 -1
  8. data/generators/bootstrap/config/deploy.yml +4 -1
  9. data/generators/cloned/Gemfile.tt +3 -1
  10. data/generators/cloned/config/deploy.yml.tt +5 -1
  11. data/generators/foundation/Gemfile.tt +4 -2
  12. data/generators/foundation/app/views/pages/index.liquid +3 -1
  13. data/generators/foundation/app/views/pages/index.liquid.haml +18 -16
  14. data/generators/foundation/config/deploy.yml +4 -1
  15. data/generators/foundation/public/javascripts/foundation.min.js +32 -14
  16. data/generators/foundation/public/javascripts/foundation/foundation.alerts.js +4 -2
  17. data/generators/foundation/public/javascripts/foundation/foundation.clearing.js +67 -31
  18. data/generators/foundation/public/javascripts/foundation/foundation.cookie.js +1 -1
  19. data/generators/foundation/public/javascripts/foundation/foundation.dropdown.js +73 -25
  20. data/generators/foundation/public/javascripts/foundation/foundation.forms.js +356 -235
  21. data/generators/foundation/public/javascripts/foundation/foundation.interchange.js +271 -0
  22. data/generators/foundation/public/javascripts/foundation/foundation.joyride.js +265 -33
  23. data/generators/foundation/public/javascripts/foundation/foundation.js +130 -55
  24. data/generators/foundation/public/javascripts/foundation/foundation.magellan.js +6 -4
  25. data/generators/foundation/public/javascripts/foundation/foundation.orbit.js +38 -13
  26. data/generators/foundation/public/javascripts/foundation/foundation.placeholder.js +1 -1
  27. data/generators/foundation/public/javascripts/foundation/foundation.reveal.js +74 -14
  28. data/generators/foundation/public/javascripts/foundation/foundation.section.js +210 -66
  29. data/generators/foundation/public/javascripts/foundation/foundation.tooltips.js +25 -12
  30. data/generators/foundation/public/javascripts/foundation/foundation.topbar.js +126 -54
  31. data/generators/foundation/public/javascripts/vendor/custom.modernizr.js +1 -1
  32. data/generators/foundation/public/javascripts/vendor/jquery.js +1 -1
  33. data/generators/foundation/public/javascripts/vendor/zepto.js +1 -1
  34. data/generators/foundation/public/stylesheets/foundation.css +870 -438
  35. data/generators/foundation/public/stylesheets/foundation.min.css +440 -1
  36. data/generators/foundation/public/stylesheets/normalize.css +89 -146
  37. data/generators/page/template.liquid.haml.tt +6 -7
  38. data/generators/page/template.liquid.tt +34 -1
  39. data/lib/locomotive/wagon.rb +15 -1
  40. data/lib/locomotive/wagon/cli.rb +8 -4
  41. data/lib/locomotive/wagon/generators/site/foundation.rb +1 -1
  42. data/lib/locomotive/wagon/liquid.rb +1 -2
  43. data/lib/locomotive/wagon/liquid/drops/content_types.rb +6 -22
  44. data/lib/locomotive/wagon/liquid/drops/page.rb +6 -14
  45. data/lib/locomotive/wagon/liquid/drops/site.rb +4 -1
  46. data/lib/locomotive/wagon/liquid/filters/html.rb +1 -1
  47. data/lib/locomotive/wagon/liquid/filters/translate.rb +10 -6
  48. data/lib/locomotive/wagon/liquid/tags/nav.rb +3 -2
  49. data/lib/locomotive/wagon/misc/dragonfly.rb +1 -1
  50. data/lib/locomotive/wagon/scopeable.rb +28 -0
  51. data/lib/locomotive/wagon/server/page.rb +7 -1
  52. data/lib/locomotive/wagon/version.rb +1 -1
  53. data/locales/de.yml +13 -12
  54. data/locales/en.yml +13 -12
  55. data/locales/es.yml +13 -12
  56. data/locales/et.yml +13 -12
  57. data/locales/fr.yml +14 -12
  58. data/locales/it.yml +13 -12
  59. data/locales/nb.yml +13 -12
  60. data/locales/nl.yml +11 -10
  61. data/locales/pl.yml +13 -12
  62. data/locales/pt-BR.yml +13 -12
  63. data/locales/ru.yml +13 -12
  64. data/locomotivecms_wagon.gemspec +2 -1
  65. data/spec/fixtures/default/app/views/pages/grunge_bands.liquid.haml +8 -0
  66. data/spec/fixtures/default/app/views/pages/index.liquid.haml +3 -0
  67. data/spec/fixtures/default/app/views/pages/music.liquid.haml +1 -1
  68. data/spec/fixtures/default/app/views/pages/songs/template.liquid.haml +4 -0
  69. data/spec/fixtures/default/app/views/pages/tags/nav.liquid.haml +6 -0
  70. data/spec/fixtures/default/app/views/pages/unlisted_pages.liquid.haml +9 -0
  71. data/spec/integration/cassettes/pull.yml +397 -240
  72. data/spec/integration/cassettes/push.yml +468 -438
  73. data/spec/integration/cassettes/staging.yml +846 -0
  74. data/spec/integration/cli_spec.rb +19 -0
  75. data/spec/integration/server/basic_spec.rb +34 -5
  76. data/spec/integration/server/liquid_spec.rb +39 -0
  77. data/spec/integration/sites_spec.rb +28 -4
  78. data/spec/spec_helper.rb +1 -0
  79. data/spec/support/helpers.rb +8 -1
  80. metadata +37 -53
@@ -156,4 +156,4 @@
156
156
  }
157
157
  }
158
158
 
159
- }(this, document, Foundation.zj));
159
+ }(this, document, Foundation.zj));
@@ -6,7 +6,7 @@
6
6
  Foundation.libs.reveal = {
7
7
  name: 'reveal',
8
8
 
9
- version : '4.0.9',
9
+ version : '4.2.0',
10
10
 
11
11
  locked : false,
12
12
 
@@ -14,6 +14,7 @@
14
14
  animation: 'fadeAndPop',
15
15
  animationSpeed: 250,
16
16
  closeOnBackgroundClick: true,
17
+ closeOnEsc: true,
17
18
  dismissModalClass: 'close-reveal-modal',
18
19
  bgClass: 'reveal-modal-bg',
19
20
  open: function(){},
@@ -36,11 +37,12 @@
36
37
  },
37
38
 
38
39
  init : function (scope, method, options) {
39
- this.scope = scope || this.scope;
40
40
  Foundation.inherit(this, 'data_options delay');
41
41
 
42
42
  if (typeof method === 'object') {
43
43
  $.extend(true, this.settings, method);
44
+ } else if (typeof options !== 'undefined') {
45
+ $.extend(true, this.settings, options);
44
46
  }
45
47
 
46
48
  if (typeof method != 'string') {
@@ -59,14 +61,30 @@
59
61
  .off('.fndtn.reveal')
60
62
  .on('click.fndtn.reveal', '[data-reveal-id]', function (e) {
61
63
  e.preventDefault();
64
+
62
65
  if (!self.locked) {
66
+ var element = $(this),
67
+ ajax = element.data('reveal-ajax');
68
+
63
69
  self.locked = true;
64
- self.open.call(self, $(this));
70
+
71
+ if (typeof ajax === 'undefined') {
72
+ self.open.call(self, element);
73
+ } else {
74
+ var url = ajax === true ? element.attr('href') : ajax;
75
+
76
+ self.open.call(self, element, {url: url});
77
+ }
65
78
  }
66
79
  })
67
80
  .on('click.fndtn.reveal touchend.click.fndtn.reveal', this.close_targets(), function (e) {
68
81
  e.preventDefault();
69
82
  if (!self.locked) {
83
+ var settings = $.extend({}, self.settings, self.data_options($('.reveal-modal.open')));
84
+ if ($(e.target)[0] === $('.' + settings.bgClass)[0] && !settings.closeOnBackgroundClick) {
85
+ return;
86
+ }
87
+
70
88
  self.locked = true;
71
89
  self.close.call(self, $(this).closest('.reveal-modal'));
72
90
  }
@@ -78,12 +96,26 @@
78
96
  .on('closed.fndtn.reveal', '.reveal-modal', this.settings.closed)
79
97
  .on('closed.fndtn.reveal', '.reveal-modal', this.close_video);
80
98
 
99
+ $( 'body' ).bind( 'keyup.reveal', function ( event ) {
100
+ var open_modal = $('.reveal-modal.open'),
101
+ settings = $.extend({}, self.settings, self.data_options(open_modal));
102
+ if ( event.which === 27 && settings.closeOnEsc) { // 27 is the keycode for the Escape key
103
+ open_modal.foundation('reveal', 'close');
104
+ }
105
+ });
106
+
81
107
  return true;
82
108
  },
83
109
 
84
- open : function (target) {
110
+ open : function (target, ajax_settings) {
85
111
  if (target) {
86
- var modal = $('#' + target.data('reveal-id'));
112
+ if (typeof target.selector !== 'undefined') {
113
+ var modal = $('#' + target.data('reveal-id'));
114
+ } else {
115
+ var modal = $(this.scope);
116
+
117
+ ajax_settings = target;
118
+ }
87
119
  } else {
88
120
  var modal = $(this.scope);
89
121
  }
@@ -101,14 +133,36 @@
101
133
  if (open_modal.length < 1) {
102
134
  this.toggle_bg(modal);
103
135
  }
104
- this.hide(open_modal, this.settings.css.open);
105
- this.show(modal, this.settings.css.open);
136
+
137
+ if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
138
+ this.hide(open_modal, this.settings.css.close);
139
+ this.show(modal, this.settings.css.open);
140
+ } else {
141
+ var self = this,
142
+ old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
143
+
144
+ $.extend(ajax_settings, {
145
+ success: function (data, textStatus, jqXHR) {
146
+ if ( $.isFunction(old_success) ) {
147
+ old_success(data, textStatus, jqXHR);
148
+ }
149
+
150
+ modal.html(data);
151
+ $(modal).foundation('section', 'reflow');
152
+
153
+ self.hide(open_modal, self.settings.css.close);
154
+ self.show(modal, self.settings.css.open);
155
+ }
156
+ });
157
+
158
+ $.ajax(ajax_settings);
159
+ }
106
160
  }
107
161
  },
108
162
 
109
163
  close : function (modal) {
110
164
 
111
- var modal = modal || $(this.scope),
165
+ var modal = modal && modal.length ? modal : $(this.scope),
112
166
  open_modals = $('.reveal-modal.open');
113
167
 
114
168
  if (open_modals.length > 0) {
@@ -132,7 +186,7 @@
132
186
  toggle_bg : function (modal) {
133
187
  if ($('.reveal-modal-bg').length === 0) {
134
188
  this.settings.bg = $('<div />', {'class': this.settings.bgClass})
135
- .insertAfter(modal);
189
+ .appendTo('body');
136
190
  }
137
191
 
138
192
  if (this.settings.bg.filter(':visible').length > 0) {
@@ -150,7 +204,7 @@
150
204
  var end_css = {
151
205
  top: $(window).scrollTop() + el.data('css-top') + 'px',
152
206
  opacity: 1
153
- }
207
+ };
154
208
 
155
209
  return this.delay(function () {
156
210
  return el
@@ -238,7 +292,7 @@
238
292
  if (iframe.length > 0) {
239
293
  iframe.attr('data-src', iframe[0].src);
240
294
  iframe.attr('src', 'about:blank');
241
- video.fadeOut(100).hide();
295
+ video.hide();
242
296
  }
243
297
  },
244
298
 
@@ -250,8 +304,12 @@
250
304
  var data_src = iframe.attr('data-src');
251
305
  if (typeof data_src === 'string') {
252
306
  iframe[0].src = iframe.attr('data-src');
307
+ } else {
308
+ var src = iframe[0].src;
309
+ iframe[0].src = undefined;
310
+ iframe[0].src = src;
253
311
  }
254
- video.show().fadeIn(100);
312
+ video.show();
255
313
  }
256
314
  },
257
315
 
@@ -265,6 +323,8 @@
265
323
 
266
324
  off : function () {
267
325
  $(this.scope).off('.fndtn.reveal');
268
- }
326
+ },
327
+
328
+ reflow : function () {}
269
329
  };
270
- }(Foundation.zj, this, this.document));
330
+ }(Foundation.zj, this, this.document));
@@ -6,19 +6,27 @@
6
6
  Foundation.libs.section = {
7
7
  name: 'section',
8
8
 
9
- version : '4.0.9',
9
+ version : '4.2.0',
10
10
 
11
11
  settings : {
12
12
  deep_linking: false,
13
13
  one_up: true,
14
+ section_selector : '[data-section]',
15
+ region_selector : 'section, .section, [data-section-region]',
16
+ title_selector : '.title, [data-section-title]',
17
+ active_region_selector : 'section.active, .section.active, .active[data-section-region]',
18
+ content_selector : '.content, [data-section-content]',
19
+ nav_selector : '[data-section="vertical-nav"], [data-section="horizontal-nav"]',
14
20
  callback: function (){}
15
21
  },
16
22
 
17
23
  init : function (scope, method, options) {
18
24
  var self = this;
25
+ Foundation.inherit(this, 'throttle data_options position_right offset_right');
19
26
 
20
- this.scope = scope || this.scope;
21
- Foundation.inherit(this, 'throttle data_options');
27
+ if (typeof method === 'object') {
28
+ $.extend(true, self.settings, method);
29
+ }
22
30
 
23
31
  if (typeof method != 'string') {
24
32
  this.set_active_from_hash();
@@ -34,11 +42,14 @@
34
42
  var self = this;
35
43
 
36
44
  $(this.scope)
37
- .on('click.fndtn.section', '[data-section] .title', function (e) {
45
+ .on('click.fndtn.section', '[data-section] .title, [data-section] [data-section-title]', function (e) {
38
46
  var $this = $(this),
39
- section = $this.closest('[data-section]');
47
+ section = $this.closest(self.settings.region_selector);
40
48
 
41
- self.toggle_active.call(this, e, self);
49
+ if (section.children(self.settings.content_selector).length > 0) {
50
+ self.toggle_active.call(this, e, self);
51
+ self.reflow();
52
+ }
42
53
  });
43
54
 
44
55
  $(window)
@@ -54,9 +65,9 @@
54
65
 
55
66
  $(document)
56
67
  .on('click.fndtn.section', function (e) {
57
- if ($(e.target).closest('.title').length < 1) {
58
- $('[data-section="vertical-nav"], [data-section="horizontal-nav"]')
59
- .find('section, .section')
68
+ if ($(e.target).closest(self.settings.title_selector).length < 1) {
69
+ $(self.settings.nav_selector)
70
+ .children(self.settings.region_selector)
60
71
  .removeClass('active')
61
72
  .attr('style', '');
62
73
  }
@@ -66,11 +77,13 @@
66
77
 
67
78
  toggle_active : function (e, self) {
68
79
  var $this = $(this),
69
- section = $this.closest('section, .section'),
70
- content = section.find('.content'),
71
- parent = section.closest('[data-section]'),
72
80
  self = Foundation.libs.section,
73
- settings = $.extend({}, self.settings, self.data_options(parent));
81
+ region = $this.closest(self.settings.region_selector),
82
+ content = $this.siblings(self.settings.content_selector),
83
+ parent = region.parent(),
84
+ settings = $.extend({}, self.settings, self.data_options(parent)),
85
+ prev_active_section = parent
86
+ .children(self.settings.active_region_selector);
74
87
 
75
88
  self.settings.toggled = true;
76
89
 
@@ -78,39 +91,60 @@
78
91
  e.preventDefault();
79
92
  }
80
93
 
81
- if (section.hasClass('active')) {
94
+ if (region.hasClass('active')) {
95
+ // this is causing the style flash.
82
96
  if (self.small(parent)
83
- || self.is_vertical(parent)
84
- || self.is_horizontal(parent)
97
+ || self.is_vertical_nav(parent)
98
+ || self.is_horizontal_nav(parent)
85
99
  || self.is_accordion(parent)) {
86
- section
87
- .removeClass('active')
88
- .attr('style', '');
100
+ if (prev_active_section[0] !== region[0]
101
+ || (prev_active_section[0] === region[0] && !settings.one_up)) {
102
+ region
103
+ .removeClass('active')
104
+ .attr('style', '');
105
+ }
89
106
  }
90
107
  } else {
91
- var prev_active_section = null,
92
- title_height = self.outerHeight(section.find('.title'));
108
+ var prev_active_section = parent
109
+ .children(self.settings.active_region_selector),
110
+ title_height = self.outerHeight(region
111
+ .children(self.settings.title_selector));
93
112
 
94
113
  if (self.small(parent) || settings.one_up) {
95
- prev_active_section = $this.closest('[data-section]').find('section.active, .section.active');
96
114
 
97
115
  if (self.small(parent)) {
98
116
  prev_active_section.attr('style', '');
99
117
  } else {
100
- prev_active_section.attr('style', 'visibility: hidden; padding-top: '+title_height+'px;');
118
+ prev_active_section.attr('style',
119
+ 'visibility: hidden; padding-top: '+title_height+'px;');
101
120
  }
102
121
  }
103
122
 
104
123
  if (self.small(parent)) {
105
- section.attr('style', '');
124
+ region.attr('style', '');
106
125
  } else {
107
- section.css('padding-top', title_height);
126
+ region.css('padding-top', title_height);
127
+ }
128
+
129
+ region.addClass('active');
130
+
131
+ if (prev_active_section.length > 0) {
132
+ prev_active_section
133
+ .removeClass('active')
134
+ .attr('style', '');
108
135
  }
109
136
 
110
- section.addClass('active');
137
+ // Toggle the content display attribute. This is done to
138
+ // ensure accurate outerWidth measurements that account for
139
+ // the scrollbar.
140
+ if (self.is_vertical_tabs(parent)) {
141
+ content.css('display', 'block');
111
142
 
112
- if (prev_active_section !== null) {
113
- prev_active_section.removeClass('active').attr('style', '');
143
+ if (prev_active_section !== null) {
144
+ prev_active_section
145
+ .children(self.settings.content_selector)
146
+ .css('display', 'none');
147
+ }
114
148
  }
115
149
  }
116
150
 
@@ -122,12 +156,13 @@
122
156
  },
123
157
 
124
158
  resize : function () {
125
- var sections = $('[data-section]'),
126
- self = Foundation.libs.section;
159
+ var self = Foundation.libs.section,
160
+ sections = $(self.settings.section_selector);
127
161
 
128
162
  sections.each(function() {
129
163
  var $this = $(this),
130
- active_section = $this.find('section.active, .section.active'),
164
+ active_section = $this
165
+ .children(self.settings.active_region_selector),
131
166
  settings = $.extend({}, self.settings, self.data_options($this));
132
167
 
133
168
  if (active_section.length > 1) {
@@ -136,29 +171,35 @@
136
171
  .removeClass('active')
137
172
  .attr('style', '');
138
173
  } else if (active_section.length < 1
139
- && !self.is_vertical($this)
140
- && !self.is_horizontal($this)
174
+ && !self.is_vertical_nav($this)
175
+ && !self.is_horizontal_nav($this)
141
176
  && !self.is_accordion($this)) {
142
177
 
143
- var first = $this.find('section, .section').first();
144
- first.addClass('active');
178
+ var first = $this.children(self.settings.region_selector).first();
179
+
180
+ if (settings.one_up || !self.small($this)) {
181
+ first.addClass('active');
182
+ }
145
183
 
146
184
  if (self.small($this)) {
147
185
  first.attr('style', '');
148
186
  } else {
149
- first.css('padding-top', self.outerHeight(first.find('.title')));
187
+ first.css('padding-top', self.outerHeight(first
188
+ .children(self.settings.title_selector)));
150
189
  }
151
190
  }
152
191
 
153
192
  if (self.small($this)) {
154
193
  active_section.attr('style', '');
155
194
  } else {
156
- active_section.css('padding-top', self.outerHeight(active_section.find('.title')));
195
+ active_section.css('padding-top', self.outerHeight(active_section
196
+ .children(self.settings.title_selector)));
157
197
  }
158
198
 
159
199
  self.position_titles($this);
160
200
 
161
- if (self.is_horizontal($this) && !self.small($this)) {
201
+ if ( (self.is_horizontal_nav($this) && !self.small($this))
202
+ || self.is_vertical_tabs($this) && !self.small($this)) {
162
203
  self.position_content($this);
163
204
  } else {
164
205
  self.position_content($this, false);
@@ -166,11 +207,11 @@
166
207
  });
167
208
  },
168
209
 
169
- is_vertical : function (el) {
210
+ is_vertical_nav : function (el) {
170
211
  return /vertical-nav/i.test(el.data('section'));
171
212
  },
172
213
 
173
- is_horizontal : function (el) {
214
+ is_horizontal_nav : function (el) {
174
215
  return /horizontal-nav/i.test(el.data('section'));
175
216
  },
176
217
 
@@ -178,35 +219,55 @@
178
219
  return /accordion/i.test(el.data('section'));
179
220
  },
180
221
 
181
- is_tabs : function (el) {
182
- return /tabs/i.test(el.data('section'));
222
+ is_horizontal_tabs : function (el) {
223
+ return /^tabs$/i.test(el.data('section'));
224
+ },
225
+
226
+ is_vertical_tabs : function (el) {
227
+ return /vertical-tabs/i.test(el.data('section'));
183
228
  },
184
229
 
185
230
  set_active_from_hash : function () {
186
231
  var hash = window.location.hash.substring(1),
187
232
  sections = $('[data-section]'),
188
233
  self = this;
189
-
190
234
  sections.each(function () {
191
235
  var section = $(this),
192
236
  settings = $.extend({}, self.settings, self.data_options(section));
193
237
 
194
238
  if (hash.length > 0 && settings.deep_linking) {
195
- section
196
- .find('section, .section')
239
+ var regions = section
240
+ .children(self.settings.region_selector)
197
241
  .attr('style', '')
198
242
  .removeClass('active');
199
- section
200
- .find('.content[data-slug="' + hash + '"]')
201
- .closest('section, .section')
202
- .addClass('active');
243
+
244
+ var hash_regions = regions.map(function () {
245
+ var content = $(self.settings.content_selector, this),
246
+ content_slug = content.data('slug');
247
+
248
+ if (new RegExp(content_slug, 'i').test(hash))
249
+ return content;
250
+ });
251
+
252
+
253
+ var count = hash_regions.length;
254
+
255
+ for (var i = count - 1; i >= 0; i--) {
256
+ $(hash_regions[i]).parent().addClass('active');
257
+ }
203
258
  }
204
259
  });
205
260
  },
206
261
 
207
262
  position_titles : function (section, off) {
208
- var titles = section.find('.title'),
263
+ var self = this,
264
+ titles = section
265
+ .children(this.settings.region_selector)
266
+ .map(function () {
267
+ return $(this).children(self.settings.title_selector);
268
+ }),
209
269
  previous_width = 0,
270
+ previous_height = 0,
210
271
  self = this;
211
272
 
212
273
  if (typeof off === 'boolean') {
@@ -214,41 +275,124 @@
214
275
 
215
276
  } else {
216
277
  titles.each(function () {
217
- $(this).css('left', previous_width);
218
- previous_width += self.outerWidth($(this));
278
+ if (self.is_vertical_tabs(section)) {
279
+ $(this).css('top', previous_height);
280
+ previous_height += self.outerHeight($(this));
281
+ } else {
282
+ if (!self.rtl) {
283
+ $(this).css('left', previous_width);
284
+ } else {
285
+ $(this).css('right', previous_width);
286
+ }
287
+ previous_width += self.outerWidth($(this));
288
+ }
219
289
  });
220
290
  }
221
291
  },
222
292
 
223
293
  position_content : function (section, off) {
224
- var titles = section.find('.title'),
225
- content = section.find('.content'),
226
- self = this;
294
+ var self = this,
295
+ regions = section.children(self.settings.region_selector),
296
+ titles = regions
297
+ .map(function () {
298
+ return $(this).children(self.settings.title_selector);
299
+ }),
300
+ content = regions
301
+ .map(function () {
302
+ return $(this).children(self.settings.content_selector);
303
+ });
227
304
 
228
305
  if (typeof off === 'boolean') {
229
306
  content.attr('style', '');
230
307
  section.attr('style', '');
231
308
  } else {
232
- section.find('section, .section').each(function () {
233
- var title = $(this).find('.title'),
234
- content = $(this).find('.content');
309
+ if (self.is_vertical_tabs(section)
310
+ && !self.small(section)) {
311
+ var content_min_height = 0,
312
+ content_min_width = Number.MAX_VALUE,
313
+ title_width = null;
314
+
315
+ regions.each(function () {
316
+ var region = $(this),
317
+ title = region.children(self.settings.title_selector),
318
+ content = region.children(self.settings.content_selector),
319
+ content_width = 0;
320
+
321
+ title_width = self.outerWidth(title);
322
+ content_width = self.outerWidth(section) - title_width;
323
+
324
+ if (content_width < content_min_width) {
325
+ content_min_width = content_width;
326
+ }
327
+
328
+ // Increment the minimum height of the content region
329
+ // to align with the height of the titles.
330
+ content_min_height += self.outerHeight(title);
331
+
332
+ // Set all of the inactive tabs to 'display: none'
333
+ // The CSS sets all of the tabs as 'display: block'
334
+ // in order to account for scrollbars when measuring the width
335
+ // of the content regions.
336
+ if (!$(this).hasClass('active')) {
337
+ content.css('display', 'none');
338
+ }
339
+ });
340
+
341
+ regions.each(function () {
342
+ var content = $(this).children(self.settings.content_selector);
343
+ content.css('minHeight', content_min_height);
344
+
345
+ // Remove 2 pixels to account for the right-shift in the CSS
346
+ content.css('maxWidth', content_min_width - 2);
347
+ });
235
348
 
236
- content.css({left: title.position().left - 1, top: self.outerHeight(title) - 2});
237
- });
238
-
239
- // temporary work around for Zepto outerheight calculation issues.
240
- if (typeof Zepto === 'function') {
241
- section.height(this.outerHeight(titles.first()));
242
349
  } else {
243
- section.height(this.outerHeight(titles.first()) - 2);
350
+ regions.each(function () {
351
+ var region = $(this),
352
+ title = region.children(self.settings.title_selector),
353
+ content = region.children(self.settings.content_selector);
354
+ if (!self.rtl) {
355
+ content
356
+ .css({left: title.position().left - 1,
357
+ top: self.outerHeight(title) - 2});
358
+ } else {
359
+ content
360
+ .css({right: self.position_right(title) + 1,
361
+ top: self.outerHeight(title) - 2});
362
+ }
363
+ });
364
+
365
+ // temporary work around for Zepto outerheight calculation issues.
366
+ if (typeof Zepto === 'function') {
367
+ section.height(this.outerHeight($(titles[0])));
368
+ } else {
369
+ section.height(this.outerHeight($(titles[0])) - 2);
370
+ }
244
371
  }
245
372
  }
373
+ },
374
+
375
+ position_right : function (el) {
376
+ var self = this,
377
+ section = el.closest(this.settings.section_selector),
378
+ regions = section.children(this.settings.region_selector),
379
+ section_width = el.closest(this.settings.section_selector).width(),
380
+ offset = regions
381
+ .map(function () {
382
+ return $(this).children(self.settings.title_selector);
383
+ }).length;
384
+ return (section_width - el.position().left - el.width() * (el.index() + 1) - offset);
385
+ },
246
386
 
387
+ reflow : function (scope) {
388
+ var scope = scope || document;
389
+ $(this.settings.section_selector, scope).trigger('resize');
247
390
  },
248
391
 
249
392
  small : function (el) {
250
393
  var settings = $.extend({}, this.settings, this.data_options(el));
251
- if (this.is_tabs(el)) {
394
+
395
+ if (this.is_horizontal_tabs(el)) {
252
396
  return false;
253
397
  }
254
398
  if (el && this.is_accordion(el)) {