Skip to content

Commit bc406b1

Browse files
Merge branch '2.1-wip'
2 parents c75e438 + 433891e commit bc406b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2282
-1145
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.gem
22
.sass-cache
33
bootstrap.css
4-
bootstrap-responsive.css
4+
bootstrap-responsive.css
5+
Gemfile.lock

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2.1.0.0
4+
* Updated to Bootstrap 2.1
5+
* Changed some mixin names to be more consistent. Nested mixins in Less are separated by a `-` when they are flattened in Sass.
6+
37
## 2.0.4.1
48
* Fix `.row-fluid > spanX` nesting
59
* Small Javascript fixes for those staying on the 2.0.4 release

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "https://rubygems.org"
2+
3+
gemspec

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@
66

77
Enjoy.
88

9-
## Updating
10-
Updating your application to a new version of `bootstrap-sass`? See our [changelog](https://github.com/thomas-mcdonald/bootstrap-sass/blob/master/CHANGELOG.md), [Bootstrap's changelog](https://github.com/twitter/bootstrap/wiki/Changelog), and this [guide to updating to Bootstrap 2.0](http://twitter.github.com/bootstrap/upgrading.html)
11-
129
## Usage
1310

1411
### Rails
1512

1613
In your Gemfile:
1714

1815
gem 'sass-rails', '~> 3.1'
19-
gem 'bootstrap-sass', '~> 2.0.4.1'
16+
gem 'bootstrap-sass', '~> 2.1.0.0'
2017

2118
#### CSS
2219

bootstrap-sass.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = "bootstrap-sass"
3-
s.version = '2.0.4.1'
3+
s.version = '2.1.0.0'
44
s.authors = ["Thomas McDonald"]
55
s.email = 'tom@conceptcoding.co.uk'
66
s.summary = "Twitter's Bootstrap, converted to Sass and ready to drop into Rails or Compass"
-1 KB
Loading
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/* ==========================================================
2+
* bootstrap-affix.js v2.1.0
3+
* http://twitter.github.com/bootstrap/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+
* ====================== */
28+
29+
var Affix = function (element, options) {
30+
this.options = $.extend({}, $.fn.affix.defaults, options)
31+
this.$window = $(window).on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
32+
this.$element = $(element)
33+
this.checkPosition()
34+
}
35+
36+
Affix.prototype.checkPosition = function () {
37+
if (!this.$element.is(':visible')) return
38+
39+
var scrollHeight = $(document).height()
40+
, scrollTop = this.$window.scrollTop()
41+
, position = this.$element.offset()
42+
, offset = this.options.offset
43+
, offsetBottom = offset.bottom
44+
, offsetTop = offset.top
45+
, reset = 'affix affix-top affix-bottom'
46+
, affix
47+
48+
if (typeof offset != 'object') offsetBottom = offsetTop = offset
49+
if (typeof offsetTop == 'function') offsetTop = offset.top()
50+
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
51+
52+
affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
53+
false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
54+
'bottom' : offsetTop != null && scrollTop <= offsetTop ?
55+
'top' : false
56+
57+
if (this.affixed === affix) return
58+
59+
this.affixed = affix
60+
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
61+
62+
this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
63+
}
64+
65+
66+
/* AFFIX PLUGIN DEFINITION
67+
* ======================= */
68+
69+
$.fn.affix = function (option) {
70+
return this.each(function () {
71+
var $this = $(this)
72+
, data = $this.data('affix')
73+
, options = typeof option == 'object' && option
74+
if (!data) $this.data('affix', (data = new Affix(this, options)))
75+
if (typeof option == 'string') data[option]()
76+
})
77+
}
78+
79+
$.fn.affix.Constructor = Affix
80+
81+
$.fn.affix.defaults = {
82+
offset: 0
83+
}
84+
85+
86+
/* AFFIX DATA-API
87+
* ============== */
88+
89+
$(window).on('load', function () {
90+
$('[data-spy="affix"]').each(function () {
91+
var $spy = $(this)
92+
, data = $spy.data()
93+
94+
data.offset = data.offset || {}
95+
96+
data.offsetBottom && (data.offset.bottom = data.offsetBottom)
97+
data.offsetTop && (data.offset.top = data.offsetTop)
98+
99+
$spy.affix(data)
100+
})
101+
})
102+
103+
104+
}(window.jQuery);

vendor/assets/javascripts/bootstrap-alert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ==========================================================
2-
* bootstrap-alert.js v2.0.4
2+
* bootstrap-alert.js v2.1.0
33
* http://twitter.github.com/bootstrap/javascript.html#alerts
44
* ==========================================================
55
* Copyright 2012 Twitter, Inc.

vendor/assets/javascripts/bootstrap-button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ============================================================
2-
* bootstrap-button.js v2.0.4
2+
* bootstrap-button.js v2.1.0
33
* http://twitter.github.com/bootstrap/javascript.html#buttons
44
* ============================================================
55
* Copyright 2012 Twitter, Inc.

vendor/assets/javascripts/bootstrap-carousel.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ==========================================================
2-
* bootstrap-carousel.js v2.0.4
2+
* bootstrap-carousel.js v2.1.0
33
* http://twitter.github.com/bootstrap/javascript.html#carousel
44
* ==========================================================
55
* Copyright 2012 Twitter, Inc.
@@ -46,7 +46,7 @@
4646
}
4747

