rails_admin 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-affix.js +99 -74
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-alert.js +48 -55
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-button.js +70 -65
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-carousel.js +163 -147
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-collapse.js +117 -114
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-dropdown.js +89 -107
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-modal.js +208 -175
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-popover.js +77 -78
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-scrollspy.js +137 -129
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-tab.js +85 -101
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-tooltip.js +364 -268
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-transition.js +51 -52
- data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-typeahead.js +1782 -335
- data/app/assets/javascripts/rails_admin/ra.filter-box.js +1 -1
- data/app/assets/javascripts/rails_admin/ra.filtering-multiselect.js +3 -3
- data/app/assets/javascripts/rails_admin/ra.filtering-select.js +1 -1
- data/app/assets/javascripts/rails_admin/ra.remote-form.js +6 -2
- data/app/assets/stylesheets/rails_admin/base/theming.scss +34 -14
- data/app/assets/stylesheets/rails_admin/bootstrap/_alerts.scss +47 -58
- data/app/assets/stylesheets/rails_admin/bootstrap/_badges.scss +57 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/_breadcrumbs.scss +12 -10
- data/app/assets/stylesheets/rails_admin/bootstrap/_button-groups.scss +163 -152
- data/app/assets/stylesheets/rails_admin/bootstrap/_buttons.scss +98 -169
- data/app/assets/stylesheets/rails_admin/bootstrap/_carousel.scss +151 -66
- data/app/assets/stylesheets/rails_admin/bootstrap/_close.scss +11 -8
- data/app/assets/stylesheets/rails_admin/bootstrap/_code.scss +36 -29
- data/app/assets/stylesheets/rails_admin/bootstrap/_component-animations.scss +16 -3
- data/app/assets/stylesheets/rails_admin/bootstrap/_dropdowns.scss +115 -148
- data/app/assets/stylesheets/rails_admin/bootstrap/_forms.scss +396 -547
- data/app/assets/stylesheets/rails_admin/bootstrap/_glyphicons.scss +237 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/_grid.scss +74 -11
- data/app/assets/stylesheets/rails_admin/bootstrap/_input-groups.scss +166 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/_jumbotron.scss +48 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/_labels.scss +66 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/_list-group.scss +131 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/_media.scss +8 -7
- data/app/assets/stylesheets/rails_admin/bootstrap/_mixins.scss +36 -693
- data/app/assets/stylesheets/rails_admin/bootstrap/_modals.scss +108 -53
- data/app/assets/stylesheets/rails_admin/bootstrap/_navbar.scss +545 -383
- data/app/assets/stylesheets/rails_admin/bootstrap/_navs.scss +191 -358
- data/app/assets/stylesheets/rails_admin/bootstrap/_normalize.scss +425 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/_pager.scss +45 -33
- data/app/assets/stylesheets/rails_admin/bootstrap/_pagination.scss +70 -105
- data/app/assets/stylesheets/rails_admin/bootstrap/_panels.scss +243 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/_popovers.scss +61 -61
- data/app/assets/stylesheets/rails_admin/bootstrap/_print.scss +101 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/_progress-bars.scss +56 -73
- data/app/assets/stylesheets/rails_admin/bootstrap/_responsive-embed.scss +34 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/_responsive-utilities.scss +150 -50
- data/app/assets/stylesheets/rails_admin/bootstrap/_scaffolding.scss +120 -23
- data/app/assets/stylesheets/rails_admin/bootstrap/_tables.scss +168 -170
- data/app/assets/stylesheets/rails_admin/bootstrap/_theme.scss +258 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/_thumbnails.scss +27 -42
- data/app/assets/stylesheets/rails_admin/bootstrap/_tooltip.scss +49 -24
- data/app/assets/stylesheets/rails_admin/bootstrap/_type.scss +200 -143
- data/app/assets/stylesheets/rails_admin/bootstrap/_utilities.scss +33 -21
- data/app/assets/stylesheets/rails_admin/bootstrap/_variables.scss +764 -215
- data/app/assets/stylesheets/rails_admin/bootstrap/_wells.scss +7 -7
- data/app/assets/stylesheets/rails_admin/bootstrap/bootstrap.scss +47 -60
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_alerts.scss +14 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_background-variant.scss +11 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_border-radius.scss +18 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_buttons.scss +50 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_center-block.scss +7 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_clearfix.scss +22 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_forms.scss +84 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_gradients.scss +58 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_grid-framework.scss +81 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_grid.scss +122 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_hide-text.scss +21 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_image.scss +34 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_labels.scss +12 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_list-group.scss +31 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_nav-divider.scss +10 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_opacity.scss +8 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_pagination.scss +23 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_panels.scss +24 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_progress-bar.scss +10 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_reset-filter.scss +8 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_resize.scss +6 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_responsive-visibility.scss +21 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_size.scss +10 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_tab-focus.scss +9 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_table-row.scss +28 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_text-emphasis.scss +11 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_text-overflow.scss +8 -0
- data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_vendor-prefixes.scss +219 -0
- data/app/assets/stylesheets/rails_admin/ra.calendar-additions.scss +17 -0
- data/app/assets/stylesheets/rails_admin/rails_admin.scss.erb +9 -5
- data/app/helpers/rails_admin/application_helper.rb +20 -19
- data/app/helpers/rails_admin/form_builder.rb +14 -11
- data/app/views/kaminari/twitter-bootstrap/_paginator.html.haml +8 -9
- data/app/views/layouts/rails_admin/_navigation.html.haml +5 -5
- data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +1 -1
- data/app/views/layouts/rails_admin/application.html.haml +9 -8
- data/app/views/layouts/rails_admin/pjax.html.haml +4 -3
- data/app/views/rails_admin/main/_form_datetime.html.haml +2 -1
- data/app/views/rails_admin/main/_form_field.html.haml +1 -1
- data/app/views/rails_admin/main/_form_text.html.haml +1 -1
- data/app/views/rails_admin/main/_submit_buttons.html.haml +1 -0
- data/app/views/rails_admin/main/dashboard.html.haml +1 -1
- data/app/views/rails_admin/main/export.html.haml +19 -16
- data/app/views/rails_admin/main/index.html.haml +11 -7
- data/app/views/rails_admin/main/show.html.haml +1 -1
- data/lib/rails_admin/adapters/active_record.rb +2 -2
- data/lib/rails_admin/adapters/mongoid/property.rb +1 -1
- data/lib/rails_admin/config/actions/bulk_delete.rb +0 -1
- data/lib/rails_admin/config/actions/edit.rb +0 -2
- data/lib/rails_admin/config/actions/export.rb +0 -2
- data/lib/rails_admin/config/actions/index.rb +0 -3
- data/lib/rails_admin/config/actions/new.rb +0 -2
- data/lib/rails_admin/config/configurable.rb +1 -1
- data/lib/rails_admin/config/fields/base.rb +9 -0
- data/lib/rails_admin/config/fields/factories/enum.rb +2 -3
- data/lib/rails_admin/config/fields/types/polymorphic_association.rb +4 -0
- data/lib/rails_admin/config/model.rb +2 -1
- data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +2 -2
- data/lib/rails_admin/support/csv_converter.rb +22 -42
- data/lib/rails_admin/version.rb +1 -1
- metadata +59 -18
- data/app/assets/stylesheets/rails_admin/bootstrap/_accordion.scss +0 -34
- data/app/assets/stylesheets/rails_admin/bootstrap/_hero-unit.scss +0 -25
- data/app/assets/stylesheets/rails_admin/bootstrap/_labels-badges.scss +0 -83
- data/app/assets/stylesheets/rails_admin/bootstrap/_layouts.scss +0 -16
- data/app/assets/stylesheets/rails_admin/bootstrap/_reset.scss +0 -216
- data/app/assets/stylesheets/rails_admin/bootstrap/_responsive-1200px-min.scss +0 -28
- data/app/assets/stylesheets/rails_admin/bootstrap/_responsive-767px-max.scss +0 -193
- data/app/assets/stylesheets/rails_admin/bootstrap/_responsive-768px-979px.scss +0 -19
- data/app/assets/stylesheets/rails_admin/bootstrap/_responsive-navbar.scss +0 -189
- data/app/assets/stylesheets/rails_admin/bootstrap/_sprites.scss +0 -197
- data/app/assets/stylesheets/rails_admin/bootstrap/responsive.scss +0 -48
|
@@ -1,114 +1,113 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* http://getbootstrap.com/
|
|
4
|
-
*
|
|
5
|
-
* Copyright
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 ($) {
|
|
22
|
-
|
|
23
|
-
"use strict"; // jshint ;_;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/* POPOVER PUBLIC CLASS DEFINITION
|
|
27
|
-
* =============================== */
|
|
1
|
+
/* ========================================================================
|
|
2
|
+
* Bootstrap: popover.js v3.2.0
|
|
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
|
+
// ===============================
|
|
28
15
|
|
|
29
16
|
var Popover = function (element, options) {
|
|
30
17
|
this.init('popover', element, options)
|
|
31
18
|
}
|
|
32
19
|
|
|
20
|
+
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
|
|
33
21
|
|
|
34
|
-
|
|
35
|
-
========================================== */
|
|
22
|
+
Popover.VERSION = '3.2.0'
|
|
36
23
|
|
|
37
|
-
Popover.
|
|
24
|
+
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
|
|
25
|
+
placement: 'right',
|
|
26
|
+
trigger: 'click',
|
|
27
|
+
content: '',
|
|
28
|
+
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
|
|
29
|
+
})
|
|
38
30
|
|
|
39
|
-
constructor: Popover
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
, title = this.getTitle()
|
|
44
|
-
, content = this.getContent()
|
|
32
|
+
// NOTE: POPOVER EXTENDS tooltip.js
|
|
33
|
+
// ================================
|
|
45
34
|
|
|
46
|
-
|
|
47
|
-
$tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
|
|
35
|
+
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
|
|
48
36
|
|
|
49
|
-
|
|
50
|
-
}
|
|
37
|
+
Popover.prototype.constructor = Popover
|
|
51
38
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
Popover.prototype.getDefaults = function () {
|
|
40
|
+
return Popover.DEFAULTS
|
|
41
|
+
}
|
|
55
42
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
43
|
+
Popover.prototype.setContent = function () {
|
|
44
|
+
var $tip = this.tip()
|
|
45
|
+
var title = this.getTitle()
|
|
46
|
+
var content = this.getContent()
|
|
60
47
|
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
|
|
49
|
+
$tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events
|
|
50
|
+
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
|
|
51
|
+
](content)
|
|
63
52
|
|
|
64
|
-
|
|
65
|
-
}
|
|
53
|
+
$tip.removeClass('fade top bottom left right in')
|
|
66
54
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return this.$tip
|
|
72
|
-
}
|
|
55
|
+
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
|
|
56
|
+
// this manually by checking the contents.
|
|
57
|
+
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
|
|
58
|
+
}
|
|
73
59
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
Popover.prototype.hasContent = function () {
|
|
61
|
+
return this.getTitle() || this.getContent()
|
|
62
|
+
}
|
|
77
63
|
|
|
78
|
-
|
|
64
|
+
Popover.prototype.getContent = function () {
|
|
65
|
+
var $e = this.$element
|
|
66
|
+
var o = this.options
|
|
79
67
|
|
|
68
|
+
return $e.attr('data-content')
|
|
69
|
+
|| (typeof o.content == 'function' ?
|
|
70
|
+
o.content.call($e[0]) :
|
|
71
|
+
o.content)
|
|
72
|
+
}
|
|
80
73
|
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
Popover.prototype.arrow = function () {
|
|
75
|
+
return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
Popover.prototype.tip = function () {
|
|
79
|
+
if (!this.$tip) this.$tip = $(this.options.template)
|
|
80
|
+
return this.$tip
|
|
81
|
+
}
|
|
83
82
|
|
|
84
|
-
var old = $.fn.popover
|
|
85
83
|
|
|
86
|
-
|
|
84
|
+
// POPOVER PLUGIN DEFINITION
|
|
85
|
+
// =========================
|
|
86
|
+
|
|
87
|
+
function Plugin(option) {
|
|
87
88
|
return this.each(function () {
|
|
88
|
-
var $this
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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)))
|
|
92
95
|
if (typeof option == 'string') data[option]()
|
|
93
96
|
})
|
|
94
97
|
}
|
|
95
98
|
|
|
96
|
-
$.fn.popover
|
|
99
|
+
var old = $.fn.popover
|
|
97
100
|
|
|
98
|
-
$.fn.popover
|
|
99
|
-
|
|
100
|
-
, trigger: 'click'
|
|
101
|
-
, content: ''
|
|
102
|
-
, template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
|
|
103
|
-
})
|
|
101
|
+
$.fn.popover = Plugin
|
|
102
|
+
$.fn.popover.Constructor = Popover
|
|
104
103
|
|
|
105
104
|
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
// POPOVER NO CONFLICT
|
|
106
|
+
// ===================
|
|
108
107
|
|
|
109
108
|
$.fn.popover.noConflict = function () {
|
|
110
109
|
$.fn.popover = old
|
|
111
110
|
return this
|
|
112
111
|
}
|
|
113
112
|
|
|
114
|
-
}(
|
|
113
|
+
}(jQuery);
|
|
@@ -1,147 +1,155 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* http://getbootstrap.com/
|
|
4
|
-
*
|
|
5
|
-
* Copyright
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 ($) {
|
|
22
|
-
|
|
23
|
-
"use strict"; // jshint ;_;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/* SCROLLSPY CLASS DEFINITION
|
|
27
|
-
* ========================== */
|
|
1
|
+
/* ========================================================================
|
|
2
|
+
* Bootstrap: scrollspy.js v3.2.0
|
|
3
|
+
* http://getbootstrap.com/javascript/#scrollspy
|
|
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
|
+
// SCROLLSPY CLASS DEFINITION
|
|
14
|
+
// ==========================
|
|
28
15
|
|
|
29
16
|
function ScrollSpy(element, options) {
|
|
30
|
-
var process
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this
|
|
34
|
-
this
|
|
35
|
-
this.selector
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this
|
|
17
|
+
var process = $.proxy(this.process, this)
|
|
18
|
+
|
|
19
|
+
this.$body = $('body')
|
|
20
|
+
this.$scrollElement = $(element).is('body') ? $(window) : $(element)
|
|
21
|
+
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
|
|
22
|
+
this.selector = (this.options.target || '') + ' .nav li > a'
|
|
23
|
+
this.offsets = []
|
|
24
|
+
this.targets = []
|
|
25
|
+
this.activeTarget = null
|
|
26
|
+
this.scrollHeight = 0
|
|
27
|
+
|
|
28
|
+
this.$scrollElement.on('scroll.bs.scrollspy', process)
|
|
39
29
|
this.refresh()
|
|
40
30
|
this.process()
|
|
41
31
|
}
|
|
42
32
|
|
|
43
|
-
ScrollSpy.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
activeTarget != targets[i]
|
|
87
|
-
&& scrollTop >= offsets[i]
|
|
88
|
-
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
|
|
89
|
-
&& this.activate( targets[i] )
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
, activate: function (target) {
|
|
94
|
-
var active
|
|
95
|
-
, selector
|
|
96
|
-
|
|
97
|
-
this.activeTarget = target
|
|
98
|
-
|
|
99
|
-
$(this.selector)
|
|
100
|
-
.parent('.active')
|
|
101
|
-
.removeClass('active')
|
|
102
|
-
|
|
103
|
-
selector = this.selector
|
|
104
|
-
+ '[data-target="' + target + '"],'
|
|
105
|
-
+ this.selector + '[href="' + target + '"]'
|
|
106
|
-
|
|
107
|
-
active = $(selector)
|
|
108
|
-
.parent('li')
|
|
109
|
-
.addClass('active')
|
|
110
|
-
|
|
111
|
-
if (active.parent('.dropdown-menu').length) {
|
|
112
|
-
active = active.closest('li.dropdown').addClass('active')
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
active.trigger('activate')
|
|
116
|
-
}
|
|
33
|
+
ScrollSpy.VERSION = '3.2.0'
|
|
34
|
+
|
|
35
|
+
ScrollSpy.DEFAULTS = {
|
|
36
|
+
offset: 10
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
ScrollSpy.prototype.getScrollHeight = function () {
|
|
40
|
+
return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
ScrollSpy.prototype.refresh = function () {
|
|
44
|
+
var offsetMethod = 'offset'
|
|
45
|
+
var offsetBase = 0
|
|
46
|
+
|
|
47
|
+
if (!$.isWindow(this.$scrollElement[0])) {
|
|
48
|
+
offsetMethod = 'position'
|
|
49
|
+
offsetBase = this.$scrollElement.scrollTop()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.offsets = []
|
|
53
|
+
this.targets = []
|
|
54
|
+
this.scrollHeight = this.getScrollHeight()
|
|
55
|
+
|
|
56
|
+
var self = this
|
|
57
|
+
|
|
58
|
+
this.$body
|
|
59
|
+
.find(this.selector)
|
|
60
|
+
.map(function () {
|
|
61
|
+
var $el = $(this)
|
|
62
|
+
var href = $el.data('target') || $el.attr('href')
|
|
63
|
+
var $href = /^#./.test(href) && $(href)
|
|
64
|
+
|
|
65
|
+
return ($href
|
|
66
|
+
&& $href.length
|
|
67
|
+
&& $href.is(':visible')
|
|
68
|
+
&& [[$href[offsetMethod]().top + offsetBase, href]]) || null
|
|
69
|
+
})
|
|
70
|
+
.sort(function (a, b) { return a[0] - b[0] })
|
|
71
|
+
.each(function () {
|
|
72
|
+
self.offsets.push(this[0])
|
|
73
|
+
self.targets.push(this[1])
|
|
74
|
+
})
|
|
75
|
+
}
|
|
117
76
|
|
|
77
|
+
ScrollSpy.prototype.process = function () {
|
|
78
|
+
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
|
79
|
+
var scrollHeight = this.getScrollHeight()
|
|
80
|
+
var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
|
|
81
|
+
var offsets = this.offsets
|
|
82
|
+
var targets = this.targets
|
|
83
|
+
var activeTarget = this.activeTarget
|
|
84
|
+
var i
|
|
85
|
+
|
|
86
|
+
if (this.scrollHeight != scrollHeight) {
|
|
87
|
+
this.refresh()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (scrollTop >= maxScroll) {
|
|
91
|
+
return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (activeTarget && scrollTop <= offsets[0]) {
|
|
95
|
+
return activeTarget != (i = targets[0]) && this.activate(i)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (i = offsets.length; i--;) {
|
|
99
|
+
activeTarget != targets[i]
|
|
100
|
+
&& scrollTop >= offsets[i]
|
|
101
|
+
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
|
|
102
|
+
&& this.activate(targets[i])
|
|
103
|
+
}
|
|
118
104
|
}
|
|
119
105
|
|
|
106
|
+
ScrollSpy.prototype.activate = function (target) {
|
|
107
|
+
this.activeTarget = target
|
|
120
108
|
|
|
121
|
-
|
|
122
|
-
|
|
109
|
+
$(this.selector)
|
|
110
|
+
.parentsUntil(this.options.target, '.active')
|
|
111
|
+
.removeClass('active')
|
|
123
112
|
|
|
124
|
-
|
|
113
|
+
var selector = this.selector +
|
|
114
|
+
'[data-target="' + target + '"],' +
|
|
115
|
+
this.selector + '[href="' + target + '"]'
|
|
116
|
+
|
|
117
|
+
var active = $(selector)
|
|
118
|
+
.parents('li')
|
|
119
|
+
.addClass('active')
|
|
125
120
|
|
|
126
|
-
|
|
121
|
+
if (active.parent('.dropdown-menu').length) {
|
|
122
|
+
active = active
|
|
123
|
+
.closest('li.dropdown')
|
|
124
|
+
.addClass('active')
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
active.trigger('activate.bs.scrollspy')
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
// SCROLLSPY PLUGIN DEFINITION
|
|
132
|
+
// ===========================
|
|
133
|
+
|
|
134
|
+
function Plugin(option) {
|
|
127
135
|
return this.each(function () {
|
|
128
|
-
var $this
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
136
|
+
var $this = $(this)
|
|
137
|
+
var data = $this.data('bs.scrollspy')
|
|
138
|
+
var options = typeof option == 'object' && option
|
|
139
|
+
|
|
140
|
+
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
|
|
132
141
|
if (typeof option == 'string') data[option]()
|
|
133
142
|
})
|
|
134
143
|
}
|
|
135
144
|
|
|
136
|
-
$.fn.scrollspy
|
|
145
|
+
var old = $.fn.scrollspy
|
|
137
146
|
|
|
138
|
-
$.fn.scrollspy
|
|
139
|
-
|
|
140
|
-
}
|
|
147
|
+
$.fn.scrollspy = Plugin
|
|
148
|
+
$.fn.scrollspy.Constructor = ScrollSpy
|
|
141
149
|
|
|
142
150
|
|
|
143
|
-
|
|
144
|
-
|
|
151
|
+
// SCROLLSPY NO CONFLICT
|
|
152
|
+
// =====================
|
|
145
153
|
|
|
146
154
|
$.fn.scrollspy.noConflict = function () {
|
|
147
155
|
$.fn.scrollspy = old
|
|
@@ -149,14 +157,14 @@
|
|
|
149
157
|
}
|
|
150
158
|
|
|
151
159
|
|
|
152
|
-
|
|
153
|
-
|
|
160
|
+
// SCROLLSPY DATA-API
|
|
161
|
+
// ==================
|
|
154
162
|
|
|
155
|
-
$(window).on('load', function () {
|
|
163
|
+
$(window).on('load.bs.scrollspy.data-api', function () {
|
|
156
164
|
$('[data-spy="scroll"]').each(function () {
|
|
157
165
|
var $spy = $(this)
|
|
158
|
-
|
|
166
|
+
Plugin.call($spy, $spy.data())
|
|
159
167
|
})
|
|
160
168
|
})
|
|
161
169
|
|
|
162
|
-
}(
|
|
170
|
+
}(jQuery);
|