jackpot 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -0
- data/.rspec +1 -0
- data/.rvmrc.example +1 -0
- data/.travis.yml +12 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +181 -0
- data/MIT-LICENSE +20 -0
- data/README.md +134 -0
- data/Rakefile +25 -0
- data/app/assets/images/jackpot/.gitkeep +0 -0
- data/app/assets/javascripts/jackpot/application.js +5 -0
- data/app/assets/javascripts/jackpot/bootstrap.js +32 -0
- data/app/assets/javascripts/jackpot/customers.js +2 -0
- data/app/assets/javascripts/jackpot/login.js +1 -0
- data/app/assets/javascripts/jackpot/payments.js +2 -0
- data/app/assets/javascripts/jackpot/subscriptions.js +2 -0
- data/app/assets/stylesheets/jackpot/application.css +9 -0
- data/app/assets/stylesheets/jackpot/customers.css +4 -0
- data/app/assets/stylesheets/jackpot/jackpot.css +10 -0
- data/app/controllers/jackpot/application_controller.rb +4 -0
- data/app/controllers/jackpot/customers_controller.rb +100 -0
- data/app/controllers/jackpot/payments_controller.rb +20 -0
- data/app/controllers/jackpot/subscriptions_controller.rb +86 -0
- data/app/helpers/jackpot/application_helper.rb +27 -0
- data/app/helpers/jackpot/customers_helper.rb +7 -0
- data/app/helpers/jackpot/subscriptions_helper.rb +4 -0
- data/app/models/jackpot/card.rb +29 -0
- data/app/models/jackpot/customer.rb +48 -0
- data/app/models/jackpot/gateway.rb +28 -0
- data/app/models/jackpot/payment.rb +33 -0
- data/app/models/jackpot/subscription.rb +13 -0
- data/app/models/jackpot/user.rb +25 -0
- data/app/views/jackpot/customers/_credit_card_form.html.erb +42 -0
- data/app/views/jackpot/customers/_form.html.erb +17 -0
- data/app/views/jackpot/customers/edit.html.erb +13 -0
- data/app/views/jackpot/customers/index.html.erb +30 -0
- data/app/views/jackpot/customers/new.html.erb +8 -0
- data/app/views/jackpot/customers/show.html.erb +32 -0
- data/app/views/jackpot/payments/create.html.erb +1 -0
- data/app/views/jackpot/payments/index.html.erb +25 -0
- data/app/views/jackpot/shared/_flash_messages.html.erb +6 -0
- data/app/views/jackpot/shared/_navigation.html.erb +5 -0
- data/app/views/jackpot/subscriptions/_form.html.erb +13 -0
- data/app/views/jackpot/subscriptions/edit.html.erb +6 -0
- data/app/views/jackpot/subscriptions/index.html.erb +29 -0
- data/app/views/jackpot/subscriptions/new.html.erb +4 -0
- data/app/views/jackpot/subscriptions/show.html.erb +23 -0
- data/app/views/layouts/devise.html.erb +22 -0
- data/app/views/layouts/jackpot/application.html.erb +39 -0
- data/config/initializers/jackpot_devise.rb +226 -0
- data/config/locales/devise.en.yml +57 -0
- data/config/routes.rb +17 -0
- data/db/migrate/20111221002616_create_jackpot_payments.rb +11 -0
- data/db/migrate/20111230014003_add_customer_information_to_jackpot_payments.rb +5 -0
- data/db/migrate/20120102223341_create_jackpot_subscriptions.rb +10 -0
- data/db/migrate/20120103211153_create_jackpot_customers.rb +11 -0
- data/db/migrate/20120104164830_add_credit_card_number_to_customer.rb +5 -0
- data/db/migrate/20120130173242_add_credit_card_information_to_customers.rb +7 -0
- data/db/migrate/20120208191815_add_billing_period_to_jackpot_subscriptions.rb +5 -0
- data/db/migrate/20120208191934_add_good_until_date_to_jackpot_customers.rb +6 -0
- data/db/migrate/20120209203542_add_subscription_and_customer_to_jackpot_payments.rb +8 -0
- data/db/migrate/20120209212043_rename_column_token_in_jackpot_payments.rb +5 -0
- data/db/migrate/20120210144038_devise_create_jackpot_users.rb +49 -0
- data/jackpot.gemspec +33 -0
- data/lib/jackpot.rb +23 -0
- data/lib/jackpot/configuration.rb +33 -0
- data/lib/jackpot/cron.rb +22 -0
- data/lib/jackpot/engine.rb +14 -0
- data/lib/jackpot/errors.rb +18 -0
- data/lib/jackpot/factory.rb +26 -0
- data/lib/jackpot/version.rb +3 -0
- data/lib/tasks/jackpot_tasks.rake +38 -0
- data/script/rails +6 -0
- data/spec/controllers/jackpot/customers_controller_spec.rb +170 -0
- data/spec/controllers/jackpot/payments_controller_spec.rb +47 -0
- data/spec/controllers/jackpot/subscriptions_controller_spec.rb +153 -0
- data/spec/dummy/.gitignore +1 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +51 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +17 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +32 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +41 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/jackpot.rb +13 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/db/schema.rb +68 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/index.html +5 -0
- data/spec/dummy/public/payment.html +36 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/fixtures/vcr/Create_Customers_To_bill_monthly_my_customers_As_a_user_I_want_to_record_their_billing_information_/assigning_credit_card_information_to_customer.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Customer/_update_credit_card_number/when_card_is_valid/.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Customer/_update_credit_card_number/when_card_is_valid/when_persisting/should_NEVER_persist_in_the_database_the_actual_card_number.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Customer/_update_credit_card_number/when_card_is_valid/when_persisting/should_NEVER_persist_in_the_database_the_verification_value.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Customer/_update_credit_card_number/when_card_is_valid/when_persisting/should_persist_in_the_database_the_ONLY_last_four_digits.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Customer/_update_credit_card_number/when_card_is_valid/when_persisting/should_persist_the_card_information.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Customer/_update_credit_card_number/when_card_is_valid/when_persisting/should_store_this_card_at_the_gateway.yml +34 -0
- data/spec/fixtures/vcr/Jackpot_Payment/_create/with_valid_token_information/creates_a_new_payment.yml +96 -0
- data/spec/fixtures/vcr/Jackpot_Payment/_create/with_valid_token_information/does_not_persist_credit_card_token_information.yml +96 -0
- data/spec/fixtures/vcr/Jackpot_Payment/_create/with_valid_token_information/records_the_payment_transaction_id_for_future_reference.yml +96 -0
- data/spec/fixtures/vcr/Jackpot_Payment/_create/with_valid_token_information/records_this_payment_information.yml +96 -0
- data/spec/fixtures/vcr/Jackpot_Payment/_customer_name/returns_its_customer_email.yml +96 -0
- data/spec/fixtures/vcr/jackpot/customer/updatecard.yml +34 -0
- data/spec/fixtures/vcr/jackpot/customer_expiration_date.yml +34 -0
- data/spec/fixtures/vcr/jackpot/receiving_payments.yml +96 -0
- data/spec/helpers/jackpot/customers_helper_spec.rb +16 -0
- data/spec/helpers/jackpot/subscriptions_helper_spec.rb +4 -0
- data/spec/lib/cron_spec.rb +39 -0
- data/spec/lib/factory_spec.rb +40 -0
- data/spec/models/jackpot/card_spec.rb +23 -0
- data/spec/models/jackpot/customer_spec.rb +140 -0
- data/spec/models/jackpot/gateway_spec.rb +22 -0
- data/spec/models/jackpot/payment_spec.rb +74 -0
- data/spec/models/jackpot/subscription_spec.rb +19 -0
- data/spec/requests/jackpot/jackpot_assign_subscription_to_customer_spec.rb +39 -0
- data/spec/requests/jackpot/jackpot_create_customer_spec.rb +73 -0
- data/spec/requests/jackpot/jackpot_create_subscriptions_spec.rb +27 -0
- data/spec/requests/jackpot/jackpot_receive_payments_spec.rb +34 -0
- data/spec/spec_helper.rb +41 -0
- data/spec/support/active_merchant.rb +1 -0
- data/spec/support/capybara.rb +6 -0
- data/spec/support/devise.rb +21 -0
- data/spec/support/factories/jackpot_customers.rb +36 -0
- data/spec/support/factories/jackpot_payments.rb +7 -0
- data/spec/support/factories/jackpot_subscriptions.rb +9 -0
- data/spec/support/factories/jackpot_users.rb +9 -0
- data/spec/support/helpers.rb +16 -0
- data/spec/support/routes.rb +3 -0
- data/spec/support/vcr.rb +10 -0
- data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/twitter/bootstrap.js +12 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +91 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +98 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +154 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +136 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +92 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +209 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +95 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +125 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +130 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +270 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +51 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +271 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/bootstrap-responsive.css +567 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/bootstrap.css.erb +3366 -0
- metadata +351 -0
@@ -0,0 +1,154 @@
|
|
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 )
|
@@ -0,0 +1,136 @@
|
|
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 )
|
@@ -0,0 +1,92 @@
|
|
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 )
|
@@ -0,0 +1,209 @@
|
|
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 = $.extend({}, $.fn.modal.defaults, 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 = typeof option == 'object' && option
|
181
|
+
if (!data) $this.data('modal', (data = new Modal(this, options)))
|
182
|
+
if (typeof option == 'string') data[option]()
|
183
|
+
else data.show()
|
184
|
+
})
|
185
|
+
}
|
186
|
+
|
187
|
+
$.fn.modal.defaults = {
|
188
|
+
backdrop: true
|
189
|
+
, keyboard: true
|
190
|
+
}
|
191
|
+
|
192
|
+
$.fn.modal.Constructor = Modal
|
193
|
+
|
194
|
+
|
195
|
+
/* MODAL DATA-API
|
196
|
+
* ============== */
|
197
|
+
|
198
|
+
$(function () {
|
199
|
+
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
|
200
|
+
var $this = $(this), href
|
201
|
+
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
202
|
+
, option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
|
203
|
+
|
204
|
+
e.preventDefault()
|
205
|
+
$target.modal(option)
|
206
|
+
})
|
207
|
+
})
|
208
|
+
|
209
|
+
}( window.jQuery )
|