rails_admin 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails_admin might be problematic. Click here for more details.

Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-affix.js +99 -74
  3. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-alert.js +48 -55
  4. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-button.js +70 -65
  5. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-carousel.js +163 -147
  6. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-collapse.js +117 -114
  7. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-dropdown.js +89 -107
  8. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-modal.js +208 -175
  9. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-popover.js +77 -78
  10. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-scrollspy.js +137 -129
  11. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-tab.js +85 -101
  12. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-tooltip.js +364 -268
  13. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-transition.js +51 -52
  14. data/app/assets/javascripts/rails_admin/bootstrap/bootstrap-typeahead.js +1782 -335
  15. data/app/assets/javascripts/rails_admin/ra.filter-box.js +1 -1
  16. data/app/assets/javascripts/rails_admin/ra.filtering-multiselect.js +3 -3
  17. data/app/assets/javascripts/rails_admin/ra.filtering-select.js +1 -1
  18. data/app/assets/javascripts/rails_admin/ra.remote-form.js +6 -2
  19. data/app/assets/stylesheets/rails_admin/base/theming.scss +34 -14
  20. data/app/assets/stylesheets/rails_admin/bootstrap/_alerts.scss +47 -58
  21. data/app/assets/stylesheets/rails_admin/bootstrap/_badges.scss +57 -0
  22. data/app/assets/stylesheets/rails_admin/bootstrap/_breadcrumbs.scss +12 -10
  23. data/app/assets/stylesheets/rails_admin/bootstrap/_button-groups.scss +163 -152
  24. data/app/assets/stylesheets/rails_admin/bootstrap/_buttons.scss +98 -169
  25. data/app/assets/stylesheets/rails_admin/bootstrap/_carousel.scss +151 -66
  26. data/app/assets/stylesheets/rails_admin/bootstrap/_close.scss +11 -8
  27. data/app/assets/stylesheets/rails_admin/bootstrap/_code.scss +36 -29
  28. data/app/assets/stylesheets/rails_admin/bootstrap/_component-animations.scss +16 -3
  29. data/app/assets/stylesheets/rails_admin/bootstrap/_dropdowns.scss +115 -148
  30. data/app/assets/stylesheets/rails_admin/bootstrap/_forms.scss +396 -547
  31. data/app/assets/stylesheets/rails_admin/bootstrap/_glyphicons.scss +237 -0
  32. data/app/assets/stylesheets/rails_admin/bootstrap/_grid.scss +74 -11
  33. data/app/assets/stylesheets/rails_admin/bootstrap/_input-groups.scss +166 -0
  34. data/app/assets/stylesheets/rails_admin/bootstrap/_jumbotron.scss +48 -0
  35. data/app/assets/stylesheets/rails_admin/bootstrap/_labels.scss +66 -0
  36. data/app/assets/stylesheets/rails_admin/bootstrap/_list-group.scss +131 -0
  37. data/app/assets/stylesheets/rails_admin/bootstrap/_media.scss +8 -7
  38. data/app/assets/stylesheets/rails_admin/bootstrap/_mixins.scss +36 -693
  39. data/app/assets/stylesheets/rails_admin/bootstrap/_modals.scss +108 -53
  40. data/app/assets/stylesheets/rails_admin/bootstrap/_navbar.scss +545 -383
  41. data/app/assets/stylesheets/rails_admin/bootstrap/_navs.scss +191 -358
  42. data/app/assets/stylesheets/rails_admin/bootstrap/_normalize.scss +425 -0
  43. data/app/assets/stylesheets/rails_admin/bootstrap/_pager.scss +45 -33
  44. data/app/assets/stylesheets/rails_admin/bootstrap/_pagination.scss +70 -105
  45. data/app/assets/stylesheets/rails_admin/bootstrap/_panels.scss +243 -0
  46. data/app/assets/stylesheets/rails_admin/bootstrap/_popovers.scss +61 -61
  47. data/app/assets/stylesheets/rails_admin/bootstrap/_print.scss +101 -0
  48. data/app/assets/stylesheets/rails_admin/bootstrap/_progress-bars.scss +56 -73
  49. data/app/assets/stylesheets/rails_admin/bootstrap/_responsive-embed.scss +34 -0
  50. data/app/assets/stylesheets/rails_admin/bootstrap/_responsive-utilities.scss +150 -50
  51. data/app/assets/stylesheets/rails_admin/bootstrap/_scaffolding.scss +120 -23
  52. data/app/assets/stylesheets/rails_admin/bootstrap/_tables.scss +168 -170
  53. data/app/assets/stylesheets/rails_admin/bootstrap/_theme.scss +258 -0
  54. data/app/assets/stylesheets/rails_admin/bootstrap/_thumbnails.scss +27 -42
  55. data/app/assets/stylesheets/rails_admin/bootstrap/_tooltip.scss +49 -24
  56. data/app/assets/stylesheets/rails_admin/bootstrap/_type.scss +200 -143
  57. data/app/assets/stylesheets/rails_admin/bootstrap/_utilities.scss +33 -21
  58. data/app/assets/stylesheets/rails_admin/bootstrap/_variables.scss +764 -215
  59. data/app/assets/stylesheets/rails_admin/bootstrap/_wells.scss +7 -7
  60. data/app/assets/stylesheets/rails_admin/bootstrap/bootstrap.scss +47 -60
  61. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_alerts.scss +14 -0
  62. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_background-variant.scss +11 -0
  63. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_border-radius.scss +18 -0
  64. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_buttons.scss +50 -0
  65. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_center-block.scss +7 -0
  66. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_clearfix.scss +22 -0
  67. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_forms.scss +84 -0
  68. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_gradients.scss +58 -0
  69. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_grid-framework.scss +81 -0
  70. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_grid.scss +122 -0
  71. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_hide-text.scss +21 -0
  72. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_image.scss +34 -0
  73. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_labels.scss +12 -0
  74. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_list-group.scss +31 -0
  75. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_nav-divider.scss +10 -0
  76. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_nav-vertical-align.scss +9 -0
  77. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_opacity.scss +8 -0
  78. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_pagination.scss +23 -0
  79. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_panels.scss +24 -0
  80. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_progress-bar.scss +10 -0
  81. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_reset-filter.scss +8 -0
  82. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_resize.scss +6 -0
  83. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_responsive-visibility.scss +21 -0
  84. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_size.scss +10 -0
  85. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_tab-focus.scss +9 -0
  86. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_table-row.scss +28 -0
  87. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_text-emphasis.scss +11 -0
  88. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_text-overflow.scss +8 -0
  89. data/app/assets/stylesheets/rails_admin/bootstrap/mixins/_vendor-prefixes.scss +219 -0
  90. data/app/assets/stylesheets/rails_admin/ra.calendar-additions.scss +17 -0
  91. data/app/assets/stylesheets/rails_admin/rails_admin.scss.erb +9 -5
  92. data/app/helpers/rails_admin/application_helper.rb +20 -19
  93. data/app/helpers/rails_admin/form_builder.rb +14 -11
  94. data/app/views/kaminari/twitter-bootstrap/_paginator.html.haml +8 -9
  95. data/app/views/layouts/rails_admin/_navigation.html.haml +5 -5
  96. data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +1 -1
  97. data/app/views/layouts/rails_admin/application.html.haml +9 -8
  98. data/app/views/layouts/rails_admin/pjax.html.haml +4 -3
  99. data/app/views/rails_admin/main/_form_datetime.html.haml +2 -1
  100. data/app/views/rails_admin/main/_form_field.html.haml +1 -1
  101. data/app/views/rails_admin/main/_form_text.html.haml +1 -1
  102. data/app/views/rails_admin/main/_submit_buttons.html.haml +1 -0
  103. data/app/views/rails_admin/main/dashboard.html.haml +1 -1
  104. data/app/views/rails_admin/main/export.html.haml +19 -16
  105. data/app/views/rails_admin/main/index.html.haml +11 -7
  106. data/app/views/rails_admin/main/show.html.haml +1 -1
  107. data/lib/rails_admin/adapters/active_record.rb +2 -2
  108. data/lib/rails_admin/adapters/mongoid/property.rb +1 -1
  109. data/lib/rails_admin/config/actions/bulk_delete.rb +0 -1
  110. data/lib/rails_admin/config/actions/edit.rb +0 -2
  111. data/lib/rails_admin/config/actions/export.rb +0 -2
  112. data/lib/rails_admin/config/actions/index.rb +0 -3
  113. data/lib/rails_admin/config/actions/new.rb +0 -2
  114. data/lib/rails_admin/config/configurable.rb +1 -1
  115. data/lib/rails_admin/config/fields/base.rb +9 -0
  116. data/lib/rails_admin/config/fields/factories/enum.rb +2 -3
  117. data/lib/rails_admin/config/fields/types/polymorphic_association.rb +4 -0
  118. data/lib/rails_admin/config/model.rb +2 -1
  119. data/lib/rails_admin/extensions/paper_trail/auditing_adapter.rb +2 -2
  120. data/lib/rails_admin/support/csv_converter.rb +22 -42
  121. data/lib/rails_admin/version.rb +1 -1
  122. metadata +59 -18
  123. data/app/assets/stylesheets/rails_admin/bootstrap/_accordion.scss +0 -34
  124. data/app/assets/stylesheets/rails_admin/bootstrap/_hero-unit.scss +0 -25
  125. data/app/assets/stylesheets/rails_admin/bootstrap/_labels-badges.scss +0 -83
  126. data/app/assets/stylesheets/rails_admin/bootstrap/_layouts.scss +0 -16
  127. data/app/assets/stylesheets/rails_admin/bootstrap/_reset.scss +0 -216
  128. data/app/assets/stylesheets/rails_admin/bootstrap/_responsive-1200px-min.scss +0 -28
  129. data/app/assets/stylesheets/rails_admin/bootstrap/_responsive-767px-max.scss +0 -193
  130. data/app/assets/stylesheets/rails_admin/bootstrap/_responsive-768px-979px.scss +0 -19
  131. data/app/assets/stylesheets/rails_admin/bootstrap/_responsive-navbar.scss +0 -189
  132. data/app/assets/stylesheets/rails_admin/bootstrap/_sprites.scss +0 -197
  133. data/app/assets/stylesheets/rails_admin/bootstrap/responsive.scss +0 -48
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d7948e3ac9d4ab1bf5166e7bcf339489c380bfb
4
- data.tar.gz: 4e881a338661abe831a5f63865d79e7c09327cd5
3
+ metadata.gz: 22f6b0bf2715b8343ec12147a678f6af4342fd60
4
+ data.tar.gz: 06c11b7753f662ea8aee4d5b0c7a41fc4f61902f
5
5
  SHA512:
