sidekiq 2.2.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sidekiq might be problematic. Click here for more details.
- data/Changes.md +9 -0
- data/Gemfile +1 -2
- data/README.md +2 -2
- data/examples/sinkiq.rb +2 -2
- data/lib/sidekiq.rb +2 -0
- data/lib/sidekiq/cli.rb +4 -0
- data/lib/sidekiq/client.rb +13 -3
- data/lib/sidekiq/exception_handler.rb +1 -1
- data/lib/sidekiq/manager.rb +1 -2
- data/lib/sidekiq/middleware/server/logging.rb +1 -1
- data/lib/sidekiq/middleware/server/retry_jobs.rb +3 -3
- data/lib/sidekiq/processor.rb +12 -15
- data/lib/sidekiq/stats.rb +36 -0
- data/lib/sidekiq/testing/inline.rb +6 -6
- data/lib/sidekiq/util.rb +2 -2
- data/lib/sidekiq/version.rb +1 -1
- data/lib/sidekiq/web.rb +21 -8
- data/sidekiq.gemspec +3 -2
- data/test/helper.rb +2 -0
- data/test/test_client.rb +7 -0
- data/test/test_exception_handler.rb +1 -1
- data/test/test_stats.rb +47 -8
- data/test/test_testing.rb +7 -0
- data/test/test_testing_inline.rb +4 -4
- data/web/assets/images/bootstrap/glyphicons-halflings-white.png +0 -0
- data/web/assets/images/bootstrap/glyphicons-halflings.png +0 -0
- data/web/assets/javascripts/application.js +7 -0
- data/web/assets/javascripts/vendor/bootstrap.js +2027 -12
- data/web/assets/stylesheets/layout.css +5 -1
- data/web/assets/stylesheets/vendor/bootstrap-responsive.css +841 -368
- data/web/assets/stylesheets/vendor/bootstrap.css +3565 -1306
- data/web/views/_summary.slim +6 -6
- data/web/views/index.slim +6 -5
- data/web/views/layout.slim +1 -1
- data/web/views/queues.slim +2 -2
- metadata +21 -55
- data/myapp/.gitignore +0 -15
- data/myapp/Capfile +0 -5
- data/myapp/Gemfile +0 -19
- data/myapp/Rakefile +0 -7
- data/myapp/app/controllers/application_controller.rb +0 -3
- data/myapp/app/controllers/work_controller.rb +0 -38
- data/myapp/app/helpers/application_helper.rb +0 -2
- data/myapp/app/mailers/.gitkeep +0 -0
- data/myapp/app/mailers/user_mailer.rb +0 -9
- data/myapp/app/models/.gitkeep +0 -0
- data/myapp/app/models/post.rb +0 -5
- data/myapp/app/views/layouts/application.html.erb +0 -14
- data/myapp/app/views/user_mailer/greetings.html.erb +0 -3
- data/myapp/app/views/work/index.html.erb +0 -1
- data/myapp/app/workers/hard_worker.rb +0 -10
- data/myapp/config.ru +0 -4
- data/myapp/config/application.rb +0 -59
- data/myapp/config/boot.rb +0 -6
- data/myapp/config/database.yml +0 -25
- data/myapp/config/deploy.rb +0 -15
- data/myapp/config/environment.rb +0 -5
- data/myapp/config/environments/development.rb +0 -38
- data/myapp/config/environments/production.rb +0 -67
- data/myapp/config/environments/test.rb +0 -37
- data/myapp/config/initializers/backtrace_silencers.rb +0 -7
- data/myapp/config/initializers/inflections.rb +0 -15
- data/myapp/config/initializers/mime_types.rb +0 -5
- data/myapp/config/initializers/secret_token.rb +0 -7
- data/myapp/config/initializers/session_store.rb +0 -8
- data/myapp/config/initializers/sidekiq.rb +0 -6
- data/myapp/config/initializers/wrap_parameters.rb +0 -14
- data/myapp/config/locales/en.yml +0 -5
- data/myapp/config/routes.rb +0 -10
- data/myapp/db/migrate/20120123214055_create_posts.rb +0 -10
- data/myapp/db/seeds.rb +0 -7
- data/myapp/lib/assets/.gitkeep +0 -0
- data/myapp/lib/tasks/.gitkeep +0 -0
- data/myapp/log/.gitkeep +0 -0
- data/myapp/script/rails +0 -6
- data/web/assets/javascripts/vendor/bootstrap/bootstrap-alert.js +0 -91
- data/web/assets/javascripts/vendor/bootstrap/bootstrap-button.js +0 -98
- data/web/assets/javascripts/vendor/bootstrap/bootstrap-carousel.js +0 -154
- data/web/assets/javascripts/vendor/bootstrap/bootstrap-collapse.js +0 -136
- data/web/assets/javascripts/vendor/bootstrap/bootstrap-dropdown.js +0 -92
- data/web/assets/javascripts/vendor/bootstrap/bootstrap-modal.js +0 -210
- data/web/assets/javascripts/vendor/bootstrap/bootstrap-popover.js +0 -95
- data/web/assets/javascripts/vendor/bootstrap/bootstrap-scrollspy.js +0 -125
- data/web/assets/javascripts/vendor/bootstrap/bootstrap-tab.js +0 -130
- data/web/assets/javascripts/vendor/bootstrap/bootstrap-tooltip.js +0 -270
- data/web/assets/javascripts/vendor/bootstrap/bootstrap-transition.js +0 -51
- data/web/assets/javascripts/vendor/bootstrap/bootstrap-typeahead.js +0 -271
data/myapp/config/environment.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
Myapp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
11
|
-
|
12
|
-
# Show full error reports and disable caching
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
18
|
-
|
19
|
-
# Print deprecation notices to the Rails logger
|
20
|
-
config.active_support.deprecation = :log
|
21
|
-
|
22
|
-
# Only use best-standards-support built into browsers
|
23
|
-
config.action_dispatch.best_standards_support = :builtin
|
24
|
-
|
25
|
-
# Raise exception on mass assignment protection for Active Record models
|
26
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
27
|
-
|
28
|
-
# Log the query plan for queries taking more than this (works
|
29
|
-
# with SQLite, MySQL, and PostgreSQL)
|
30
|
-
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
31
|
-
|
32
|
-
# Do not compress assets
|
33
|
-
config.assets.compress = false
|
34
|
-
|
35
|
-
# Expands the lines which load the assets
|
36
|
-
config.assets.debug = true
|
37
|
-
config.assets.logger = nil
|
38
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
Myapp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# Code is not reloaded between requests
|
5
|
-
config.cache_classes = true
|
6
|
-
|
7
|
-
# Full error reports are disabled and caching is turned on
|
8
|
-
config.consider_all_requests_local = false
|
9
|
-
config.action_controller.perform_caching = true
|
10
|
-
|
11
|
-
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
-
config.serve_static_assets = false
|
13
|
-
|
14
|
-
# Compress JavaScripts and CSS
|
15
|
-
config.assets.compress = true
|
16
|
-
|
17
|
-
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
-
config.assets.compile = false
|
19
|
-
|
20
|
-
# Generate digests for assets URLs
|
21
|
-
config.assets.digest = true
|
22
|
-
|
23
|
-
# Defaults to Rails.root.join("public/assets")
|
24
|
-
# config.assets.manifest = YOUR_PATH
|
25
|
-
|
26
|
-
# Specifies the header that your server uses for sending files
|
27
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
28
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
29
|
-
|
30
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
31
|
-
# config.force_ssl = true
|
32
|
-
|
33
|
-
# See everything in the log (default is :info)
|
34
|
-
# config.log_level = :debug
|
35
|
-
|
36
|
-
# Prepend all log lines with the following tags
|
37
|
-
# config.log_tags = [ :subdomain, :uuid ]
|
38
|
-
|
39
|
-
# Use a different logger for distributed setups
|
40
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
41
|
-
|
42
|
-
# Use a different cache store in production
|
43
|
-
# config.cache_store = :mem_cache_store
|
44
|
-
|
45
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
46
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
47
|
-
|
48
|
-
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
49
|
-
# config.assets.precompile += %w( search.js )
|
50
|
-
|
51
|
-
# Disable delivery errors, bad email addresses will be ignored
|
52
|
-
# config.action_mailer.raise_delivery_errors = false
|
53
|
-
|
54
|
-
# Enable threaded mode
|
55
|
-
# config.threadsafe!
|
56
|
-
|
57
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
58
|
-
# the I18n.default_locale when a translation can not be found)
|
59
|
-
config.i18n.fallbacks = true
|
60
|
-
|
61
|
-
# Send deprecation notices to registered listeners
|
62
|
-
config.active_support.deprecation = :notify
|
63
|
-
|
64
|
-
# Log the query plan for queries taking more than this (works
|
65
|
-
# with SQLite, MySQL, and PostgreSQL)
|
66
|
-
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
67
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
Myapp::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = true
|
9
|
-
|
10
|
-
# Configure static asset server for tests with Cache-Control for performance
|
11
|
-
config.serve_static_assets = true
|
12
|
-
config.static_cache_control = "public, max-age=3600"
|
13
|
-
|
14
|
-
# Log error messages when you accidentally call methods on nil
|
15
|
-
config.whiny_nils = true
|
16
|
-
|
17
|
-
# Show full error reports and disable caching
|
18
|
-
config.consider_all_requests_local = true
|
19
|
-
config.action_controller.perform_caching = false
|
20
|
-
|
21
|
-
# Raise exceptions instead of rendering exception templates
|
22
|
-
config.action_dispatch.show_exceptions = false
|
23
|
-
|
24
|
-
# Disable request forgery protection in test environment
|
25
|
-
config.action_controller.allow_forgery_protection = false
|
26
|
-
|
27
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
28
|
-
# The :test delivery method accumulates sent emails in the
|
29
|
-
# ActionMailer::Base.deliveries array.
|
30
|
-
config.action_mailer.delivery_method = :test
|
31
|
-
|
32
|
-
# Raise exception on mass assignment protection for Active Record models
|
33
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
34
|
-
|
35
|
-
# Print deprecation notices to the stderr
|
36
|
-
config.active_support.deprecation = :stderr
|
37
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
-
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
-
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Add new inflection rules using the following format
|
4
|
-
# (all these examples are active by default):
|
5
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
-
# inflect.singular /^(ox)en/i, '\1'
|
8
|
-
# inflect.irregular 'person', 'people'
|
9
|
-
# inflect.uncountable %w( fish sheep )
|
10
|
-
# end
|
11
|
-
#
|
12
|
-
# These inflection rules are supported but not enabled by default:
|
13
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
14
|
-
# inflect.acronym 'RESTful'
|
15
|
-
# end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
# Make sure the secret is at least 30 characters and all random,
|
6
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
Myapp::Application.config.secret_token = 'bdd335500c81ba1f279f9dd8198d1f334445d0193168ed73c1282502180dca27e3e102ec345e99b2acac6a63f7fe29da69c60cc9e76e8da34fb5d4989db24cd8'
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
Myapp::Application.config.session_store :cookie_store, key: '_myapp_session'
|
4
|
-
|
5
|
-
# Use the database for sessions instead of the cookie-based default,
|
6
|
-
# which shouldn't be used to store highly confidential information
|
7
|
-
# (create the session table with "rails generate session_migration")
|
8
|
-
# Myapp::Application.config.session_store :active_record_store
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
#
|
3
|
-
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
-
# is enabled by default.
|
5
|
-
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json]
|
9
|
-
end
|
10
|
-
|
11
|
-
# Disable root element in JSON by default.
|
12
|
-
ActiveSupport.on_load(:active_record) do
|
13
|
-
self.include_root_in_json = false
|
14
|
-
end
|
data/myapp/config/locales/en.yml
DELETED
data/myapp/config/routes.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'sidekiq/web'
|
2
|
-
|
3
|
-
Myapp::Application.routes.draw do
|
4
|
-
mount Sidekiq::Web => '/sidekiq'
|
5
|
-
get "work" => "work#index"
|
6
|
-
get "work/email" => "work#email"
|
7
|
-
get "work/post" => "work#delayed_post"
|
8
|
-
get "work/long" => "work#long"
|
9
|
-
get "work/crash" => "work#crash"
|
10
|
-
end
|
data/myapp/db/seeds.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
-
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
-
#
|
4
|
-
# Examples:
|
5
|
-
#
|
6
|
-
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
-
# Mayor.create(name: 'Emanuel', city: cities.first)
|
data/myapp/lib/assets/.gitkeep
DELETED
File without changes
|
data/myapp/lib/tasks/.gitkeep
DELETED
File without changes
|
data/myapp/log/.gitkeep
DELETED
File without changes
|
data/myapp/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
@@ -1,91 +0,0 @@
|
|
1
|
-
/* ==========================================================
|
2
|
-
* bootstrap-alert.js v2.0.0
|
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"
|
24
|
-
|
25
|
-
/* ALERT CLASS DEFINITION
|
26
|
-
* ====================== */
|
27
|
-
|
28
|
-
var dismiss = '[data-dismiss="alert"]'
|
29
|
-
, Alert = function ( el ) {
|
30
|
-
$(el).on('click', dismiss, this.close)
|
31
|
-
}
|
32
|
-
|
33
|
-
Alert.prototype = {
|
34
|
-
|
35
|
-
constructor: Alert
|
36
|
-
|
37
|
-
, close: function ( e ) {
|
38
|
-
var $this = $(this)
|
39
|
-
, selector = $this.attr('data-target')
|
40
|
-
, $parent
|
41
|
-
|
42
|
-
if (!selector) {
|
43
|
-
selector = $this.attr('href')
|
44
|
-
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
45
|
-
}
|
46
|
-
|
47
|
-
$parent = $(selector)
|
48
|
-
$parent.trigger('close')
|
49
|
-
|
50
|
-
e && e.preventDefault()
|
51
|
-
|
52
|
-
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
|
53
|
-
|
54
|
-
$parent.removeClass('in')
|
55
|
-
|
56
|
-
function removeElement() {
|
57
|
-
$parent.remove()
|
58
|
-
$parent.trigger('closed')
|
59
|
-
}
|
60
|
-
|
61
|
-
$.support.transition && $parent.hasClass('fade') ?
|
62
|
-
$parent.on($.support.transition.end, removeElement) :
|
63
|
-
removeElement()
|
64
|
-
}
|
65
|
-
|
66
|
-
}
|
67
|
-
|
68
|
-
|
69
|
-
/* ALERT PLUGIN DEFINITION
|
70
|
-
* ======================= */
|
71
|
-
|
72
|
-
$.fn.alert = function ( option ) {
|
73
|
-
return this.each(function () {
|
74
|
-
var $this = $(this)
|
75
|
-
, data = $this.data('alert')
|
76
|
-
if (!data) $this.data('alert', (data = new Alert(this)))
|
77
|
-
if (typeof option == 'string') data[option].call($this)
|
78
|
-
})
|
79
|
-
}
|
80
|
-
|
81
|
-
$.fn.alert.Constructor = Alert
|
82
|
-
|
83
|
-
|
84
|
-
/* ALERT DATA-API
|
85
|
-
* ============== */
|
86
|
-
|
87
|
-
$(function () {
|
88
|
-
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
|
89
|
-
})
|
90
|
-
|
91
|
-
}( window.jQuery )
|
@@ -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 )
|