twitter-bootstrap-rails 3.2.0 → 3.2.1.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of twitter-bootstrap-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +85 -121
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +479 -463
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/javascripts/twitter/bootstrap/affix.js +19 -14
- data/app/assets/javascripts/twitter/bootstrap/alert.js +10 -6
- data/app/assets/javascripts/twitter/bootstrap/button.js +11 -8
- data/app/assets/javascripts/twitter/bootstrap/carousel.js +49 -31
- data/app/assets/javascripts/twitter/bootstrap/collapse.js +22 -22
- data/app/assets/javascripts/twitter/bootstrap/dropdown.js +17 -13
- data/app/assets/javascripts/twitter/bootstrap/modal.js +66 -29
- data/app/assets/javascripts/twitter/bootstrap/popover.js +10 -7
- data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +40 -23
- data/app/assets/javascripts/twitter/bootstrap/tab.js +11 -8
- data/app/assets/javascripts/twitter/bootstrap/tooltip.js +115 -57
- data/app/assets/javascripts/twitter/bootstrap/transition.js +18 -7
- data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +1670 -2
- data/app/helpers/bootstrap_flash_helper.rb +1 -1
- data/app/helpers/form_errors_helper.rb +11 -11
- data/app/helpers/glyph_helper.rb +2 -1
- data/app/helpers/modal_helper.rb +3 -3
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +6 -3
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +5 -5
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +3 -3
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +3 -5
- data/lib/generators/bootstrap/themed/templates/_form.html.erb +12 -9
- data/lib/generators/bootstrap/themed/templates/_form.html.haml +7 -5
- data/lib/generators/bootstrap/themed/templates/_form.html.slim +8 -6
- data/lib/generators/bootstrap/themed/templates/edit.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/index.html.slim +2 -3
- data/lib/generators/bootstrap/themed/templates/new.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.slim +1 -1
- data/lib/twitter/bootstrap/rails/engine.rb +16 -12
- data/lib/twitter/bootstrap/rails/version.rb +1 -1
- data/spec/lib/breadcrumbs_spec.rb +2 -2
- data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +10 -4
- data/spec/lib/twitter_bootstrap_rails/form_errors_helper_spec.rb +148 -0
- data/spec/lib/twitter_bootstrap_rails/glyph_helper_spec.rb +24 -0
- data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +1 -1
- data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +1 -1
- data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +1 -3
- data/vendor/toolkit/fontawesome/core.less +3 -4
- data/vendor/toolkit/fontawesome/font-awesome.less +1 -1
- data/vendor/toolkit/fontawesome/icons.less +48 -2
- data/vendor/toolkit/fontawesome/list.less +1 -1
- data/vendor/toolkit/fontawesome/mixins.less +9 -4
- data/vendor/toolkit/fontawesome/path.less +5 -5
- data/vendor/toolkit/fontawesome/rotated-flipped.less +11 -0
- data/vendor/toolkit/fontawesome/spinning.less +15 -18
- data/vendor/toolkit/fontawesome/variables.less +49 -3
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +0 -1
- data/vendor/toolkit/twitter/bootstrap/glyphicons.less +6 -5
- metadata +59 -25
- data/app/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- data/app/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
Binary file
|
Binary file
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: affix.js v3.
|
2
|
+
* Bootstrap: affix.js v3.2.0
|
3
3
|
* http://getbootstrap.com/javascript/#affix
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2011-2014 Twitter, Inc.
|
@@ -15,7 +15,8 @@
|
|
15
15
|
|
16
16
|
var Affix = function (element, options) {
|
17
17
|
this.options = $.extend({}, Affix.DEFAULTS, options)
|
18
|
-
|
18
|
+
|
19
|
+
this.$target = $(this.options.target)
|
19
20
|
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
|
20
21
|
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
|
21
22
|
|
@@ -27,16 +28,19 @@
|
|
27
28
|
this.checkPosition()
|
28
29
|
}
|
29
30
|
|
30
|
-
Affix.
|
31
|
+
Affix.VERSION = '3.2.0'
|
32
|
+
|
33
|
+
Affix.RESET = 'affix affix-top affix-bottom'
|
31
34
|
|
32
35
|
Affix.DEFAULTS = {
|
33
|
-
offset: 0
|
36
|
+
offset: 0,
|
37
|
+
target: window
|
34
38
|
}
|
35
39
|
|
36
40
|
Affix.prototype.getPinnedOffset = function () {
|
37
41
|
if (this.pinnedOffset) return this.pinnedOffset
|
38
42
|
this.$element.removeClass(Affix.RESET).addClass('affix')
|
39
|
-
var scrollTop = this.$
|
43
|
+
var scrollTop = this.$target.scrollTop()
|
40
44
|
var position = this.$element.offset()
|
41
45
|
return (this.pinnedOffset = position.top - scrollTop)
|
42
46
|
}
|
@@ -49,14 +53,12 @@
|
|
49
53
|
if (!this.$element.is(':visible')) return
|
50
54
|
|
51
55
|
var scrollHeight = $(document).height()
|
52
|
-
var scrollTop = this.$
|
56
|
+
var scrollTop = this.$target.scrollTop()
|
53
57
|
var position = this.$element.offset()
|
54
58
|
var offset = this.options.offset
|
55
59
|
var offsetTop = offset.top
|
56
60
|
var offsetBottom = offset.bottom
|
57
61
|
|
58
|
-
if (this.affixed == 'top') position.top += scrollTop
|
59
|
-
|
60
62
|
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
61
63
|
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
|
62
64
|
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
|
@@ -66,7 +68,7 @@
|
|
66
68
|
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
|
67
69
|
|
68
70
|
if (this.affixed === affix) return
|
69
|
-
if (this.unpin) this.$element.css('top', '')
|
71
|
+
if (this.unpin != null) this.$element.css('top', '')
|
70
72
|
|
71
73
|
var affixType = 'affix' + (affix ? '-' + affix : '')
|
72
74
|
var e = $.Event(affixType + '.bs.affix')
|
@@ -84,7 +86,9 @@
|
|
84
86
|
.trigger($.Event(affixType.replace('affix', 'affixed')))
|
85
87
|
|
86
88
|
if (affix == 'bottom') {
|
87
|
-
this.$element.offset({
|
89
|
+
this.$element.offset({
|
90
|
+
top: scrollHeight - this.$element.height() - offsetBottom
|
91
|
+
})
|
88
92
|
}
|
89
93
|
}
|
90
94
|
|
@@ -92,9 +96,7 @@
|
|
92
96
|
// AFFIX PLUGIN DEFINITION
|
93
97
|
// =======================
|
94
98
|
|
95
|
-
|
96
|
-
|
97
|
-
$.fn.affix = function (option) {
|
99
|
+
function Plugin(option) {
|
98
100
|
return this.each(function () {
|
99
101
|
var $this = $(this)
|
100
102
|
var data = $this.data('bs.affix')
|
@@ -105,6 +107,9 @@
|
|
105
107
|
})
|
106
108
|
}
|
107
109
|
|
110
|
+
var old = $.fn.affix
|
111
|
+
|
112
|
+
$.fn.affix = Plugin
|
108
113
|
$.fn.affix.Constructor = Affix
|
109
114
|
|
110
115
|
|
@@ -130,7 +135,7 @@
|
|
130
135
|
if (data.offsetBottom) data.offset.bottom = data.offsetBottom
|
131
136
|
if (data.offsetTop) data.offset.top = data.offsetTop
|
132
137
|
|
133
|
-
$spy
|
138
|
+
Plugin.call($spy, data)
|
134
139
|
})
|
135
140
|
})
|
136
141
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: alert.js v3.
|
2
|
+
* Bootstrap: alert.js v3.2.0
|
3
3
|
* http://getbootstrap.com/javascript/#alerts
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2011-2014 Twitter, Inc.
|
@@ -18,6 +18,8 @@
|
|
18
18
|
$(el).on('click', dismiss, this.close)
|
19
19
|
}
|
20
20
|
|
21
|
+
Alert.VERSION = '3.2.0'
|
22
|
+
|
21
23
|
Alert.prototype.close = function (e) {
|
22
24
|
var $this = $(this)
|
23
25
|
var selector = $this.attr('data-target')
|
@@ -42,12 +44,13 @@
|
|
42
44
|
$parent.removeClass('in')
|
43
45
|
|
44
46
|
function removeElement() {
|
45
|
-
|
47
|
+
// detach from parent, fire event then clean up data
|
48
|
+
$parent.detach().trigger('closed.bs.alert').remove()
|
46
49
|
}
|
47
50
|
|
48
51
|
$.support.transition && $parent.hasClass('fade') ?
|
49
52
|
$parent
|
50
|
-
.one(
|
53
|
+
.one('bsTransitionEnd', removeElement)
|
51
54
|
.emulateTransitionEnd(150) :
|
52
55
|
removeElement()
|
53
56
|
}
|
@@ -56,9 +59,7 @@
|
|
56
59
|
// ALERT PLUGIN DEFINITION
|
57
60
|
// =======================
|
58
61
|
|
59
|
-
|
60
|
-
|
61
|
-
$.fn.alert = function (option) {
|
62
|
+
function Plugin(option) {
|
62
63
|
return this.each(function () {
|
63
64
|
var $this = $(this)
|
64
65
|
var data = $this.data('bs.alert')
|
@@ -68,6 +69,9 @@
|
|
68
69
|
})
|
69
70
|
}
|
70
71
|
|
72
|
+
var old = $.fn.alert
|
73
|
+
|
74
|
+
$.fn.alert = Plugin
|
71
75
|
$.fn.alert.Constructor = Alert
|
72
76
|
|
73
77
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: button.js v3.
|
2
|
+
* Bootstrap: button.js v3.2.0
|
3
3
|
* http://getbootstrap.com/javascript/#buttons
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2011-2014 Twitter, Inc.
|
@@ -19,6 +19,8 @@
|
|
19
19
|
this.isLoading = false
|
20
20
|
}
|
21
21
|
|
22
|
+
Button.VERSION = '3.2.0'
|
23
|
+
|
22
24
|
Button.DEFAULTS = {
|
23
25
|
loadingText: 'loading...'
|
24
26
|
}
|
@@ -31,9 +33,9 @@
|
|
31
33
|
|
32
34
|
state = state + 'Text'
|
33
35
|
|
34
|
-
if (
|
36
|
+
if (data.resetText == null) $el.data('resetText', $el[val]())
|
35
37
|
|
36
|
-
$el[val](data[state]
|
38
|
+
$el[val](data[state] == null ? this.options[state] : data[state])
|
37
39
|
|
38
40
|
// push to event loop to allow forms to submit
|
39
41
|
setTimeout($.proxy(function () {
|
@@ -67,9 +69,7 @@
|
|
67
69
|
// BUTTON PLUGIN DEFINITION
|
68
70
|
// ========================
|
69
71
|
|
70
|
-
|
71
|
-
|
72
|
-
$.fn.button = function (option) {
|
72
|
+
function Plugin(option) {
|
73
73
|
return this.each(function () {
|
74
74
|
var $this = $(this)
|
75
75
|
var data = $this.data('bs.button')
|
@@ -82,6 +82,9 @@
|
|
82
82
|
})
|
83
83
|
}
|
84
84
|
|
85
|
+
var old = $.fn.button
|
86
|
+
|
87
|
+
$.fn.button = Plugin
|
85
88
|
$.fn.button.Constructor = Button
|
86
89
|
|
87
90
|
|
@@ -97,10 +100,10 @@
|
|
97
100
|
// BUTTON DATA-API
|
98
101
|
// ===============
|
99
102
|
|
100
|
-
$(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
|
103
|
+
$(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
|
101
104
|
var $btn = $(e.target)
|
102
105
|
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
103
|
-
$btn
|
106
|
+
Plugin.call($btn, 'toggle')
|
104
107
|
e.preventDefault()
|
105
108
|
})
|
106
109
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: carousel.js v3.
|
2
|
+
* Bootstrap: carousel.js v3.2.0
|
3
3
|
* http://getbootstrap.com/javascript/#carousel
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2011-2014 Twitter, Inc.
|
@@ -14,7 +14,7 @@
|
|
14
14
|
// =========================
|
15
15
|
|
16
16
|
var Carousel = function (element, options) {
|
17
|
-
this.$element = $(element)
|
17
|
+
this.$element = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this))
|
18
18
|
this.$indicators = this.$element.find('.carousel-indicators')
|
19
19
|
this.options = options
|
20
20
|
this.paused =
|
@@ -24,17 +24,29 @@
|
|
24
24
|
this.$items = null
|
25
25
|
|
26
26
|
this.options.pause == 'hover' && this.$element
|
27
|
-
.on('mouseenter', $.proxy(this.pause, this))
|
28
|
-
.on('mouseleave', $.proxy(this.cycle, this))
|
27
|
+
.on('mouseenter.bs.carousel', $.proxy(this.pause, this))
|
28
|
+
.on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
|
29
29
|
}
|
30
30
|
|
31
|
+
Carousel.VERSION = '3.2.0'
|
32
|
+
|
31
33
|
Carousel.DEFAULTS = {
|
32
34
|
interval: 5000,
|
33
35
|
pause: 'hover',
|
34
36
|
wrap: true
|
35
37
|
}
|
36
38
|
|
37
|
-
Carousel.prototype.
|
39
|
+
Carousel.prototype.keydown = function (e) {
|
40
|
+
switch (e.which) {
|
41
|
+
case 37: this.prev(); break
|
42
|
+
case 39: this.next(); break
|
43
|
+
default: return
|
44
|
+
}
|
45
|
+
|
46
|
+
e.preventDefault()
|
47
|
+
}
|
48
|
+
|
49
|
+
Carousel.prototype.cycle = function (e) {
|
38
50
|
e || (this.paused = false)
|
39
51
|
|
40
52
|
this.interval && clearInterval(this.interval)
|
@@ -46,20 +58,18 @@
|
|
46
58
|
return this
|
47
59
|
}
|
48
60
|
|
49
|
-
Carousel.prototype.
|
50
|
-
this.$
|
51
|
-
this.$items
|
52
|
-
|
53
|
-
return this.$items.index(this.$active)
|
61
|
+
Carousel.prototype.getItemIndex = function (item) {
|
62
|
+
this.$items = item.parent().children('.item')
|
63
|
+
return this.$items.index(item || this.$active)
|
54
64
|
}
|
55
65
|
|
56
66
|
Carousel.prototype.to = function (pos) {
|
57
67
|
var that = this
|
58
|
-
var activeIndex = this.
|
68
|
+
var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
|
59
69
|
|
60
70
|
if (pos > (this.$items.length - 1) || pos < 0) return
|
61
71
|
|
62
|
-
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
|
72
|
+
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
|
63
73
|
if (activeIndex == pos) return this.pause().cycle()
|
64
74
|
|
65
75
|
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
|
@@ -101,11 +111,15 @@
|
|
101
111
|
$next = this.$element.find('.item')[fallback]()
|
102
112
|
}
|
103
113
|
|
104
|
-
if ($next.hasClass('active')) return this.sliding = false
|
114
|
+
if ($next.hasClass('active')) return (this.sliding = false)
|
105
115
|
|
106
|
-
var
|
107
|
-
|
108
|
-
|
116
|
+
var relatedTarget = $next[0]
|
117
|
+
var slideEvent = $.Event('slide.bs.carousel', {
|
118
|
+
relatedTarget: relatedTarget,
|
119
|
+
direction: direction
|
120
|
+
})
|
121
|
+
this.$element.trigger(slideEvent)
|
122
|
+
if (slideEvent.isDefaultPrevented()) return
|
109
123
|
|
110
124
|
this.sliding = true
|
111
125
|
|
@@ -113,30 +127,31 @@
|
|
113
127
|
|
114
128
|
if (this.$indicators.length) {
|
115
129
|
this.$indicators.find('.active').removeClass('active')
|
116
|
-
this.$
|
117
|
-
|
118
|
-
$nextIndicator && $nextIndicator.addClass('active')
|
119
|
-
})
|
130
|
+
var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
|
131
|
+
$nextIndicator && $nextIndicator.addClass('active')
|
120
132
|
}
|
121
133
|
|
134
|
+
var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
|
122
135
|
if ($.support.transition && this.$element.hasClass('slide')) {
|
123
136
|
$next.addClass(type)
|
124
137
|
$next[0].offsetWidth // force reflow
|
125
138
|
$active.addClass(direction)
|
126
139
|
$next.addClass(direction)
|
127
140
|
$active
|
128
|
-
.one(
|
141
|
+
.one('bsTransitionEnd', function () {
|
129
142
|
$next.removeClass([type, direction].join(' ')).addClass('active')
|
130
143
|
$active.removeClass(['active', direction].join(' '))
|
131
144
|
that.sliding = false
|
132
|
-
setTimeout(function () {
|
145
|
+
setTimeout(function () {
|
146
|
+
that.$element.trigger(slidEvent)
|
147
|
+
}, 0)
|
133
148
|
})
|
134
149
|
.emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
|
135
150
|
} else {
|
136
151
|
$active.removeClass('active')
|
137
152
|
$next.addClass('active')
|
138
153
|
this.sliding = false
|
139
|
-
this.$element.trigger(
|
154
|
+
this.$element.trigger(slidEvent)
|
140
155
|
}
|
141
156
|
|
142
157
|
isCycling && this.cycle()
|
@@ -148,9 +163,7 @@
|
|
148
163
|
// CAROUSEL PLUGIN DEFINITION
|
149
164
|
// ==========================
|
150
165
|
|
151
|
-
|
152
|
-
|
153
|
-
$.fn.carousel = function (option) {
|
166
|
+
function Plugin(option) {
|
154
167
|
return this.each(function () {
|
155
168
|
var $this = $(this)
|
156
169
|
var data = $this.data('bs.carousel')
|
@@ -164,6 +177,9 @@
|
|
164
177
|
})
|
165
178
|
}
|
166
179
|
|
180
|
+
var old = $.fn.carousel
|
181
|
+
|
182
|
+
$.fn.carousel = Plugin
|
167
183
|
$.fn.carousel.Constructor = Carousel
|
168
184
|
|
169
185
|
|
@@ -180,15 +196,17 @@
|
|
180
196
|
// =================
|
181
197
|
|
182
198
|
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
|
183
|
-
var
|
184
|
-
var $
|
199
|
+
var href
|
200
|
+
var $this = $(this)
|
201
|
+
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
|
202
|
+
if (!$target.hasClass('carousel')) return
|
185
203
|
var options = $.extend({}, $target.data(), $this.data())
|
186
204
|
var slideIndex = $this.attr('data-slide-to')
|
187
205
|
if (slideIndex) options.interval = false
|
188
206
|
|
189
|
-
$target
|
207
|
+
Plugin.call($target, options)
|
190
208
|
|
191
|
-
if (slideIndex
|
209
|
+
if (slideIndex) {
|
192
210
|
$target.data('bs.carousel').to(slideIndex)
|
193
211
|
}
|
194
212
|
|
@@ -198,7 +216,7 @@
|
|
198
216
|
$(window).on('load', function () {
|
199
217
|
$('[data-ride="carousel"]').each(function () {
|
200
218
|
var $carousel = $(this)
|
201
|
-
|
219
|
+
Plugin.call($carousel, $carousel.data())
|
202
220
|
})
|
203
221
|
})
|
204
222
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: collapse.js v3.
|
2
|
+
* Bootstrap: collapse.js v3.2.0
|
3
3
|
* http://getbootstrap.com/javascript/#collapse
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2011-2014 Twitter, Inc.
|
@@ -22,6 +22,8 @@
|
|
22
22
|
if (this.options.toggle) this.toggle()
|
23
23
|
}
|
24
24
|
|
25
|
+
Collapse.VERSION = '3.2.0'
|
26
|
+
|
25
27
|
Collapse.DEFAULTS = {
|
26
28
|
toggle: true
|
27
29
|
}
|
@@ -43,7 +45,7 @@
|
|
43
45
|
if (actives && actives.length) {
|
44
46
|
var hasData = actives.data('bs.collapse')
|
45
47
|
if (hasData && hasData.transitioning) return
|
46
|
-
|
48
|
+
Plugin.call(actives, 'hide')
|
47
49
|
hasData || actives.data('bs.collapse', null)
|
48
50
|
}
|
49
51
|
|
@@ -51,18 +53,17 @@
|
|
51
53
|
|
52
54
|
this.$element
|
53
55
|
.removeClass('collapse')
|
54
|
-
.addClass('collapsing')
|
55
|
-
[dimension](0)
|
56
|
+
.addClass('collapsing')[dimension](0)
|
56
57
|
|
57
58
|
this.transitioning = 1
|
58
59
|
|
59
60
|
var complete = function () {
|
60
61
|
this.$element
|
61
62
|
.removeClass('collapsing')
|
62
|
-
.addClass('collapse in')
|
63
|
-
[dimension]('auto')
|
63
|
+
.addClass('collapse in')[dimension]('')
|
64
64
|
this.transitioning = 0
|
65
|
-
this.$element
|
65
|
+
this.$element
|
66
|
+
.trigger('shown.bs.collapse')
|
66
67
|
}
|
67
68
|
|
68
69
|
if (!$.support.transition) return complete.call(this)
|
@@ -70,9 +71,8 @@
|
|
70
71
|
var scrollSize = $.camelCase(['scroll', dimension].join('-'))
|
71
72
|
|
72
73
|
this.$element
|
73
|
-
.one(
|
74
|
-
.emulateTransitionEnd(350)
|
75
|
-
[dimension](this.$element[0][scrollSize])
|
74
|
+
.one('bsTransitionEnd', $.proxy(complete, this))
|
75
|
+
.emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
|
76
76
|
}
|
77
77
|
|
78
78
|
Collapse.prototype.hide = function () {
|
@@ -84,9 +84,7 @@
|
|
84
84
|
|
85
85
|
var dimension = this.dimension()
|
86
86
|
|
87
|
-
this.$element
|
88
|
-
[dimension](this.$element[dimension]())
|
89
|
-
[0].offsetHeight
|
87
|
+
this.$element[dimension](this.$element[dimension]())[0].offsetHeight
|
90
88
|
|
91
89
|
this.$element
|
92
90
|
.addClass('collapsing')
|
@@ -107,7 +105,7 @@
|
|
107
105
|
|
108
106
|
this.$element
|
109
107
|
[dimension](0)
|
110
|
-
.one(
|
108
|
+
.one('bsTransitionEnd', $.proxy(complete, this))
|
111
109
|
.emulateTransitionEnd(350)
|
112
110
|
}
|
113
111
|
|
@@ -119,9 +117,7 @@
|
|
119
117
|
// COLLAPSE PLUGIN DEFINITION
|
120
118
|
// ==========================
|
121
119
|
|
122
|
-
|
123
|
-
|
124
|
-
$.fn.collapse = function (option) {
|
120
|
+
function Plugin(option) {
|
125
121
|
return this.each(function () {
|
126
122
|
var $this = $(this)
|
127
123
|
var data = $this.data('bs.collapse')
|
@@ -133,6 +129,9 @@
|
|
133
129
|
})
|
134
130
|
}
|
135
131
|
|
132
|
+
var old = $.fn.collapse
|
133
|
+
|
134
|
+
$.fn.collapse = Plugin
|
136
135
|
$.fn.collapse.Constructor = Collapse
|
137
136
|
|
138
137
|
|
@@ -148,11 +147,12 @@
|
|
148
147
|
// COLLAPSE DATA-API
|
149
148
|
// =================
|
150
149
|
|
151
|
-
$(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
152
|
-
var
|
150
|
+
$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
|
151
|
+
var href
|
152
|
+
var $this = $(this)
|
153
153
|
var target = $this.attr('data-target')
|
154
154
|
|| e.preventDefault()
|
155
|
-
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
|
155
|
+
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
|
156
156
|
var $target = $(target)
|
157
157
|
var data = $target.data('bs.collapse')
|
158
158
|
var option = data ? 'toggle' : $this.data()
|
@@ -160,11 +160,11 @@
|
|
160
160
|
var $parent = parent && $(parent)
|
161
161
|
|
162
162
|
if (!data || !data.transitioning) {
|
163
|
-
if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
|
163
|
+
if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
|
164
164
|
$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
|
165
165
|
}
|
166
166
|
|
167
|
-
$target
|
167
|
+
Plugin.call($target, option)
|
168
168
|
})
|
169
169
|
|
170
170
|
}(jQuery);
|