6
- metadata.gz: 29fb2a57d29ef44aa2f8315524e7641d28ce6c2ccb58213fe029d6550029fb2b8c59793c7fd809c8cad49bed26b36f6d378efbfade36ca96fb489f068b9f486b
7
- data.tar.gz: 88a1f753871f780448116f2b0a43e7d28ddbcf3f7dd8b3a2b13f5a215fbd9c0ce5380ca41420e64147db80975cc62005cd7ba421e8b06dad2c586f46ea59a061
6
+ metadata.gz: 5088678be8b3b6e30e545fbbfcdc9331a725341d8c002eb2067c181b349ad5a2a34e7d45d6b7257310858f0e6b35888759a354e8c4581546cbe822a9f6a96892
7
+ data.tar.gz: 28e6549d5c45bae55ad63564ca5ff4ed81dc9bc25df53b253cb64d783f10d43da61f69bea76acb004725f9e7abf6695fdbe405404f207a49a0ffda863478e58d
@@ -1,94 +1,120 @@
1
- /* ==========================================================
2
- * bootstrap-affix.js v2.3.2
3
- * http://getbootstrap.com/2.3.2/javascript.html#affix
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
- /* AFFIX CLASS DEFINITION
27
- * ====================== */
1
+ /* ========================================================================
2
+ * Bootstrap: affix.js v3.2.0
3
+ * http://getbootstrap.com/javascript/#affix
4
+ * ========================================================================
5
+ * Copyright 2011-2014 Twitter, Inc.
6
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
+ * ======================================================================== */
8
+
9
+
10
+ +function ($) {
11
+ 'use strict';
12
+
13
+ // AFFIX CLASS DEFINITION
14
+ // ======================
28
15
 
29
16
  var Affix = function (element, options) {
30
- this.options = $.extend({}, $.fn.affix.defaults, options)
31
- this.$window = $(window)
32
- .on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
33
- .on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
34
- this.$element = $(element)
17
+ this.options = $.extend({}, Affix.DEFAULTS, options)
18
+
19
+ this.$target = $(this.options.target)
20
+ .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
21
+ .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
22
+
23
+ this.$element = $(element)
24
+ this.affixed =
25
+ this.unpin =
26
+ this.pinnedOffset = null
27
+
35
28
  this.checkPosition()
36
29
  }
37
30
 
31
+ Affix.VERSION = '3.2.0'
32
+
33
+ Affix.RESET = 'affix affix-top affix-bottom'
34
+
35
+ Affix.DEFAULTS = {
36
+ offset: 0,
37
+ target: window
38
+ }
39
+
40
+ Affix.prototype.getPinnedOffset = function () {
41
+ if (this.pinnedOffset) return this.pinnedOffset
42
+ this.$element.removeClass(Affix.RESET).addClass('affix')
43
+ var scrollTop = this.$target.scrollTop()
44
+ var position = this.$element.offset()
45
+ return (this.pinnedOffset = position.top - scrollTop)
46
+ }
47
+
48
+ Affix.prototype.checkPositionWithEventLoop = function () {
49
+ setTimeout($.proxy(this.checkPosition, this), 1)
50
+ }
51
+
38
52
  Affix.prototype.checkPosition = function () {
39
53
  if (!this.$element.is(':visible')) return
40
54
 
41
55
  var scrollHeight = $(document).height()
42
- , scrollTop = this.$window.scrollTop()
43
- , position = this.$element.offset()
44
- , offset = this.options.offset
45
- , offsetBottom = offset.bottom
46
- , offsetTop = offset.top
47
- , reset = 'affix affix-top affix-bottom'
48
- , affix
49
-
50
- if (typeof offset != 'object') offsetBottom = offsetTop = offset
51
- if (typeof offsetTop == 'function') offsetTop = offset.top()
52
- if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
53
-
54
- affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
55
- false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
56
- 'bottom' : offsetTop != null && scrollTop <= offsetTop ?
57
- 'top' : false
56
+ var scrollTop = this.$target.scrollTop()
57
+ var position = this.$element.offset()
58
+ var offset = this.options.offset
59
+ var offsetTop = offset.top
60
+ var offsetBottom = offset.bottom
61
+
62
+ if (typeof offset != 'object') offsetBottom = offsetTop = offset
63
+ if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
64
+ if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
65
+
66
+ var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
67
+ offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
68
+ offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
58
69
 
59
70
  if (this.affixed === affix) return
71
+ if (this.unpin != null) this.$element.css('top', '')
60
72
 
61
- this.affixed = affix
62
- this.unpin = affix == 'bottom' ? position.top - scrollTop : null
73
+ var affixType = 'affix' + (affix ? '-' + affix : '')
74
+ var e = $.Event(affixType + '.bs.affix')
63
75
 
64
- this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
65
- }
76
+ this.$element.trigger(e)
66
77
 
78
+ if (e.isDefaultPrevented()) return
67
79
 
68
- /* AFFIX PLUGIN DEFINITION
69
- * ======================= */
80
+ this.affixed = affix
81
+ this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
82
+
83
+ this.$element
84
+ .removeClass(Affix.RESET)
85
+ .addClass(affixType)
86
+ .trigger($.Event(affixType.replace('affix', 'affixed')))
87
+
88
+ if (affix == 'bottom') {
89
+ this.$element.offset({
90
+ top: scrollHeight - this.$element.height() - offsetBottom
91
+ })
92
+ }
93
+ }
70
94
 
