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,90 @@
|
|
1
|
+
/* ==========================================================
|
2
|
+
* bootstrap-alert.js v2.0.4
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#alerts
|
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
|
+
/* ALERT CLASS DEFINITION
|
27
|
+
* ====================== */
|
28
|
+
|
29
|
+
var dismiss = '[data-dismiss="alert"]'
|
30
|
+
, Alert = function (el) {
|
31
|
+
$(el).on('click', dismiss, this.close)
|
32
|
+
}
|
33
|
+
|
34
|
+
Alert.prototype.close = function (e) {
|
35
|
+
var $this = $(this)
|
36
|
+
, selector = $this.attr('data-target')
|
37
|
+
, $parent
|
38
|
+
|
39
|
+
if (!selector) {
|
40
|
+
selector = $this.attr('href')
|
41
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
42
|
+
}
|
43
|
+
|
44
|
+
$parent = $(selector)
|
45
|
+
|
46
|
+
e && e.preventDefault()
|
47
|
+
|
48
|
+
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
|
49
|
+
|
50
|
+
$parent.trigger(e = $.Event('close'))
|
51
|
+
|
52
|
+
if (e.isDefaultPrevented()) return
|
53
|
+
|
54
|
+
$parent.removeClass('in')
|
55
|
+
|
56
|
+
function removeElement() {
|
57
|
+
$parent
|
58
|
+
.trigger('closed')
|
59
|
+
.remove()
|
60
|
+
}
|
61
|
+
|
62
|
+
$.support.transition && $parent.hasClass('fade') ?
|
63
|
+
$parent.on($.support.transition.end, removeElement) :
|
64
|
+
removeElement()
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
/* ALERT PLUGIN DEFINITION
|
69
|
+
* ======================= */
|
70
|
+
|
71
|
+
$.fn.alert = function (option) {
|
72
|
+
return this.each(function () {
|
73
|
+
var $this = $(this)
|
74
|
+
, data = $this.data('alert')
|
75
|
+
if (!data) $this.data('alert', (data = new Alert(this)))
|
76
|
+
if (typeof option == 'string') data[option].call($this)
|
77
|
+
})
|
78
|
+
}
|
79
|
+
|
80
|
+
$.fn.alert.Constructor = Alert
|
81
|
+
|
82
|
+
|
83
|
+
/* ALERT DATA-API
|
84
|
+
* ============== */
|
85
|
+
|
86
|
+
$(function () {
|
87
|
+
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
|
88
|
+
})
|
89
|
+
|
90
|
+
}(window.jQuery);
|
@@ -0,0 +1,96 @@
|
|
1
|
+
/* ============================================================
|
2
|
+
* bootstrap-button.js v2.0.4
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#buttons
|
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
|
+
/* BUTTON PUBLIC CLASS DEFINITION
|
27
|
+
* ============================== */
|
28
|
+
|
29
|
+
var Button = function (element, options) {
|
30
|
+
this.$element = $(element)
|
31
|
+
this.options = $.extend({}, $.fn.button.defaults, options)
|
32
|
+
}
|
33
|
+
|
34
|
+
Button.prototype.setState = function (state) {
|
35
|
+
var d = 'disabled'
|
36
|
+
, $el = this.$element
|
37
|
+
, data = $el.data()
|
38
|
+
, val = $el.is('input') ? 'val' : 'html'
|
39
|
+
|
40
|
+
state = state + 'Text'
|
41
|
+
data.resetText || $el.data('resetText', $el[val]())
|
42
|
+
|
43
|
+
$el[val](data[state] || this.options[state])
|
44
|
+
|
45
|
+
// push to event loop to allow forms to submit
|
46
|
+
setTimeout(function () {
|
47
|
+
state == 'loadingText' ?
|
48
|
+
$el.addClass(d).attr(d, d) :
|
49
|
+
$el.removeClass(d).removeAttr(d)
|
50
|
+
}, 0)
|
51
|
+
}
|
52
|
+
|
53
|
+
Button.prototype.toggle = function () {
|
54
|
+
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
|
55
|
+
|
56
|
+
$parent && $parent
|
57
|
+
.find('.active')
|
58
|
+
.removeClass('active')
|
59
|
+
|
60
|
+
this.$element.toggleClass('active')
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
/* BUTTON PLUGIN DEFINITION
|
65
|
+
* ======================== */
|
66
|
+
|
67
|
+
$.fn.button = function (option) {
|
68
|
+
return this.each(function () {
|
69
|
+
var $this = $(this)
|
70
|
+
, data = $this.data('button')
|
71
|
+
, options = typeof option == 'object' && option
|
72
|
+
if (!data) $this.data('button', (data = new Button(this, options)))
|
73
|
+
if (option == 'toggle') data.toggle()
|
74
|
+
else if (option) data.setState(option)
|
75
|
+
})
|
76
|
+
}
|
77
|
+
|
78
|
+
$.fn.button.defaults = {
|
79
|
+
loadingText: 'loading...'
|
80
|
+
}
|
81
|
+
|
82
|
+
$.fn.button.Constructor = Button
|
83
|
+
|
84
|
+
|
85
|
+
/* BUTTON DATA-API
|
86
|
+
* =============== */
|
87
|
+
|
88
|
+
$(function () {
|
89
|
+
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
|
90
|
+
var $btn = $(e.target)
|
91
|
+
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
92
|
+
$btn.button('toggle')
|
93
|
+
})
|
94
|
+
})
|
95
|
+
|
96
|
+
}(window.jQuery);
|
@@ -0,0 +1,169 @@
|
|
1
|
+
/* ==========================================================
|
2
|
+
* bootstrap-carousel.js v2.0.4
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#carousel
|
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
|
+
/* CAROUSEL CLASS DEFINITION
|
27
|
+
* ========================= */
|
28
|
+
|
29
|
+
var Carousel = function (element, options) {
|
30
|
+
this.$element = $(element)
|
31
|
+
this.options = options
|
32
|
+
this.options.slide && this.slide(this.options.slide)
|
33
|
+
this.options.pause == 'hover' && this.$element
|
34
|
+
.on('mouseenter', $.proxy(this.pause, this))
|
35
|
+
.on('mouseleave', $.proxy(this.cycle, this))
|
36
|
+
}
|
37
|
+
|
38
|
+
Carousel.prototype = {
|
39
|
+
|
40
|
+
cycle: function (e) {
|
41
|
+
if (!e) this.paused = false
|
42
|
+
this.options.interval
|
43
|
+
&& !this.paused
|
44
|
+
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
|
45
|
+
return this
|
46
|
+
}
|
47
|
+
|
48
|
+
, to: function (pos) {
|
49
|
+
var $active = this.$element.find('.active')
|
50
|
+
, children = $active.parent().children()
|
51
|
+
, activePos = children.index($active)
|
52
|
+
, that = this
|
53
|
+
|
54
|
+
if (pos > (children.length - 1) || pos < 0) return
|
55
|
+
|
56
|
+
if (this.sliding) {
|
57
|
+
return this.$element.one('slid', function () {
|
58
|
+
that.to(pos)
|
59
|
+
})
|
60
|
+
}
|
61
|
+
|
62
|
+
if (activePos == pos) {
|
63
|
+
return this.pause().cycle()
|
64
|
+
}
|
65
|
+
|
66
|
+
return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
|
67
|
+
}
|
68
|
+
|
69
|
+
, pause: function (e) {
|
70
|
+
if (!e) this.paused = true
|
71
|
+
clearInterval(this.interval)
|
72
|
+
this.interval = null
|
73
|
+
return this
|
74
|
+
}
|
75
|
+
|
76
|
+
, next: function () {
|
77
|
+
if (this.sliding) return
|
78
|
+
return this.slide('next')
|
79
|
+
}
|
80
|
+
|
81
|
+
, prev: function () {
|
82
|
+
if (this.sliding) return
|
83
|
+
return this.slide('prev')
|
84
|
+
}
|
85
|
+
|
86
|
+
, slide: function (type, next) {
|
87
|
+
var $active = this.$element.find('.active')
|
88
|
+
, $next = next || $active[type]()
|
89
|
+
, isCycling = this.interval
|
90
|
+
, direction = type == 'next' ? 'left' : 'right'
|
91
|
+
, fallback = type == 'next' ? 'first' : 'last'
|
92
|
+
, that = this
|
93
|
+
, e = $.Event('slide')
|
94
|
+
|
95
|
+
this.sliding = true
|
96
|
+
|
97
|
+
isCycling && this.pause()
|
98
|
+
|
99
|
+
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
|
100
|
+
|
101
|
+
if ($next.hasClass('active')) return
|
102
|
+
|
103
|
+
if ($.support.transition && this.$element.hasClass('slide')) {
|
104
|
+
this.$element.trigger(e)
|
105
|
+
if (e.isDefaultPrevented()) return
|
106
|
+
$next.addClass(type)
|
107
|
+
$next[0].offsetWidth // force reflow
|
108
|
+
$active.addClass(direction)
|
109
|
+
$next.addClass(direction)
|
110
|
+
this.$element.one($.support.transition.end, function () {
|
111
|
+
$next.removeClass([type, direction].join(' ')).addClass('active')
|
112
|
+
$active.removeClass(['active', direction].join(' '))
|
113
|
+
that.sliding = false
|
114
|
+
setTimeout(function () { that.$element.trigger('slid') }, 0)
|
115
|
+
})
|
116
|
+
} else {
|
117
|
+
this.$element.trigger(e)
|
118
|
+
if (e.isDefaultPrevented()) return
|
119
|
+
$active.removeClass('active')
|
120
|
+
$next.addClass('active')
|
121
|
+
this.sliding = false
|
122
|
+
this.$element.trigger('slid')
|
123
|
+
}
|
124
|
+
|
125
|
+
isCycling && this.cycle()
|
126
|
+
|
127
|
+
return this
|
128
|
+
}
|
129
|
+
|
130
|
+
}
|
131
|
+
|
132
|
+
|
133
|
+
/* CAROUSEL PLUGIN DEFINITION
|
134
|
+
* ========================== */
|
135
|
+
|
136
|
+
$.fn.carousel = function (option) {
|
137
|
+
return this.each(function () {
|
138
|
+
var $this = $(this)
|
139
|
+
, data = $this.data('carousel')
|
140
|
+
, options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
|
141
|
+
if (!data) $this.data('carousel', (data = new Carousel(this, options)))
|
142
|
+
if (typeof option == 'number') data.to(option)
|
143
|
+
else if (typeof option == 'string' || (option = options.slide)) data[option]()
|
144
|
+
else if (options.interval) data.cycle()
|
145
|
+
})
|
146
|
+
}
|
147
|
+
|
148
|
+
$.fn.carousel.defaults = {
|
149
|
+
interval: 5000
|
150
|
+
, pause: 'hover'
|
151
|
+
}
|
152
|
+
|
153
|
+
$.fn.carousel.Constructor = Carousel
|
154
|
+
|
155
|
+
|
156
|
+
/* CAROUSEL DATA-API
|
157
|
+
* ================= */
|
158
|
+
|
159
|
+
$(function () {
|
160
|
+
$('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
|
161
|
+
var $this = $(this), href
|
162
|
+
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
163
|
+
, options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
|
164
|
+
$target.carousel(options)
|
165
|
+
e.preventDefault()
|
166
|
+
})
|
167
|
+
})
|
168
|
+
|
169
|
+
}(window.jQuery);
|
@@ -0,0 +1,157 @@
|
|
1
|
+
/* =============================================================
|
2
|
+
* bootstrap-collapse.js v2.0.4
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#collapse
|
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
|
+
/* COLLAPSE PUBLIC CLASS DEFINITION
|
27
|
+
* ================================ */
|
28
|
+
|
29
|
+
var Collapse = function (element, options) {
|
30
|
+
this.$element = $(element)
|
31
|
+
this.options = $.extend({}, $.fn.collapse.defaults, options)
|
32
|
+
|
33
|
+
if (this.options.parent) {
|
34
|
+
this.$parent = $(this.options.parent)
|
35
|
+
}
|
36
|
+
|
37
|
+
this.options.toggle && this.toggle()
|
38
|
+
}
|
39
|
+
|
40
|
+
Collapse.prototype = {
|
41
|
+
|
42
|
+
constructor: Collapse
|
43
|
+
|
44
|
+
, dimension: function () {
|
45
|
+
var hasWidth = this.$element.hasClass('width')
|
46
|
+
return hasWidth ? 'width' : 'height'
|
47
|
+
}
|
48
|
+
|
49
|
+
, show: function () {
|
50
|
+
var dimension
|
51
|
+
, scroll
|
52
|
+
, actives
|
53
|
+
, hasData
|
54
|
+
|
55
|
+
if (this.transitioning) return
|
56
|
+
|
57
|
+
dimension = this.dimension()
|
58
|
+
scroll = $.camelCase(['scroll', dimension].join('-'))
|
59
|
+
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
|
60
|
+
|
61
|
+
if (actives && actives.length) {
|
62
|
+
hasData = actives.data('collapse')
|
63
|
+
if (hasData && hasData.transitioning) return
|
64
|
+
actives.collapse('hide')
|
65
|
+
hasData || actives.data('collapse', null)
|
66
|
+
}
|
67
|
+
|
68
|
+
this.$element[dimension](0)
|
69
|
+
this.transition('addClass', $.Event('show'), 'shown')
|
70
|
+
this.$element[dimension](this.$element[0][scroll])
|
71
|
+
}
|
72
|
+
|
73
|
+
, hide: function () {
|
74
|
+
var dimension
|
75
|
+
if (this.transitioning) return
|
76
|
+
dimension = this.dimension()
|
77
|
+
this.reset(this.$element[dimension]())
|
78
|
+
this.transition('removeClass', $.Event('hide'), 'hidden')
|
79
|
+
this.$element[dimension](0)
|
80
|
+
}
|
81
|
+
|
82
|
+
, reset: function (size) {
|
83
|
+
var dimension = this.dimension()
|
84
|
+
|
85
|
+
this.$element
|
86
|
+
.removeClass('collapse')
|
87
|
+
[dimension](size || 'auto')
|
88
|
+
[0].offsetWidth
|
89
|
+
|
90
|
+
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
|
91
|
+
|
92
|
+
return this
|
93
|
+
}
|
94
|
+
|
95
|
+
, transition: function (method, startEvent, completeEvent) {
|
96
|
+
var that = this
|
97
|
+
, complete = function () {
|
98
|
+
if (startEvent.type == 'show') that.reset()
|
99
|
+
that.transitioning = 0
|
100
|
+
that.$element.trigger(completeEvent)
|
101
|
+
}
|
102
|
+
|
103
|
+
this.$element.trigger(startEvent)
|
104
|
+
|
105
|
+
if (startEvent.isDefaultPrevented()) return
|
106
|
+
|
107
|
+
this.transitioning = 1
|
108
|
+
|
109
|
+
this.$element[method]('in')
|
110
|
+
|
111
|
+
$.support.transition && this.$element.hasClass('collapse') ?
|
112
|
+
this.$element.one($.support.transition.end, complete) :
|
113
|
+
complete()
|
114
|
+
}
|
115
|
+
|
116
|
+
, toggle: function () {
|
117
|
+
this[this.$element.hasClass('in') ? 'hide' : 'show']()
|
118
|
+
}
|
119
|
+
|
120
|
+
}
|
121
|
+
|
122
|
+
|
123
|
+
/* COLLAPSIBLE PLUGIN DEFINITION
|
124
|
+
* ============================== */
|
125
|
+
|
126
|
+
$.fn.collapse = function (option) {
|
127
|
+
return this.each(function () {
|
128
|
+
var $this = $(this)
|
129
|
+
, data = $this.data('collapse')
|
130
|
+
, options = typeof option == 'object' && option
|
131
|
+
if (!data) $this.data('collapse', (data = new Collapse(this, options)))
|
132
|
+
if (typeof option == 'string') data[option]()
|
133
|
+
})
|
134
|
+
}
|
135
|
+
|
136
|
+
$.fn.collapse.defaults = {
|
137
|
+
toggle: true
|
138
|
+
}
|
139
|
+
|
140
|
+
$.fn.collapse.Constructor = Collapse
|
141
|
+
|
142
|
+
|
143
|
+
/* COLLAPSIBLE DATA-API
|
144
|
+
* ==================== */
|
145
|
+
|
146
|
+
$(function () {
|
147
|
+
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
|
148
|
+
var $this = $(this), href
|
149
|
+
, target = $this.attr('data-target')
|
150
|
+
|| e.preventDefault()
|
151
|
+
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
|
152
|
+
, option = $(target).data('collapse') ? 'toggle' : $this.data()
|
153
|
+
$(target).collapse(option)
|
154
|
+
})
|
155
|
+
})
|
156
|
+
|
157
|
+
}(window.jQuery);
|