less-rails-bootstrap 1.3.3 → 1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 1.4.0 - 11/05/2011
5
+ ------------------
6
+
7
+ * Bootstrap update (f92759b36db43e782e4235f1f214ac5851383f9b)
8
+
9
+
4
10
  1.3.3 - 10/09/2011
5
11
  ------------------
6
12
 
@@ -1,7 +1,7 @@
1
1
  module Less
2
2
  module Rails
3
3
  module Bootstrap
4
- VERSION = "1.3.3"
4
+ VERSION = "1.4"
5
5
  end
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================
2
- * bootstrap-alerts.js v1.3.0
2
+ * bootstrap-alerts.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#alerts
4
4
  * ==========================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
20
20
 
21
21
  !function( $ ){
22
22
 
23
+ "use strict"
24
+
23
25
  /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
24
26
  * ======================================================= */
25
27
 
@@ -38,11 +40,11 @@
38
40
  if ( $.support.transition ) {
39
41
  transitionEnd = "TransitionEnd"
40
42
  if ( $.browser.webkit ) {
41
- transitionEnd = "webkitTransitionEnd"
43
+ transitionEnd = "webkitTransitionEnd"
42
44
  } else if ( $.browser.mozilla ) {
43
- transitionEnd = "transitionend"
45
+ transitionEnd = "transitionend"
44
46
  } else if ( $.browser.opera ) {
45
- transitionEnd = "oTransitionEnd"
47
+ transitionEnd = "oTransitionEnd"
46
48
  }
47
49
  }
48
50
 
@@ -51,9 +53,10 @@
51
53
  /* ALERT CLASS DEFINITION
52
54
  * ====================== */
53
55
 
54
- var Alert = function ( content, selector ) {
56
+ var Alert = function ( content, options ) {
57
+ this.settings = $.extend({}, $.fn.alert.defaults, options)
55
58
  this.$element = $(content)
56
- .delegate(selector || '.close', 'click', this.close)
59
+ .delegate(this.settings.selector, 'click', this.close)
57
60
  }
58
61
 
59
62
  Alert.prototype = {
@@ -92,13 +95,19 @@
92
95
  return $this.data('alert')[options]()
93
96
  }
94
97
 
95
- $(this).data('alert', new Alert( this ))
98
+ $(this).data('alert', new Alert( this, options ))
96
99
 
97
100
  })
98
101
  }
99
102
 
103
+ $.fn.alert.defaults = {
104
+ selector: '.close'
105
+ }
106
+
100
107
  $(document).ready(function () {
101
- new Alert($('body'), '.alert-message[data-alert] .close')
108
+ new Alert($('body'), {
109
+ selector: '.alert-message[data-alert] .close'
110
+ })
102
111
  })
103
112
 
104
113
  }( window.jQuery || window.ender );
@@ -0,0 +1,62 @@
1
+ /* ============================================================
2
+ * bootstrap-buttons.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#buttons
4
+ * ============================================================
5
+ * Copyright 2011 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
+ function setState(el, state) {
25
+ var d = 'disabled'
26
+ , $el = $(el)
27
+ , data = $el.data()
28
+
29
+ state = state + 'Text'
30
+ data.resetText || $el.data('resetText', $el.html())
31
+
32
+ $el.html( data[state] || $.fn.button.defaults[state] )
33
+
34
+ state == 'loadingText' ?
35
+ $el.addClass(d).attr(d, d) :
36
+ $el.removeClass(d).removeAttr(d)
37
+ }
38
+
39
+ function toggle(el) {
40
+ $(el).toggleClass('active')
41
+ }
42
+
43
+ $.fn.button = function(options) {
44
+ return this.each(function () {
45
+ if (options == 'toggle') {
46
+ return toggle(this)
47
+ }
48
+ options && setState(this, options)
49
+ })
50
+ }
51
+
52
+ $.fn.button.defaults = {
53
+ loadingText: 'loading...'
54
+ }
55
+
56
+ $(function () {
57
+ $('body').delegate('.btn[data-toggle]', 'click', function () {
58
+ $(this).button('toggle')
59
+ })
60
+ })
61
+
62
+ }( window.jQuery || window.ender );
@@ -1,5 +1,5 @@
1
1
  /* ============================================================
2
- * bootstrap-dropdown.js v1.3.0
2
+ * bootstrap-dropdown.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#dropdown
4
4
  * ============================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -20,16 +20,7 @@
20
20
 
21
21
  !function( $ ){
22
22
 
23
- var d = 'a.menu, .dropdown-toggle'
24
-
25
- function clearMenus() {
26
- $(d).parent('li').removeClass('open')
27
- }
28
-
29
- $(function () {
30
- $('html').bind("click", clearMenus)
31
- $('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' )
32
- })
23
+ "use strict"
33
24
 
34
25
  /* DROPDOWN PLUGIN DEFINITION
35
26
  * ========================== */