71
- var old = $.fn.affix
72
95
 
73
- $.fn.affix = function (option) {
96
+ // AFFIX PLUGIN DEFINITION
97
+ // =======================
98
+
99
+ function Plugin(option) {
74
100
  return this.each(function () {
75
- var $this = $(this)
76
- , data = $this.data('affix')
77
- , options = typeof option == 'object' && option
78
- if (!data) $this.data('affix', (data = new Affix(this, options)))
101
+ var $this = $(this)
102
+ var data = $this.data('bs.affix')
103
+ var options = typeof option == 'object' && option
104
+
105
+ if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
79
106
  if (typeof option == 'string') data[option]()
80
107
  })
81
108
  }
82
109
 
83
- $.fn.affix.Constructor = Affix
110
+ var old = $.fn.affix
84
111
 
85
- $.fn.affix.defaults = {
86
- offset: 0
87
- }
112
+ $.fn.affix = Plugin
113
+ $.fn.affix.Constructor = Affix
88
114
 
89
115
 
90
- /* AFFIX NO CONFLICT
91
- * ================= */
116
+ // AFFIX NO CONFLICT
117
+ // =================
92
118
 
93
119
  $.fn.affix.noConflict = function () {
94
120
  $.fn.affix = old
@@ -96,22 +122,21 @@
96
122
  }
97
123
 
98
124
 
99
- /* AFFIX DATA-API
100
- * ============== */
125
+ // AFFIX DATA-API
126
+ // ==============
101
127
 
102
128
  $(window).on('load', function () {
103
129
  $('[data-spy="affix"]').each(function () {
104
130
  var $spy = $(this)
105
- , data = $spy.data()
131
+ var data = $spy.data()
106
132
 
107
133
  data.offset = data.offset || {}
108
134
 
109
- data.offsetBottom && (data.offset.bottom = data.offsetBottom)
110
- data.offsetTop && (data.offset.top = data.offsetTop)
135
+ if (data.offsetBottom) data.offset.bottom = data.offsetBottom
136
+ if (data.offsetTop) data.offset.top = data.offsetTop
111
137
 
112
- $spy.affix(data)
138
+ Plugin.call($spy, data)
113
139
  })
114
140
  })
115
141
 
116
-
117
- }(window.jQuery);
142
+ }(jQuery);
@@ -1,89 +1,82 @@
1
- /* ==========================================================
2
- * bootstrap-alert.js v2.3.2
3
- * http://getbootstrap.com/2.3.2/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
- * ====================== */
1
+ /* ========================================================================
2
+ * Bootstrap: alert.js v3.2.0
3
+ * http://getbootstrap.com/javascript/#alerts
4
+ * ========================================================================
5
+ * Copyright 2011-2014 Twitter, Inc.
6
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
+ * ======================================================================== */
8
+
9
+
10
+ +function ($) {
11
+ 'use strict';
12
+
13
+ // ALERT CLASS DEFINITION
14
+ // ======================
28
15
 
29
16
  var dismiss = '[data-dismiss="alert"]'
30
- , Alert = function (el) {
31
- $(el).on('click', dismiss, this.close)
32
- }
17
+ var Alert = function (el) {
18
+ $(el).on('click', dismiss, this.close)
19
+ }
20
+
21
+ Alert.VERSION = '3.2.0'
33
22
 
34
23
  Alert.prototype.close = function (e) {
35
- var $this = $(this)
36
- , selector = $this.attr('data-target')
37
- , $parent
24
+ var $this = $(this)
25
+ var selector = $this.attr('data-target')
38
26
 
39
27
  if (!selector) {
40
28
  selector = $this.attr('href')
41
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
29
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
42
30
  }
43
31
 
44
- $parent = $(selector)
32
+ var $parent = $(selector)
45
33
 
46
- e && e.preventDefault()
34
+ if (e) e.preventDefault()
47
35
 
48
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
36
+ if (!$parent.length) {
37
+ $parent = $this.hasClass('alert') ? $this : $this.parent()
38
+ }
49
39
 
50
- $parent.trigger(e = $.Event('close'))
40
+ $parent.trigger(e = $.Event('close.bs.alert'))
51
41
 
52
42
  if (e.isDefaultPrevented()) return
53
43
 
54
44
  $parent.removeClass('in')
55
45
 
56
46
  function removeElement() {
57
- $parent
58
- .trigger('closed')
59
- .remove()
47
+ // detach from parent, fire event then clean up data
48
+ $parent.detach().trigger('closed.bs.alert').remove()
60
49
  }
61
50
 
62
51
  $.support.transition && $parent.hasClass('fade') ?
63
- $parent.on($.support.transition.end, removeElement) :
52
+ $parent
53
+ .one('bsTransitionEnd', removeElement)
54
+ .emulateTransitionEnd(150) :
64
55
  removeElement()
65
56
  }
66
57
 
67
58
 
68
- /* ALERT PLUGIN DEFINITION
69
- * ======================= */
70
-
71
- var old = $.fn.alert
59
+ // ALERT PLUGIN DEFINITION
60
+ // =======================
72
61
 
73
- $.fn.alert = function (option) {
62
+ function Plugin(option) {
74
63
  return this.each(function () {
75
64
  var $this = $(this)
76
- , data = $this.data('alert')
77
- if (!data) $this.data('alert', (data = new Alert(this)))
65
+ var data = $this.data('bs.alert')
66
+
67
+ if (!data) $this.data('bs.alert', (data = new Alert(this)))
78
68
  if (typeof option == 'string') data[option].call($this)
79
69
  })
80
70
  }
81
71
 
72
+ var old = $.fn.alert
73
+
74
+ $.fn.alert = Plugin
82
75
  $.fn.alert.Constructor = Alert
83
76
 
84
77
 
85
- /* ALERT NO CONFLICT
86
- * ================= */
78
+ // ALERT NO CONFLICT
79
+ // =================
87
80
 
88
81
  $.fn.alert.noConflict = function () {
89
82
  $.fn.alert = old
@@ -91,9 +84,9 @@
91
84
  }
92
85
 
93
86
 
94
- /* ALERT DATA-API
95
- * ============== */
87
+ // ALERT DATA-API
88
+ // ==============
96
89
 
97
- $(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
90
+ $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
98
91
 
99
- }(window.jQuery);
92
+ }(jQuery);
@@ -1,91 +1,95 @@
1
- /* ============================================================
2
- * bootstrap-button.js v2.3.2
3
- * http://getbootstrap.com/2.3.2/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
- * ============================== */
1
+ /* ========================================================================
2
+ * Bootstrap: button.js v3.2.0
3
+ * http://getbootstrap.com/javascript/#buttons
4
+ * ========================================================================
5
+ * Copyright 2011-2014 Twitter, Inc.
6
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
+ * ======================================================================== */
8
+
9
+
10
+ +function ($) {
11
+ 'use strict';
12
+
13
+ // BUTTON PUBLIC CLASS DEFINITION
14
+ // ==============================
28
15
 
29
16
  var Button = function (element, options) {
30
- this.$element = $(element)
31
- this.options = $.extend({}, $.fn.button.defaults, options)
17
+ this.$element = $(element)
18
+ this.options = $.extend({}, Button.DEFAULTS, options)
19
+ this.isLoading = false
20
+ }
21
+
22
+ Button.VERSION = '3.2.0'
23
+
24
+ Button.DEFAULTS = {
25
+ loadingText: 'loading...'
32
26
  }
33
27
 
34
28
  Button.prototype.setState = function (state) {
35
- var d = 'disabled'
36
- , $el = this.$element
37
- , data = $el.data()
38
- , val = $el.is('input') ? 'val' : 'html'
29
+ var d = 'disabled'
30
+ var $el = this.$element
31
+ var val = $el.is('input') ? 'val' : 'html'
32
+ var data = $el.data()
39
33
 
40
34
  state = state + 'Text'
41
- data.resetText || $el.data('resetText', $el[val]())
42
35
 
43
- $el[val](data[state] || this.options[state])
36
+ if (data.resetText == null) $el.data('resetText', $el[val]())
37
+
38
+ $el[val](data[state] == null ? this.options[state] : data[state])
44
39
 
45
40
  // push to event loop to allow forms to submit
46
- setTimeout(function () {
47
- state == 'loadingText' ?
48
- $el.addClass(d).attr(d, d) :
41
+ setTimeout($.proxy(function () {
42
+ if (state == 'loadingText') {
43
+ this.isLoading = true
44
+ $el.addClass(d).attr(d, d)
45
+ } else if (this.isLoading) {
46
+ this.isLoading = false
49
47
  $el.removeClass(d).removeAttr(d)
50
- }, 0)
48
+ }
49
+ }, this), 0)
51
50
  }
52
51
 
53
52
  Button.prototype.toggle = function () {
54
- var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
55
-
56
- $parent && $parent
57
- .find('.active')
58
- .removeClass('active')
59
-
60
- this.$element.toggleClass('active')
53
+ var changed = true
54
+ var $parent = this.$element.closest('[data-toggle="buttons"]')
55
+
56
+ if ($parent.length) {
57
+ var $input = this.$element.find('input')
58
+ if ($input.prop('type') == 'radio') {
59
+ if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
60
+ else $parent.find('.active').removeClass('active')
61
+ }
62
+ if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
63
+ }
64
+
65
+ if (changed) this.$element.toggleClass('active')
61
66
  }
62
67
 
63
68
 
64
- /* BUTTON PLUGIN DEFINITION
65
- * ======================== */
66
-
67
- var old = $.fn.button
69
+ // BUTTON PLUGIN DEFINITION
70
+ // ========================
68
71
 
69
- $.fn.button = function (option) {
72
+ function Plugin(option) {
70
73
  return this.each(function () {
71
- var $this = $(this)
72
- , data = $this.data('button')
73
- , options = typeof option == 'object' && option
74
- if (!data) $this.data('button', (data = new Button(this, options)))
74
+ var $this = $(this)
75
+ var data = $this.data('bs.button')
76
+ var options = typeof option == 'object' && option
77
+
78
+ if (!data) $this.data('bs.button', (data = new Button(this, options)))
79
+
75
80
  if (option == 'toggle') data.toggle()
76
81
  else if (option) data.setState(option)
77
82
  })
78
83
  }
79
84
 
80
- $.fn.button.defaults = {
81
- loadingText: 'loading...'
82
- }
85
+ var old = $.fn.button
83
86
 
87
+ $.fn.button = Plugin
84
88
  $.fn.button.Constructor = Button
85
89
 
86
90
 
87
- /* BUTTON NO CONFLICT
88
- * ================== */
91
+ // BUTTON NO CONFLICT
92
+ // ==================
89
93
 
90
94
  $.fn.button.noConflict = function () {
91
95
  $.fn.button = old
@@ -93,13 +97,14 @@
93
97
  }
94
98
 
95
99
 
96
- /* BUTTON DATA-API
97
- * =============== */
100
+ // BUTTON DATA-API
101
+ // ===============
98
102
 
99
- $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) {
103
+ $(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
100
104
  var $btn = $(e.target)
101
105
  if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
102
- $btn.button('toggle')
106
+ Plugin.call($btn, 'toggle')
107
+ e.preventDefault()
103
108
  })
104
109
 
105
- }(window.jQuery);
110
+ }(jQuery);