less-rails-bootstrap 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/.gitignore +4 -0
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile +2 -0
  4. data/README.md +99 -0
  5. data/Rakefile +1 -0
  6. data/less-rails-bootstrap.gemspec +18 -0
  7. data/lib/less-rails-bootstrap.rb +8 -0
  8. data/lib/less/rails/bootstrap.rb +2 -0
  9. data/lib/less/rails/bootstrap/engine.rb +14 -0
  10. data/lib/less/rails/bootstrap/version.rb +7 -0
  11. data/vendor/assets/javascripts/twitter/bootstrap.js +7 -0
  12. data/vendor/assets/javascripts/twitter/bootstrap/alerts.js +104 -0
  13. data/vendor/assets/javascripts/twitter/bootstrap/dropdown.js +50 -0
  14. data/vendor/assets/javascripts/twitter/bootstrap/modal.js +238 -0
  15. data/vendor/assets/javascripts/twitter/bootstrap/popover.js +77 -0
  16. data/vendor/assets/javascripts/twitter/bootstrap/scrollspy.js +105 -0
  17. data/vendor/assets/javascripts/twitter/bootstrap/tabs.js +62 -0
  18. data/vendor/assets/javascripts/twitter/bootstrap/twipsy.js +307 -0
  19. data/vendor/assets/stylesheets/twitter/bootstrap.css.less +1 -0
  20. data/vendor/assets/stylesheets/twitter/bootstrap.less +1 -0
  21. data/vendor/assets/stylesheets/twitter/bootstrap/bootstrap.less +26 -0
  22. data/vendor/assets/stylesheets/twitter/bootstrap/forms.less +465 -0
  23. data/vendor/assets/stylesheets/twitter/bootstrap/mixins.less +217 -0
  24. data/vendor/assets/stylesheets/twitter/bootstrap/patterns.less +1005 -0
  25. data/vendor/assets/stylesheets/twitter/bootstrap/reset.less +141 -0
  26. data/vendor/assets/stylesheets/twitter/bootstrap/scaffolding.less +135 -0
  27. data/vendor/assets/stylesheets/twitter/bootstrap/tables.less +170 -0
  28. data/vendor/assets/stylesheets/twitter/bootstrap/type.less +187 -0
  29. data/vendor/assets/stylesheets/twitter/bootstrap/variables.less +60 -0
  30. metadata +111 -0
