Skip to content

Commit 9a4a99f

Browse files
committed
[feat]correct the file naming
Resolve #3
1 parent 0c44787 commit 9a4a99f

File tree

4 files changed

+104
-104
lines changed

4 files changed

+104
-104
lines changed

LockBsFormAsset.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class LockBsFormAsset extends AssetBundle
2828
/**
2929
* {@inheritdoc}
3030
*/
31-
public $js = ['assets/lock.js'];
31+
public $js = ['assets/lock.bootstrap.js'];
3232

3333
/**
3434
* {@inheritdoc}

LockFormAsset.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class LockFormAsset extends AssetBundle
2626
/**
2727
* {@inheritdoc}
2828
*/
29-
public $js = ['assets/lock.bootstrap.js'];
29+
public $js = ['assets/lock.js'];
3030

3131
/**
3232
* {@inheritdoc}

assets/lock.bootstrap.js

+10-92
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,4 @@
1-
/* ========================================================================
2-
* Bootstrap: button.js v3.3.5
3-
* http://getbootstrap.com/javascript/#buttons
4-
* ========================================================================
5-
* Copyright 2011-2015 Twitter, Inc.
6-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7-
* ======================================================================== */
8-
9-
+function ($) {
10-
'use strict';
11-
12-
// BUTTON PUBLIC CLASS DEFINITION
13-
// ==============================
14-
15-
var Button = function (element, options) {
16-
this.$element = $(element)
17-
this.options = $.extend({}, Button.DEFAULTS, options)
18-
this.isLoading = false
19-
}
20-
21-
Button.VERSION = '3.3.5'
22-
23-
Button.DEFAULTS = {
24-
loadingText: 'loading...'
25-
}
26-
27-
Button.prototype.setState = function (state) {
28-
var d = 'disabled'
29-
var $el = this.$element
30-
var val = $el.is('input') ? 'val' : 'html'
31-
var data = $el.data()
32-
33-
state += 'Text'
34-
35-
if (data.resetText == null) $el.data('resetText', $el[val]())
36-
37-
// push to event loop to allow forms to submit
38-
setTimeout($.proxy(function () {
39-
$el[val](data[state] == null ? this.options[state] : data[state])
40-
41-
if (state == 'loadingText') {
42-
this.isLoading = true
43-
$el.addClass(d).attr(d, d)
44-
} else if (this.isLoading) {
45-
this.isLoading = false
46-
$el.removeClass(d).removeAttr(d)
47-
}
48-
}, this), 0)
49-
}
50-
51-
Button.prototype.toggle = $.noop;
52-
53-
// BUTTON PLUGIN DEFINITION
54-
// ========================
55-
56-
function Plugin(option) {
57-
return this.each(function () {
58-
var $this = $(this)
59-
var data = $this.data('bs.button')
60-
var options = typeof option == 'object' && option
61-
62-
if (!data) $this.data('bs.button', (data = new Button(this, options)))
63-
64-
if (option == 'toggle') data.toggle()
65-
else if (option) data.setState(option)
66-
})
67-
}
68-
69-
var old = $.fn.button
70-
71-
$.fn.button = Plugin
72-
$.fn.button.Constructor = Button
73-
74-
75-
// BUTTON NO CONFLICT
76-
// ==================
77-
78-
$.fn.button.noConflict = function () {
79-
$.fn.button = old
80-
return this
81-
}
82-
83-
}(jQuery);
84-
+function (yii) {
1+
(function(yii) {
852
function showLoading() {
863
var $self = $(this),
874
data = $self.data('yiiActiveForm'),
@@ -91,20 +8,21 @@
918
}
929
$submit.button('loading');
9310
}
11+
9412
function resetLoading() {
95-
var $self = $(this),
96-
$submit = $self.data('yiiActiveForm').submitObject;
97-
if (!$submit) {
98-
$submit = $self.find('[type=submit]');
99-
}
100-
$submit.button('reset');
13+
var $self = $(this),
14+
$submit = $self.data('yiiActiveForm').submitObject;
15+
if (!$submit) {
16+
$submit = $self.find('[type=submit]');
17+
}
18+
$submit.button('reset');
10119
}
10220

10321
yii.lock = {
104-
init: function () {
22+
init: function() {
10523
$('body')
10624
.on('beforeSubmit', 'form', showLoading)
10725
.on('ajaxComplete', 'form', resetLoading);
10826
}
10927
};
110-
}(yii);
28+
})(yii);