@@ -47,4 +38,18 @@
47
38
  })
48
39
  }
49
40
 
50
- }( window.jQuery || window.ender );
41
+ /* APPLY TO STANDARD DROPDOWN ELEMENTS
42
+ * =================================== */
43
+
44
+ var d = 'a.menu, .dropdown-toggle'
45
+
46
+ function clearMenus() {
47
+ $(d).parent('li').removeClass('open')
48
+ }
49
+
50
+ $(function () {
51
+ $('html').bind("click", clearMenus)
52
+ $('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' )
53
+ })
54
+
55
+ }( window.jQuery || window.ender );
@@ -1,5 +1,5 @@
1
1
  /* =========================================================
2
- * bootstrap-modal.js v1.3.0
2
+ * bootstrap-modal.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#modal
4
4
  * =========================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
20
20
 
21
21
  !function( $ ){
22
22
 
23
+ "use strict"
24
+
23
25
  /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
24
26
  * ======================================================= */
25
27
 
@@ -53,16 +55,12 @@
53
55
  * ============================= */
54
56
 
55
57
  var Modal = function ( content, options ) {
56
- this.settings = $.extend({}, $.fn.modal.defaults)
58
+ this.settings = $.extend({}, $.fn.modal.defaults, options)
57
59
  this.$element = $(content)
58
60
  .delegate('.close', 'click.modal', $.proxy(this.hide, this))
59
61
 
60
- if ( options ) {
61
- $.extend( this.settings, options )
62
-
63
- if ( options.show ) {
64
- this.show()
65
- }
62
+ if ( this.settings.show ) {
63
+ this.show()
66
64
  }
67
65
 
68
66
  return this
@@ -81,17 +79,22 @@
81
79
 
82
80
  escape.call(this)
83
81
  backdrop.call(this, function () {
82
+ var transition = $.support.transition && that.$element.hasClass('fade')
83
+
84
84
  that.$element
85
85
  .appendTo(document.body)
86
86
  .show()
87
87
 
88
- if ($.support.transition && that.$element.hasClass('fade')) {
88
+ if (transition) {
89
89
  that.$element[0].offsetWidth // force reflow
90
90
  }
91
91
 
92
- that.$element
93
- .addClass('in')
94
- .trigger('shown')
92
+ that.$element.addClass('in')
93
+
94
+ transition ?
95
+ that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
96
+ that.$element.trigger('shown')
97
+
95
98
  })
96
99
 
97
100
  return this
@@ -100,6 +103,10 @@
100
103
  , hide: function (e) {
101
104
  e && e.preventDefault()
102
105
 
106
+ if ( !this.isShown ) {
107
+ return this
108
+ }
109
+
103
110
  var that = this
104
111
  this.isShown = false
105
112
 
@@ -109,17 +116,9 @@
109
116
  .trigger('hide')
110
117
  .removeClass('in')
111
118
 
112
- function removeElement () {
113
- that.$element
114
- .hide()
115
- .trigger('hidden')
116
-
117
- backdrop.call(that)
118
- }
119
-
120
119
  $.support.transition && this.$element.hasClass('fade') ?
121
- this.$element.one(transitionEnd, removeElement) :
122
- removeElement()
120
+ hideWithTransition.call(this) :
121
+ hideModal.call(this)
123
122
 
124
123
  return this
125
124
  }
@@ -130,6 +129,28 @@
130
129
  /* MODAL PRIVATE METHODS
131
130
  * ===================== */
132
131
 
132
+ function hideWithTransition() {
133
+ // firefox drops transitionEnd events :{o
134
+ var that = this
135
+ , timeout = setTimeout(function () {
136
+ that.$element.unbind(transitionEnd)
137
+ hideModal.call(that)
138
+ }, 500)
139
+
140
+ this.$element.one(transitionEnd, function () {
141
+ clearTimeout(timeout)
142
+ hideModal.call(that)
143
+ })
144
+ }
145
+
146
+ function hideModal (that) {
147
+ this.$element
148
+ .hide()
149
+ .trigger('hidden')
150
+
151
+ backdrop.call(this)
152
+ }
153
+
133
154
  function backdrop ( callback ) {
134
155
  var that = this
135
156
  , animate = this.$element.hasClass('fade') ? 'fade' : ''
@@ -156,19 +177,20 @@
156
177
  } else if ( !this.isShown && this.$backdrop ) {
157
178
  this.$backdrop.removeClass('in')
158
179
 
159
- function removeElement() {
160
- that.$backdrop.remove()
161
- that.$backdrop = null
162
- }
163
-
164
180
  $.support.transition && this.$element.hasClass('fade')?
165
- this.$backdrop.one(transitionEnd, removeElement) :
166
- removeElement()
181
+ this.$backdrop.one(transitionEnd, $.proxy(removeBackdrop, this)) :
182
+ removeBackdrop.call(this)
183
+
167
184
  } else if ( callback ) {
168
185
  callback()
169
186
  }
170
187
  }
171
188
 
189
+ function removeBackdrop() {
190
+ this.$backdrop.remove()
191
+ this.$backdrop = null
192
+ }
193
+
172
194
  function escape() {
173
195
  var that = this
174
196
  if ( this.isShown && this.settings.keyboard ) {
@@ -220,7 +242,7 @@
220
242
  $.fn.modal.defaults = {
221
243
  backdrop: false
222
244
  , keyboard: false
223
- , show: true
245
+ , show: false
224
246
  }
225
247
 
226
248
 
@@ -235,4 +257,4 @@
235
257
  })
236
258
  })
