zendesk_api 0.1.11 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.travis.yml +1 -3
- data/Gemfile +24 -0
- data/Gemfile.lock +75 -10
- data/Procfile +1 -0
- data/Rakefile +10 -3
- data/Readme.md +65 -0
- data/bin/zendesk +26 -0
- data/config.ru +6 -0
- data/config/mongoid.yml +81 -0
- data/lib/zendesk_api/actions.rb +2 -2
- data/lib/zendesk_api/collection.rb +15 -4
- data/lib/zendesk_api/console/base.rb +12 -0
- data/lib/zendesk_api/console/console.rb +144 -0
- data/lib/zendesk_api/console/extensions.rb +183 -0
- data/lib/zendesk_api/console/options.rb +41 -0
- data/lib/zendesk_api/resource.rb +12 -1
- data/lib/zendesk_api/resources.rb +28 -8
- data/lib/zendesk_api/server/base.rb +119 -0
- data/lib/zendesk_api/server/docs/account_settings.md +145 -0
- data/lib/zendesk_api/server/docs/activity_stream.md +121 -0
- data/lib/zendesk_api/server/docs/attachments.md +73 -0
- data/lib/zendesk_api/server/docs/autocomplete.md +29 -0
- data/lib/zendesk_api/server/docs/categories.md +193 -0
- data/lib/zendesk_api/server/docs/custom_roles.md +88 -0
- data/lib/zendesk_api/server/docs/forum_subscriptions.md +139 -0
- data/lib/zendesk_api/server/docs/forums.md +229 -0
- data/lib/zendesk_api/server/docs/group_memberships.md +229 -0
- data/lib/zendesk_api/server/docs/groups.md +212 -0
- data/lib/zendesk_api/server/docs/introduction.md +159 -0
- data/lib/zendesk_api/server/docs/job_statuses.md +86 -0
- data/lib/zendesk_api/server/docs/locales.md +124 -0
- data/lib/zendesk_api/server/docs/macros.md +287 -0
- data/lib/zendesk_api/server/docs/organizations.md +253 -0
- data/lib/zendesk_api/server/docs/problems.md +117 -0
- data/lib/zendesk_api/server/docs/requests.md +256 -0
- data/lib/zendesk_api/server/docs/satisfaction_ratings.md +136 -0
- data/lib/zendesk_api/server/docs/search.md +106 -0
- data/lib/zendesk_api/server/docs/sharing_agreements.md +57 -0
- data/lib/zendesk_api/server/docs/side_loading.md +125 -0
- data/lib/zendesk_api/server/docs/suspended_tickets.md +182 -0
- data/lib/zendesk_api/server/docs/tags.md +36 -0
- data/lib/zendesk_api/server/docs/ticket_audits.md +657 -0
- data/lib/zendesk_api/server/docs/ticket_export.md +121 -0
- data/lib/zendesk_api/server/docs/ticket_fields.md +277 -0
- data/lib/zendesk_api/server/docs/ticket_import.md +65 -0
- data/lib/zendesk_api/server/docs/ticket_metrics.md +125 -0
- data/lib/zendesk_api/server/docs/tickets.md +622 -0
- data/lib/zendesk_api/server/docs/topic_comments.md +221 -0
- data/lib/zendesk_api/server/docs/topic_subscriptions.md +140 -0
- data/lib/zendesk_api/server/docs/topic_votes.md +154 -0
- data/lib/zendesk_api/server/docs/topics.md +335 -0
- data/lib/zendesk_api/server/docs/triggers.md +199 -0
- data/lib/zendesk_api/server/docs/user_identities.md +279 -0
- data/lib/zendesk_api/server/docs/users.md +400 -0
- data/lib/zendesk_api/server/docs/views.md +505 -0
- data/lib/zendesk_api/server/helper.rb +104 -0
- data/lib/zendesk_api/server/html_renderer.rb +98 -0
- data/lib/zendesk_api/server/models/user_request.rb +16 -0
- data/lib/zendesk_api/server/models/zlib_json.rb +13 -0
- data/lib/zendesk_api/server/public/config.rb +26 -0
- data/lib/zendesk_api/server/public/favicon.ico +0 -0
- data/lib/zendesk_api/server/public/images/glyphicons-halflings-white.png +0 -0
- data/lib/zendesk_api/server/public/images/glyphicons-halflings.png +0 -0
- data/lib/zendesk_api/server/public/images/spinner.gif +0 -0
- data/lib/zendesk_api/server/public/images/zendesk_developers_bg.png +0 -0
- data/lib/zendesk_api/server/public/images/zendesk_developers_header.png +0 -0
- data/lib/zendesk_api/server/public/javascripts/application.js +186 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-alert.js +90 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-button.js +96 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-carousel.js +169 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-collapse.js +157 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-dropdown.js +100 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-modal.js +218 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-popover.js +98 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-scrollspy.js +151 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-tab.js +135 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-tooltip.js +275 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-transition.js +61 -0
- data/lib/zendesk_api/server/public/javascripts/bootstrap-typeahead.js +285 -0
- data/lib/zendesk_api/server/public/sass/screen.scss +102 -0
- data/lib/zendesk_api/server/public/sass/styles.scss +5 -0
- data/lib/zendesk_api/server/public/stylesheets/developer.screen.css +836 -0
- data/lib/zendesk_api/server/public/stylesheets/screen.css +129 -0
- data/lib/zendesk_api/server/public/stylesheets/styles.css +6208 -0
- data/lib/zendesk_api/server/templates/footer.haml +13 -0
- data/lib/zendesk_api/server/templates/header.haml +20 -0
- data/lib/zendesk_api/server/templates/index.haml +68 -0
- data/lib/zendesk_api/server/templates/layout.haml +44 -0
- data/lib/zendesk_api/server/templates/param.haml +4 -0
- data/lib/zendesk_api/server/templates/search.haml +23 -0
- data/lib/zendesk_api/server/templates/sidebar.haml +7 -0
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/{association_spec.rb → core/association_spec.rb} +1 -1
- data/spec/{client_spec.rb → core/client_spec.rb} +1 -1
- data/spec/{collection_spec.rb → core/collection_spec.rb} +1 -1
- data/spec/{configuration_spec.rb → core/configuration_spec.rb} +1 -1
- data/spec/{create_resource_spec.rb → core/create_resource_spec.rb} +1 -1
- data/spec/{data_resource_spec.rb → core/data_resource_spec.rb} +1 -1
- data/spec/{inflection_spec.rb → core/inflection_spec.rb} +1 -1
- data/spec/{lru_cache_spec.rb → core/lru_cache_spec.rb} +1 -1
- data/spec/{middleware → core/middleware}/request/etag_cache_spec.rb +1 -1
- data/spec/{middleware → core/middleware}/request/retry_spec.rb +1 -1
- data/spec/{middleware → core/middleware}/request/test.jpg +0 -0
- data/spec/{middleware → core/middleware}/request/upload_spec.rb +1 -1
- data/spec/{middleware → core/middleware}/response/callback_spec.rb +1 -1
- data/spec/{middleware → core/middleware}/response/deflate_spec.rb +1 -1
- data/spec/{middleware → core/middleware}/response/gzip_spec.rb +1 -1
- data/spec/{middleware → core/middleware}/response/parse_iso_dates_spec.rb +1 -1
- data/spec/{read_resource_spec.rb → core/read_resource_spec.rb} +1 -1
- data/spec/{rescue_spec.rb → core/rescue_spec.rb} +1 -1
- data/spec/{resource_spec.rb → core/resource_spec.rb} +1 -1
- data/spec/{search_spec.rb → core/search_spec.rb} +1 -1
- data/spec/{spec_helper.rb → core/spec_helper.rb} +5 -5
- data/spec/{trackie_spec.rb → core/trackie_spec.rb} +1 -1
- data/{live → spec/live}/Readme.md +0 -0
- data/{live → spec/live}/activity_spec.rb +1 -1
- data/{live → spec/live}/audit_spec.rb +1 -1
- data/{live → spec/live}/bookmark_spec.rb +1 -1
- data/{live → spec/live}/category_spec.rb +1 -1
- data/{live → spec/live}/collection_spec.rb +1 -1
- data/{live → spec/live}/crm_spec.rb +1 -1
- data/{live → spec/live}/custom_role_spec.rb +1 -1
- data/{live → spec/live}/forum_spec.rb +1 -1
- data/{live → spec/live}/forum_subscription_spec.rb +1 -1
- data/{live → spec/live}/group_membership_spec.rb +1 -1
- data/{live → spec/live}/group_spec.rb +1 -1
- data/{live → spec/live}/identity_spec.rb +1 -1
- data/{live → spec/live}/locale_spec.rb +1 -1
- data/{live → spec/live}/macro_spec.rb +1 -1
- data/{live → spec/live}/mobile_device_spec.rb +1 -1
- data/{live → spec/live}/organization_spec.rb +1 -1
- data/{live → spec/live}/request_spec.rb +1 -1
- data/{live → spec/live}/satisfaction_rating_spec.rb +1 -1
- data/{live → spec/live}/setting_spec.rb +1 -1
- data/{live → spec/live}/suspended_ticket_spec.rb +1 -1
- data/{live → spec/live}/ticket_field_spec.rb +1 -1
- data/{live → spec/live}/ticket_metrics_spec.rb +1 -1
- data/{live → spec/live}/ticket_spec.rb +1 -1
- data/spec/live/topic_comment_spec.rb +24 -0
- data/{live → spec/live}/topic_spec.rb +1 -1
- data/{live → spec/live}/topic_subscription_spec.rb +1 -1
- data/{live → spec/live}/topic_vote_spec.rb +1 -1
- data/{live → spec/live}/upload_spec.rb +1 -1
- data/{live → spec/live}/user_spec.rb +1 -1
- data/{live → spec/live}/view_spec.rb +1 -1
- data/spec/macros/resource_macros.rb +1 -1
- data/spec/server/app_spec.rb +140 -0
- data/spec/server/helper_spec.rb +97 -0
- data/spec/server/html_renderer_spec.rb +130 -0
- data/spec/server/spec_helper.rb +43 -0
- metadata +198 -77
- data/live/topic_comment_spec.rb +0 -13
@@ -0,0 +1,100 @@
|
|
1
|
+
/* ============================================================
|
2
|
+
* bootstrap-dropdown.js v2.0.4
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
|
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 ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* DROPDOWN CLASS DEFINITION
|
27
|
+
* ========================= */
|
28
|
+
|
29
|
+
var toggle = '[data-toggle="dropdown"]'
|
30
|
+
, Dropdown = function (element) {
|
31
|
+
var $el = $(element).on('click.dropdown.data-api', this.toggle)
|
32
|
+
$('html').on('click.dropdown.data-api', function () {
|
33
|
+
$el.parent().removeClass('open')
|
34
|
+
})
|
35
|
+
}
|
36
|
+
|
37
|
+
Dropdown.prototype = {
|
38
|
+
|
39
|
+
constructor: Dropdown
|
40
|
+
|
41
|
+
, toggle: function (e) {
|
42
|
+
var $this = $(this)
|
43
|
+
, $parent
|
44
|
+
, selector
|
45
|
+
, isActive
|
46
|
+
|
47
|
+
if ($this.is('.disabled, :disabled')) return
|
48
|
+
|
49
|
+
selector = $this.attr('data-target')
|
50
|
+
|
51
|
+
if (!selector) {
|
52
|
+
selector = $this.attr('href')
|
53
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
54
|
+
}
|
55
|
+
|
56
|
+
$parent = $(selector)
|
57
|
+
$parent.length || ($parent = $this.parent())
|
58
|
+
|
59
|
+
isActive = $parent.hasClass('open')
|
60
|
+
|
61
|
+
clearMenus()
|
62
|
+
|
63
|
+
if (!isActive) $parent.toggleClass('open')
|
64
|
+
|
65
|
+
return false
|
66
|
+
}
|
67
|
+
|
68
|
+
}
|
69
|
+
|
70
|
+
function clearMenus() {
|
71
|
+
$(toggle).parent().removeClass('open')
|
72
|
+
}
|
73
|
+
|
74
|
+
|
75
|
+
/* DROPDOWN PLUGIN DEFINITION
|
76
|
+
* ========================== */
|
77
|
+
|
78
|
+
$.fn.dropdown = function (option) {
|
79
|
+
return this.each(function () {
|
80
|
+
var $this = $(this)
|
81
|
+
, data = $this.data('dropdown')
|
82
|
+
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
|
83
|
+
if (typeof option == 'string') data[option].call($this)
|
84
|
+
})
|
85
|
+
}
|
86
|
+
|
87
|
+
$.fn.dropdown.Constructor = Dropdown
|
88
|
+
|
89
|
+
|
90
|
+
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
91
|
+
* =================================== */
|
92
|
+
|
93
|
+
$(function () {
|
94
|
+
$('html').on('click.dropdown.data-api', clearMenus)
|
95
|
+
$('body')
|
96
|
+
.on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
|
97
|
+
.on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
|
98
|
+
})
|
99
|
+
|
100
|
+
}(window.jQuery);
|
@@ -0,0 +1,218 @@
|
|
1
|
+
/* =========================================================
|
2
|
+
* bootstrap-modal.js v2.0.4
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#modals
|
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 ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* MODAL CLASS DEFINITION
|
27
|
+
* ====================== */
|
28
|
+
|
29
|
+
var Modal = function (content, options) {
|
30
|
+
this.options = options
|
31
|
+
this.$element = $(content)
|
32
|
+
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
|
33
|
+
}
|
34
|
+
|
35
|
+
Modal.prototype = {
|
36
|
+
|
37
|
+
constructor: Modal
|
38
|
+
|
39
|
+
, toggle: function () {
|
40
|
+
return this[!this.isShown ? 'show' : 'hide']()
|
41
|
+
}
|
42
|
+
|
43
|
+
, show: function () {
|
44
|
+
var that = this
|
45
|
+
, e = $.Event('show')
|
46
|
+
|
47
|
+
this.$element.trigger(e)
|
48
|
+
|
49
|
+
if (this.isShown || e.isDefaultPrevented()) return
|
50
|
+
|
51
|
+
$('body').addClass('modal-open')
|
52
|
+
|
53
|
+
this.isShown = true
|
54
|
+
|
55
|
+
escape.call(this)
|
56
|
+
backdrop.call(this, function () {
|
57
|
+
var transition = $.support.transition && that.$element.hasClass('fade')
|
58
|
+
|
59
|
+
if (!that.$element.parent().length) {
|
60
|
+
that.$element.appendTo(document.body) //don't move modals dom position
|
61
|
+
}
|
62
|
+
|
63
|
+
that.$element
|
64
|
+
.show()
|
65
|
+
|
66
|
+
if (transition) {
|
67
|
+
that.$element[0].offsetWidth // force reflow
|
68
|
+
}
|
69
|
+
|
70
|
+
that.$element.addClass('in')
|
71
|
+
|
72
|
+
transition ?
|
73
|
+
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
|
74
|
+
that.$element.trigger('shown')
|
75
|
+
|
76
|
+
})
|
77
|
+
}
|
78
|
+
|
79
|
+
, hide: function (e) {
|
80
|
+
e && e.preventDefault()
|
81
|
+
|
82
|
+
var that = this
|
83
|
+
|
84
|
+
e = $.Event('hide')
|
85
|
+
|
86
|
+
this.$element.trigger(e)
|
87
|
+
|
88
|
+
if (!this.isShown || e.isDefaultPrevented()) return
|
89
|
+
|
90
|
+
this.isShown = false
|
91
|
+
|
92
|
+
$('body').removeClass('modal-open')
|
93
|
+
|
94
|
+
escape.call(this)
|
95
|
+
|
96
|
+
this.$element.removeClass('in')
|
97
|
+
|
98
|
+
$.support.transition && this.$element.hasClass('fade') ?
|
99
|
+
hideWithTransition.call(this) :
|
100
|
+
hideModal.call(this)
|
101
|
+
}
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
/* MODAL PRIVATE METHODS
|
107
|
+
* ===================== */
|
108
|
+
|
109
|
+
function hideWithTransition() {
|
110
|
+
var that = this
|
111
|
+
, timeout = setTimeout(function () {
|
112
|
+
that.$element.off($.support.transition.end)
|
113
|
+
hideModal.call(that)
|
114
|
+
}, 500)
|
115
|
+
|
116
|
+
this.$element.one($.support.transition.end, function () {
|
117
|
+
clearTimeout(timeout)
|
118
|
+
hideModal.call(that)
|
119
|
+
})
|
120
|
+
}
|
121
|
+
|
122
|
+
function hideModal(that) {
|
123
|
+
this.$element
|
124
|
+
.hide()
|
125
|
+
.trigger('hidden')
|
126
|
+
|
127
|
+
backdrop.call(this)
|
128
|
+
}
|
129
|
+
|
130
|
+
function backdrop(callback) {
|
131
|
+
var that = this
|
132
|
+
, animate = this.$element.hasClass('fade') ? 'fade' : ''
|
133
|
+
|
134
|
+
if (this.isShown && this.options.backdrop) {
|
135
|
+
var doAnimate = $.support.transition && animate
|
136
|
+
|
137
|
+
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
138
|
+
.appendTo(document.body)
|
139
|
+
|
140
|
+
if (this.options.backdrop != 'static') {
|
141
|
+
this.$backdrop.click($.proxy(this.hide, this))
|
142
|
+
}
|
143
|
+
|
144
|
+
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
|
145
|
+
|
146
|
+
this.$backdrop.addClass('in')
|
147
|
+
|
148
|
+
doAnimate ?
|
149
|
+
this.$backdrop.one($.support.transition.end, callback) :
|
150
|
+
callback()
|
151
|
+
|
152
|
+
} else if (!this.isShown && this.$backdrop) {
|
153
|
+
this.$backdrop.removeClass('in')
|
154
|
+
|
155
|
+
$.support.transition && this.$element.hasClass('fade')?
|
156
|
+
this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
|
157
|
+
removeBackdrop.call(this)
|
158
|
+
|
159
|
+
} else if (callback) {
|
160
|
+
callback()
|
161
|
+
}
|
162
|
+
}
|
163
|
+
|
164
|
+
function removeBackdrop() {
|
165
|
+
this.$backdrop.remove()
|
166
|
+
this.$backdrop = null
|
167
|
+
}
|
168
|
+
|
169
|
+
function escape() {
|
170
|
+
var that = this
|
171
|
+
if (this.isShown && this.options.keyboard) {
|
172
|
+
$(document).on('keyup.dismiss.modal', function ( e ) {
|
173
|
+
e.which == 27 && that.hide()
|
174
|
+
})
|
175
|
+
} else if (!this.isShown) {
|
176
|
+
$(document).off('keyup.dismiss.modal')
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
|
181
|
+
/* MODAL PLUGIN DEFINITION
|
182
|
+
* ======================= */
|
183
|
+
|
184
|
+
$.fn.modal = function (option) {
|
185
|
+
return this.each(function () {
|
186
|
+
var $this = $(this)
|
187
|
+
, data = $this.data('modal')
|
188
|
+
, options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
|
189
|
+
if (!data) $this.data('modal', (data = new Modal(this, options)))
|
190
|
+
if (typeof option == 'string') data[option]()
|
191
|
+
else if (options.show) data.show()
|
192
|
+
})
|
193
|
+
}
|
194
|
+
|
195
|
+
$.fn.modal.defaults = {
|
196
|
+
backdrop: true
|
197
|
+
, keyboard: true
|
198
|
+
, show: true
|
199
|
+
}
|
200
|
+
|
201
|
+
$.fn.modal.Constructor = Modal
|
202
|
+
|
203
|
+
|
204
|
+
/* MODAL DATA-API
|
205
|
+
* ============== */
|
206
|
+
|
207
|
+
$(function () {
|
208
|
+
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
|
209
|
+
var $this = $(this), href
|
210
|
+
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
211
|
+
, option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
|
212
|
+
|
213
|
+
e.preventDefault()
|
214
|
+
$target.modal(option)
|
215
|
+
})
|
216
|
+
})
|
217
|
+
|
218
|
+
}(window.jQuery);
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/* ===========================================================
|
2
|
+
* bootstrap-popover.js v2.0.4
|
3
|
+
* http://twitter.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 ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* POPOVER PUBLIC CLASS DEFINITION
|
27
|
+
* =============================== */
|
28
|
+
|
29
|
+
var Popover = function ( element, options ) {
|
30
|
+
this.init('popover', element, options)
|
31
|
+
}
|
32
|
+
|
33
|
+
|
34
|
+
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
|
35
|
+
========================================== */
|
36
|
+
|
37
|
+
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
|
38
|
+
|
39
|
+
constructor: Popover
|
40
|
+
|
41
|
+
, setContent: function () {
|
42
|
+
var $tip = this.tip()
|
43
|
+
, title = this.getTitle()
|
44
|
+
, content = this.getContent()
|
45
|
+
|
46
|
+
$tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title)
|
47
|
+
$tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content)
|
48
|
+
|
49
|
+
$tip.removeClass('fade top bottom left right in')
|
50
|
+
}
|
51
|
+
|
52
|
+
, hasContent: function () {
|
53
|
+
return this.getTitle() || this.getContent()
|
54
|
+
}
|
55
|
+
|
56
|
+
, getContent: function () {
|
57
|
+
var content
|
58
|
+
, $e = this.$element
|
59
|
+
, o = this.options
|
60
|
+
|
61
|
+
content = $e.attr('data-content')
|
62
|
+
|| (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
|
63
|
+
|
64
|
+
return content
|
65
|
+
}
|
66
|
+
|
67
|
+
, tip: function () {
|
68
|
+
if (!this.$tip) {
|
69
|
+
this.$tip = $(this.options.template)
|
70
|
+
}
|
71
|
+
return this.$tip
|
72
|
+
}
|
73
|
+
|
74
|
+
})
|
75
|
+
|
76
|
+
|
77
|
+
/* POPOVER PLUGIN DEFINITION
|
78
|
+
* ======================= */
|
79
|
+
|
80
|
+
$.fn.popover = function (option) {
|
81
|
+
return this.each(function () {
|
82
|
+
var $this = $(this)
|
83
|
+
, data = $this.data('popover')
|
84
|
+
, options = typeof option == 'object' && option
|
85
|
+
if (!data) $this.data('popover', (data = new Popover(this, options)))
|
86
|
+
if (typeof option == 'string') data[option]()
|
87
|
+
})
|
88
|
+
}
|
89
|
+
|
90
|
+
$.fn.popover.Constructor = Popover
|
91
|
+
|
92
|
+
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
|
93
|
+
placement: 'right'
|
94
|
+
, content: ''
|
95
|
+
, 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>'
|
96
|
+
})
|
97
|
+
|
98
|
+
}(window.jQuery);
|
@@ -0,0 +1,151 @@
|
|
1
|
+
/* =============================================================
|
2
|
+
* bootstrap-scrollspy.js v2.0.4
|
3
|
+
* http://twitter.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 ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* SCROLLSPY CLASS DEFINITION
|
27
|
+
* ========================== */
|
28
|
+
|
29
|
+
function ScrollSpy( element, options) {
|
30
|
+
var process = $.proxy(this.process, this)
|
31
|
+
, $element = $(element).is('body') ? $(window) : $(element)
|
32
|
+
, href
|
33
|
+
this.options = $.extend({}, $.fn.scrollspy.defaults, options)
|
34
|
+
this.$scrollElement = $element.on('scroll.scroll.data-api', process)
|
35
|
+
this.selector = (this.options.target
|
36
|
+
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
37
|
+
|| '') + ' .nav li > a'
|
38
|
+
this.$body = $('body')
|
39
|
+
this.refresh()
|
40
|
+
this.process()
|
41
|
+
}
|
42
|
+
|
43
|
+
ScrollSpy.prototype = {
|
44
|
+
|
45
|
+
constructor: ScrollSpy
|
46
|
+
|
47
|
+
, refresh: function () {
|
48
|
+
var self = this
|
49
|
+
, $targets
|
50
|
+
|
51
|
+
this.offsets = $([])
|
52
|
+
this.targets = $([])
|
53
|
+
|
54
|
+
$targets = this.$body
|
55
|
+
.find(this.selector)
|
56
|
+
.map(function () {
|
57
|
+
var $el = $(this)
|
58
|
+
, href = $el.data('target') || $el.attr('href')
|
59
|
+
, $href = /^#\w/.test(href) && $(href)
|
60
|
+
return ( $href
|
61
|
+
&& href.length
|
62
|
+
&& [[ $href.position().top, href ]] ) || null
|
63
|
+
})
|
64
|
+
.sort(function (a, b) { return a[0] - b[0] })
|
65
|
+
.each(function () {
|
66
|
+
self.offsets.push(this[0])
|
67
|
+
self.targets.push(this[1])
|
68
|
+
})
|
69
|
+
}
|
70
|
+
|
71
|
+
, process: function () {
|
72
|
+
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
73
|
+
, scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
|
74
|
+
, maxScroll = scrollHeight - this.$scrollElement.height()
|
75
|
+
, offsets = this.offsets
|
76
|
+
, targets = this.targets
|
77
|
+
, activeTarget = this.activeTarget
|
78
|
+
, i
|
79
|
+
|
80
|
+
if (scrollTop >= maxScroll) {
|
81
|
+
return activeTarget != (i = targets.last()[0])
|
82
|
+
&& this.activate ( i )
|
83
|
+
}
|
84
|
+
|
85
|
+
for (i = offsets.length; i--;) {
|
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')) {
|
112
|
+
active = active.closest('li.dropdown').addClass('active')
|
113
|
+
}
|
114
|
+
|
115
|
+
active.trigger('activate')
|
116
|
+
}
|
117
|
+
|
118
|
+
}
|
119
|
+
|
120
|
+
|
121
|
+
/* SCROLLSPY PLUGIN DEFINITION
|
122
|
+
* =========================== */
|
123
|
+
|
124
|
+
$.fn.scrollspy = function ( option ) {
|
125
|
+
return this.each(function () {
|
126
|
+
var $this = $(this)
|
127
|
+
, data = $this.data('scrollspy')
|
128
|
+
, options = typeof option == 'object' && option
|
129
|
+
if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
|
130
|
+
if (typeof option == 'string') data[option]()
|
131
|
+
})
|
132
|
+
}
|
133
|
+
|
134
|
+
$.fn.scrollspy.Constructor = ScrollSpy
|
135
|
+
|
136
|
+
$.fn.scrollspy.defaults = {
|
137
|
+
offset: 10
|
138
|
+
}
|
139
|
+
|
140
|
+
|
141
|
+
/* SCROLLSPY DATA-API
|
142
|
+
* ================== */
|
143
|
+
|
144
|
+
$(function () {
|
145
|
+
$('[data-spy="scroll"]').each(function () {
|
146
|
+
var $spy = $(this)
|
147
|
+
$spy.scrollspy($spy.data())
|
148
|
+
})
|
149
|
+
})
|
150
|
+
|
151
|
+
}(window.jQuery);
|