Skip to content

Commit 8a86b57

Browse files
committed
Merge branch 'release/3.0.0.0.rc2'
* release/3.0.0.0.rc2: Bump version to v3.0.0.0.rc2 Integrate changes up to twbs/[email protected] Integrate changes up to twbs/bootstrap@54a3e4b Fix conversion of responsive utilities Integrate changes up to twbs/bootstrap@95affa3 Integrate changes up to twbs/bootstrap@d22bd3a Integrate changes up to twbs/bootstrap@5db9a10 Disable compression when testing Integrate changes up to twbs/bootstrap@180034a Integrate changes up to twbs/bootstrap@46a424f Integrate changes up to twbs/bootstrap@e1180da Restore upstream javascript load order Minor bugfixes/whitespace adjustments Stop accumulating cruft in the packaged gem
2 parents f6bda34 + 3d2650d commit 8a86b57

Some content is hidden

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

45 files changed

+1557
-890
lines changed
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
//= require twitter/bootstrap/transition.js
2-
//= require twitter/bootstrap/alert.js
3-
//= require twitter/bootstrap/button.js
4-
//= require twitter/bootstrap/carousel.js
5-
//= require twitter/bootstrap/collapse.js
6-
//= require twitter/bootstrap/dropdown.js
7-
//= require twitter/bootstrap/modal.js
8-
//= require twitter/bootstrap/tooltip.js
9-
//= require twitter/bootstrap/popover.js
10-
//= require twitter/bootstrap/scrollspy.js
11-
//= require twitter/bootstrap/tab.js
12-
//= require twitter/bootstrap/affix.js
1+
//= require twitter/bootstrap/transition
2+
//= require twitter/bootstrap/alert
3+
//= require twitter/bootstrap/button
4+
//= require twitter/bootstrap/carousel
5+
//= require twitter/bootstrap/collapse
6+
//= require twitter/bootstrap/dropdown
7+
//= require twitter/bootstrap/modal
8+
//= require twitter/bootstrap/tooltip
9+
//= require twitter/bootstrap/popover
10+
//= require twitter/bootstrap/scrollspy
11+
//= require twitter/bootstrap/tab
12+
//= require twitter/bootstrap/affix

app/assets/javascripts/twitter/bootstrap/button.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@
5656
var $parent = this.$element.closest('[data-toggle="buttons"]')
5757

5858
if ($parent.length) {
59-
var $input = this.$element.find('input').prop('checked', !this.$element.hasClass('active'))
59+
var $input = this.$element.find('input')
60+
.prop('checked', !this.$element.hasClass('active'))
61+
.trigger('change')
6062
if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
6163
}
6264