237
259
 
238
- }( window.jQuery || window.ender );
260
+ }( window.jQuery || window.ender );
@@ -1,5 +1,5 @@
1
1
  /* ===========================================================
2
- * bootstrap-popover.js v1.3.0
2
+ * bootstrap-popover.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#popover
4
4
  * ===========================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
20
20
 
21
21
  !function( $ ) {
22
22
 
23
+ "use strict"
24
+
23
25
  var Popover = function ( element, options ) {
24
26
  this.$element = $(element)
25
27
  this.options = options
@@ -39,13 +41,17 @@
39
41
  $tip[0].className = 'popover'
40
42
  }
41
43
 
44
+ , hasContent: function () {
45
+ return this.getTitle() || this.getContent()
46
+ }
47
+
42
48
  , getContent: function () {
43
49
  var content
44
50
  , $e = this.$element
45
51
  , o = this.options
46
52
 
47
53
  if (typeof this.options.content == 'string') {
48
- content = $e.attr(o.content)
54
+ content = this.options.content
49
55
  } else if (typeof this.options.content == 'function') {
50
56
  content = this.options.content.call(this.$element[0])
51
57
  }
@@ -55,7 +61,7 @@
55
61
  , tip: function() {
56
62
  if (!this.$tip) {
57
63
  this.$tip = $('<div class="popover" />')
58
- .html('<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>')
64
+ .html(this.options.template)
59
65
  }
60
66
  return this.$tip
61
67
  }
@@ -72,6 +78,9 @@
72
78
  return this
73
79
  }
74
80
 
75
- $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'})
81
+ $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
82
+ placement: 'right'
83
+ , template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
84
+ })
76
85
 
77
86
  }( window.jQuery || window.ender );
@@ -1,5 +1,5 @@
1
1
  /* =============================================================
2
- * bootstrap-scrollspy.js v1.3.0
2
+ * bootstrap-scrollspy.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#scrollspy
4
4
  * =============================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
20
20
 
21
21
  !function ( $ ) {
22
22
 
23
+ "use strict"
24
+
23
25
  var $window = $(window)
24
26
 
25
27
  function ScrollSpy( topbar, selector ) {
@@ -1,5 +1,5 @@
1
1
  /* ========================================================
2
- * bootstrap-tabs.js v1.3.0
2
+ * bootstrap-tabs.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#tabs
4
4
  * ========================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -20,28 +20,46 @@
20
20
 
21
21
  !function( $ ){
22
22
 
23
+ "use strict"
24
+
23
25
  function activate ( element, container ) {
24
- container.find('.active').removeClass('active')
26
+ container
27
+ .find('> .active')
28
+ .removeClass('active')
29
+ .find('> .dropdown-menu > .active')
30
+ .removeClass('active')
31
+
25
32
  element.addClass('active')
33
+
34
+ if ( element.parent('.dropdown-menu') ) {
35
+ element.closest('li.dropdown').addClass('active')
36
+ }
26
37
  }
27
38
 
28
39
  function tab( e ) {
29
40
  var $this = $(this)
41
+ , $ul = $this.closest('ul:not(.dropdown-menu)')
30
42
  , href = $this.attr('href')
31
- , $ul = $this.closest('ul')
32
- , $controlled
43
+ , previous
44
+ , $href
33
45
 
34
- if (/^#\w+/.test(href)) {
46
+ if ( /^#\w+/.test(href) ) {
35
47
  e.preventDefault()
36
48
 
37
- if ($this.hasClass('active')) {
49
+ if ( $this.parent('li').hasClass('active') ) {
38
50
  return
39
51
  }
40
52
 
53
+ previous = $ul.find('.active a').last()[0]
41
54
  $href = $(href)
42
55
 
43
56
  activate($this.parent('li'), $ul)
44
57
  activate($href, $href.parent())
58
+
59
+ $this.trigger({
60
+ type: 'change'
61
+ , relatedTarget: previous
62
+ })
45
63
  }
46
64
  }
47
65
 
@@ -59,4 +77,4 @@
59
77
  $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a')
60
78
  })
61
79
 
62
- }( window.jQuery || window.ender );
80
+ }( window.jQuery || window.ender );
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================
2
- * bootstrap-twipsy.js v1.3.0
2
+ * bootstrap-twipsy.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#twipsy
4
4
  * Adapted from the original jQuery.tipsy by Jason Frame
5
5
  * ==========================================================
@@ -21,6 +21,8 @@
21
21
 
22
22
  !function( $ ) {
23
23
 
24
+ "use strict"
25
+
24
26
  /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
25
27
  * ======================================================= */