assets/lock.js

+92-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,87 @@
1-
(function(yii) {
1+
/* ========================================================================
2+
* Bootstrap: button.js v3.3.5
3+
* http://getbootstrap.com/javascript/#buttons
4+
* ========================================================================
5+
* Copyright 2011-2015 Twitter, Inc.
6+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7+
* ======================================================================== */
8+
9+
+function ($) {
10+
'use strict';
11+
12+
// BUTTON PUBLIC CLASS DEFINITION
13+
// ==============================
14+
15+
var Button = function (element, options) {
16+
this.$element = $(element)
17+
this.options = $.extend({}, Button.DEFAULTS, options)
18+
this.isLoading = false
19+
}
20+
21+
Button.VERSION = '3.3.5'
22+
23+
Button.DEFAULTS = {
24+
loadingText: 'loading...'
25+
}
26+
27+
Button.prototype.setState = function (state) {
28+
var d = 'disabled'
29+
var $el = this.$element
30+
var val = $el.is('input') ? 'val' : 'html'
31+
var data = $el.data()
32+
33+
state += 'Text'
34+
35+
if (data.resetText == null) $el.data('resetText', $el[val]())
36+
37+
// push to event loop to allow forms to submit
38+
setTimeout($.proxy(function () {
39+
$el[val](data[state] == null ? this.options[state] : data[state])
40+
41+
if (state == 'loadingText') {
42+
this.isLoading = true
43+
$el.addClass(d).attr(d, d)
44+
} else if (this.isLoading) {
45+
this.isLoading = false
46+
$el.removeClass(d).removeAttr(d)
47+
}
48+
}, this), 0)
49+
}
50+
51+
Button.prototype.toggle = $.noop;
52+
53+
// BUTTON PLUGIN DEFINITION
54+
// ========================
55+
56+
function Plugin(option) {
57+
return this.each(function () {
58+
var $this = $(this)
59+
var data = $this.data('bs.button')
60+
var options = typeof option == 'object' && option
61+
62+
if (!data) $this.data('bs.button', (data = new Button(this, options)))
63+
64+
if (option == 'toggle') data.toggle()
65+
else if (option) data.setState(option)
66+
})
67+
}
68+
69+
var old = $.fn.button
70+
71+
$.fn.button = Plugin
72+
$.fn.button.Constructor = Button
73+
74+
75+
// BUTTON NO CONFLICT
76+
// ==================
77+
78+
$.fn.button.noConflict = function () {
79+
$.fn.button = old
80+
return this
81+
}
82+
83+
}(jQuery);
84+
+function (yii) {
285
function showLoading() {
386
var $self = $(this),
487
data = $self.data('yiiActiveForm'),
@@ -8,21 +91,20 @@
891
}
992
$submit.button('loading');
1093
}
11-
1294
function resetLoading() {
13-
var $self = $(this),
14-
$submit = $self.data('yiiActiveForm').submitObject;
15-
if (!$submit) {
16-
$submit = $self.find('[type=submit]');
17-
}
18-
$submit.button('reset');
95+
var $self = $(this),
96+
$submit = $self.data('yiiActiveForm').submitObject;
97+
if (!$submit) {
98+
$submit = $self.find('[type=submit]');
99+
}
100+
$submit.button('reset');
19101
}
20102

21103
yii.lock = {
22-
init: function() {
104+
init: function () {
23105
$('body')
24106
.on('beforeSubmit', 'form', showLoading)
25107
.on('ajaxComplete', 'form', resetLoading);
26108
}
27109
};
28-
})(yii);
110+
}(yii);

0 commit comments

Comments
 (0)