@@ -72,7 +74,7 @@
7274
$.fn.button = function (option) {
7375
return this.each(function () {
7476
var $this = $(this)
75-
var data = $this.data('button')
77+
var data = $this.data('bs.button')
7678
var options = typeof option == 'object' && option
7779

7880
if (!data) $this.data('bs.button', (data = new Button(this, options)))

app/assets/javascripts/twitter/bootstrap/carousel.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
Carousel.DEFAULTS = {
4242
interval: 5000
4343
, pause: 'hover'
44+
, wrap: true
4445
}
4546

4647
Carousel.prototype.cycle = function (e) {
@@ -105,12 +106,15 @@
105106
var fallback = type == 'next' ? 'first' : 'last'
106107
var that = this
107108

109+
if (!$next.length) {
110+
if (!this.options.wrap) return
111+
$next = this.$element.find('.item')[fallback]()
112+
}
113+
108114
this.sliding = true
109115

110116
isCycling && this.pause()
111117

112-
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
113-
114118
var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
115119

116120
if ($next.hasClass('active')) return

app/assets/javascripts/twitter/bootstrap/collapse.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
this.$element.trigger(startEvent)
4949
if (startEvent.isDefaultPrevented()) return
5050

51-
var actives = this.$parent && this.$parent.find('> .accordion-group > .in')
51+
var actives = this.$parent && this.$parent.find('> .panel > .in')
5252

5353
if (actives && actives.length) {
5454
var hasData = actives.data('bs.collapse')
@@ -169,7 +169,7 @@
169169
var $parent = parent && $(parent)
170170

171171
if (!data || !data.transitioning) {
172-
if ($parent) $parent.find('[data-toggle=collapse][data-parent=' + parent + ']').not($this).addClass('collapsed')
172+
if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
173173
$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
174174
}
175175

app/assets/javascripts/twitter/bootstrap/modal.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
this.$backdrop =
3030
this.isShown = null
3131

32-
if (this.options.remote) this.$element.find('.modal-body').load(this.options.remote)
32+
if (this.options.remote) this.$element.load(this.options.remote)
3333
}
3434

3535
Modal.DEFAULTS = {
@@ -38,13 +38,13 @@
3838
, show: true
3939
}
4040

41-
Modal.prototype.toggle = function () {
42-
return this[!this.isShown ? 'show' : 'hide']()
41+
Modal.prototype.toggle = function (_relatedTarget) {
42+
return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
4343
}
4444

45-
Modal.prototype.show = function () {
45+
Modal.prototype.show = function (_relatedTarget) {
4646
var that = this
47-
var e = $.Event('show.bs.modal')
47+
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
4848

4949
this.$element.trigger(e)
5050

@@ -73,13 +73,15 @@
7373

7474
that.enforceFocus()
7575

76+
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
77+
7678
transition ?
7779
that.$element
7880
.one($.support.transition.end, function () {
79-
that.$element.focus().trigger('shown.bs.modal')
81+
that.$element.focus().trigger(e)
8082
})
8183
.emulateTransitionEnd(300) :
82-
that.$element.focus().trigger('shown.bs.modal')
84+
that.$element.focus().trigger(e)
8385
})
8486
}
8587

@@ -101,6 +103,7 @@
101103
this.$element
102104
.removeClass('in')
103105
.attr('aria-hidden', true)
106+
.off('click.dismiss.modal')
104107

105108
$.support.transition && this.$element.hasClass('fade') ?
106109
this.$element
@@ -153,7 +156,7 @@
153156
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
154157
.appendTo(document.body)
155158

156-
this.$element.on('click', $.proxy(function (e) {
159+
this.$element.on('click.dismiss.modal', $.proxy(function (e) {
157160
if (e.target !== e.currentTarget) return
158161
this.options.backdrop == 'static'
159162
? this.$element[0].focus.call(this.$element[0])
@@ -192,15 +195,15 @@
192195

193196
var old = $.fn.modal
194197

195-
$.fn.modal = function (option) {
198+
$.fn.modal = function (option, _relatedTarget) {
196199
return this.each(function () {
197200
var $this = $(this)
198201
var data = $this.data('bs.modal')
199202
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
200203

201204
if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
202-
if (typeof option == 'string') data[option]()
203-
else if (options.show) data.show()
205+
if (typeof option == 'string') data[option](_relatedTarget)
206+
else if (options.show) data.show(_relatedTarget)
204207
})
205208
}
206209

@@ -223,19 +226,19 @@
223226
var $this = $(this)
224227
var href = $this.attr('href')
225228
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
226-
var option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
229+
var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
227230

228231
e.preventDefault()
229232

230233
$target
231-
.modal(option)
234+
.modal(option, this)
232235
.one('hide', function () {
233236
$this.is(':visible') && $this.focus()
234237
})
235238
})
236239

237-
var $body = $(document.body)
238-
.on('shown.bs.modal', '.modal', function () { $body.addClass('modal-open') })
239-
.on('hidden.bs.modal', '.modal', function () { $body.removeClass('modal-open') })
240+
$(document)
241+
.on('shown.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
242+
.on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
240243

241244
}(window.jQuery);

app/assets/javascripts/twitter/bootstrap/popover.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858

5959
$tip.removeClass('fade top bottom left right in')
6060

61-
$tip.find('.popover-title:empty').hide()
61+
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
62+
// this manually by checking the contents.
63+
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
6264
}
6365

6466
Popover.prototype.hasContent = function () {
@@ -75,15 +77,15 @@
7577
o.content)
7678
}
7779

80+
Popover.prototype.arrow = function () {
81+
return this.$arrow = this.$arrow || this.tip().find('.arrow')
82+
}
83+
7884
Popover.prototype.tip = function () {
7985
if (!this.$tip) this.$tip = $(this.options.template)
8086
return this.$tip
8187
}
8288

83-
Popover.prototype.destroy = function () {
84-
this.hide().$element.off('.' + this.type).removeData(this.type)
85-
}
86-
8789

8890
// POPOVER PLUGIN DEFINITION
8991
// =========================

app/assets/javascripts/twitter/bootstrap/tooltip.js

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* ========================================================================
22
* Bootstrap: tooltip.js v3.0.0
3-
* http://twbs.github.com/bootstrap/javascript.html#affix
3+
* http://twbs.github.com/bootstrap/javascript.html#tooltip
44
* Inspired by the original jQuery.tipsy by Jason Frame
55
* ========================================================================
66
* Copyright 2012 Twitter, Inc.
@@ -64,7 +64,7 @@
6464
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
6565
var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
6666

67-
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
67+
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
6868
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
6969
}
7070
}
@@ -91,16 +91,20 @@
9191
return options
9292
}
9393

94-
Tooltip.prototype.enter = function (obj) {
95-
var defaults = this.getDefaults()
94+
Tooltip.prototype.getDelegateOptions = function () {
9695
var options = {}
96+
var defaults = this.getDefaults()
9797

9898
this._options && $.each(this._options, function (key, value) {
9999
if (defaults[key] != value) options[key] = value
100100
})
101101

102+
return options
103+
}
104+
105+
Tooltip.prototype.enter = function (obj) {
102106
var self = obj instanceof this.constructor ?
103-
obj : $(obj.currentTarget)[this.type](options).data('bs.' + this.type)
107+
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
104108

105109
clearTimeout(self.timeout)
106110

@@ -114,7 +118,7 @@
114118

115119
Tooltip.prototype.leave = function (obj) {
116120
var self = obj instanceof this.constructor ?
117-
obj : $(obj.currentTarget)[this.type](this._options).data('bs.' + this.type)
121+
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
118122

119123
clearTimeout(self.timeout)
120124

@@ -179,12 +183,9 @@
179183
.addClass(placement)
180184
}
181185

182-
var tp = placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
183-
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
184-
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
185-
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
186+
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
186187

187-
this.applyPlacement(tp, placement)
188+
this.applyPlacement(calculatedOffset, placement)
188189
this.$element.trigger('shown.bs.' + this.type)
189190
}
190191
}
@@ -196,25 +197,33 @@
196197
var height = $tip[0].offsetHeight
197198

198199
// manually read margins because getBoundingClientRect includes difference
199-
offset.top = offset.top + parseInt($tip.css('margin-top'), 10)
200-
offset.left = offset.left + parseInt($tip.css('margin-left'), 10)
200+
var marginTop = parseInt($tip.css('margin-top'), 10)
201+
var marginLeft = parseInt($tip.css('margin-left'), 10)
202+
203+
// we must check for NaN for ie 8/9
204+
if (isNaN(marginTop)) marginTop = 0
205+
if (isNaN(marginLeft)) marginLeft = 0
206+
207+
offset.top = offset.top + marginTop
208+
offset.left = offset.left + marginLeft
201209

202210
$tip
203211
.offset(offset)
204212
.addClass('in')
205213

214+
// check to see if placing tip in new offset caused the tip to resize itself
206215
var actualWidth = $tip[0].offsetWidth
207216
var actualHeight = $tip[0].offsetHeight
208217

209218
if (placement == 'top' && actualHeight != height) {
210219
replace = true
211-
offset.top = offset.top + height - actualHeight
220+
offset.top = offset.top + height - actualHeight
212221
}
213222

214-
if (placement == 'bottom' || placement == 'top') {
223+
if (/bottom|top/.test(placement)) {
215224
var delta = 0
216225

217-
if (offset.left < 0){
226+
if (offset.left < 0) {
218227
delta = offset.left * -2
219228
offset.left = 0
220229

@@ -249,6 +258,8 @@
249258
var $tip = this.tip()
250259
var e = $.Event('hide.bs.' + this.type)
251260

261+
function complete() { $tip.detach() }
262+
252263
this.$element.trigger(e)
253264

254265
if (e.isDefaultPrevented()) return
@@ -257,9 +268,9 @@
257268

258269
$.support.transition && this.$tip.hasClass('fade') ?
259270
$tip
260-
.one($.support.transition.end, $tip.detach)
271+
.one($.support.transition.end, complete)
261272
.emulateTransitionEnd(150) :
262-
$tip.detach()
273+
complete()
263274

264275
this.$element.trigger('hidden.bs.' + this.type)
265276

@@ -285,6 +296,13 @@
285296
}, this.$element.offset())
286297
}
287298

299+
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
300+
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
301+
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
302+
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
303+
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
304+
}
305+
288306
Tooltip.prototype.getTitle = function () {
289307
var title
290308
var $e = this.$element
@@ -300,8 +318,8 @@
300318
return this.$tip = this.$tip || $(this.options.template)
301319
}
302320

303-
Tooltip.prototype.arrow =function(){
304-
return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
321+
Tooltip.prototype.arrow = function () {
322+
return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
305323
}
306324

307325
Tooltip.prototype.validate = function () {
@@ -325,7 +343,7 @@
325343
}
326344

327345
Tooltip.prototype.toggle = function (e) {
328-
var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this
346+
var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
329347
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
330348
}
331349

app/assets/javascripts/twitter/bootstrap/transition.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
// http://blog.alexmaccaw.com/css-transitions
4444
$.fn.emulateTransitionEnd = function (duration) {
4545
var called = false, $el = this
46-
$(this).one('webkitTransitionEnd', function () { called = true })
47-
var callback = function () { if (!called) $($el).trigger('webkitTransitionEnd') }
46+
$(this).one($.support.transition.end, function () { called = true })
47+
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
4848
setTimeout(callback, duration)
4949
return this
5050
}

0 commit comments

Comments
 (0)