sidekiq 0.10.0 → 7.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (234) hide show
  1. checksums.yaml +7 -0
  2. data/Changes.md +2047 -0
  3. data/LICENSE.txt +9 -0
  4. data/README.md +73 -27
  5. data/bin/sidekiq +25 -9
  6. data/bin/sidekiqload +247 -0
  7. data/bin/sidekiqmon +11 -0
  8. data/lib/generators/sidekiq/job_generator.rb +57 -0
  9. data/lib/generators/sidekiq/templates/job.rb.erb +9 -0
  10. data/lib/generators/sidekiq/templates/job_spec.rb.erb +6 -0
  11. data/lib/generators/sidekiq/templates/job_test.rb.erb +8 -0
  12. data/lib/sidekiq/api.rb +1145 -0
  13. data/lib/sidekiq/capsule.rb +127 -0
  14. data/lib/sidekiq/cli.rb +348 -109
  15. data/lib/sidekiq/client.rb +241 -41
  16. data/lib/sidekiq/component.rb +68 -0
  17. data/lib/sidekiq/config.rb +287 -0
  18. data/lib/sidekiq/deploy.rb +62 -0
  19. data/lib/sidekiq/embedded.rb +61 -0
  20. data/lib/sidekiq/fetch.rb +88 -0
  21. data/lib/sidekiq/job.rb +374 -0
  22. data/lib/sidekiq/job_logger.rb +51 -0
  23. data/lib/sidekiq/job_retry.rb +300 -0
  24. data/lib/sidekiq/job_util.rb +107 -0
  25. data/lib/sidekiq/launcher.rb +271 -0
  26. data/lib/sidekiq/logger.rb +131 -0
  27. data/lib/sidekiq/manager.rb +96 -103
  28. data/lib/sidekiq/metrics/query.rb +153 -0
  29. data/lib/sidekiq/metrics/shared.rb +95 -0
  30. data/lib/sidekiq/metrics/tracking.rb +136 -0
  31. data/lib/sidekiq/middleware/chain.rb +149 -38
  32. data/lib/sidekiq/middleware/current_attributes.rb +95 -0
  33. data/lib/sidekiq/middleware/i18n.rb +42 -0
  34. data/lib/sidekiq/middleware/modules.rb +21 -0
  35. data/lib/sidekiq/monitor.rb +146 -0
  36. data/lib/sidekiq/paginator.rb +55 -0
  37. data/lib/sidekiq/processor.rb +246 -61
  38. data/lib/sidekiq/rails.rb +60 -13
  39. data/lib/sidekiq/redis_client_adapter.rb +95 -0
  40. data/lib/sidekiq/redis_connection.rb +68 -15
  41. data/lib/sidekiq/ring_buffer.rb +29 -0
  42. data/lib/sidekiq/scheduled.rb +236 -0
  43. data/lib/sidekiq/sd_notify.rb +149 -0
  44. data/lib/sidekiq/systemd.rb +24 -0
  45. data/lib/sidekiq/testing/inline.rb +30 -0
  46. data/lib/sidekiq/testing.rb +304 -10
  47. data/lib/sidekiq/transaction_aware_client.rb +44 -0
  48. data/lib/sidekiq/version.rb +4 -1
  49. data/lib/sidekiq/web/action.rb +93 -0
  50. data/lib/sidekiq/web/application.rb +447 -0
  51. data/lib/sidekiq/web/csrf_protection.rb +180 -0
  52. data/lib/sidekiq/web/helpers.rb +370 -0
  53. data/lib/sidekiq/web/router.rb +104 -0
  54. data/lib/sidekiq/web.rb +143 -74
  55. data/lib/sidekiq/worker_compatibility_alias.rb +13 -0
  56. data/lib/sidekiq.rb +120 -73
  57. data/sidekiq.gemspec +26 -23
  58. data/web/assets/images/apple-touch-icon.png +0 -0
  59. data/web/assets/images/favicon.ico +0 -0
  60. data/web/assets/images/logo.png +0 -0
  61. data/web/assets/images/status.png +0 -0
  62. data/web/assets/javascripts/application.js +162 -3
  63. data/web/assets/javascripts/base-charts.js +106 -0
  64. data/web/assets/javascripts/chart.min.js +13 -0
  65. data/web/assets/javascripts/chartjs-plugin-annotation.min.js +7 -0
  66. data/web/assets/javascripts/dashboard-charts.js +168 -0
  67. data/web/assets/javascripts/dashboard.js +59 -0
  68. data/web/assets/javascripts/metrics.js +264 -0
  69. data/web/assets/stylesheets/application-dark.css +147 -0
  70. data/web/assets/stylesheets/application-rtl.css +153 -0
  71. data/web/assets/stylesheets/application.css +720 -7
  72. data/web/assets/stylesheets/bootstrap-rtl.min.css +9 -0
  73. data/web/assets/stylesheets/bootstrap.css +5 -0
  74. data/web/locales/ar.yml +87 -0
  75. data/web/locales/cs.yml +78 -0
  76. data/web/locales/da.yml +75 -0
  77. data/web/locales/de.yml +81 -0
  78. data/web/locales/el.yml +87 -0
  79. data/web/locales/en.yml +101 -0
  80. data/web/locales/es.yml +86 -0
  81. data/web/locales/fa.yml +80 -0
  82. data/web/locales/fr.yml +99 -0
  83. data/web/locales/gd.yml +99 -0
  84. data/web/locales/he.yml +80 -0
  85. data/web/locales/hi.yml +75 -0
  86. data/web/locales/it.yml +69 -0
  87. data/web/locales/ja.yml +91 -0
  88. data/web/locales/ko.yml +68 -0
  89. data/web/locales/lt.yml +83 -0
  90. data/web/locales/nb.yml +77 -0
  91. data/web/locales/nl.yml +68 -0
  92. data/web/locales/pl.yml +59 -0
  93. data/web/locales/pt-br.yml +96 -0
  94. data/web/locales/pt.yml +67 -0
  95. data/web/locales/ru.yml +83 -0
  96. data/web/locales/sv.yml +68 -0
  97. data/web/locales/ta.yml +75 -0
  98. data/web/locales/uk.yml +77 -0
  99. data/web/locales/ur.yml +80 -0
  100. data/web/locales/vi.yml +83 -0
  101. data/web/locales/zh-cn.yml +95 -0
  102. data/web/locales/zh-tw.yml +102 -0
  103. data/web/views/_footer.erb +23 -0
  104. data/web/views/_job_info.erb +105 -0
  105. data/web/views/_metrics_period_select.erb +12 -0
  106. data/web/views/_nav.erb +52 -0
  107. data/web/views/_paging.erb +25 -0
  108. data/web/views/_poll_link.erb +4 -0
  109. data/web/views/_status.erb +4 -0
  110. data/web/views/_summary.erb +40 -0
  111. data/web/views/busy.erb +148 -0
  112. data/web/views/dashboard.erb +115 -0
  113. data/web/views/dead.erb +34 -0
  114. data/web/views/filtering.erb +7 -0
  115. data/web/views/layout.erb +42 -0
  116. data/web/views/metrics.erb +82 -0
  117. data/web/views/metrics_for_job.erb +68 -0
  118. data/web/views/morgue.erb +74 -0
  119. data/web/views/queue.erb +55 -0
  120. data/web/views/queues.erb +40 -0
  121. data/web/views/retries.erb +79 -0
  122. data/web/views/retry.erb +34 -0
  123. data/web/views/scheduled.erb +56 -0
  124. data/web/views/scheduled_job_info.erb +8 -0
  125. metadata +159 -237
  126. data/.gitignore +0 -6
  127. data/.rvmrc +0 -4
  128. data/COMM-LICENSE +0 -75
  129. data/Gemfile +0 -10
  130. data/LICENSE +0 -22
  131. data/Rakefile +0 -9
  132. data/TODO.md +0 -1
  133. data/bin/client +0 -7
  134. data/bin/sidekiqctl +0 -43
  135. data/config.ru +0 -8
  136. data/examples/chef/cookbooks/sidekiq/README.rdoc +0 -11
  137. data/examples/chef/cookbooks/sidekiq/recipes/default.rb +0 -55
  138. data/examples/chef/cookbooks/sidekiq/templates/default/monitrc.conf.erb +0 -8
  139. data/examples/chef/cookbooks/sidekiq/templates/default/sidekiq.erb +0 -219
  140. data/examples/chef/cookbooks/sidekiq/templates/default/sidekiq.yml.erb +0 -22
  141. data/examples/config.yml +0 -9
  142. data/examples/monitrc.conf +0 -6
  143. data/examples/por.rb +0 -27
  144. data/examples/scheduling.rb +0 -37
  145. data/examples/sinkiq.rb +0 -57
  146. data/examples/web-ui.png +0 -0
  147. data/lib/sidekiq/capistrano.rb +0 -32
  148. data/lib/sidekiq/extensions/action_mailer.rb +0 -26
  149. data/lib/sidekiq/extensions/active_record.rb +0 -27
  150. data/lib/sidekiq/extensions/generic_proxy.rb +0 -21
  151. data/lib/sidekiq/middleware/client/unique_jobs.rb +0 -32
  152. data/lib/sidekiq/middleware/server/active_record.rb +0 -13
  153. data/lib/sidekiq/middleware/server/exception_handler.rb +0 -38
  154. data/lib/sidekiq/middleware/server/failure_jobs.rb +0 -24
  155. data/lib/sidekiq/middleware/server/logging.rb +0 -27
  156. data/lib/sidekiq/middleware/server/retry_jobs.rb +0 -59
  157. data/lib/sidekiq/middleware/server/unique_jobs.rb +0 -15
  158. data/lib/sidekiq/retry.rb +0 -57
  159. data/lib/sidekiq/util.rb +0 -61
  160. data/lib/sidekiq/worker.rb +0 -37
  161. data/myapp/.gitignore +0 -15
  162. data/myapp/Capfile +0 -5
  163. data/myapp/Gemfile +0 -19
  164. data/myapp/Gemfile.lock +0 -143
  165. data/myapp/Rakefile +0 -7
  166. data/myapp/app/controllers/application_controller.rb +0 -3
  167. data/myapp/app/controllers/work_controller.rb +0 -38
  168. data/myapp/app/helpers/application_helper.rb +0 -2
  169. data/myapp/app/mailers/.gitkeep +0 -0
  170. data/myapp/app/mailers/user_mailer.rb +0 -9
  171. data/myapp/app/models/.gitkeep +0 -0
  172. data/myapp/app/models/post.rb +0 -5
  173. data/myapp/app/views/layouts/application.html.erb +0 -14
  174. data/myapp/app/views/user_mailer/greetings.html.erb +0 -3
  175. data/myapp/app/views/work/index.html.erb +0 -1
  176. data/myapp/app/workers/hard_worker.rb +0 -9
  177. data/myapp/config/application.rb +0 -59
  178. data/myapp/config/boot.rb +0 -6
  179. data/myapp/config/database.yml +0 -25
  180. data/myapp/config/deploy.rb +0 -15
  181. data/myapp/config/environment.rb +0 -5
  182. data/myapp/config/environments/development.rb +0 -38
  183. data/myapp/config/environments/production.rb +0 -67
  184. data/myapp/config/environments/test.rb +0 -37
  185. data/myapp/config/initializers/backtrace_silencers.rb +0 -7
  186. data/myapp/config/initializers/inflections.rb +0 -15
  187. data/myapp/config/initializers/mime_types.rb +0 -5
  188. data/myapp/config/initializers/secret_token.rb +0 -7
  189. data/myapp/config/initializers/session_store.rb +0 -8
  190. data/myapp/config/initializers/sidekiq.rb +0 -6
  191. data/myapp/config/initializers/wrap_parameters.rb +0 -14
  192. data/myapp/config/locales/en.yml +0 -5
  193. data/myapp/config/routes.rb +0 -10
  194. data/myapp/config.ru +0 -4
  195. data/myapp/db/migrate/20120123214055_create_posts.rb +0 -10
  196. data/myapp/db/seeds.rb +0 -7
  197. data/myapp/lib/assets/.gitkeep +0 -0
  198. data/myapp/lib/tasks/.gitkeep +0 -0
  199. data/myapp/log/.gitkeep +0 -0
  200. data/myapp/script/rails +0 -6
  201. data/test/config.yml +0 -9
  202. data/test/fake_env.rb +0 -0
  203. data/test/helper.rb +0 -15
  204. data/test/test_cli.rb +0 -168
  205. data/test/test_client.rb +0 -105
  206. data/test/test_extensions.rb +0 -68
  207. data/test/test_manager.rb +0 -43
  208. data/test/test_middleware.rb +0 -92
  209. data/test/test_processor.rb +0 -32
  210. data/test/test_retry.rb +0 -83
  211. data/test/test_stats.rb +0 -78
  212. data/test/test_testing.rb +0 -65
  213. data/test/test_web.rb +0 -61
  214. data/web/assets/images/bootstrap/glyphicons-halflings-white.png +0 -0
  215. data/web/assets/images/bootstrap/glyphicons-halflings.png +0 -0
  216. data/web/assets/javascripts/vendor/bootstrap/bootstrap-alert.js +0 -91
  217. data/web/assets/javascripts/vendor/bootstrap/bootstrap-button.js +0 -98
  218. data/web/assets/javascripts/vendor/bootstrap/bootstrap-carousel.js +0 -154
  219. data/web/assets/javascripts/vendor/bootstrap/bootstrap-collapse.js +0 -136
  220. data/web/assets/javascripts/vendor/bootstrap/bootstrap-dropdown.js +0 -92
  221. data/web/assets/javascripts/vendor/bootstrap/bootstrap-modal.js +0 -210
  222. data/web/assets/javascripts/vendor/bootstrap/bootstrap-popover.js +0 -95
  223. data/web/assets/javascripts/vendor/bootstrap/bootstrap-scrollspy.js +0 -125
  224. data/web/assets/javascripts/vendor/bootstrap/bootstrap-tab.js +0 -130
  225. data/web/assets/javascripts/vendor/bootstrap/bootstrap-tooltip.js +0 -270
  226. data/web/assets/javascripts/vendor/bootstrap/bootstrap-transition.js +0 -51
  227. data/web/assets/javascripts/vendor/bootstrap/bootstrap-typeahead.js +0 -271
  228. data/web/assets/javascripts/vendor/bootstrap.js +0 -12
  229. data/web/assets/javascripts/vendor/jquery.js +0 -9266
  230. data/web/assets/stylesheets/vendor/bootstrap-responsive.css +0 -567
  231. data/web/assets/stylesheets/vendor/bootstrap.css +0 -3365
  232. data/web/views/index.slim +0 -62
  233. data/web/views/layout.slim +0 -24
  234. data/web/views/queue.slim +0 -11
