bootstrap-generators 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +238 -21
- data/bootstrap-generators.gemspec +3 -3
- data/lib/bootstrap-generators.rb +0 -1
- data/lib/bootstrap/generators/version.rb +1 -1
- data/lib/generators/bootstrap/install/install_generator.rb +5 -12
- data/lib/generators/bootstrap/install/templates/assets/stylesheets/fluid.css +5 -5
- data/lib/generators/bootstrap/install/templates/assets/stylesheets/fluid.css.less +119 -0
- data/lib/generators/bootstrap/install/templates/assets/stylesheets/fluid.css.scss +5 -5
- data/lib/generators/bootstrap/install/templates/assets/stylesheets/hero.css +0 -5
- data/lib/generators/bootstrap/install/templates/assets/stylesheets/hero.css.less +114 -0
- data/lib/generators/bootstrap/install/templates/assets/stylesheets/hero.css.scss +0 -5
- data/lib/generators/bootstrap/install/templates/config/initializers/simple_form.rb +118 -40
- data/lib/generators/bootstrap/install/templates/config/locales/simple_form.en.yml +24 -0
- data/lib/generators/bootstrap/install/templates/form_builders/form_builder/_form.html.erb +9 -8
- data/lib/generators/bootstrap/install/templates/form_builders/form_builder/_form.html.haml +8 -7
- data/lib/generators/bootstrap/install/templates/form_builders/simple_form/_form.html.erb +5 -7
- data/lib/generators/bootstrap/install/templates/form_builders/simple_form/_form.html.haml +6 -7
- data/lib/generators/bootstrap/install/templates/layouts/fluid.html.erb +50 -47
- data/lib/generators/bootstrap/install/templates/layouts/fluid.html.haml +75 -55
- data/lib/generators/bootstrap/install/templates/layouts/hero.html.erb +11 -14
- data/lib/generators/bootstrap/install/templates/layouts/hero.html.haml +9 -11
- data/lib/generators/bootstrap/install/templates/lib/templates/erb/scaffold/edit.html.erb +8 -2
- data/lib/generators/bootstrap/install/templates/lib/templates/erb/scaffold/index.html.erb +5 -2
- data/lib/generators/bootstrap/install/templates/lib/templates/erb/scaffold/new.html.erb +4 -1
- data/lib/generators/bootstrap/install/templates/lib/templates/erb/scaffold/show.html.erb +8 -2
- data/lib/generators/bootstrap/install/templates/lib/templates/haml/scaffold/edit.html.haml +6 -2
- data/lib/generators/bootstrap/install/templates/lib/templates/haml/scaffold/index.html.haml +4 -2
- data/lib/generators/bootstrap/install/templates/lib/templates/haml/scaffold/new.html.haml +3 -1
- data/lib/generators/bootstrap/install/templates/lib/templates/haml/scaffold/show.html.haml +6 -2
- data/test/lib/generators/bootstrap/install_generator_test.rb +6 -20
- data/test/test_helper.rb +1 -1
- data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/bootstrap-alert.js +91 -0
- data/vendor/assets/javascripts/bootstrap-button.js +98 -0
- data/vendor/assets/javascripts/bootstrap-carousel.js +154 -0
- data/vendor/assets/javascripts/bootstrap-collapse.js +136 -0
- data/vendor/assets/javascripts/bootstrap-dropdown.js +58 -21
- data/vendor/assets/javascripts/bootstrap-modal.js +63 -114
- data/vendor/assets/javascripts/bootstrap-popover.js +38 -33
- data/vendor/assets/javascripts/bootstrap-scrollspy.js +62 -44
- data/vendor/assets/javascripts/bootstrap-tab.js +130 -0
- data/vendor/assets/javascripts/bootstrap-tooltip.js +270 -0
- data/vendor/assets/javascripts/bootstrap-transition.js +51 -0
- data/vendor/assets/javascripts/bootstrap-typeahead.js +271 -0
- data/vendor/assets/javascripts/bootstrap.js +11 -6
- data/vendor/assets/stylesheets/bootstrap.css +2497 -1602
- data/vendor/assets/stylesheets/less/accordion.less +28 -0
- data/vendor/assets/stylesheets/less/alerts.less +70 -0
- data/vendor/assets/stylesheets/less/bootstrap.less +62 -0
- data/vendor/assets/stylesheets/less/breadcrumbs.less +22 -0
- data/vendor/assets/stylesheets/less/button-groups.less +147 -0
- data/vendor/assets/stylesheets/less/buttons.less +165 -0
- data/vendor/assets/stylesheets/less/carousel.less +121 -0
- data/vendor/assets/stylesheets/less/close.less +18 -0
- data/vendor/assets/stylesheets/less/code.less +44 -0
- data/vendor/assets/stylesheets/less/component-animations.less +18 -0
- data/vendor/assets/stylesheets/less/dropdowns.less +131 -0
- data/vendor/assets/stylesheets/less/forms.less +515 -0
- data/vendor/assets/stylesheets/less/grid.less +8 -0
- data/vendor/assets/stylesheets/less/hero-unit.less +20 -0
- data/vendor/assets/stylesheets/less/labels.less +16 -0
- data/vendor/assets/stylesheets/less/layouts.less +17 -0
- data/vendor/assets/stylesheets/less/mixins.less +537 -0
- data/vendor/assets/stylesheets/less/modals.less +72 -0
- data/vendor/assets/stylesheets/less/navbar.less +292 -0
- data/vendor/assets/stylesheets/less/navs.less +344 -0
- data/vendor/assets/stylesheets/less/pager.less +30 -0
- data/vendor/assets/stylesheets/less/pagination.less +55 -0
- data/vendor/assets/stylesheets/less/popovers.less +49 -0
- data/vendor/assets/stylesheets/less/progress-bars.less +95 -0
- data/vendor/assets/stylesheets/less/reset.less +126 -0
- data/vendor/assets/stylesheets/less/responsive.less +323 -0
- data/vendor/assets/stylesheets/less/scaffolding.less +29 -0
- data/vendor/assets/stylesheets/less/sprites.less +156 -0
- data/vendor/assets/stylesheets/less/tables.less +139 -0
- data/vendor/assets/stylesheets/less/thumbnails.less +35 -0
- data/vendor/assets/stylesheets/less/tooltip.less +35 -0
- data/vendor/assets/stylesheets/less/type.less +217 -0
- data/vendor/assets/stylesheets/less/utilities.less +23 -0
- data/vendor/assets/stylesheets/less/variables.less +99 -0
- data/vendor/assets/stylesheets/less/wells.less +17 -0
- metadata +62 -33
- data/lib/bootstrap/helpers/form_builder.rb +0 -26
- data/lib/generators/bootstrap/install/templates/app/inputs/boolean_input.rb +0 -12
- data/lib/generators/bootstrap/install/templates/app/inputs/collection_input.rb +0 -12
- data/lib/generators/bootstrap/install/templates/app/inputs/date_time_input.rb +0 -16
- data/lib/generators/bootstrap/install/templates/app/inputs/file_input.rb +0 -16
- data/lib/generators/bootstrap/install/templates/app/inputs/numeric_input.rb +0 -16
- data/lib/generators/bootstrap/install/templates/app/inputs/password_input.rb +0 -16
- data/lib/generators/bootstrap/install/templates/app/inputs/string_input.rb +0 -16
- data/lib/generators/bootstrap/install/templates/app/inputs/text_input.rb +0 -16
- data/lib/generators/bootstrap/install/templates/assets/stylesheets/container-app.css +0 -53
- data/lib/generators/bootstrap/install/templates/assets/stylesheets/container-app.css.scss +0 -55
- data/lib/generators/bootstrap/install/templates/layouts/container-app.html.erb +0 -58
- data/lib/generators/bootstrap/install/templates/layouts/container-app.html.haml +0 -46
- data/vendor/assets/javascripts/bootstrap-alerts.js +0 -113
- data/vendor/assets/javascripts/bootstrap-buttons.js +0 -62
- data/vendor/assets/javascripts/bootstrap-tabs.js +0 -80
- data/vendor/assets/javascripts/bootstrap-twipsy.js +0 -321
- data/vendor/assets/stylesheets/bootstrap.min.css +0 -356
@@ -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 )
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/* ===========================================================
|
2
|
-
* bootstrap-popover.js
|
3
|
-
* http://twitter.github.com/bootstrap/javascript.html#
|
2
|
+
* bootstrap-popover.js v2.0.0
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#popovers
|
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.
|
@@ -23,22 +23,25 @@
|
|
23
23
|
"use strict"
|
24
24
|
|
25
25
|
var Popover = function ( element, options ) {
|
26
|
-
this
|
27
|
-
this.options = options
|
28
|
-
this.enabled = true
|
29
|
-
this.fixTitle()
|
26
|
+
this.init('popover', element, options)
|
30
27
|
}
|
31
28
|
|
32
|
-
/* NOTE: POPOVER EXTENDS BOOTSTRAP-
|
33
|
-
|
29
|
+
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
|
30
|
+
========================================== */
|
34
31
|
|
35
|
-
Popover.prototype = $.extend({}, $.fn.
|
32
|
+
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
|
36
33
|
|
37
|
-
|
34
|
+
constructor: Popover
|
35
|
+
|
36
|
+
, setContent: function () {
|
38
37
|
var $tip = this.tip()
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
, title = this.getTitle()
|
39
|
+
, content = this.getContent()
|
40
|
+
|
41
|
+
$tip.find('.popover-title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
|
42
|
+
$tip.find('.popover-content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content)
|
43
|
+
|
44
|
+
$tip.removeClass('fade top bottom left right in')
|
42
45
|
}
|
43
46
|
|
44
47
|
, hasContent: function () {
|
@@ -47,22 +50,20 @@
|
|
47
50
|
|
48
51
|
, getContent: function () {
|
49
52
|
var content
|
50
|
-
|
51
|
-
|
53
|
+
, $e = this.$element
|
54
|
+
, o = this.options
|
52
55
|
|
53
|
-
|
54
|
-
content
|
55
|
-
|
56
|
-
|
57
|
-
}
|
56
|
+
content = $e.attr('data-content')
|
57
|
+
|| (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
|
58
|
+
|
59
|
+
content = content.toString().replace(/(^\s*|\s*$)/, "")
|
58
60
|
|
59
61
|
return content
|
60
62
|
}
|
61
63
|
|
62
64
|
, tip: function() {
|
63
65
|
if (!this.$tip) {
|
64
|
-
this.$tip = $(
|
65
|
-
.html(this.options.template)
|
66
|
+
this.$tip = $(this.options.template)
|
66
67
|
}
|
67
68
|
return this.$tip
|
68
69
|
}
|
@@ -73,18 +74,22 @@
|
|
73
74
|
/* POPOVER PLUGIN DEFINITION
|
74
75
|
* ======================= */
|
75
76
|
|
76
|
-
$.fn.popover = function (
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
$.fn.popover = function ( option ) {
|
78
|
+
return this.each(function () {
|
79
|
+
var $this = $(this)
|
80
|
+
, data = $this.data('popover')
|
81
|
+
, options = typeof option == 'object' && option
|
82
|
+
if (!data) $this.data('popover', (data = new Popover(this, options)))
|
83
|
+
if (typeof option == 'string') data[option]()
|
84
|
+
})
|
80
85
|
}
|
81
86
|
|
82
|
-
$.fn.popover.
|
87
|
+
$.fn.popover.Constructor = Popover
|
88
|
+
|
89
|
+
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
|
83
90
|
placement: 'right'
|
84
|
-
, content: '
|
85
|
-
, template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
|
91
|
+
, content: ''
|
92
|
+
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
|
86
93
|
})
|
87
94
|
|
88
|
-
|
89
|
-
|
90
|
-
}( window.jQuery || window.ender );
|
95
|
+
}( window.jQuery )
|