twitter-bootstrap3-rails 3.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +708 -0
- data/Rakefile +46 -0
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +399 -0
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- data/app/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
- data/app/assets/javascripts/twitter/bootstrap.js +12 -0
- data/app/assets/javascripts/twitter/bootstrap/affix.js +126 -0
- data/app/assets/javascripts/twitter/bootstrap/alert.js +98 -0
- data/app/assets/javascripts/twitter/bootstrap/button.js +109 -0
- data/app/assets/javascripts/twitter/bootstrap/carousel.js +217 -0
- data/app/assets/javascripts/twitter/bootstrap/collapse.js +179 -0
- data/app/assets/javascripts/twitter/bootstrap/dropdown.js +154 -0
- data/app/assets/javascripts/twitter/bootstrap/modal.js +244 -0
- data/app/assets/javascripts/twitter/bootstrap/popover.js +117 -0
- data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +158 -0
- data/app/assets/javascripts/twitter/bootstrap/tab.js +135 -0
- data/app/assets/javascripts/twitter/bootstrap/tooltip.js +382 -0
- data/app/assets/javascripts/twitter/bootstrap/transition.js +56 -0
- data/app/assets/javascripts/twitter/bootstrap_ujs.js +11 -0
- data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +5579 -0
- data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +787 -0
- data/app/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +146 -0
- data/app/helpers/badge_label_helper.rb +16 -0
- data/app/helpers/bootstrap_flash_helper.rb +29 -0
- data/app/helpers/flash_block_helper.rb +17 -0
- data/app/helpers/glyph_helper.rb +17 -0
- data/app/helpers/modal_helper.rb +59 -0
- data/app/helpers/navbar_helper.rb +195 -0
- data/app/helpers/twitter_breadcrumbs_helper.rb +10 -0
- data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +12 -0
- data/lib/generators/bootstrap/install/install_generator.rb +82 -0
- data/lib/generators/bootstrap/install/templates/application.css +7 -0
- data/lib/generators/bootstrap/install/templates/application.js +10 -0
- data/lib/generators/bootstrap/install/templates/bootstrap.coffee +3 -0
- data/lib/generators/bootstrap/install/templates/bootstrap.js +4 -0
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.css +7 -0
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +29 -0
- data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +18 -0
- data/lib/generators/bootstrap/layout/layout_generator.rb +20 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +85 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +50 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +52 -0
- data/lib/generators/bootstrap/partial/partial_generator.rb +20 -0
- data/lib/generators/bootstrap/partial/templates/_login.html.erb +28 -0
- data/lib/generators/bootstrap/themed/templates/_form.html.erb +16 -0
- data/lib/generators/bootstrap/themed/templates/_form.html.haml +9 -0
- data/lib/generators/bootstrap/themed/templates/_form.html.slim +10 -0
- data/lib/generators/bootstrap/themed/templates/edit.html.erb +5 -0
- data/lib/generators/bootstrap/themed/templates/edit.html.haml +4 -0
- data/lib/generators/bootstrap/themed/templates/edit.html.slim +4 -0
- data/lib/generators/bootstrap/themed/templates/index.html.erb +40 -0
- data/lib/generators/bootstrap/themed/templates/index.html.haml +25 -0
- data/lib/generators/bootstrap/themed/templates/index.html.slim +27 -0
- data/lib/generators/bootstrap/themed/templates/new.html.erb +5 -0
- data/lib/generators/bootstrap/themed/templates/new.html.haml +4 -0
- data/lib/generators/bootstrap/themed/templates/new.html.slim +4 -0
- data/lib/generators/bootstrap/themed/templates/show.html.erb +21 -0
- data/lib/generators/bootstrap/themed/templates/show.html.haml +15 -0
- data/lib/generators/bootstrap/themed/templates/show.html.slim +16 -0
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +13 -0
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +10 -0
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +11 -0
- data/lib/generators/bootstrap/themed/themed_generator.rb +148 -0
- data/lib/twitter-bootstrap-rails.rb +10 -0
- data/lib/twitter/bootstrap/rails/bootstrap.rb +2 -0
- data/lib/twitter/bootstrap/rails/engine.rb +33 -0
- data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +42 -0
- data/lib/twitter/bootstrap/rails/version.rb +7 -0
- data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +22 -0
- data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +62 -0
- data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +331 -0
- data/spec/lib/twitter_bootstrap_rails/uri_state_spec.rb +47 -0
- data/spec/spec_helper.rb +11 -0
- data/test/lib/breadcrumbs_test.rb +75 -0
- data/test/test_helper.rb +11 -0
- data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +5579 -0
- data/vendor/static-source/bootstrap.less +1 -0
- data/vendor/static-source/fontawesome.less +9 -0
- data/vendor/static-source/sprites.less +6 -0
- data/vendor/toolkit/fontawesome/bootstrap.less +84 -0
- data/vendor/toolkit/fontawesome/core.less +129 -0
- data/vendor/toolkit/fontawesome/extras.less +93 -0
- data/vendor/toolkit/fontawesome/font-awesome-ie7.less +1953 -0
- data/vendor/toolkit/fontawesome/font-awesome.less +33 -0
- data/vendor/toolkit/fontawesome/icons.less +381 -0
- data/vendor/toolkit/fontawesome/mixins.less +48 -0
- data/vendor/toolkit/fontawesome/path.less +14 -0
- data/vendor/toolkit/fontawesome/variables.less +735 -0
- data/vendor/toolkit/twitter/bootstrap/alerts.less +71 -0
- data/vendor/toolkit/twitter/bootstrap/badges.less +51 -0
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +63 -0
- data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +23 -0
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +244 -0
- data/vendor/toolkit/twitter/bootstrap/buttons.less +159 -0
- data/vendor/toolkit/twitter/bootstrap/carousel.less +204 -0
- data/vendor/toolkit/twitter/bootstrap/close.less +33 -0
- data/vendor/toolkit/twitter/bootstrap/code.less +56 -0
- data/vendor/toolkit/twitter/bootstrap/component-animations.less +29 -0
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +176 -0
- data/vendor/toolkit/twitter/bootstrap/forms.less +332 -0
- data/vendor/toolkit/twitter/bootstrap/grid.less +340 -0
- data/vendor/toolkit/twitter/bootstrap/input-groups.less +127 -0
- data/vendor/toolkit/twitter/bootstrap/jumbotron.less +29 -0
- data/vendor/toolkit/twitter/bootstrap/labels.less +54 -0
- data/vendor/toolkit/twitter/bootstrap/list-group.less +88 -0
- data/vendor/toolkit/twitter/bootstrap/media.less +56 -0
- data/vendor/toolkit/twitter/bootstrap/mixins.less +693 -0
- data/vendor/toolkit/twitter/bootstrap/modals.less +133 -0
- data/vendor/toolkit/twitter/bootstrap/navbar.less +559 -0
- data/vendor/toolkit/twitter/bootstrap/navs.less +228 -0
- data/vendor/toolkit/twitter/bootstrap/normalize.less +396 -0
- data/vendor/toolkit/twitter/bootstrap/pager.less +55 -0
- data/vendor/toolkit/twitter/bootstrap/pagination.less +72 -0
- data/vendor/toolkit/twitter/bootstrap/panels.less +128 -0
- data/vendor/toolkit/twitter/bootstrap/popovers.less +133 -0
- data/vendor/toolkit/twitter/bootstrap/print.less +100 -0
- data/vendor/toolkit/twitter/bootstrap/progress-bars.less +99 -0
- data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +149 -0
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +111 -0
- data/vendor/toolkit/twitter/bootstrap/tables.less +211 -0
- data/vendor/toolkit/twitter/bootstrap/thumbnails.less +42 -0
- data/vendor/toolkit/twitter/bootstrap/tooltip.less +95 -0
- data/vendor/toolkit/twitter/bootstrap/type.less +238 -0
- data/vendor/toolkit/twitter/bootstrap/utilities.less +42 -0
- data/vendor/toolkit/twitter/bootstrap/variables.less +607 -0
- data/vendor/toolkit/twitter/bootstrap/wells.less +29 -0
- data/vendor/toolkit/twitter/bootstrap_base.less +2 -0
- metadata +297 -0
@@ -0,0 +1,117 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: popover.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#popovers
|
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
|
+
|
21
|
+
+function ($) { "use strict";
|
22
|
+
|
23
|
+
// POPOVER PUBLIC CLASS DEFINITION
|
24
|
+
// ===============================
|
25
|
+
|
26
|
+
var Popover = function (element, options) {
|
27
|
+
this.init('popover', element, options)
|
28
|
+
}
|
29
|
+
|
30
|
+
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
|
31
|
+
|
32
|
+
Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
|
33
|
+
placement: 'right'
|
34
|
+
, trigger: 'click'
|
35
|
+
, content: ''
|
36
|
+
, template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
|
37
|
+
})
|
38
|
+
|
39
|
+
|
40
|
+
// NOTE: POPOVER EXTENDS tooltip.js
|
41
|
+
// ================================
|
42
|
+
|
43
|
+
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
|
44
|
+
|
45
|
+
Popover.prototype.constructor = Popover
|
46
|
+
|
47
|
+
Popover.prototype.getDefaults = function () {
|
48
|
+
return Popover.DEFAULTS
|
49
|
+
}
|
50
|
+
|
51
|
+
Popover.prototype.setContent = function () {
|
52
|
+
var $tip = this.tip()
|
53
|
+
var title = this.getTitle()
|
54
|
+
var content = this.getContent()
|
55
|
+
|
56
|
+
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
|
57
|
+
$tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
|
58
|
+
|
59
|
+
$tip.removeClass('fade top bottom left right in')
|
60
|
+
|
61
|
+
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
|
62
|
+
// this manually by checking the contents.
|
63
|
+
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
|
64
|
+
}
|
65
|
+
|
66
|
+
Popover.prototype.hasContent = function () {
|
67
|
+
return this.getTitle() || this.getContent()
|
68
|
+
}
|
69
|
+
|
70
|
+
Popover.prototype.getContent = function () {
|
71
|
+
var $e = this.$element
|
72
|
+
var o = this.options
|
73
|
+
|
74
|
+
return $e.attr('data-content')
|
75
|
+
|| (typeof o.content == 'function' ?
|
76
|
+
o.content.call($e[0]) :
|
77
|
+
o.content)
|
78
|
+
}
|
79
|
+
|
80
|
+
Popover.prototype.arrow = function () {
|
81
|
+
return this.$arrow = this.$arrow || this.tip().find('.arrow')
|
82
|
+
}
|
83
|
+
|
84
|
+
Popover.prototype.tip = function () {
|
85
|
+
if (!this.$tip) this.$tip = $(this.options.template)
|
86
|
+
return this.$tip
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
// POPOVER PLUGIN DEFINITION
|
91
|
+
// =========================
|
92
|
+
|
93
|
+
var old = $.fn.popover
|
94
|
+
|
95
|
+
$.fn.popover = function (option) {
|
96
|
+
return this.each(function () {
|
97
|
+
var $this = $(this)
|
98
|
+
var data = $this.data('bs.popover')
|
99
|
+
var options = typeof option == 'object' && option
|
100
|
+
|
101
|
+
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
|
102
|
+
if (typeof option == 'string') data[option]()
|
103
|
+
})
|
104
|
+
}
|
105
|
+
|
106
|
+
$.fn.popover.Constructor = Popover
|
107
|
+
|
108
|
+
|
109
|
+
// POPOVER NO CONFLICT
|
110
|
+
// ===================
|
111
|
+
|
112
|
+
$.fn.popover.noConflict = function () {
|
113
|
+
$.fn.popover = old
|
114
|
+
return this
|
115
|
+
}
|
116
|
+
|
117
|
+
}(window.jQuery);
|
@@ -0,0 +1,158 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: scrollspy.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#scrollspy
|
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
|
+
|
21
|
+
+function ($) { "use strict";
|
22
|
+
|
23
|
+
// SCROLLSPY CLASS DEFINITION
|
24
|
+
// ==========================
|
25
|
+
|
26
|
+
function ScrollSpy(element, options) {
|
27
|
+
var href
|
28
|
+
var process = $.proxy(this.process, this)
|
29
|
+
|
30
|
+
this.$element = $(element).is('body') ? $(window) : $(element)
|
31
|
+
this.$body = $('body')
|
32
|
+
this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
|
33
|
+
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
|
34
|
+
this.selector = (this.options.target
|
35
|
+
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
36
|
+
|| '') + ' .nav li > a'
|
37
|
+
this.offsets = $([])
|
38
|
+
this.targets = $([])
|
39
|
+
this.activeTarget = null
|
40
|
+
|
41
|
+
this.refresh()
|
42
|
+
this.process()
|
43
|
+
}
|
44
|
+
|
45
|
+
ScrollSpy.DEFAULTS = {
|
46
|
+
offset: 10
|
47
|
+
}
|
48
|
+
|
49
|
+
ScrollSpy.prototype.refresh = function () {
|
50
|
+
var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
|
51
|
+
|
52
|
+
this.offsets = $([])
|
53
|
+
this.targets = $([])
|
54
|
+
|
55
|
+
var self = this
|
56
|
+
var $targets = this.$body
|
57
|
+
.find(this.selector)
|
58
|
+
.map(function () {
|
59
|
+
var $el = $(this)
|
60
|
+
var href = $el.data('target') || $el.attr('href')
|
61
|
+
var $href = /^#\w/.test(href) && $(href)
|
62
|
+
|
63
|
+
return ($href
|
64
|
+
&& $href.length
|
65
|
+
&& [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
|
66
|
+
})
|
67
|
+
.sort(function (a, b) { return a[0] - b[0] })
|
68
|
+
.each(function () {
|
69
|
+
self.offsets.push(this[0])
|
70
|
+
self.targets.push(this[1])
|
71
|
+
})
|
72
|
+
}
|
73
|
+
|
74
|
+
ScrollSpy.prototype.process = function () {
|
75
|
+
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
76
|
+
var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
|
77
|
+
var maxScroll = scrollHeight - this.$scrollElement.height()
|
78
|
+
var offsets = this.offsets
|
79
|
+
var targets = this.targets
|
80
|
+
var activeTarget = this.activeTarget
|
81
|
+
var i
|
82
|
+
|
83
|
+
if (scrollTop >= maxScroll) {
|
84
|
+
return activeTarget != (i = targets.last()[0]) && this.activate(i)
|
85
|
+
}
|
86
|
+
|
87
|
+
for (i = offsets.length; i--;) {
|
88
|
+
activeTarget != targets[i]
|
89
|
+
&& scrollTop >= offsets[i]
|
90
|
+
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
|
91
|
+
&& this.activate( targets[i] )
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
ScrollSpy.prototype.activate = function (target) {
|
96
|
+
this.activeTarget = target
|
97
|
+
|
98
|
+
$(this.selector)
|
99
|
+
.parents('.active')
|
100
|
+
.removeClass('active')
|
101
|
+
|
102
|
+
var selector = this.selector
|
103
|
+
+ '[data-target="' + target + '"],'
|
104
|
+
+ this.selector + '[href="' + target + '"]'
|
105
|
+
|
106
|
+
var active = $(selector)
|
107
|
+
.parents('li')
|
108
|
+
.addClass('active')
|
109
|
+
|
110
|
+
if (active.parent('.dropdown-menu').length) {
|
111
|
+
active = active
|
112
|
+
.closest('li.dropdown')
|
113
|
+
.addClass('active')
|
114
|
+
}
|
115
|
+
|
116
|
+
active.trigger('activate')
|
117
|
+
}
|
118
|
+
|
119
|
+
|
120
|
+
// SCROLLSPY PLUGIN DEFINITION
|
121
|
+
// ===========================
|
122
|
+
|
123
|
+
var old = $.fn.scrollspy
|
124
|
+
|
125
|
+
$.fn.scrollspy = function (option) {
|
126
|
+
return this.each(function () {
|
127
|
+
var $this = $(this)
|
128
|
+
var data = $this.data('bs.scrollspy')
|
129
|
+
var options = typeof option == 'object' && option
|
130
|
+
|
131
|
+
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
|
132
|
+
if (typeof option == 'string') data[option]()
|
133
|
+
})
|
134
|
+
}
|
135
|
+
|
136
|
+
$.fn.scrollspy.Constructor = ScrollSpy
|
137
|
+
|
138
|
+
|
139
|
+
// SCROLLSPY NO CONFLICT
|
140
|
+
// =====================
|
141
|
+
|
142
|
+
$.fn.scrollspy.noConflict = function () {
|
143
|
+
$.fn.scrollspy = old
|
144
|
+
return this
|
145
|
+
}
|
146
|
+
|
147
|
+
|
148
|
+
// SCROLLSPY DATA-API
|
149
|
+
// ==================
|
150
|
+
|
151
|
+
$(window).on('load', function () {
|
152
|
+
$('[data-spy="scroll"]').each(function () {
|
153
|
+
var $spy = $(this)
|
154
|
+
$spy.scrollspy($spy.data())
|
155
|
+
})
|
156
|
+
})
|
157
|
+
|
158
|
+
}(window.jQuery);
|
@@ -0,0 +1,135 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: tab.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#tabs
|
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
|
+
|
21
|
+
+function ($) { "use strict";
|
22
|
+
|
23
|
+
// TAB CLASS DEFINITION
|
24
|
+
// ====================
|
25
|
+
|
26
|
+
var Tab = function (element) {
|
27
|
+
this.element = $(element)
|
28
|
+
}
|
29
|
+
|
30
|
+
Tab.prototype.show = function () {
|
31
|
+
var $this = this.element
|
32
|
+
var $ul = $this.closest('ul:not(.dropdown-menu)')
|
33
|
+
var selector = $this.attr('data-target')
|
34
|
+
|
35
|
+
if (!selector) {
|
36
|
+
selector = $this.attr('href')
|
37
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
38
|
+
}
|
39
|
+
|
40
|
+
if ($this.parent('li').hasClass('active')) return
|
41
|
+
|
42
|
+
var previous = $ul.find('.active:last a')[0]
|
43
|
+
var e = $.Event('show.bs.tab', {
|
44
|
+
relatedTarget: previous
|
45
|
+
})
|
46
|
+
|
47
|
+
$this.trigger(e)
|
48
|
+
|
49
|
+
if (e.isDefaultPrevented()) return
|
50
|
+
|
51
|
+
var $target = $(selector)
|
52
|
+
|
53
|
+
this.activate($this.parent('li'), $ul)
|
54
|
+
this.activate($target, $target.parent(), function () {
|
55
|
+
$this.trigger({
|
56
|
+
type: 'shown.bs.tab'
|
57
|
+
, relatedTarget: previous
|
58
|
+
})
|
59
|
+
})
|
60
|
+
}
|
61
|
+
|
62
|
+
Tab.prototype.activate = function (element, container, callback) {
|
63
|
+
var $active = container.find('> .active')
|
64
|
+
var transition = callback
|
65
|
+
&& $.support.transition
|
66
|
+
&& $active.hasClass('fade')
|
67
|
+
|
68
|
+
function next() {
|
69
|
+
$active
|
70
|
+
.removeClass('active')
|
71
|
+
.find('> .dropdown-menu > .active')
|
72
|
+
.removeClass('active')
|
73
|
+
|
74
|
+
element.addClass('active')
|
75
|
+
|
76
|
+
if (transition) {
|
77
|
+
element[0].offsetWidth // reflow for transition
|
78
|
+
element.addClass('in')
|
79
|
+
} else {
|
80
|
+
element.removeClass('fade')
|
81
|
+
}
|
82
|
+
|
83
|
+
if (element.parent('.dropdown-menu')) {
|
84
|
+
element.closest('li.dropdown').addClass('active')
|
85
|
+
}
|
86
|
+
|
87
|
+
callback && callback()
|
88
|
+
}
|
89
|
+
|
90
|
+
transition ?
|
91
|
+
$active
|
92
|
+
.one($.support.transition.end, next)
|
93
|
+
.emulateTransitionEnd(150) :
|
94
|
+
next()
|
95
|
+
|
96
|
+
$active.removeClass('in')
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
// TAB PLUGIN DEFINITION
|
101
|
+
// =====================
|
102
|
+
|
103
|
+
var old = $.fn.tab
|
104
|
+
|
105
|
+
$.fn.tab = function ( option ) {
|
106
|
+
return this.each(function () {
|
107
|
+
var $this = $(this)
|
108
|
+
var data = $this.data('bs.tab')
|
109
|
+
|
110
|
+
if (!data) $this.data('bs.tab', (data = new Tab(this)))
|
111
|
+
if (typeof option == 'string') data[option]()
|
112
|
+
})
|
113
|
+
}
|
114
|
+
|
115
|
+
$.fn.tab.Constructor = Tab
|
116
|
+
|
117
|
+
|
118
|
+
// TAB NO CONFLICT
|
119
|
+
// ===============
|
120
|
+
|
121
|
+
$.fn.tab.noConflict = function () {
|
122
|
+
$.fn.tab = old
|
123
|
+
return this
|
124
|
+
}
|
125
|
+
|
126
|
+
|
127
|
+
// TAB DATA-API
|
128
|
+
// ============
|
129
|
+
|
130
|
+
$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
|
131
|
+
e.preventDefault()
|
132
|
+
$(this).tab('show')
|
133
|
+
})
|
134
|
+
|
135
|
+
}(window.jQuery);
|
@@ -0,0 +1,382 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: tooltip.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#tooltip
|
4
|
+
* Inspired by the original jQuery.tipsy by Jason Frame
|
5
|
+
* ========================================================================
|
6
|
+
* Copyright 2012 Twitter, Inc.
|
7
|
+
*
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
* you may not use this file except in compliance with the License.
|
10
|
+
* You may obtain a copy of the License at
|
11
|
+
*
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
* See the License for the specific language governing permissions and
|
18
|
+
* limitations under the License.
|
19
|
+
* ======================================================================== */
|
20
|
+
|
21
|
+
|
22
|
+
+function ($) { "use strict";
|
23
|
+
|
24
|
+
// TOOLTIP PUBLIC CLASS DEFINITION
|
25
|
+
// ===============================
|
26
|
+
|
27
|
+
var Tooltip = function (element, options) {
|
28
|
+
this.type =
|
29
|
+
this.options =
|
30
|
+
this.enabled =
|
31
|
+
this.timeout =
|
32
|
+
this.hoverState =
|
33
|
+
this.$element = null
|
34
|
+
|
35
|
+
this.init('tooltip', element, options)
|
36
|
+
}
|
37
|
+
|
38
|
+
Tooltip.DEFAULTS = {
|
39
|
+
animation: true
|
40
|
+
, placement: 'top'
|
41
|
+
, selector: false
|
42
|
+
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
|
43
|
+
, trigger: 'hover focus'
|
44
|
+
, title: ''
|
45
|
+
, delay: 0
|
46
|
+
, html: false
|
47
|
+
, container: false
|
48
|
+
}
|
49
|
+
|
50
|
+
Tooltip.prototype.init = function (type, element, options) {
|
51
|
+
this.enabled = true
|
52
|
+
this.type = type
|
53
|
+
this.$element = $(element)
|
54
|
+
this.options = this.getOptions(options)
|
55
|
+
|
56
|
+
var triggers = this.options.trigger.split(' ')
|
57
|
+
|
58
|
+
for (var i = triggers.length; i--;) {
|
59
|
+
var trigger = triggers[i]
|
60
|
+
|
61
|
+
if (trigger == 'click') {
|
62
|
+
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
|
63
|
+
} else if (trigger != 'manual') {
|
64
|
+
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
|
65
|
+
var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
|
66
|
+
|
67
|
+
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
|
68
|
+
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
this.options.selector ?
|
73
|
+
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
|
74
|
+
this.fixTitle()
|
75
|
+
}
|
76
|
+
|
77
|
+
Tooltip.prototype.getDefaults = function () {
|
78
|
+
return Tooltip.DEFAULTS
|
79
|
+
}
|
80
|
+
|
81
|
+
Tooltip.prototype.getOptions = function (options) {
|
82
|
+
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
|
83
|
+
|
84
|
+
if (options.delay && typeof options.delay == 'number') {
|
85
|
+
options.delay = {
|
86
|
+
show: options.delay
|
87
|
+
, hide: options.delay
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
return options
|
92
|
+
}
|
93
|
+
|
94
|
+
Tooltip.prototype.getDelegateOptions = function () {
|
95
|
+
var options = {}
|
96
|
+
var defaults = this.getDefaults()
|
97
|
+
|
98
|
+
this._options && $.each(this._options, function (key, value) {
|
99
|
+
if (defaults[key] != value) options[key] = value
|
100
|
+
})
|
101
|
+
|
102
|
+
return options
|
103
|
+
}
|
104
|
+
|
105
|
+
Tooltip.prototype.enter = function (obj) {
|
106
|
+
var self = obj instanceof this.constructor ?
|
107
|
+
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
|
108
|
+
|
109
|
+
clearTimeout(self.timeout)
|
110
|
+
|
111
|
+
if (!self.options.delay || !self.options.delay.show) return self.show()
|
112
|
+
|
113
|
+
self.hoverState = 'in'
|
114
|
+
self.timeout = setTimeout(function () {
|
115
|
+
if (self.hoverState == 'in') self.show()
|
116
|
+
}, self.options.delay.show)
|
117
|
+
}
|
118
|
+
|
119
|
+
Tooltip.prototype.leave = function (obj) {
|
120
|
+
var self = obj instanceof this.constructor ?
|
121
|
+
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
|
122
|
+
|
123
|
+
clearTimeout(self.timeout)
|
124
|
+
|
125
|
+
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
126
|
+
|
127
|
+
self.hoverState = 'out'
|
128
|
+
self.timeout = setTimeout(function () {
|
129
|
+
if (self.hoverState == 'out') self.hide()
|
130
|
+
}, self.options.delay.hide)
|
131
|
+
}
|
132
|
+
|
133
|
+
Tooltip.prototype.show = function () {
|
134
|
+
var e = $.Event('show.bs.'+ this.type)
|
135
|
+
|
136
|
+
if (this.hasContent() && this.enabled) {
|
137
|
+
this.$element.trigger(e)
|
138
|
+
|
139
|
+
if (e.isDefaultPrevented()) return
|
140
|
+
|
141
|
+
var $tip = this.tip()
|
142
|
+
|
143
|
+
this.setContent()
|
144
|
+
|
145
|
+
if (this.options.animation) $tip.addClass('fade')
|
146
|
+
|
147
|
+
var placement = typeof this.options.placement == 'function' ?
|
148
|
+
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
149
|
+
this.options.placement
|
150
|
+
|
151
|
+
var autoToken = /\s?auto?\s?/i
|
152
|
+
var autoPlace = autoToken.test(placement)
|
153
|
+
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
|
154
|
+
|
155
|
+
$tip
|
156
|
+
.detach()
|
157
|
+
.css({ top: 0, left: 0, display: 'block' })
|
158
|
+
.addClass(placement)
|
159
|
+
|
160
|
+
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
161
|
+
|
162
|
+
var pos = this.getPosition()
|
163
|
+
var actualWidth = $tip[0].offsetWidth
|
164
|
+
var actualHeight = $tip[0].offsetHeight
|
165
|
+
|
166
|
+
if (autoPlace) {
|
167
|
+
var $parent = this.$element.parent()
|
168
|
+
|
169
|
+
var orgPlacement = placement
|
170
|
+
var docScroll = document.documentElement.scrollTop || document.body.scrollTop
|
171
|
+
var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
|
172
|
+
var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
|
173
|
+
var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
|
174
|
+
|
175
|
+
placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
|
176
|
+
placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
|
177
|
+
placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
|
178
|
+
placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
|
179
|
+
placement
|
180
|
+
|
181
|
+
$tip
|
182
|
+
.removeClass(orgPlacement)
|
183
|
+
.addClass(placement)
|
184
|
+
}
|
185
|
+
|
186
|
+
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
|
187
|
+
|
188
|
+
this.applyPlacement(calculatedOffset, placement)
|
189
|
+
this.$element.trigger('shown.bs.' + this.type)
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
Tooltip.prototype.applyPlacement = function(offset, placement) {
|
194
|
+
var replace
|
195
|
+
var $tip = this.tip()
|
196
|
+
var width = $tip[0].offsetWidth
|
197
|
+
var height = $tip[0].offsetHeight
|
198
|
+
|
199
|
+
// manually read margins because getBoundingClientRect includes difference
|
200
|
+
var marginTop = parseInt($tip.css('margin-top'), 10)
|
201
|
+
var marginLeft = parseInt($tip.css('margin-left'), 10)
|
202
|
+
|
203
|
+
// we must check for NaN for ie 8/9
|
204
|
+
if (isNaN(marginTop)) marginTop = 0
|
205
|
+
if (isNaN(marginLeft)) marginLeft = 0
|
206
|
+
|
207
|
+
offset.top = offset.top + marginTop
|
208
|
+
offset.left = offset.left + marginLeft
|
209
|
+
|
210
|
+
$tip
|
211
|
+
.offset(offset)
|
212
|
+
.addClass('in')
|
213
|
+
|
214
|
+
// check to see if placing tip in new offset caused the tip to resize itself
|
215
|
+
var actualWidth = $tip[0].offsetWidth
|
216
|
+
var actualHeight = $tip[0].offsetHeight
|
217
|
+
|
218
|
+
if (placement == 'top' && actualHeight != height) {
|
219
|
+
replace = true
|
220
|
+
offset.top = offset.top + height - actualHeight
|
221
|
+
}
|
222
|
+
|
223
|
+
if (/bottom|top/.test(placement)) {
|
224
|
+
var delta = 0
|
225
|
+
|
226
|
+
if (offset.left < 0) {
|
227
|
+
delta = offset.left * -2
|
228
|
+
offset.left = 0
|
229
|
+
|
230
|
+
$tip.offset(offset)
|
231
|
+
|
232
|
+
actualWidth = $tip[0].offsetWidth
|
233
|
+
actualHeight = $tip[0].offsetHeight
|
234
|
+
}
|
235
|
+
|
236
|
+
this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
|
237
|
+
} else {
|
238
|
+
this.replaceArrow(actualHeight - height, actualHeight, 'top')
|
239
|
+
}
|
240
|
+
|
241
|
+
if (replace) $tip.offset(offset)
|
242
|
+
}
|
243
|
+
|
244
|
+
Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
|
245
|
+
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
|
246
|
+
}
|
247
|
+
|
248
|
+
Tooltip.prototype.setContent = function () {
|
249
|
+
var $tip = this.tip()
|
250
|
+
var title = this.getTitle()
|
251
|
+
|
252
|
+
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
|
253
|
+
$tip.removeClass('fade in top bottom left right')
|
254
|
+
}
|
255
|
+
|
256
|
+
Tooltip.prototype.hide = function () {
|
257
|
+
var that = this
|
258
|
+
var $tip = this.tip()
|
259
|
+
var e = $.Event('hide.bs.' + this.type)
|
260
|
+
|
261
|
+
function complete() { $tip.detach() }
|
262
|
+
|
263
|
+
this.$element.trigger(e)
|
264
|
+
|
265
|
+
if (e.isDefaultPrevented()) return
|
266
|
+
|
267
|
+
$tip.removeClass('in')
|
268
|
+
|
269
|
+
$.support.transition && this.$tip.hasClass('fade') ?
|
270
|
+
$tip
|
271
|
+
.one($.support.transition.end, complete)
|
272
|
+
.emulateTransitionEnd(150) :
|
273
|
+
complete()
|
274
|
+
|
275
|
+
this.$element.trigger('hidden.bs.' + this.type)
|
276
|
+
|
277
|
+
return this
|
278
|
+
}
|
279
|
+
|
280
|
+
Tooltip.prototype.fixTitle = function () {
|
281
|
+
var $e = this.$element
|
282
|
+
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
283
|
+
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
|
284
|
+
}
|
285
|
+
}
|
286
|
+
|
287
|
+
Tooltip.prototype.hasContent = function () {
|
288
|
+
return this.getTitle()
|
289
|
+
}
|
290
|
+
|
291
|
+
Tooltip.prototype.getPosition = function () {
|
292
|
+
var el = this.$element[0]
|
293
|
+
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
|
294
|
+
width: el.offsetWidth
|
295
|
+
, height: el.offsetHeight
|
296
|
+
}, this.$element.offset())
|
297
|
+
}
|
298
|
+
|
299
|
+
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
|
300
|
+
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
|
301
|
+
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
|
302
|
+
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
|
303
|
+
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
|
304
|
+
}
|
305
|
+
|
306
|
+
Tooltip.prototype.getTitle = function () {
|
307
|
+
var title
|
308
|
+
var $e = this.$element
|
309
|
+
var o = this.options
|
310
|
+
|
311
|
+
title = $e.attr('data-original-title')
|
312
|
+
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
|
313
|
+
|
314
|
+
return title
|
315
|
+
}
|
316
|
+
|
317
|
+
Tooltip.prototype.tip = function () {
|
318
|
+
return this.$tip = this.$tip || $(this.options.template)
|
319
|
+
}
|
320
|
+
|
321
|
+
Tooltip.prototype.arrow = function () {
|
322
|
+
return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
|
323
|
+
}
|
324
|
+
|
325
|
+
Tooltip.prototype.validate = function () {
|
326
|
+
if (!this.$element[0].parentNode) {
|
327
|
+
this.hide()
|
328
|
+
this.$element = null
|
329
|
+
this.options = null
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
Tooltip.prototype.enable = function () {
|
334
|
+
this.enabled = true
|
335
|
+
}
|
336
|
+
|
337
|
+
Tooltip.prototype.disable = function () {
|
338
|
+
this.enabled = false
|
339
|
+
}
|
340
|
+
|
341
|
+
Tooltip.prototype.toggleEnabled = function () {
|
342
|
+
this.enabled = !this.enabled
|
343
|
+
}
|
344
|
+
|
345
|
+
Tooltip.prototype.toggle = function (e) {
|
346
|
+
var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
|
347
|
+
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
|
348
|
+
}
|
349
|
+
|
350
|
+
Tooltip.prototype.destroy = function () {
|
351
|
+
this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
|
352
|
+
}
|
353
|
+
|
354
|
+
|
355
|
+
// TOOLTIP PLUGIN DEFINITION
|
356
|
+
// =========================
|
357
|
+
|
358
|
+
var old = $.fn.tooltip
|
359
|
+
|
360
|
+
$.fn.tooltip = function (option) {
|
361
|
+
return this.each(function () {
|
362
|
+
var $this = $(this)
|
363
|
+
var data = $this.data('bs.tooltip')
|
364
|
+
var options = typeof option == 'object' && option
|
365
|
+
|
366
|
+
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
|
367
|
+
if (typeof option == 'string') data[option]()
|
368
|
+
})
|
369
|
+
}
|
370
|
+
|
371
|
+
$.fn.tooltip.Constructor = Tooltip
|
372
|
+
|
373
|
+
|
374
|
+
// TOOLTIP NO CONFLICT
|
375
|
+
// ===================
|
376
|
+
|
377
|
+
$.fn.tooltip.noConflict = function () {
|
378
|
+
$.fn.tooltip = old
|
379
|
+
return this
|
380
|
+
}
|
381
|
+
|
382
|
+
}(window.jQuery);
|