@@ -1,98 +0,0 @@
1
- /* ============================================================
2
- * bootstrap-button.js v2.0.0
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
- !function( $ ){
21
-
22
- "use strict"
23
-
24
- /* BUTTON PUBLIC CLASS DEFINITION
25
- * ============================== */
26
-
27
- var Button = function ( element, options ) {
28
- this.$element = $(element)
29
- this.options = $.extend({}, $.fn.button.defaults, options)
30
- }
31
-
32
- Button.prototype = {
33
-
34
- constructor: Button
35
-
36
- , setState: function ( state ) {
37
- var d = 'disabled'
38
- , $el = this.$element
39
- , data = $el.data()
40
- , val = $el.is('input') ? 'val' : 'html'
41
-
42
- state = state + 'Text'
43
- data.resetText || $el.data('resetText', $el[val]())
44
-
45
- $el[val](data[state] || this.options[state])
46
-
47
- // push to event loop to allow forms to submit
48
- setTimeout(function () {
49
- state == 'loadingText' ?
50
- $el.addClass(d).attr(d, d) :
51
- $el.removeClass(d).removeAttr(d)
52
- }, 0)
53
- }
54
-
55
- , toggle: function () {
56
- var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
57
-
58
- $parent && $parent
59
- .find('.active')
60
- .removeClass('active')
61
-
62
- this.$element.toggleClass('active')
63
- }
64
-
65
- }
66
-
67
-
68
- /* BUTTON PLUGIN DEFINITION
69
- * ======================== */
70
-
71
- $.fn.button = function ( option ) {
72
- return this.each(function () {
73
- var $this = $(this)
74
- , data = $this.data('button')
75
- , options = typeof option == 'object' && option
76
- if (!data) $this.data('button', (data = new Button(this, options)))
77
- if (option == 'toggle') data.toggle()
78
- else if (option) data.setState(option)
79
- })
80
- }
81
-
82
- $.fn.button.defaults = {
83
- loadingText: 'loading...'
84
- }
85
-
86
- $.fn.button.Constructor = Button
87
-
88
-
89
- /* BUTTON DATA-API
90
- * =============== */
91
-
92
- $(function () {
93
- $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
94
- $(e.target).button('toggle')
95
- })
96
- })
97
-
98
- }( window.jQuery )
@@ -1,154 +0,0 @@
1
- /* ==========================================================
2
- * bootstrap-carousel.js v2.0.0
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"
24
-
25
- /* CAROUSEL CLASS DEFINITION
26
- * ========================= */
27
-
28
- var Carousel = function (element, options) {
29
- this.$element = $(element)
30
- this.options = $.extend({}, $.fn.carousel.defaults, options)
31
- this.options.slide && this.slide(this.options.slide)
32
- }
33
-
34
- Carousel.prototype = {
35
-
36
- cycle: function () {
37
- this.interval = setInterval($.proxy(this.next, this), this.options.interval)
38
- return this
39
- }
40
-
41
- , to: function (pos) {
42
- var $active = this.$element.find('.active')
43
- , children = $active.parent().children()
44
- , activePos = children.index($active)
45
- , that = this
46
-
47
- if (pos > (children.length - 1) || pos < 0) return
48
-
49
- if (this.sliding) {
50
- return this.$element.one('slid', function () {
51
- that.to(pos)
52
- })
53
- }
54
-
55
- if (activePos == pos) {
56
- return this.pause().cycle()
57
- }
58
-
59
- return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
60
- }
61
-
62
- , pause: function () {
63
- clearInterval(this.interval)
64
- return this
65
- }
66
-
67
- , next: function () {
68
- if (this.sliding) return
69
- return this.slide('next')
70
- }
71
-
72
- , prev: function () {
73
- if (this.sliding) return
74
- return this.slide('prev')
75
- }
76
-
77
- , slide: function (type, next) {
78
- var $active = this.$element.find('.active')
79
- , $next = next || $active[type]()
80
- , isCycling = this.interval
81
- , direction = type == 'next' ? 'left' : 'right'
82
- , fallback = type == 'next' ? 'first' : 'last'
83
- , that = this
84
-
85
- this.sliding = true
86
-
87
- isCycling && this.pause()
88
-
89
- $next = $next.length ? $next : this.$element.find('.item')[fallback]()
90
-
91
- if (!$.support.transition && this.$element.hasClass('slide')) {
92
- this.$element.trigger('slide')
93
- $active.removeClass('active')
94
- $next.addClass('active')
95
- this.sliding = false
96
- this.$element.trigger('slid')
97
- } else {
98
- $next.addClass(type)
99
- $next[0].offsetWidth // force reflow
100
- $active.addClass(direction)
101
- $next.addClass(direction)
102
- this.$element.trigger('slide')
103
- this.$element.one($.support.transition.end, function () {
104
- $next.removeClass([type, direction].join(' ')).addClass('active')
105
- $active.removeClass(['active', direction].join(' '))
106
- that.sliding = false
107
- setTimeout(function () { that.$element.trigger('slid') }, 0)
108
- })
109
- }
110
-
111
- isCycling && this.cycle()
112
-
113
- return this
114
- }
115
-
116
- }
117
-
118
-
119
- /* CAROUSEL PLUGIN DEFINITION
120
- * ========================== */
121
-
122
- $.fn.carousel = function ( option ) {
123
- return this.each(function () {
124
- var $this = $(this)
125
- , data = $this.data('carousel')
126
- , options = typeof option == 'object' && option
127
- if (!data) $this.data('carousel', (data = new Carousel(this, options)))
128
- if (typeof option == 'number') data.to(option)
129
- else if (typeof option == 'string' || (option = options.slide)) data[option]()
130
- else data.cycle()
131
- })
132
- }
133
-
134
- $.fn.carousel.defaults = {
135
- interval: 5000
136
- }
137
-
138
- $.fn.carousel.Constructor = Carousel
139
-
140
-
141
- /* CAROUSEL DATA-API
142
- * ================= */
143
-
144
- $(function () {
145
- $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
146
- var $this = $(this), href
147
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
148
- , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
149
- $target.carousel(options)
150
- e.preventDefault()
151
- })
152
- })
153
-
154
- }( window.jQuery )
@@ -1,136 +0,0 @@
1
- /* =============================================================
2
- * bootstrap-collapse.js v2.0.0
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
- !function( $ ){
21
-
22
- "use strict"
23
-
24
- var Collapse = function ( element, options ) {
25
- this.$element = $(element)
26
- this.options = $.extend({}, $.fn.collapse.defaults, options)
27
-
28
- if (this.options["parent"]) {
29
- this.$parent = $(this.options["parent"])
30
- }
31
-
32
- this.options.toggle && this.toggle()
33
- }
34
-
35
- Collapse.prototype = {
36
-
37
- constructor: Collapse
38
-
39
- , dimension: function () {
40
- var hasWidth = this.$element.hasClass('width')
41
- return hasWidth ? 'width' : 'height'
42
- }
43
-
44
- , show: function () {
45
- var dimension = this.dimension()
46
- , scroll = $.camelCase(['scroll', dimension].join('-'))
47
- , actives = this.$parent && this.$parent.find('.in')
48
- , hasData
49
-
50
- if (actives && actives.length) {
51
- hasData = actives.data('collapse')
52
- actives.collapse('hide')
53
- hasData || actives.data('collapse', null)
54
- }
55
-
56
- this.$element[dimension](0)
57
- this.transition('addClass', 'show', 'shown')
58
- this.$element[dimension](this.$element[0][scroll])
59
-
60
- }
61
-
62
- , hide: function () {
63
- var dimension = this.dimension()
64
- this.reset(this.$element[dimension]())
65
- this.transition('removeClass', 'hide', 'hidden')
66
- this.$element[dimension](0)
67
- }
68
-
69
- , reset: function ( size ) {
70
- var dimension = this.dimension()
71
-
72
- this.$element
73
- .removeClass('collapse')
74
- [dimension](size || 'auto')
75
- [0].offsetWidth
76
-
77
- this.$element.addClass('collapse')
78
- }
79
-
80
- , transition: function ( method, startEvent, completeEvent ) {
81
- var that = this
82
- , complete = function () {
83
- if (startEvent == 'show') that.reset()
84
- that.$element.trigger(completeEvent)
85
- }
86
-
87
- this.$element
88
- .trigger(startEvent)
89
- [method]('in')
90
-
91
- $.support.transition && this.$element.hasClass('collapse') ?
92
- this.$element.one($.support.transition.end, complete) :
93
- complete()
94
- }
95
-
96
- , toggle: function () {
97
- this[this.$element.hasClass('in') ? 'hide' : 'show']()
98
- }
99
-
100
- }
101
-
102
- /* COLLAPSIBLE PLUGIN DEFINITION
103
- * ============================== */
104
-
105
- $.fn.collapse = function ( option ) {
106
- return this.each(function () {
107
- var $this = $(this)
108
- , data = $this.data('collapse')
109
- , options = typeof option == 'object' && option
110
- if (!data) $this.data('collapse', (data = new Collapse(this, options)))
111
- if (typeof option == 'string') data[option]()
112
- })
113
- }
114
-
115
- $.fn.collapse.defaults = {
116
- toggle: true
117
- }
118
-
119
- $.fn.collapse.Constructor = Collapse
120
-
121
-
122
- /* COLLAPSIBLE DATA-API
123
- * ==================== */
124
-
125
- $(function () {
126
- $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
127
- var $this = $(this), href
128
- , target = $this.attr('data-target')
129
- || e.preventDefault()
130
- || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
131
- , option = $(target).data('collapse') ? 'toggle' : $this.data()
132
- $(target).collapse(option)
133
- })
134
- })
135
-
136
- }( window.jQuery )
@@ -1,92 +0,0 @@
1
- /* ============================================================
2
- * bootstrap-dropdown.js v2.0.0
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"
24
-
25
- /* DROPDOWN CLASS DEFINITION
26
- * ========================= */
27
-
28
- var toggle = '[data-toggle="dropdown"]'
29
- , Dropdown = function ( element ) {
30
- var $el = $(element).on('click.dropdown.data-api', this.toggle)
31
- $('html').on('click.dropdown.data-api', function () {
32
- $el.parent().removeClass('open')
33
- })
34
- }
35
-
36
- Dropdown.prototype = {
37
-
38
- constructor: Dropdown
39
-
40
- , toggle: function ( e ) {
41
- var $this = $(this)
42
- , selector = $this.attr('data-target')
43
- , $parent
44
- , isActive
45
-
46
- if (!selector) {
47
- selector = $this.attr('href')
48
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
49
- }
50
-
51
- $parent = $(selector)
52
- $parent.length || ($parent = $this.parent())
53
-
54
- isActive = $parent.hasClass('open')
55
-
56
- clearMenus()
57
- !isActive && $parent.toggleClass('open')
58
-
59
- return false
60
- }
61
-
62
- }
63
-
64
- function clearMenus() {
65
- $(toggle).parent().removeClass('open')
66
- }
67
-
68
-
69
- /* DROPDOWN PLUGIN DEFINITION
70
- * ========================== */
71
-
72
- $.fn.dropdown = function ( option ) {
73
- return this.each(function () {
74
- var $this = $(this)
75
- , data = $this.data('dropdown')
76
- if (!data) $this.data('dropdown', (data = new Dropdown(this)))
77
- if (typeof option == 'string') data[option].call($this)
78
- })
79
- }
80
-
81
- $.fn.dropdown.Constructor = Dropdown
82
-
83
-
84
- /* APPLY TO STANDARD DROPDOWN ELEMENTS
85
- * =================================== */
86
-
87
- $(function () {
88
- $('html').on('click.dropdown.data-api', clearMenus)
89
- $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
90
- })
91
-
92
- }( window.jQuery )
@@ -1,210 +0,0 @@
1
- /* =========================================================
2
- * bootstrap-modal.js v2.0.0
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"
24
-
25
- /* MODAL CLASS DEFINITION
26
- * ====================== */
27
-
28
- var Modal = function ( content, options ) {
29
- this.options = options
30
- this.$element = $(content)
31
- .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
32
- }
33
-
34
- Modal.prototype = {
35
-
36
- constructor: Modal
37
-
38
- , toggle: function () {
39
- return this[!this.isShown ? 'show' : 'hide']()
40
- }
41
-
42
- , show: function () {
43
- var that = this
44
-
45
- if (this.isShown) return
46
-
47
- $('body').addClass('modal-open')
48
-
49
- this.isShown = true
50
- this.$element.trigger('show')
51
-
52
- escape.call(this)
53
- backdrop.call(this, function () {
54
- var transition = $.support.transition && that.$element.hasClass('fade')
55
-
56
- !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
57
-
58
- that.$element
59
- .show()
60
-
61
- if (transition) {
62
- that.$element[0].offsetWidth // force reflow
63
- }
64
-
65
- that.$element.addClass('in')
66
-
67
- transition ?
68
- that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
69
- that.$element.trigger('shown')
70
-
71
- })
72
- }
73
-
74
- , hide: function ( e ) {
75
- e && e.preventDefault()
76
-
77
- if (!this.isShown) return
78
-
79
- var that = this
80
- this.isShown = false
81
-
82
- $('body').removeClass('modal-open')
83
-
84
- escape.call(this)
85
-
86
- this.$element
87
- .trigger('hide')
88
- .removeClass('in')
89
-
90
- $.support.transition && this.$element.hasClass('fade') ?
91
- hideWithTransition.call(this) :
92
- hideModal.call(this)
93
- }
94
-
95
- }
96
-
97
-
98
- /* MODAL PRIVATE METHODS
99
- * ===================== */
100
-
101
- function hideWithTransition() {
102
- var that = this
103
- , timeout = setTimeout(function () {
104
- that.$element.off($.support.transition.end)
105
- hideModal.call(that)
106
- }, 500)
107
-
108
- this.$element.one($.support.transition.end, function () {
109
- clearTimeout(timeout)
110
- hideModal.call(that)
111
- })
112
- }
113
-
114
- function hideModal( that ) {
115
- this.$element
116
- .hide()
117
- .trigger('hidden')
118
-
119
- backdrop.call(this)
120
- }
121
-
122
- function backdrop( callback ) {
123
- var that = this
124
- , animate = this.$element.hasClass('fade') ? 'fade' : ''
125
-
126
- if (this.isShown && this.options.backdrop) {
127
- var doAnimate = $.support.transition && animate
128
-
129
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
130
- .appendTo(document.body)
131
-
132
- if (this.options.backdrop != 'static') {
133
- this.$backdrop.click($.proxy(this.hide, this))
134
- }
135
-
136
- if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
137
-
138
- this.$backdrop.addClass('in')
139
-
140
- doAnimate ?
141
- this.$backdrop.one($.support.transition.end, callback) :
142
- callback()
143
-
144
- } else if (!this.isShown && this.$backdrop) {
145
- this.$backdrop.removeClass('in')
146
-
147
- $.support.transition && this.$element.hasClass('fade')?
148
- this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
149
- removeBackdrop.call(this)
150
-
151
- } else if (callback) {
152
- callback()
153
- }
154
- }
155
-
156
- function removeBackdrop() {
157
- this.$backdrop.remove()
158
- this.$backdrop = null
159
- }
160
-
161
- function escape() {
162
- var that = this
163
- if (this.isShown && this.options.keyboard) {
164
- $(document).on('keyup.dismiss.modal', function ( e ) {
165
- e.which == 27 && that.hide()
166
- })
167
- } else if (!this.isShown) {
168
- $(document).off('keyup.dismiss.modal')
169
- }
170
- }
171
-
172
-
173
- /* MODAL PLUGIN DEFINITION
174
- * ======================= */
175
-
176
- $.fn.modal = function ( option ) {
177
- return this.each(function () {
178
- var $this = $(this)
179
- , data = $this.data('modal')
180
- , options = $.extend({}, $.fn.modal.defaults, typeof option == 'object' && option)
181
- if (!data) $this.data('modal', (data = new Modal(this, options)))
182
- if (typeof option == 'string') data[option]()
183
- else if (options.show) data.show()
184
- })
185
- }
186
-
187
- $.fn.modal.defaults = {
188
- backdrop: true
189
- , keyboard: true
190
- , show: true
191
- }
192
-
193
- $.fn.modal.Constructor = Modal
194
-
195
-
196
- /* MODAL DATA-API
197
- * ============== */
198
-
199
- $(function () {
200
- $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
201
- var $this = $(this), href
202
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
203
- , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
204
-
205
- e.preventDefault()
206
- $target.modal(option)
207
- })
208
- })
209
-
210
- }( window.jQuery )