twitter-bootstrap-rails 1.4.3 → 2.0rc0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of twitter-bootstrap-rails might be problematic. Click here for more details.
- data/README.md +85 -52
- data/lib/generators/bootstrap/install/templates/bootstrap.coffee +15 -12
- data/lib/generators/bootstrap/layout/layout_generator.rb +1 -1
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +97 -50
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +40 -0
- data/lib/generators/bootstrap/themed/templates/_form.html.erb +5 -1
- data/lib/generators/bootstrap/themed/templates/edit.html.erb +2 -1
- data/lib/generators/bootstrap/themed/templates/index.html.erb +1 -0
- data/lib/generators/bootstrap/themed/templates/new.html.erb +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.erb +7 -3
- data/lib/generators/bootstrap/themed/themed_generator.rb +0 -15
- data/lib/twitter-bootstrap-rails.rb +3 -3
- data/lib/twitter/bootstrap/rails/bootstrap.rb +1 -1
- data/lib/twitter/bootstrap/rails/version.rb +1 -1
- data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/twitter/bootstrap.js +10 -6
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +91 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +98 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +154 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +136 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +58 -21
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +63 -114
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +38 -33
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +62 -44
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +130 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +270 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +51 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +271 -0
- data/vendor/toolkit/twitter/bootstrap/accordion.less +28 -0
- data/vendor/toolkit/twitter/bootstrap/alerts.less +70 -0
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +41 -5
- data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +22 -0
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +147 -0
- data/vendor/toolkit/twitter/bootstrap/buttons.less +165 -0
- data/vendor/toolkit/twitter/bootstrap/carousel.less +121 -0
- data/vendor/toolkit/twitter/bootstrap/close.less +18 -0
- data/vendor/toolkit/twitter/bootstrap/code.less +44 -0
- data/vendor/toolkit/twitter/bootstrap/component-animations.less +18 -0
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +131 -0
- data/vendor/toolkit/twitter/bootstrap/forms.less +335 -299
- data/vendor/toolkit/twitter/bootstrap/grid.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/hero-unit.less +20 -0
- data/vendor/toolkit/twitter/bootstrap/labels.less +16 -0
- data/vendor/toolkit/twitter/bootstrap/layouts.less +17 -0
- data/vendor/toolkit/twitter/bootstrap/mixins.less +391 -76
- data/vendor/toolkit/twitter/bootstrap/modals.less +72 -0
- data/vendor/toolkit/twitter/bootstrap/navbar.less +292 -0
- data/vendor/toolkit/twitter/bootstrap/navs.less +344 -0
- data/vendor/toolkit/twitter/bootstrap/pager.less +30 -0
- data/vendor/toolkit/twitter/bootstrap/pagination.less +55 -0
- data/vendor/toolkit/twitter/bootstrap/popovers.less +49 -0
- data/vendor/toolkit/twitter/bootstrap/progress-bars.less +95 -0
- data/vendor/toolkit/twitter/bootstrap/reset.less +37 -52
- data/vendor/toolkit/twitter/bootstrap/responsive.less +323 -0
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +13 -123
- data/vendor/toolkit/twitter/bootstrap/sprites.less +156 -0
- data/vendor/toolkit/twitter/bootstrap/tables.less +75 -160
- data/vendor/toolkit/twitter/bootstrap/thumbnails.less +35 -0
- data/vendor/toolkit/twitter/bootstrap/tooltip.less +35 -0
- data/vendor/toolkit/twitter/bootstrap/type.less +100 -70
- data/vendor/toolkit/twitter/bootstrap/utilities.less +23 -0
- data/vendor/toolkit/twitter/bootstrap/variables.less +94 -55
- data/vendor/toolkit/twitter/bootstrap/wells.less +17 -0
- metadata +58 -49
- data/lib/generators/bootstrap/themed/templates/builders/builder.rb +0 -24
- data/lib/generators/bootstrap/themed/templates/builders/helper.rb +0 -6
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alerts.js +0 -124
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-buttons.js +0 -64
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tabs.js +0 -80
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-twipsy.js +0 -321
- data/vendor/toolkit/twitter/bootstrap/patterns.less +0 -1063
@@ -0,0 +1,136 @@
|
|
1
|
+
/* =============================================================
|
2
|
+
* bootstrap-collapse.js v2.0.0
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#collapse
|
4
|
+
* =============================================================
|
5
|
+
* Copyright 2012 Twitter, Inc.
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
* ============================================================ */
|
19
|
+
|
20
|
+
!function( $ ){
|
21
|
+
|
22
|
+
"use strict"
|
23
|
+
|
24
|
+
var Collapse = function ( element, options ) {
|
25
|
+
this.$element = $(element)
|
26
|
+
this.options = $.extend({}, $.fn.collapse.defaults, options)
|
27
|
+
|
28
|
+
if (this.options["parent"]) {
|
29
|
+
this.$parent = $(this.options["parent"])
|
30
|
+
}
|
31
|
+
|
32
|
+
this.options.toggle && this.toggle()
|
33
|
+
}
|
34
|
+
|
35
|
+
Collapse.prototype = {
|
36
|
+
|
37
|
+
constructor: Collapse
|
38
|
+
|
39
|
+
, dimension: function () {
|
40
|
+
var hasWidth = this.$element.hasClass('width')
|
41
|
+
return hasWidth ? 'width' : 'height'
|
42
|
+
}
|
43
|
+
|
44
|
+
, show: function () {
|
45
|
+
var dimension = this.dimension()
|
46
|
+
, scroll = $.camelCase(['scroll', dimension].join('-'))
|
47
|
+
, actives = this.$parent && this.$parent.find('.in')
|
48
|
+
, hasData
|
49
|
+
|
50
|
+
if (actives && actives.length) {
|
51
|
+
hasData = actives.data('collapse')
|
52
|
+
actives.collapse('hide')
|
53
|
+
hasData || actives.data('collapse', null)
|
54
|
+
}
|
55
|
+
|
56
|
+
this.$element[dimension](0)
|
57
|
+
this.transition('addClass', 'show', 'shown')
|
58
|
+
this.$element[dimension](this.$element[0][scroll])
|
59
|
+
|
60
|
+
}
|
61
|
+
|
62
|
+
, hide: function () {
|
63
|
+
var dimension = this.dimension()
|
64
|
+
this.reset(this.$element[dimension]())
|
65
|
+
this.transition('removeClass', 'hide', 'hidden')
|
66
|
+
this.$element[dimension](0)
|
67
|
+
}
|
68
|
+
|
69
|
+
, reset: function ( size ) {
|
70
|
+
var dimension = this.dimension()
|
71
|
+
|
72
|
+
this.$element
|
73
|
+
.removeClass('collapse')
|
74
|
+
[dimension](size || 'auto')
|
75
|
+
[0].offsetWidth
|
76
|
+
|
77
|
+
this.$element.addClass('collapse')
|
78
|
+
}
|
79
|
+
|
80
|
+
, transition: function ( method, startEvent, completeEvent ) {
|
81
|
+
var that = this
|
82
|
+
, complete = function () {
|
83
|
+
if (startEvent == 'show') that.reset()
|
84
|
+
that.$element.trigger(completeEvent)
|
85
|
+
}
|
86
|
+
|
87
|
+
this.$element
|
88
|
+
.trigger(startEvent)
|
89
|
+
[method]('in')
|
90
|
+
|
91
|
+
$.support.transition && this.$element.hasClass('collapse') ?
|
92
|
+
this.$element.one($.support.transition.end, complete) :
|
93
|
+
complete()
|
94
|
+
}
|
95
|
+
|
96
|
+
, toggle: function () {
|
97
|
+
this[this.$element.hasClass('in') ? 'hide' : 'show']()
|
98
|
+
}
|
99
|
+
|
100
|
+
}
|
101
|
+
|
102
|
+
/* COLLAPSIBLE PLUGIN DEFINITION
|
103
|
+
* ============================== */
|
104
|
+
|
105
|
+
$.fn.collapse = function ( option ) {
|
106
|
+
return this.each(function () {
|
107
|
+
var $this = $(this)
|
108
|
+
, data = $this.data('collapse')
|
109
|
+
, options = typeof option == 'object' && option
|
110
|
+
if (!data) $this.data('collapse', (data = new Collapse(this, options)))
|
111
|
+
if (typeof option == 'string') data[option]()
|
112
|
+
})
|
113
|
+
}
|
114
|
+
|
115
|
+
$.fn.collapse.defaults = {
|
116
|
+
toggle: true
|
117
|
+
}
|
118
|
+
|
119
|
+
$.fn.collapse.Constructor = Collapse
|
120
|
+
|
121
|
+
|
122
|
+
/* COLLAPSIBLE DATA-API
|
123
|
+
* ==================== */
|
124
|
+
|
125
|
+
$(function () {
|
126
|
+
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
|
127
|
+
var $this = $(this), href
|
128
|
+
, target = $this.attr('data-target')
|
129
|
+
|| e.preventDefault()
|
130
|
+
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
|
131
|
+
, option = $(target).data('collapse') ? 'toggle' : $this.data()
|
132
|
+
$(target).collapse(option)
|
133
|
+
})
|
134
|
+
})
|
135
|
+
|
136
|
+
}( window.jQuery )
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/* ============================================================
|
2
|
-
* bootstrap-dropdown.js
|
3
|
-
* http://twitter.github.com/bootstrap/javascript.html#
|
2
|
+
* bootstrap-dropdown.js v2.0.0
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
|
4
4
|
* ============================================================
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2012 Twitter, Inc.
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -22,34 +22,71 @@
|
|
22
22
|
|
23
23
|
"use strict"
|
24
24
|
|
25
|
+
/* DROPDOWN CLASS DEFINITION
|
26
|
+
* ========================= */
|
27
|
+
|
28
|
+
var toggle = '[data-toggle="dropdown"]'
|
29
|
+
, Dropdown = function ( element ) {
|
30
|
+
var $el = $(element).on('click.dropdown.data-api', this.toggle)
|
31
|
+
$('html').on('click.dropdown.data-api', function () {
|
32
|
+
$el.parent().removeClass('open')
|
33
|
+
})
|
34
|
+
}
|
35
|
+
|
36
|
+
Dropdown.prototype = {
|
37
|
+
|
38
|
+
constructor: Dropdown
|
39
|
+
|
40
|
+
, toggle: function ( e ) {
|
41
|
+
var $this = $(this)
|
42
|
+
, selector = $this.attr('data-target')
|
43
|
+
, $parent
|
44
|
+
, isActive
|
45
|
+
|
46
|
+
if (!selector) {
|
47
|
+
selector = $this.attr('href')
|
48
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
49
|
+
}
|
50
|
+
|
51
|
+
$parent = $(selector)
|
52
|
+
$parent.length || ($parent = $this.parent())
|
53
|
+
|
54
|
+
isActive = $parent.hasClass('open')
|
55
|
+
|
56
|
+
clearMenus()
|
57
|
+
!isActive && $parent.toggleClass('open')
|
58
|
+
|
59
|
+
return false
|
60
|
+
}
|
61
|
+
|
62
|
+
}
|
63
|
+
|
64
|
+
function clearMenus() {
|
65
|
+
$(toggle).parent().removeClass('open')
|
66
|
+
}
|
67
|
+
|
68
|
+
|
25
69
|
/* DROPDOWN PLUGIN DEFINITION
|
26
70
|
* ========================== */
|
27
71
|
|
28
|
-
$.fn.dropdown = function (
|
72
|
+
$.fn.dropdown = function ( option ) {
|
29
73
|
return this.each(function () {
|
30
|
-
$
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
clearMenus()
|
35
|
-
!isActive && li.toggleClass('open')
|
36
|
-
return false
|
37
|
-
})
|
74
|
+
var $this = $(this)
|
75
|
+
, data = $this.data('dropdown')
|
76
|
+
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
|
77
|
+
if (typeof option == 'string') data[option].call($this)
|
38
78
|
})
|
39
79
|
}
|
40
80
|
|
41
|
-
|
42
|
-
* =================================== */
|
81
|
+
$.fn.dropdown.Constructor = Dropdown
|
43
82
|
|
44
|
-
var d = 'a.menu, .dropdown-toggle'
|
45
83
|
|
46
|
-
|
47
|
-
|
48
|
-
}
|
84
|
+
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
85
|
+
* =================================== */
|
49
86
|
|
50
87
|
$(function () {
|
51
|
-
$('html').
|
52
|
-
$('body').
|
88
|
+
$('html').on('click.dropdown.data-api', clearMenus)
|
89
|
+
$('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
|
53
90
|
})
|
54
91
|
|
55
|
-
}( window.jQuery
|
92
|
+
}( window.jQuery )
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/* =========================================================
|
2
|
-
* bootstrap-modal.js
|
3
|
-
* http://twitter.github.com/bootstrap/javascript.html#
|
2
|
+
* bootstrap-modal.js v2.0.0
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#modals
|
4
4
|
* =========================================================
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2012 Twitter, Inc.
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -22,58 +22,30 @@
|
|
22
22
|
|
23
23
|
"use strict"
|
24
24
|
|
25
|
-
/*
|
26
|
-
*
|
27
|
-
|
28
|
-
var transitionEnd
|
29
|
-
|
30
|
-
$(document).ready(function () {
|
31
|
-
|
32
|
-
$.support.transition = (function () {
|
33
|
-
var thisBody = document.body || document.documentElement
|
34
|
-
, thisStyle = thisBody.style
|
35
|
-
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
|
36
|
-
return support
|
37
|
-
})()
|
38
|
-
|
39
|
-
// set CSS transition event type
|
40
|
-
if ( $.support.transition ) {
|
41
|
-
transitionEnd = "TransitionEnd"
|
42
|
-
if ( $.browser.webkit ) {
|
43
|
-
transitionEnd = "webkitTransitionEnd"
|
44
|
-
} else if ( $.browser.mozilla ) {
|
45
|
-
transitionEnd = "transitionend"
|
46
|
-
} else if ( $.browser.opera ) {
|
47
|
-
transitionEnd = "oTransitionEnd"
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
})
|
52
|
-
|
53
|
-
|
54
|
-
/* MODAL PUBLIC CLASS DEFINITION
|
55
|
-
* ============================= */
|
25
|
+
/* MODAL CLASS DEFINITION
|
26
|
+
* ====================== */
|
56
27
|
|
57
28
|
var Modal = function ( content, options ) {
|
58
|
-
this.
|
29
|
+
this.options = $.extend({}, $.fn.modal.defaults, options)
|
59
30
|
this.$element = $(content)
|
60
|
-
.delegate('
|
61
|
-
|
62
|
-
if ( this.settings.show ) {
|
63
|
-
this.show()
|
64
|
-
}
|
65
|
-
|
66
|
-
return this
|
31
|
+
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
|
67
32
|
}
|
68
33
|
|
69
34
|
Modal.prototype = {
|
70
35
|
|
71
|
-
|
36
|
+
constructor: Modal
|
37
|
+
|
38
|
+
, toggle: function () {
|
72
39
|
return this[!this.isShown ? 'show' : 'hide']()
|
73
40
|
}
|
74
41
|
|
75
42
|
, show: function () {
|
76
43
|
var that = this
|
44
|
+
|
45
|
+
if (this.isShown) return
|
46
|
+
|
47
|
+
$('body').addClass('modal-open')
|
48
|
+
|
77
49
|
this.isShown = true
|
78
50
|
this.$element.trigger('show')
|
79
51
|
|
@@ -81,8 +53,9 @@
|
|
81
53
|
backdrop.call(this, function () {
|
82
54
|
var transition = $.support.transition && that.$element.hasClass('fade')
|
83
55
|
|
56
|
+
!that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
|
57
|
+
|
84
58
|
that.$element
|
85
|
-
.appendTo(document.body)
|
86
59
|
.show()
|
87
60
|
|
88
61
|
if (transition) {
|
@@ -92,24 +65,22 @@
|
|
92
65
|
that.$element.addClass('in')
|
93
66
|
|
94
67
|
transition ?
|
95
|
-
that.$element.one(
|
68
|
+
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
|
96
69
|
that.$element.trigger('shown')
|
97
70
|
|
98
71
|
})
|
99
|
-
|
100
|
-
return this
|
101
72
|
}
|
102
73
|
|
103
|
-
, hide: function (e) {
|
74
|
+
, hide: function ( e ) {
|
104
75
|
e && e.preventDefault()
|
105
76
|
|
106
|
-
if (
|
107
|
-
return this
|
108
|
-
}
|
77
|
+
if (!this.isShown) return
|
109
78
|
|
110
79
|
var that = this
|
111
80
|
this.isShown = false
|
112
81
|
|
82
|
+
$('body').removeClass('modal-open')
|
83
|
+
|
113
84
|
escape.call(this)
|
114
85
|
|
115
86
|
this.$element
|
@@ -119,8 +90,6 @@
|
|
119
90
|
$.support.transition && this.$element.hasClass('fade') ?
|
120
91
|
hideWithTransition.call(this) :
|
121
92
|
hideModal.call(this)
|
122
|
-
|
123
|
-
return this
|
124
93
|
}
|
125
94
|
|
126
95
|
}
|
@@ -130,20 +99,19 @@
|
|
130
99
|
* ===================== */
|
131
100
|
|
132
101
|
function hideWithTransition() {
|
133
|
-
// firefox drops transitionEnd events :{o
|
134
102
|
var that = this
|
135
103
|
, timeout = setTimeout(function () {
|
136
|
-
that.$element.
|
104
|
+
that.$element.off($.support.transition.end)
|
137
105
|
hideModal.call(that)
|
138
106
|
}, 500)
|
139
107
|
|
140
|
-
this.$element.one(
|
108
|
+
this.$element.one($.support.transition.end, function () {
|
141
109
|
clearTimeout(timeout)
|
142
110
|
hideModal.call(that)
|
143
111
|
})
|
144
112
|
}
|
145
113
|
|
146
|
-
function hideModal
|
114
|
+
function hideModal( that ) {
|
147
115
|
this.$element
|
148
116
|
.hide()
|
149
117
|
.trigger('hidden')
|
@@ -151,38 +119,37 @@
|
|
151
119
|
backdrop.call(this)
|
152
120
|
}
|
153
121
|
|
154
|
-
function backdrop
|
122
|
+
function backdrop( callback ) {
|
155
123
|
var that = this
|
156
124
|
, animate = this.$element.hasClass('fade') ? 'fade' : ''
|
157
|
-
|
125
|
+
|
126
|
+
if (this.isShown && this.options.backdrop) {
|
158
127
|
var doAnimate = $.support.transition && animate
|
159
128
|
|
160
129
|
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
161
130
|
.appendTo(document.body)
|
162
131
|
|
163
|
-
if (
|
132
|
+
if (this.options.backdrop != 'static') {
|
164
133
|
this.$backdrop.click($.proxy(this.hide, this))
|
165
134
|
}
|
166
135
|
|
167
|
-
if (
|
168
|
-
this.$backdrop[0].offsetWidth // force reflow
|
169
|
-
}
|
136
|
+
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
|
170
137
|
|
171
138
|
this.$backdrop.addClass('in')
|
172
139
|
|
173
140
|
doAnimate ?
|
174
|
-
this.$backdrop.one(
|
141
|
+
this.$backdrop.one($.support.transition.end, callback) :
|
175
142
|
callback()
|
176
143
|
|
177
|
-
} else if (
|
144
|
+
} else if (!this.isShown && this.$backdrop) {
|
178
145
|
this.$backdrop.removeClass('in')
|
179
146
|
|
180
147
|
$.support.transition && this.$element.hasClass('fade')?
|
181
|
-
this.$backdrop.one(
|
148
|
+
this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
|
182
149
|
removeBackdrop.call(this)
|
183
150
|
|
184
|
-
} else if (
|
185
|
-
|
151
|
+
} else if (callback) {
|
152
|
+
callback()
|
186
153
|
}
|
187
154
|
}
|
188
155
|
|
@@ -193,14 +160,12 @@
|
|
193
160
|
|
194
161
|
function escape() {
|
195
162
|
var that = this
|
196
|
-
if (
|
197
|
-
$(document).
|
198
|
-
|
199
|
-
that.hide()
|
200
|
-
}
|
163
|
+
if (this.isShown && this.options.keyboard) {
|
164
|
+
$(document).on('keyup.dismiss.modal', function ( e ) {
|
165
|
+
e.which == 27 && that.hide()
|
201
166
|
})
|
202
|
-
} else if (
|
203
|
-
$(document).
|
167
|
+
} else if (!this.isShown) {
|
168
|
+
$(document).off('keyup.dismiss.modal')
|
204
169
|
}
|
205
170
|
}
|
206
171
|
|
@@ -208,53 +173,37 @@
|
|
208
173
|
/* MODAL PLUGIN DEFINITION
|
209
174
|
* ======================= */
|
210
175
|
|
211
|
-
$.fn.modal = function (
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
if (
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
}
|
221
|
-
|
222
|
-
return this.each(function () {
|
223
|
-
$(this).data('modal', new Modal(this, options))
|
224
|
-
})
|
225
|
-
}
|
226
|
-
|
227
|
-
if ( options === true ) {
|
228
|
-
return modal
|
229
|
-
}
|
230
|
-
|
231
|
-
if ( typeof options == 'string' ) {
|
232
|
-
modal[options]()
|
233
|
-
} else if ( modal ) {
|
234
|
-
modal.toggle()
|
235
|
-
}
|
236
|
-
|
237
|
-
return this
|
176
|
+
$.fn.modal = function ( option ) {
|
177
|
+
return this.each(function () {
|
178
|
+
var $this = $(this)
|
179
|
+
, data = $this.data('modal')
|
180
|
+
, options = typeof option == 'object' && option
|
181
|
+
if (!data) $this.data('modal', (data = new Modal(this, options)))
|
182
|
+
if (typeof option == 'string') data[option]()
|
183
|
+
else data.show()
|
184
|
+
})
|
238
185
|
}
|
239
186
|
|
240
|
-
$.fn.modal.Modal = Modal
|
241
|
-
|
242
187
|
$.fn.modal.defaults = {
|
243
|
-
|
244
|
-
|
245
|
-
, show: false
|
188
|
+
backdrop: true
|
189
|
+
, keyboard: true
|
246
190
|
}
|
247
191
|
|
192
|
+
$.fn.modal.Constructor = Modal
|
193
|
+
|
194
|
+
|
195
|
+
/* MODAL DATA-API
|
196
|
+
* ============== */
|
248
197
|
|
249
|
-
|
250
|
-
|
198
|
+
$(function () {
|
199
|
+
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
|
200
|
+
var $this = $(this), href
|
201
|
+
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
202
|
+
, option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
|
251
203
|
|
252
|
-
$(document).ready(function () {
|
253
|
-
$('body').delegate('[data-controls-modal]', 'click', function (e) {
|
254
204
|
e.preventDefault()
|
255
|
-
|
256
|
-
$('#' + $this.attr('data-controls-modal')).modal( $this.data() )
|
205
|
+
$target.modal(option)
|
257
206
|
})
|
258
207
|
})
|
259
208
|
|
260
|
-
}( window.jQuery
|
209
|
+
}( window.jQuery )
|