26
28
 
@@ -70,7 +72,7 @@
70
72
  , $tip
71
73
  , tp
72
74
 
73
- if (this.getTitle() && this.enabled) {
75
+ if (this.hasContent() && this.enabled) {
74
76
  $tip = this.tip()
75
77
  this.setContent()
76
78
 
@@ -90,7 +92,8 @@
90
92
 
91
93
  actualWidth = $tip[0].offsetWidth
92
94
  actualHeight = $tip[0].offsetHeight
93
- placement = _.maybeCall(this.options.placement, this.$element[0])
95
+
96
+ placement = maybeCall(this.options.placement, this, [ $tip[0], this.$element[0] ])
94
97
 
95
98
  switch (placement) {
96
99
  case 'below':
@@ -142,6 +145,10 @@
142
145
  }
143
146
  }
144
147
 
148
+ , hasContent: function () {
149
+ return this.getTitle()
150
+ }
151
+
145
152
  , getTitle: function() {
146
153
  var title
147
154
  , $e = this.$element
@@ -162,7 +169,7 @@
162
169
 
163
170
  , tip: function() {
164
171
  if (!this.$tip) {
165
- this.$tip = $('<div class="twipsy" />').html('<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>')
172
+ this.$tip = $('<div class="twipsy" />').html(this.options.template)
166
173
  }
167
174
  return this.$tip
168
175
  }
@@ -193,15 +200,10 @@
193
200
  /* TWIPSY PRIVATE METHODS
194
201
  * ====================== */
195
202
 
196
- var _ = {
197
-
198
- maybeCall: function ( thing, ctx ) {
199
- return (typeof thing == 'function') ? (thing.call(ctx)) : thing
200
- }
201
-
203
+ function maybeCall ( thing, ctx, args ) {
204
+ return typeof thing == 'function' ? thing.apply(ctx, args) : thing
202
205
  }
203
206
 
204
-
205
207
  /* TWIPSY PLUGIN DEFINITION
206
208
  * ======================== */
207
209
 
@@ -298,10 +300,11 @@
298
300
  , offset: 0
299
301
  , title: 'title'
300
302
  , trigger: 'hover'
303
+ , template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
301
304
  }
302
305
 
303
306
  $.fn.twipsy.elementOptions = function(ele, options) {
304
- return $.metadata ? $.extend({}, options, $(ele).metadata()) : options
307
+ return $.extend({}, options, $(ele).data())
305
308
  }
306
309
 
307
310
  }( window.jQuery || window.ender );
@@ -1,4 +1,5 @@
1
1
  //= require twitter/bootstrap/alerts
2
+ //= require twitter/bootstrap/buttons
2
3
  //= require twitter/bootstrap/dropdown
3
4
  //= require twitter/bootstrap/modal
4
5
  //= require twitter/bootstrap/twipsy
@@ -23,4 +23,4 @@
23
23
  @import "type.less";
24
24
  @import "forms.less";
25
25
  @import "tables.less";
26
- @import "patterns.less";
26
+ @import "patterns.less";