4848
, to: function (pos) {
49-
var $active = this.$element.find('.active')
49+
var $active = this.$element.find('.item.active')
5050
, children = $active.parent().children()
5151
, activePos = children.index($active)
5252
, that = this
@@ -68,6 +68,10 @@
6868

6969
, pause: function (e) {
7070
if (!e) this.paused = true
71+
if (this.$element.find('.next, .prev').length && $.support.transition.end) {
72+
this.$element.trigger($.support.transition.end)
73+
this.cycle()
74+
}
7175
clearInterval(this.interval)
7276
this.interval = null
7377
return this
@@ -84,13 +88,15 @@
8488
}
8589

8690
, slide: function (type, next) {
87-
var $active = this.$element.find('.active')
91+
var $active = this.$element.find('.item.active')
8892
, $next = next || $active[type]()
8993
, isCycling = this.interval
9094
, direction = type == 'next' ? 'left' : 'right'
9195
, fallback = type == 'next' ? 'first' : 'last'
9296
, that = this
93-
, e = $.Event('slide')
97+
, e = $.Event('slide', {
98+
relatedTarget: $next[0]
99+
})
94100

95101
this.sliding = true
96102

@@ -138,9 +144,10 @@
138144
var $this = $(this)
139145
, data = $this.data('carousel')
140146
, options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
147+
, action = typeof option == 'string' ? option : options.slide
141148
if (!data) $this.data('carousel', (data = new Carousel(this, options)))
142149
if (typeof option == 'number') data.to(option)
143-
else if (typeof option == 'string' || (option = options.slide)) data[option]()
150+
else if (action) data[action]()
144151
else if (options.interval) data.cycle()
145152
})
146153
}

vendor/assets/javascripts/bootstrap-collapse.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* =============================================================
2-
* bootstrap-collapse.js v2.0.4
2+
* bootstrap-collapse.js v2.1.0
33
* http://twitter.github.com/bootstrap/javascript.html#collapse
44
* =============================================================
55
* Copyright 2012 Twitter, Inc.
@@ -67,7 +67,7 @@
6767

6868
this.$element[dimension](0)
6969
this.transition('addClass', $.Event('show'), 'shown')
70-
this.$element[dimension](this.$element[0][scroll])
70+
$.support.transition && this.$element[dimension](this.$element[0][scroll])
7171
}
7272

7373
, hide: function () {
@@ -144,12 +144,13 @@
144144
* ==================== */
145145

146146
$(function () {
147-
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
147+
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
148148
var $this = $(this), href
149149
, target = $this.attr('data-target')
150150
|| e.preventDefault()
151151
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
152152
, option = $(target).data('collapse') ? 'toggle' : $this.data()
153+
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
153154
$(target).collapse(option)
154155
})
155156
})

vendor/assets/javascripts/bootstrap-dropdown.js

Lines changed: 66 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ============================================================
2-
* bootstrap-dropdown.js v2.0.4
2+
* bootstrap-dropdown.js v2.1.0
33
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
44
* ============================================================
55
* Copyright 2012 Twitter, Inc.
@@ -26,7 +26,7 @@
2626
/* DROPDOWN CLASS DEFINITION
2727
* ========================= */
2828

29-
var toggle = '[data-toggle="dropdown"]'
29+
var toggle = '[data-toggle=dropdown]'
3030
, Dropdown = function (element) {
3131
var $el = $(element).on('click.dropdown.data-api', this.toggle)
3232
$('html').on('click.dropdown.data-api', function () {
@@ -41,34 +41,82 @@
4141
, toggle: function (e) {
4242
var $this = $(this)
4343
, $parent
44-
, selector
4544
, isActive
4645

4746
if ($this.is('.disabled, :disabled')) return
4847

49-
selector = $this.attr('data-target')
48+
$parent = getParent($this)
5049

51-
if (!selector) {
52-
selector = $this.attr('href')
53-
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
50+
isActive = $parent.hasClass('open')
51+
52+
clearMenus()
53+
54+
if (!isActive) {
55+
$parent.toggleClass('open')
56+
$this.focus()
5457
}
5558

56-
$parent = $(selector)
57-
$parent.length || ($parent = $this.parent())
59+
return false
60+
}
61+
62+
, keydown: function (e) {
63+
var $this
64+
, $items
65+
, $active
66+
, $parent
67+
, isActive
68+
, index
69+
70+
if (!/(38|40|27)/.test(e.keyCode)) return
71+
72+
$this = $(this)
73+
74+
e.preventDefault()
75+
e.stopPropagation()
76+
77+
if ($this.is('.disabled, :disabled')) return
78+
79+
$parent = getParent($this)
5880

5981
isActive = $parent.hasClass('open')
6082

61-
clearMenus()
83+
if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
6284

63-
if (!isActive) $parent.toggleClass('open')
85+
$items = $('[role=menu] li:not(.divider) a', $parent)
6486

65-
return false
87+
if (!$items.length) return
88+
89+
index = $items.index($items.filter(':focus'))
90+
91+
if (e.keyCode == 38 && index > 0) index-- // up
92+
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
93+
if (!~index) index = 0
94+
95+
$items
96+
.eq(index)
97+
.focus()
6698
}
6799

68100
}
69101

70102
function clearMenus() {
71-
$(toggle).parent().removeClass('open')
103+
getParent($(toggle))
104+
.removeClass('open')
105+
}
106+
107+
function getParent($this) {
108+
var selector = $this.attr('data-target')
109+
, $parent
110+
111+
if (!selector) {
112+
selector = $this.attr('href')
113+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
114+
}
115+
116+
$parent = $(selector)
117+
$parent.length || ($parent = $this.parent())
118+
119+
return $parent
72120
}
73121

74122

@@ -91,10 +139,12 @@
91139
* =================================== */
92140

93141
$(function () {
94-
$('html').on('click.dropdown.data-api', clearMenus)
142+
$('html')
143+
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
95144
$('body')
96-
.on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
97-
.on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
145+
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
146+
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
147+
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
98148
})
99149

100150
}(window.jQuery);

0 commit comments

Comments
 (0)