twitter-bootstrap-rails 2.2.8 → 3.2.0
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.
- checksums.yaml +7 -0
- data/README.md +82 -119
- data/Rakefile +4 -6
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +471 -366
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/javascripts/twitter/bootstrap.js +12 -13
- data/app/assets/javascripts/twitter/bootstrap/affix.js +137 -0
- data/app/assets/javascripts/twitter/bootstrap/alert.js +88 -0
- data/app/assets/javascripts/twitter/bootstrap/button.js +107 -0
- data/app/assets/javascripts/twitter/bootstrap/carousel.js +205 -0
- data/app/assets/javascripts/twitter/bootstrap/collapse.js +170 -0
- data/app/assets/javascripts/twitter/bootstrap/dropdown.js +147 -0
- data/app/assets/javascripts/twitter/bootstrap/modal.js +243 -0
- data/app/assets/javascripts/twitter/bootstrap/popover.js +110 -0
- data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +153 -0
- data/app/assets/javascripts/twitter/bootstrap/tab.js +125 -0
- data/app/assets/javascripts/twitter/bootstrap/tooltip.js +399 -0
- data/app/assets/javascripts/twitter/bootstrap/transition.js +48 -0
- data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +1 -890
- data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +4 -787
- data/app/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +1 -146
- data/app/helpers/bootstrap_flash_helper.rb +7 -5
- data/app/helpers/form_errors_helper.rb +22 -0
- data/app/helpers/glyph_helper.rb +8 -6
- data/app/helpers/modal_helper.rb +29 -21
- data/app/helpers/navbar_helper.rb +42 -30
- data/app/helpers/twitter_breadcrumbs_helper.rb +3 -2
- data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +4 -4
- data/lib/generators/bootstrap/install/install_generator.rb +3 -2
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +7 -8
- data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +5 -0
- data/lib/generators/bootstrap/layout/layout_generator.rb +1 -4
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +22 -43
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +16 -31
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +10 -25
- data/lib/generators/bootstrap/partial/templates/_login.html.erb +2 -3
- data/lib/generators/bootstrap/themed/templates/_form.html.erb +25 -8
- data/lib/generators/bootstrap/themed/templates/_form.html.haml +7 -7
- data/lib/generators/bootstrap/themed/templates/_form.html.slim +7 -7
- data/lib/generators/bootstrap/themed/templates/index.html.erb +2 -2
- data/lib/generators/bootstrap/themed/templates/index.html.haml +2 -2
- data/lib/generators/bootstrap/themed/templates/index.html.slim +2 -2
- data/lib/generators/bootstrap/themed/templates/show.html.erb +5 -7
- data/lib/generators/bootstrap/themed/templates/show.html.haml +4 -4
- data/lib/generators/bootstrap/themed/templates/show.html.slim +5 -6
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +5 -5
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +3 -3
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +4 -4
- data/lib/generators/bootstrap/themed/themed_generator.rb +2 -2
- data/lib/twitter/bootstrap/rails/{twitter-bootstrap-breadcrumbs.rb → breadcrumbs.rb} +24 -8
- data/lib/twitter/bootstrap/rails/engine.rb +5 -2
- data/lib/twitter/bootstrap/rails/version.rb +2 -2
- data/spec/lib/breadcrumbs_spec.rb +74 -0
- data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +4 -2
- data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +15 -15
- data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +157 -173
- data/spec/lib/twitter_bootstrap_rails/uri_state_spec.rb +18 -16
- data/spec/spec_helper.rb +7 -1
- data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +5797 -0
- data/vendor/static-source/bootstrap.less +0 -1
- data/vendor/static-source/fontawesome.less +0 -1
- data/vendor/static-source/sprites.less +1 -1
- data/vendor/toolkit/fontawesome/bordered-pulled.less +16 -0
- data/vendor/toolkit/fontawesome/core.less +9 -126
- data/vendor/toolkit/fontawesome/fixed-width.less +6 -0
- data/vendor/toolkit/fontawesome/font-awesome.less +9 -25
- data/vendor/toolkit/fontawesome/icons.less +503 -378
- data/vendor/toolkit/fontawesome/larger.less +13 -0
- data/vendor/toolkit/fontawesome/list.less +19 -0
- data/vendor/toolkit/fontawesome/mixins.less +14 -42
- data/vendor/toolkit/fontawesome/path.less +1 -1
- data/vendor/toolkit/fontawesome/rotated-flipped.less +9 -0
- data/vendor/toolkit/fontawesome/spinning.less +32 -0
- data/vendor/toolkit/fontawesome/stacked.less +20 -0
- data/vendor/toolkit/fontawesome/variables.less +511 -731
- data/vendor/toolkit/twitter/bootstrap/alerts.less +47 -58
- data/vendor/toolkit/twitter/bootstrap/badges.less +55 -0
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +27 -39
- data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +11 -9
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +168 -152
- data/vendor/toolkit/twitter/bootstrap/buttons.less +101 -170
- data/vendor/toolkit/twitter/bootstrap/carousel.less +150 -65
- data/vendor/toolkit/twitter/bootstrap/close.less +20 -19
- data/vendor/toolkit/twitter/bootstrap/code.less +38 -30
- data/vendor/toolkit/twitter/bootstrap/component-animations.less +12 -3
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +115 -148
- data/vendor/toolkit/twitter/bootstrap/forms.less +401 -547
- data/vendor/toolkit/twitter/bootstrap/glyphicons.less +233 -0
- data/vendor/toolkit/twitter/bootstrap/grid.less +74 -11
- data/vendor/toolkit/twitter/bootstrap/input-groups.less +166 -0
- data/vendor/toolkit/twitter/bootstrap/jumbotron.less +48 -0
- data/vendor/toolkit/twitter/bootstrap/labels.less +64 -0
- data/vendor/toolkit/twitter/bootstrap/list-group.less +132 -0
- data/vendor/toolkit/twitter/bootstrap/media.less +8 -7
- data/vendor/toolkit/twitter/bootstrap/mixins.less +36 -699
- data/vendor/toolkit/twitter/bootstrap/mixins/alerts.less +14 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/background-variant.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/border-radius.less +18 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/buttons.less +52 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/center-block.less +7 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/clearfix.less +22 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/forms.less +85 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/gradients.less +59 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/grid-framework.less +91 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/grid.less +122 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/hide-text.less +21 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/image.less +33 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/labels.less +12 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/list-group.less +29 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/nav-divider.less +10 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/nav-vertical-align.less +9 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/opacity.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/pagination.less +23 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/panels.less +24 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/progress-bar.less +10 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/reset-filter.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/resize.less +6 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/responsive-visibility.less +15 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/size.less +10 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/tab-focus.less +9 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/table-row.less +28 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/text-emphasis.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/text-overflow.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/vendor-prefixes.less +224 -0
- data/vendor/toolkit/twitter/bootstrap/modals.less +109 -54
- data/vendor/toolkit/twitter/bootstrap/navbar.less +542 -384
- data/vendor/toolkit/twitter/bootstrap/navs.less +192 -359
- data/vendor/toolkit/twitter/bootstrap/normalize.less +425 -0
- data/vendor/toolkit/twitter/bootstrap/pager.less +46 -34
- data/vendor/toolkit/twitter/bootstrap/pagination.less +70 -105
- data/vendor/toolkit/twitter/bootstrap/panels.less +248 -0
- data/vendor/toolkit/twitter/bootstrap/popovers.less +61 -61
- data/vendor/toolkit/twitter/bootstrap/print.less +101 -0
- data/vendor/toolkit/twitter/bootstrap/progress-bars.less +51 -73
- data/vendor/toolkit/twitter/bootstrap/responsive-embed.less +34 -0
- data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +177 -42
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +120 -23
- data/vendor/toolkit/twitter/bootstrap/tables.less +171 -182
- data/vendor/toolkit/twitter/bootstrap/theme.less +260 -0
- data/vendor/toolkit/twitter/bootstrap/thumbnails.less +26 -43
- data/vendor/toolkit/twitter/bootstrap/tooltip.less +49 -24
- data/vendor/toolkit/twitter/bootstrap/type.less +208 -147
- data/vendor/toolkit/twitter/bootstrap/utilities.less +33 -7
- data/vendor/toolkit/twitter/bootstrap/variables.less +761 -215
- data/vendor/toolkit/twitter/bootstrap/wells.less +7 -7
- metadata +128 -138
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-affix.js +0 -117
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +0 -99
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-button.js +0 -105
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +0 -207
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +0 -167
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +0 -169
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +0 -247
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +0 -114
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +0 -162
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +0 -144
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +0 -361
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +0 -60
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +0 -335
- data/test/lib/breadcrumbs_test.rb +0 -75
- data/test/test_helper.rb +0 -11
- data/vendor/toolkit/fontawesome/bootstrap.less +0 -84
- data/vendor/toolkit/fontawesome/extras.less +0 -93
- data/vendor/toolkit/fontawesome/font-awesome-ie7.less +0 -1953
- data/vendor/toolkit/twitter/bootstrap/accordion.less +0 -34
- data/vendor/toolkit/twitter/bootstrap/hero-unit.less +0 -25
- data/vendor/toolkit/twitter/bootstrap/labels-badges.less +0 -84
- data/vendor/toolkit/twitter/bootstrap/layouts.less +0 -16
- data/vendor/toolkit/twitter/bootstrap/reset.less +0 -216
- data/vendor/toolkit/twitter/bootstrap/responsive-1200px-min.less +0 -28
- data/vendor/toolkit/twitter/bootstrap/responsive-767px-max.less +0 -193
- data/vendor/toolkit/twitter/bootstrap/responsive-768px-979px.less +0 -19
- data/vendor/toolkit/twitter/bootstrap/responsive-navbar.less +0 -189
- data/vendor/toolkit/twitter/bootstrap/responsive.less +0 -48
- data/vendor/toolkit/twitter/bootstrap/sprites.less +0 -197
@@ -0,0 +1,147 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: dropdown.js v3.1.1
|
3
|
+
* http://getbootstrap.com/javascript/#dropdowns
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2011-2014 Twitter, Inc.
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
|
+
* ======================================================================== */
|
8
|
+
|
9
|
+
|
10
|
+
+function ($) {
|
11
|
+
'use strict';
|
12
|
+
|
13
|
+
// DROPDOWN CLASS DEFINITION
|
14
|
+
// =========================
|
15
|
+
|
16
|
+
var backdrop = '.dropdown-backdrop'
|
17
|
+
var toggle = '[data-toggle=dropdown]'
|
18
|
+
var Dropdown = function (element) {
|
19
|
+
$(element).on('click.bs.dropdown', this.toggle)
|
20
|
+
}
|
21
|
+
|
22
|
+
Dropdown.prototype.toggle = function (e) {
|
23
|
+
var $this = $(this)
|
24
|
+
|
25
|
+
if ($this.is('.disabled, :disabled')) return
|
26
|
+
|
27
|
+
var $parent = getParent($this)
|
28
|
+
var isActive = $parent.hasClass('open')
|
29
|
+
|
30
|
+
clearMenus()
|
31
|
+
|
32
|
+
if (!isActive) {
|
33
|
+
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
|
34
|
+
// if mobile we use a backdrop because click events don't delegate
|
35
|
+
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
|
36
|
+
}
|
37
|
+
|
38
|
+
var relatedTarget = { relatedTarget: this }
|
39
|
+
$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
|
40
|
+
|
41
|
+
if (e.isDefaultPrevented()) return
|
42
|
+
|
43
|
+
$parent
|
44
|
+
.toggleClass('open')
|
45
|
+
.trigger('shown.bs.dropdown', relatedTarget)
|
46
|
+
|
47
|
+
$this.focus()
|
48
|
+
}
|
49
|
+
|
50
|
+
return false
|
51
|
+
}
|
52
|
+
|
53
|
+
Dropdown.prototype.keydown = function (e) {
|
54
|
+
if (!/(38|40|27)/.test(e.keyCode)) return
|
55
|
+
|
56
|
+
var $this = $(this)
|
57
|
+
|
58
|
+
e.preventDefault()
|
59
|
+
e.stopPropagation()
|
60
|
+
|
61
|
+
if ($this.is('.disabled, :disabled')) return
|
62
|
+
|
63
|
+
var $parent = getParent($this)
|
64
|
+
var isActive = $parent.hasClass('open')
|
65
|
+
|
66
|
+
if (!isActive || (isActive && e.keyCode == 27)) {
|
67
|
+
if (e.which == 27) $parent.find(toggle).focus()
|
68
|
+
return $this.click()
|
69
|
+
}
|
70
|
+
|
71
|
+
var desc = ' li:not(.divider):visible a'
|
72
|
+
var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc)
|
73
|
+
|
74
|
+
if (!$items.length) return
|
75
|
+
|
76
|
+
var index = $items.index($items.filter(':focus'))
|
77
|
+
|
78
|
+
if (e.keyCode == 38 && index > 0) index-- // up
|
79
|
+
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
|
80
|
+
if (!~index) index = 0
|
81
|
+
|
82
|
+
$items.eq(index).focus()
|
83
|
+
}
|
84
|
+
|
85
|
+
function clearMenus(e) {
|
86
|
+
$(backdrop).remove()
|
87
|
+
$(toggle).each(function () {
|
88
|
+
var $parent = getParent($(this))
|
89
|
+
var relatedTarget = { relatedTarget: this }
|
90
|
+
if (!$parent.hasClass('open')) return
|
91
|
+
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
|
92
|
+
if (e.isDefaultPrevented()) return
|
93
|
+
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
|
94
|
+
})
|
95
|
+
}
|
96
|
+
|
97
|
+
function getParent($this) {
|
98
|
+
var selector = $this.attr('data-target')
|
99
|
+
|
100
|
+
if (!selector) {
|
101
|
+
selector = $this.attr('href')
|
102
|
+
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
103
|
+
}
|
104
|
+
|
105
|
+
var $parent = selector && $(selector)
|
106
|
+
|
107
|
+
return $parent && $parent.length ? $parent : $this.parent()
|
108
|
+
}
|
109
|
+
|
110
|
+
|
111
|
+
// DROPDOWN PLUGIN DEFINITION
|
112
|
+
// ==========================
|
113
|
+
|
114
|
+
var old = $.fn.dropdown
|
115
|
+
|
116
|
+
$.fn.dropdown = function (option) {
|
117
|
+
return this.each(function () {
|
118
|
+
var $this = $(this)
|
119
|
+
var data = $this.data('bs.dropdown')
|
120
|
+
|
121
|
+
if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
|
122
|
+
if (typeof option == 'string') data[option].call($this)
|
123
|
+
})
|
124
|
+
}
|
125
|
+
|
126
|
+
$.fn.dropdown.Constructor = Dropdown
|
127
|
+
|
128
|
+
|
129
|
+
// DROPDOWN NO CONFLICT
|
130
|
+
// ====================
|
131
|
+
|
132
|
+
$.fn.dropdown.noConflict = function () {
|
133
|
+
$.fn.dropdown = old
|
134
|
+
return this
|
135
|
+
}
|
136
|
+
|
137
|
+
|
138
|
+
// APPLY TO STANDARD DROPDOWN ELEMENTS
|
139
|
+
// ===================================
|
140
|
+
|
141
|
+
$(document)
|
142
|
+
.on('click.bs.dropdown.data-api', clearMenus)
|
143
|
+
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
144
|
+
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
|
145
|
+
.on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown)
|
146
|
+
|
147
|
+
}(jQuery);
|
@@ -0,0 +1,243 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: modal.js v3.1.1
|
3
|
+
* http://getbootstrap.com/javascript/#modals
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2011-2014 Twitter, Inc.
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
|
+
* ======================================================================== */
|
8
|
+
|
9
|
+
|
10
|
+
+function ($) {
|
11
|
+
'use strict';
|
12
|
+
|
13
|
+
// MODAL CLASS DEFINITION
|
14
|
+
// ======================
|
15
|
+
|
16
|
+
var Modal = function (element, options) {
|
17
|
+
this.options = options
|
18
|
+
this.$element = $(element)
|
19
|
+
this.$backdrop =
|
20
|
+
this.isShown = null
|
21
|
+
|
22
|
+
if (this.options.remote) {
|
23
|
+
this.$element
|
24
|
+
.find('.modal-content')
|
25
|
+
.load(this.options.remote, $.proxy(function () {
|
26
|
+
this.$element.trigger('loaded.bs.modal')
|
27
|
+
}, this))
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
Modal.DEFAULTS = {
|
32
|
+
backdrop: true,
|
33
|
+
keyboard: true,
|
34
|
+
show: true
|
35
|
+
}
|
36
|
+
|
37
|
+
Modal.prototype.toggle = function (_relatedTarget) {
|
38
|
+
return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
|
39
|
+
}
|
40
|
+
|
41
|
+
Modal.prototype.show = function (_relatedTarget) {
|
42
|
+
var that = this
|
43
|
+
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
|
44
|
+
|
45
|
+
this.$element.trigger(e)
|
46
|
+
|
47
|
+
if (this.isShown || e.isDefaultPrevented()) return
|
48
|
+
|
49
|
+
this.isShown = true
|
50
|
+
|
51
|
+
this.escape()
|
52
|
+
|
53
|
+
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
|
54
|
+
|
55
|
+
this.backdrop(function () {
|
56
|
+
var transition = $.support.transition && that.$element.hasClass('fade')
|
57
|
+
|
58
|
+
if (!that.$element.parent().length) {
|
59
|
+
that.$element.appendTo(document.body) // don't move modals dom position
|
60
|
+
}
|
61
|
+
|
62
|
+
that.$element
|
63
|
+
.show()
|
64
|
+
.scrollTop(0)
|
65
|
+
|
66
|
+
if (transition) {
|
67
|
+
that.$element[0].offsetWidth // force reflow
|
68
|
+
}
|
69
|
+
|
70
|
+
that.$element
|
71
|
+
.addClass('in')
|
72
|
+
.attr('aria-hidden', false)
|
73
|
+
|
74
|
+
that.enforceFocus()
|
75
|
+
|
76
|
+
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
|
77
|
+
|
78
|
+
transition ?
|
79
|
+
that.$element.find('.modal-dialog') // wait for modal to slide in
|
80
|
+
.one($.support.transition.end, function () {
|
81
|
+
that.$element.focus().trigger(e)
|
82
|
+
})
|
83
|
+
.emulateTransitionEnd(300) :
|
84
|
+
that.$element.focus().trigger(e)
|
85
|
+
})
|
86
|
+
}
|
87
|
+
|
88
|
+
Modal.prototype.hide = function (e) {
|
89
|
+
if (e) e.preventDefault()
|
90
|
+
|
91
|
+
e = $.Event('hide.bs.modal')
|
92
|
+
|
93
|
+
this.$element.trigger(e)
|
94
|
+
|
95
|
+
if (!this.isShown || e.isDefaultPrevented()) return
|
96
|
+
|
97
|
+
this.isShown = false
|
98
|
+
|
99
|
+
this.escape()
|
100
|
+
|
101
|
+
$(document).off('focusin.bs.modal')
|
102
|
+
|
103
|
+
this.$element
|
104
|
+
.removeClass('in')
|
105
|
+
.attr('aria-hidden', true)
|
106
|
+
.off('click.dismiss.bs.modal')
|
107
|
+
|
108
|
+
$.support.transition && this.$element.hasClass('fade') ?
|
109
|
+
this.$element
|
110
|
+
.one($.support.transition.end, $.proxy(this.hideModal, this))
|
111
|
+
.emulateTransitionEnd(300) :
|
112
|
+
this.hideModal()
|
113
|
+
}
|
114
|
+
|
115
|
+
Modal.prototype.enforceFocus = function () {
|
116
|
+
$(document)
|
117
|
+
.off('focusin.bs.modal') // guard against infinite focus loop
|
118
|
+
.on('focusin.bs.modal', $.proxy(function (e) {
|
119
|
+
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
|
120
|
+
this.$element.focus()
|
121
|
+
}
|
122
|
+
}, this))
|
123
|
+
}
|
124
|
+
|
125
|
+
Modal.prototype.escape = function () {
|
126
|
+
if (this.isShown && this.options.keyboard) {
|
127
|
+
this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
|
128
|
+
e.which == 27 && this.hide()
|
129
|
+
}, this))
|
130
|
+
} else if (!this.isShown) {
|
131
|
+
this.$element.off('keyup.dismiss.bs.modal')
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
Modal.prototype.hideModal = function () {
|
136
|
+
var that = this
|
137
|
+
this.$element.hide()
|
138
|
+
this.backdrop(function () {
|
139
|
+
that.removeBackdrop()
|
140
|
+
that.$element.trigger('hidden.bs.modal')
|
141
|
+
})
|
142
|
+
}
|
143
|
+
|
144
|
+
Modal.prototype.removeBackdrop = function () {
|
145
|
+
this.$backdrop && this.$backdrop.remove()
|
146
|
+
this.$backdrop = null
|
147
|
+
}
|
148
|
+
|
149
|
+
Modal.prototype.backdrop = function (callback) {
|
150
|
+
var animate = this.$element.hasClass('fade') ? 'fade' : ''
|
151
|
+
|
152
|
+
if (this.isShown && this.options.backdrop) {
|
153
|
+
var doAnimate = $.support.transition && animate
|
154
|
+
|
155
|
+
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
156
|
+
.appendTo(document.body)
|
157
|
+
|
158
|
+
this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
|
159
|
+
if (e.target !== e.currentTarget) return
|
160
|
+
this.options.backdrop == 'static'
|
161
|
+
? this.$element[0].focus.call(this.$element[0])
|
162
|
+
: this.hide.call(this)
|
163
|
+
}, this))
|
164
|
+
|
165
|
+
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
|
166
|
+
|
167
|
+
this.$backdrop.addClass('in')
|
168
|
+
|
169
|
+
if (!callback) return
|
170
|
+
|
171
|
+
doAnimate ?
|
172
|
+
this.$backdrop
|
173
|
+
.one($.support.transition.end, callback)
|
174
|
+
.emulateTransitionEnd(150) :
|
175
|
+
callback()
|
176
|
+
|
177
|
+
} else if (!this.isShown && this.$backdrop) {
|
178
|
+
this.$backdrop.removeClass('in')
|
179
|
+
|
180
|
+
$.support.transition && this.$element.hasClass('fade') ?
|
181
|
+
this.$backdrop
|
182
|
+
.one($.support.transition.end, callback)
|
183
|
+
.emulateTransitionEnd(150) :
|
184
|
+
callback()
|
185
|
+
|
186
|
+
} else if (callback) {
|
187
|
+
callback()
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
|
192
|
+
// MODAL PLUGIN DEFINITION
|
193
|
+
// =======================
|
194
|
+
|
195
|
+
var old = $.fn.modal
|
196
|
+
|
197
|
+
$.fn.modal = function (option, _relatedTarget) {
|
198
|
+
return this.each(function () {
|
199
|
+
var $this = $(this)
|
200
|
+
var data = $this.data('bs.modal')
|
201
|
+
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
202
|
+
|
203
|
+
if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
|
204
|
+
if (typeof option == 'string') data[option](_relatedTarget)
|
205
|
+
else if (options.show) data.show(_relatedTarget)
|
206
|
+
})
|
207
|
+
}
|
208
|
+
|
209
|
+
$.fn.modal.Constructor = Modal
|
210
|
+
|
211
|
+
|
212
|
+
// MODAL NO CONFLICT
|
213
|
+
// =================
|
214
|
+
|
215
|
+
$.fn.modal.noConflict = function () {
|
216
|
+
$.fn.modal = old
|
217
|
+
return this
|
218
|
+
}
|
219
|
+
|
220
|
+
|
221
|
+
// MODAL DATA-API
|
222
|
+
// ==============
|
223
|
+
|
224
|
+
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
|
225
|
+
var $this = $(this)
|
226
|
+
var href = $this.attr('href')
|
227
|
+
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
|
228
|
+
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
|
229
|
+
|
230
|
+
if ($this.is('a')) e.preventDefault()
|
231
|
+
|
232
|
+
$target
|
233
|
+
.modal(option, this)
|
234
|
+
.one('hide', function () {
|
235
|
+
$this.is(':visible') && $this.focus()
|
236
|
+
})
|
237
|
+
})
|
238
|
+
|
239
|
+
$(document)
|
240
|
+
.on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
|
241
|
+
.on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
|
242
|
+
|
243
|
+
}(jQuery);
|
@@ -0,0 +1,110 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: popover.js v3.1.1
|
3
|
+
* http://getbootstrap.com/javascript/#popovers
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2011-2014 Twitter, Inc.
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
|
+
* ======================================================================== */
|
8
|
+
|
9
|
+
|
10
|
+
+function ($) {
|
11
|
+
'use strict';
|
12
|
+
|
13
|
+
// POPOVER PUBLIC CLASS DEFINITION
|
14
|
+
// ===============================
|
15
|
+
|
16
|
+
var Popover = function (element, options) {
|
17
|
+
this.init('popover', element, options)
|
18
|
+
}
|
19
|
+
|
20
|
+
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
|
21
|
+
|
22
|
+
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
|
23
|
+
placement: 'right',
|
24
|
+
trigger: 'click',
|
25
|
+
content: '',
|
26
|
+
template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
|
27
|
+
})
|
28
|
+
|
29
|
+
|
30
|
+
// NOTE: POPOVER EXTENDS tooltip.js
|
31
|
+
// ================================
|
32
|
+
|
33
|
+
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
|
34
|
+
|
35
|
+
Popover.prototype.constructor = Popover
|
36
|
+
|
37
|
+
Popover.prototype.getDefaults = function () {
|
38
|
+
return Popover.DEFAULTS
|
39
|
+
}
|
40
|
+
|
41
|
+
Popover.prototype.setContent = function () {
|
42
|
+
var $tip = this.tip()
|
43
|
+
var title = this.getTitle()
|
44
|
+
var content = this.getContent()
|
45
|
+
|
46
|
+
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
|
47
|
+
$tip.find('.popover-content')[ // we use append for html objects to maintain js events
|
48
|
+
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
|
49
|
+
](content)
|
50
|
+
|
51
|
+
$tip.removeClass('fade top bottom left right in')
|
52
|
+
|
53
|
+
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
|
54
|
+
// this manually by checking the contents.
|
55
|
+
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
|
56
|
+
}
|
57
|
+
|
58
|
+
Popover.prototype.hasContent = function () {
|
59
|
+
return this.getTitle() || this.getContent()
|
60
|
+
}
|
61
|
+
|
62
|
+
Popover.prototype.getContent = function () {
|
63
|
+
var $e = this.$element
|
64
|
+
var o = this.options
|
65
|
+
|
66
|
+
return $e.attr('data-content')
|
67
|
+
|| (typeof o.content == 'function' ?
|
68
|
+
o.content.call($e[0]) :
|
69
|
+
o.content)
|
70
|
+
}
|
71
|
+
|
72
|
+
Popover.prototype.arrow = function () {
|
73
|
+
return this.$arrow = this.$arrow || this.tip().find('.arrow')
|
74
|
+
}
|
75
|
+
|
76
|
+
Popover.prototype.tip = function () {
|
77
|
+
if (!this.$tip) this.$tip = $(this.options.template)
|
78
|
+
return this.$tip
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
// POPOVER PLUGIN DEFINITION
|
83
|
+
// =========================
|
84
|
+
|
85
|
+
var old = $.fn.popover
|
86
|
+
|
87
|
+
$.fn.popover = function (option) {
|
88
|
+
return this.each(function () {
|
89
|
+
var $this = $(this)
|
90
|
+
var data = $this.data('bs.popover')
|
91
|
+
var options = typeof option == 'object' && option
|
92
|
+
|
93
|
+
if (!data && option == 'destroy') return
|
94
|
+
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
|
95
|
+
if (typeof option == 'string') data[option]()
|
96
|
+
})
|
97
|
+
}
|
98
|
+
|
99
|
+
$.fn.popover.Constructor = Popover
|
100
|
+
|
101
|
+
|
102
|
+
// POPOVER NO CONFLICT
|
103
|
+
// ===================
|
104
|
+
|
105
|
+
$.fn.popover.noConflict = function () {
|
106
|
+
$.fn.popover = old
|
107
|
+
return this
|
108
|
+
}
|
109
|
+
|
110
|
+
}(jQuery);
|