@@ -0,0 +1,77 @@
1
+ /* ===========================================================
2
+ * bootstrap-popover.js v1.3.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#popover
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
+
21
+ !function( $ ) {
22
+
23
+ var Popover = function ( element, options ) {
24
+ this.$element = $(element)
25
+ this.options = options
26
+ this.enabled = true
27
+ this.fixTitle()
28
+ }
29
+
30
+ /* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
31
+ ========================================= */
32
+
33
+ Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {
34
+
35
+ setContent: function () {
36
+ var $tip = this.tip()
37
+ $tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
38
+ $tip.find('.content p')[this.options.html ? 'html' : 'text'](this.getContent())
39
+ $tip[0].className = 'popover'
40
+ }
41
+
42
+ , getContent: function () {
43
+ var content
44
+ , $e = this.$element
45
+ , o = this.options
46
+
47
+ if (typeof this.options.content == 'string') {
48
+ content = $e.attr(o.content)
49
+ } else if (typeof this.options.content == 'function') {
50
+ content = this.options.content.call(this.$element[0])
51
+ }
52
+ return content
53
+ }
54
+
55
+ , tip: function() {
56
+ if (!this.$tip) {
57
+ 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>')
59
+ }
60
+ return this.$tip
61
+ }
62
+
63
+ })
64
+
65
+
66
+ /* POPOVER PLUGIN DEFINITION
67
+ * ======================= */
68
+
69
+ $.fn.popover = function (options) {
70
+ if (typeof options == 'object') options = $.extend({}, $.fn.popover.defaults, options)
71
+ $.fn.twipsy.initWith.call(this, options, Popover, 'popover')
72
+ return this
73
+ }
74
+
75
+ $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'})
76
+
77
+ }( window.jQuery || window.ender );
@@ -0,0 +1,105 @@
1
+ /* =============================================================
2
+ * bootstrap-scrollspy.js v1.3.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#scrollspy
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
+
21
+ !function ( $ ) {
22
+
23
+ var $window = $(window)
24
+
25
+ function ScrollSpy( topbar, selector ) {
26
+ var processScroll = $.proxy(this.processScroll, this)
27
+ this.$topbar = $(topbar)
28
+ this.selector = selector || 'li > a'
29
+ this.refresh()
30
+ this.$topbar.delegate(this.selector, 'click', processScroll)
31
+ $window.scroll(processScroll)
32
+ this.processScroll()
33
+ }
34
+
35
+ ScrollSpy.prototype = {
36
+
37
+ refresh: function () {
38
+ this.targets = this.$topbar.find(this.selector).map(function () {
39
+ var href = $(this).attr('href')
40
+ return /^#\w/.test(href) && $(href).length ? href : null
41
+ })
42
+
43
+ this.offsets = $.map(this.targets, function (id) {
44
+ return $(id).offset().top
45
+ })
46
+ }
47
+
48
+ , processScroll: function () {
49
+ var scrollTop = $window.scrollTop() + 10
50
+ , offsets = this.offsets
51
+ , targets = this.targets
52
+ , activeTarget = this.activeTarget
53
+ , i
54
+
55
+ for (i = offsets.length; i--;) {
56
+ activeTarget != targets[i]
57
+ && scrollTop >= offsets[i]
58
+ && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
59
+ && this.activateButton( targets[i] )
60
+ }
61
+ }
62
+
63
+ , activateButton: function (target) {
64
+ this.activeTarget = target
65
+
66
+ this.$topbar
67
+ .find(this.selector).parent('.active')
68
+ .removeClass('active')
69
+
70
+ this.$topbar
71
+ .find(this.selector + '[href="' + target + '"]')
72
+ .parent('li')
73
+ .addClass('active')
74
+ }
75
+
76
+ }
77
+
78
+ /* SCROLLSPY PLUGIN DEFINITION
79
+ * =========================== */
80
+
81
+ $.fn.scrollSpy = function( options ) {
82
+ var scrollspy = this.data('scrollspy')
83
+
84
+ if (!scrollspy) {
85
+ return this.each(function () {
86
+ $(this).data('scrollspy', new ScrollSpy( this, options ))
87
+ })
88
+ }
89
+
90
+ if ( options === true ) {
91
+ return scrollspy
92
+ }
93
+
94
+ if ( typeof options == 'string' ) {
95
+ scrollspy[options]()
96
+ }
97
+
98
+ return this
99
+ }
100
+
101
+ $(document).ready(function () {
102
+ $('body').scrollSpy('[data-scrollspy] li > a')
103
+ })
104
+
105
+ }( window.jQuery || window.ender );
@@ -0,0 +1,62 @@
1
+ /* ========================================================
2
+ * bootstrap-tabs.js v1.3.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#tabs
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
+
21
+ !function( $ ){
22
+
23
+ function activate ( element, container ) {
24
+ container.find('.active').removeClass('active')
25
+ element.addClass('active')
26
+ }
27
+
28
+ function tab( e ) {
29
+ var $this = $(this)
30
+ , href = $this.attr('href')
31
+ , $ul = $this.closest('ul')
32
+ , $controlled
33
+
34
+ if (/^#\w+/.test(href)) {
35
+ e.preventDefault()
36
+
37
+ if ($this.hasClass('active')) {
38
+ return
39
+ }
40
+
41
+ $href = $(href)
42
+
43
+ activate($this.parent('li'), $ul)
44
+ activate($href, $href.parent())
45
+ }
46
+ }
47
+
48
+
49
+ /* TABS/PILLS PLUGIN DEFINITION
50
+ * ============================ */
51
+
52
+ $.fn.tabs = $.fn.pills = function ( selector ) {
53
+ return this.each(function () {
54
+ $(this).delegate(selector || '.tabs li > a, .pills > li > a', 'click', tab)
55
+ })
56
+ }
57
+
58
+ $(document).ready(function () {
59
+ $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a')
60
+ })
61
+
62
+ }( window.jQuery || window.ender );
@@ -0,0 +1,307 @@
1
+ /* ==========================================================
2
+ * bootstrap-twipsy.js v1.3.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#twipsy
4
+ * Adapted from the original jQuery.tipsy by Jason Frame
5
+ * ==========================================================
6
+ * Copyright 2011 Twitter, Inc.
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ * ========================================================== */
20
+
21
+
22
+ !function( $ ) {
23
+
24
+ /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
25
+ * ======================================================= */
26
+
27
+ var transitionEnd
28
+
29
+ $(document).ready(function () {
30
+
31
+ $.support.transition = (function () {
32
+ var thisBody = document.body || document.documentElement
33
+ , thisStyle = thisBody.style
34
+ , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
35
+ return support
36
+ })()
37
+
38
+ // set CSS transition event type
39
+ if ( $.support.transition ) {
40
+ transitionEnd = "TransitionEnd"
41
+ if ( $.browser.webkit ) {
42
+ transitionEnd = "webkitTransitionEnd"
43
+ } else if ( $.browser.mozilla ) {
44
+ transitionEnd = "transitionend"
45
+ } else if ( $.browser.opera ) {
46
+ transitionEnd = "oTransitionEnd"
47
+ }
48
+ }
49
+
50
+ })
51
+
52
+
53
+ /* TWIPSY PUBLIC CLASS DEFINITION
54
+ * ============================== */
55
+
56
+ var Twipsy = function ( element, options ) {
57
+ this.$element = $(element)
58
+ this.options = options
59
+ this.enabled = true
60
+ this.fixTitle()
61
+ }
62
+
63
+ Twipsy.prototype = {
64
+
65
+ show: function() {
66
+ var pos
67
+ , actualWidth
68
+ , actualHeight
69
+ , placement
70
+ , $tip
71
+ , tp
72
+
73
+ if (this.getTitle() && this.enabled) {
74
+ $tip = this.tip()
75
+ this.setContent()
76
+
77
+ if (this.options.animate) {
78
+ $tip.addClass('fade')
79
+ }
80
+
81
+ $tip
82
+ .remove()
83
+ .css({ top: 0, left: 0, display: 'block' })
84
+ .prependTo(document.body)
85
+
86
+ pos = $.extend({}, this.$element.offset(), {
87
+ width: this.$element[0].offsetWidth
88
+ , height: this.$element[0].offsetHeight
89
+ })
90
+
91
+ actualWidth = $tip[0].offsetWidth
92
+ actualHeight = $tip[0].offsetHeight
93
+ placement = _.maybeCall(this.options.placement, this.$element[0])
94
+
95
+ switch (placement) {
96
+ case 'below':
97
+ tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
98
+ break
99
+ case 'above':
100
+ tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
101
+ break
102
+ case 'left':
103
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}
104
+ break
105
+ case 'right':
106
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}
107
+ break
108
+ }
109
+
110
+ $tip
111
+ .css(tp)
112
+ .addClass(placement)
113
+ .addClass('in')
114
+ }
115
+ }
116
+
117
+ , setContent: function () {
118
+ var $tip = this.tip()
119
+ $tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](this.getTitle())
120
+ $tip[0].className = 'twipsy'
121
+ }
122
+
123
+ , hide: function() {
124
+ var that = this
125
+ , $tip = this.tip()
126
+
127
+ $tip.removeClass('in')
128
+
129
+ function removeElement () {
130
+ $tip.remove()
131
+ }
132
+
133
+ $.support.transition && this.$tip.hasClass('fade') ?
134
+ $tip.bind(transitionEnd, removeElement) :
135
+ removeElement()
136
+ }
137
+
138
+ , fixTitle: function() {
139
+ var $e = this.$element
140
+ if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
141
+ $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
142
+ }
143
+ }
144
+
145
+ , getTitle: function() {
146
+ var title
147
+ , $e = this.$element
148
+ , o = this.options
149
+
150
+ this.fixTitle()
151
+
152
+ if (typeof o.title == 'string') {
153
+ title = $e.attr(o.title == 'title' ? 'data-original-title' : o.title)
154
+ } else if (typeof o.title == 'function') {
155
+ title = o.title.call($e[0])
156
+ }
157
+
158
+ title = ('' + title).replace(/(^\s*|\s*$)/, "")
159
+
160
+ return title || o.fallback
161
+ }
162
+
163
+ , tip: function() {
164
+ if (!this.$tip) {
165
+ this.$tip = $('<div class="twipsy" />').html('<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>')
166
+ }
167
+ return this.$tip
168
+ }
169
+
170
+ , validate: function() {
171
+ if (!this.$element[0].parentNode) {
172
+ this.hide()
173
+ this.$element = null
174
+ this.options = null
175
+ }
176
+ }
177
+
178
+ , enable: function() {
179
+ this.enabled = true
180
+ }
181
+
182
+ , disable: function() {
183
+ this.enabled = false
184
+ }
185
+
186
+ , toggleEnabled: function() {
187
+ this.enabled = !this.enabled
188
+ }
189
+
190
+ }
191
+
192
+
193
+ /* TWIPSY PRIVATE METHODS
194
+ * ====================== */
195
+
196
+ var _ = {
197
+
198
+ maybeCall: function ( thing, ctx ) {
199
+ return (typeof thing == 'function') ? (thing.call(ctx)) : thing
200
+ }
201
+
202
+ }
203
+
204
+
205
+ /* TWIPSY PLUGIN DEFINITION
206
+ * ======================== */
207
+
208
+ $.fn.twipsy = function (options) {
209
+ $.fn.twipsy.initWith.call(this, options, Twipsy, 'twipsy')
210
+ return this
211
+ }
212
+
213
+ $.fn.twipsy.initWith = function (options, Constructor, name) {
214
+ var twipsy
215
+ , binder
216
+ , eventIn
217
+ , eventOut
218
+
219
+ if (options === true) {
220
+ return this.data(name)
221
+ } else if (typeof options == 'string') {
222
+ twipsy = this.data(name)
223
+ if (twipsy) {
224
+ twipsy[options]()
225
+ }
226
+ return this
227
+ }
228
+
229
+ options = $.extend({}, $.fn[name].defaults, options)
230
+
231
+ function get(ele) {
232
+ var twipsy = $.data(ele, name)
233
+
234
+ if (!twipsy) {
235
+ twipsy = new Constructor(ele, $.fn.twipsy.elementOptions(ele, options))
236
+ $.data(ele, name, twipsy)
237
+ }
238
+
239
+ return twipsy
240
+ }
241
+
242
+ function enter() {
243
+ var twipsy = get(this)
244
+ twipsy.hoverState = 'in'
245
+
246
+ if (options.delayIn == 0) {
247
+ twipsy.show()
248
+ } else {
249
+ twipsy.fixTitle()
250
+ setTimeout(function() {
251
+ if (twipsy.hoverState == 'in') {
252
+ twipsy.show()
253
+ }
254
+ }, options.delayIn)
255
+ }
256
+ }
257
+
258
+ function leave() {
259
+ var twipsy = get(this)
260
+ twipsy.hoverState = 'out'
261
+ if (options.delayOut == 0) {
262
+ twipsy.hide()
263
+ } else {
264
+ setTimeout(function() {
265
+ if (twipsy.hoverState == 'out') {
266
+ twipsy.hide()
267
+ }
268
+ }, options.delayOut)
269
+ }
270
+ }
271
+
272
+ if (!options.live) {
273
+ this.each(function() {
274
+ get(this)
275
+ })
276
+ }
277
+
278
+ if (options.trigger != 'manual') {
279
+ binder = options.live ? 'live' : 'bind'
280
+ eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus'
281
+ eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'
282
+ this[binder](eventIn, enter)[binder](eventOut, leave)
283
+ }
284
+
285
+ return this
286
+ }
287
+
288
+ $.fn.twipsy.Twipsy = Twipsy
289
+
290
+ $.fn.twipsy.defaults = {
291
+ animate: true
292
+ , delayIn: 0
293
+ , delayOut: 0
294
+ , fallback: ''
295
+ , placement: 'above'
296
+ , html: false
297
+ , live: false
298
+ , offset: 0
299
+ , title: 'title'
300
+ , trigger: 'hover'
301
+ }
302
+
303
+ $.fn.twipsy.elementOptions = function(ele, options) {
304
+ return $.metadata ? $.extend({}, options, $(ele).metadata()) : options
305
+ }
306
+
307
+ }( window.jQuery || window.ender );