bootstrap-sass 2.0.2 → 2.0.3

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

Potentially problematic release.


This version of bootstrap-sass might be problematic. Click here for more details.

Files changed (44) hide show
  1. data/README.md +26 -10
  2. data/lib/bootstrap-sass.rb +24 -13
  3. data/lib/bootstrap-sass/{compass_extensions.rb → compass_functions.rb} +0 -0
  4. data/lib/bootstrap-sass/engine.rb +0 -2
  5. data/lib/bootstrap-sass/{config/sass_extentions.rb → rails_functions.rb} +0 -0
  6. data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
  7. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  8. data/vendor/assets/javascripts/bootstrap-alert.js +28 -32
  9. data/vendor/assets/javascripts/bootstrap-button.js +29 -33
  10. data/vendor/assets/javascripts/bootstrap-carousel.js +27 -19
  11. data/vendor/assets/javascripts/bootstrap-collapse.js +45 -26
  12. data/vendor/assets/javascripts/bootstrap-dropdown.js +18 -10
  13. data/vendor/assets/javascripts/bootstrap-modal.js +25 -17
  14. data/vendor/assets/javascripts/bootstrap-popover.js +13 -10
  15. data/vendor/assets/javascripts/bootstrap-scrollspy.js +43 -17
  16. data/vendor/assets/javascripts/bootstrap-tab.js +12 -7
  17. data/vendor/assets/javascripts/bootstrap-tooltip.js +40 -35
  18. data/vendor/assets/javascripts/bootstrap-transition.js +30 -20
  19. data/vendor/assets/javascripts/bootstrap-typeahead.js +24 -10
  20. data/vendor/assets/stylesheets/_bootstrap-responsive.scss +100 -68
  21. data/vendor/assets/stylesheets/_bootstrap.scss +11 -2
  22. data/vendor/assets/stylesheets/bootstrap/_accordion.scss +5 -0
  23. data/vendor/assets/stylesheets/bootstrap/_button-groups.scss +51 -31
  24. data/vendor/assets/stylesheets/bootstrap/_buttons.scss +15 -11
  25. data/vendor/assets/stylesheets/bootstrap/_close.scss +12 -1
  26. data/vendor/assets/stylesheets/bootstrap/_code.scss +4 -4
  27. data/vendor/assets/stylesheets/bootstrap/_component-animations.scss +4 -4
  28. data/vendor/assets/stylesheets/bootstrap/_dropdowns.scss +16 -22
  29. data/vendor/assets/stylesheets/bootstrap/_forms.scss +58 -37
  30. data/vendor/assets/stylesheets/bootstrap/_labels-badges.scss +50 -0
  31. data/vendor/assets/stylesheets/bootstrap/_layouts.scss +1 -1
  32. data/vendor/assets/stylesheets/bootstrap/_mixins.scss +99 -73
  33. data/vendor/assets/stylesheets/bootstrap/_navbar.scss +61 -40
  34. data/vendor/assets/stylesheets/bootstrap/_navs.scss +27 -26
  35. data/vendor/assets/stylesheets/bootstrap/_progress-bars.scss +15 -6
  36. data/vendor/assets/stylesheets/bootstrap/_reset.scss +3 -3
  37. data/vendor/assets/stylesheets/bootstrap/_sprites.scss +25 -5
  38. data/vendor/assets/stylesheets/bootstrap/_tables.scss +17 -6
  39. data/vendor/assets/stylesheets/bootstrap/_thumbnails.scss +14 -0
  40. data/vendor/assets/stylesheets/bootstrap/_type.scss +7 -6
  41. data/vendor/assets/stylesheets/bootstrap/_variables.scss +52 -9
  42. metadata +10 -22
  43. data/vendor/assets/stylesheets/bootstrap/_badges.scss +0 -36
  44. data/vendor/assets/stylesheets/bootstrap/_labels.scss +0 -38
data/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # Bootstrap for Sass
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/thomas-mcdonald/bootstrap-sass.png?branch=master)](http://travis-ci.org/thomas-mcdonald/bootstrap-sass)
4
+
3
5
  `bootstrap-sass` is an Sass-powered version of [Twitter's Bootstrap](http://github.com/twitter/bootstrap), ready to drop right into your Sass powered applications.
4
6
 
5
7
  Enjoy.
6
8
 
7
9
  ## Updating
8
- 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)
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)
9
11
 
10
12
  ## Usage
11
13
 
@@ -14,7 +16,7 @@ Updating your application to a new version of `bootstrap-sass`? See [our changel
14
16
  In your Gemfile:
15
17
 
16
18
  gem 'sass-rails', '~> 3.1'
17
- gem 'bootstrap-sass', '~> 2.0.2'
19
+ gem 'bootstrap-sass', '~> 2.0.3'
18
20
 
19
21
  #### CSS
20
22
 
@@ -22,13 +24,6 @@ Import "bootstrap" in your SCSS file of choice to get all of Bootstrap's styles,
22
24
 
23
25
  @import "bootstrap";
24
26
 
25
- Need to configure a variable or two? Simple define the value of the variable you want to change *before* importing Bootstrap. Sass will respect your existing definition rather than overwriting it with the Bootstrap defaults. A list of customisable variables can be found in the [Bootstrap documentation](http://twitter.github.com/bootstrap/less.html#variables).
26
-
27
- $primaryButtonBackground: #f00;
28
- @import "bootstrap";
29
-
30
- **Note**: It's important that the file you are importing is not named `bootstrap`, since this will cause an import loop. As a general rule, errors are something you should try to avoid.
31
-
32
27
  #### Javascripts
33
28
 
34
29
  You can include the Bootstrap javascripts through two methods. In this case, Sprocket's `//= require` directives are useful, since there is no better alternative.
@@ -76,6 +71,27 @@ Install the gem, add the require statement to the top of your configuration file
76
71
 
77
72
  You'll get the same benefits as those starting from scratch. Radical.
78
73
 
79
- ----
74
+ ## Configuration
75
+ Need to configure a variable or two? Simply define the value of the variable you want to change *before* importing Bootstrap. Sass will respect your existing definition rather than overwriting it with the Bootstrap defaults. A list of customisable variables can be found in the [Bootstrap documentation](http://twitter.github.com/bootstrap/less.html#variables).
76
+
77
+ $btnPrimaryBackground: #f00;
78
+ @import "bootstrap";
80
79
 
80
+ **Note**: It's important that the file you are importing is not named `bootstrap`, since this will cause an import loop. As a general rule, errors are something you should try to avoid.
81
+
82
+ ### Passing multiple values to mixins
83
+
84
+ Some CSS3 properties take multiple values, such as `box-shadow` or `text-shadow`. To pass multiple values to the Bootstrap mixins, you must escape the values or else the Sass parser will choke on the commas. Here's how to escape the values in Sass:
85
+
86
+ .selector {
87
+ @include box-shadow(#{0 2px 5px rgba(0,0,0,.25) inset, 0 -2px 5px rgba(0,0,0,.25) inset});
88
+ }
89
+
90
+ ### Responsive styling?
81
91
  As per the Bootstrap project we don't include the responsive styles by default. `@import "bootstrap-responsive";` to get them.
92
+
93
+ ## Who
94
+ bootstrap-sass is a project by [Thomas McDonald](https://twitter.com/#!/thomasmcdonald_), with support from [other awesome people](https://github.com/thomas-mcdonald/bootstrap-sass/graphs/contributors).
95
+
96
+ ## You're in good company
97
+ bootstrap-sass is used to build some awesome projects, including [Diaspora](http://diasporaproject.org/), [rails_admin](https://github.com/sferik/rails_admin), Michael Hartl's [Rails Tutorial](http://railstutorial.org/) and [gitlabhq](http://gitlabhq.com/). Using bootstrap-sass? I'd love it if you let me know through Twitter.
@@ -3,30 +3,41 @@ module Bootstrap
3
3
 
4
4
  # Inspired by Kaminari
5
5
  def self.load!
6
- if rails?
7
- require 'sass-rails' # See: https://github.com/thomas-mcdonald/bootstrap-sass/pull/4
8
- require 'bootstrap-sass/engine'
9
- require 'bootstrap-sass/config/sass_extentions'
6
+ if compass? && asset_pipeline?
7
+ register_compass_extension
8
+ register_rails_engine
10
9
  elsif compass?
11
- require 'bootstrap-sass/compass_extensions'
12
- require 'bootstrap-sass/config/sass_extentions'
13
- base = File.join(File.dirname(__FILE__), '..')
14
- styles = File.join(base, 'vendor', 'assets', 'stylesheets')
15
- templates = File.join(base, 'templates')
16
- ::Compass::Frameworks.register('bootstrap', :stylesheets_directory => styles, :templates_directory => templates)
10
+ # Only require compass extension if a standalone project
11
+ require 'bootstrap-sass/compass_functions'
12
+ register_compass_extension
13
+ elsif asset_pipeline?
14
+ require 'sass-rails' # See: https://github.com/thomas-mcdonald/bootstrap-sass/pull/4
15
+ register_rails_engine
16
+ require 'bootstrap-sass/rails_functions'
17
17
  else
18
- raise Bootstrap::FrameworkNotFound, "bootstrap-sass requires either Rails or Compass, neither of which are loaded"
18
+ raise Bootstrap::FrameworkNotFound, "bootstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded"
19
19
  end
20
20
  end
21
21
 
22
22
  private
23
- def self.rails?
24
- defined?(::Rails)
23
+ def self.asset_pipeline?
24
+ defined?(::Rails) && ::Rails.version >= '3.1.0'
25
25
  end
26
26
 
27
27
  def self.compass?
28
28
  defined?(::Compass)
29
29
  end
30
+
31
+ def self.register_compass_extension
32
+ base = File.join(File.dirname(__FILE__), '..')
33
+ styles = File.join(base, 'vendor', 'assets', 'stylesheets')
34
+ templates = File.join(base, 'templates')
35
+ ::Compass::Frameworks.register('bootstrap', :stylesheets_directory => styles, :templates_directory => templates)
36
+ end
37
+
38
+ def self.register_rails_engine
39
+ require 'bootstrap-sass/engine'
40
+ end
30
41
  end
31
42
 
32
43
  Bootstrap.load!
@@ -2,8 +2,6 @@ module Bootstrap
2
2
  module Rails
3
3
  class Engine < ::Rails::Engine
4
4
  # Rails, will you please look in our vendor? kthx
5
- # also add our initializer.
6
- # paths["config/initializers"] << 'lib/bootstrap-sass/config'
7
5
  end
8
6
  end
9
7
  end
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================
2
- * bootstrap-alert.js v2.0.2
2
+ * bootstrap-alert.js v2.0.3
3
3
  * http://twitter.github.com/bootstrap/javascript.html#alerts
4
4
  * ==========================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -18,61 +18,57 @@
18
18
  * ========================================================== */
19
19
 
20
20
 
21
- !function( $ ){
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
22
24
 
23
- "use strict"
24
25
 
25
26
  /* ALERT CLASS DEFINITION
26
27
  * ====================== */
27
28
 
28
29
  var dismiss = '[data-dismiss="alert"]'
29
- , Alert = function ( el ) {
30
+ , Alert = function (el) {
30
31
  $(el).on('click', dismiss, this.close)
31
32
  }
32
33
 
33
- Alert.prototype = {
34
-
35
- constructor: Alert
34
+ Alert.prototype.close = function (e) {
35
+ var $this = $(this)
36
+ , selector = $this.attr('data-target')
37
+ , $parent
36
38
 
37
- , close: function ( e ) {
38
- var $this = $(this)
39
- , selector = $this.attr('data-target')
40
- , $parent
39
+ if (!selector) {
40
+ selector = $this.attr('href')
41
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
42
+ }
41
43
 
42
- if (!selector) {
43
- selector = $this.attr('href')
44
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
45
- }
44
+ $parent = $(selector)
46
45
 
47
- $parent = $(selector)
48
- $parent.trigger('close')
46
+ e && e.preventDefault()
49
47
 
50
- e && e.preventDefault()
48
+ $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
51
49
 
52
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
50
+ $parent.trigger(e = $.Event('close'))
53
51
 
54
- $parent
55
- .trigger('close')
56
- .removeClass('in')
52
+ if (e.isDefaultPrevented()) return
57
53
 
58
- function removeElement() {
59
- $parent
60
- .trigger('closed')
61
- .remove()
62
- }
54
+ $parent.removeClass('in')
63
55
 
64
- $.support.transition && $parent.hasClass('fade') ?
65
- $parent.on($.support.transition.end, removeElement) :
66
- removeElement()
56
+ function removeElement() {
57
+ $parent
58
+ .trigger('closed')
59
+ .remove()
67
60
  }
68
61
 
62
+ $.support.transition && $parent.hasClass('fade') ?
63
+ $parent.on($.support.transition.end, removeElement) :
64
+ removeElement()
69
65
  }
70
66
 
71
67
 
72
68
  /* ALERT PLUGIN DEFINITION
73
69
  * ======================= */
74
70
 
75
- $.fn.alert = function ( option ) {
71
+ $.fn.alert = function (option) {
76
72
  return this.each(function () {
77
73
  var $this = $(this)
78
74
  , data = $this.data('alert')
@@ -91,4 +87,4 @@
91
87
  $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
92
88
  })
93
89
 
94
- }( window.jQuery );
90
+ }(window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /* ============================================================
2
- * bootstrap-button.js v2.0.2
2
+ * bootstrap-button.js v2.0.3
3
3
  * http://twitter.github.com/bootstrap/javascript.html#buttons
4
4
  * ============================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -17,58 +17,54 @@
17
17
  * limitations under the License.
18
18
  * ============================================================ */
19
19
 
20
- !function( $ ){
21
20
 
22
- "use strict"
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
24
+
23
25
 
24
26
  /* BUTTON PUBLIC CLASS DEFINITION
25
27
  * ============================== */
26
28
 
27
- var Button = function ( element, options ) {
29
+ var Button = function (element, options) {
28
30
  this.$element = $(element)
29
31
  this.options = $.extend({}, $.fn.button.defaults, options)
30
32
  }
31
33
 
32
- Button.prototype = {
33
-
34
- constructor: Button
34
+ Button.prototype.setState = function (state) {
35
+ var d = 'disabled'
36
+ , $el = this.$element
37
+ , data = $el.data()
38
+ , val = $el.is('input') ? 'val' : 'html'
35
39
 
36
- , setState: function ( state ) {
37
- var d = 'disabled'
38
- , $el = this.$element
39
- , data = $el.data()
40
- , val = $el.is('input') ? 'val' : 'html'
40
+ state = state + 'Text'
41
+ data.resetText || $el.data('resetText', $el[val]())
41
42
 
42
- state = state + 'Text'
43
- data.resetText || $el.data('resetText', $el[val]())
43
+ $el[val](data[state] || this.options[state])
44
44
 
45
- $el[val](data[state] || this.options[state])
46
-
47
- // push to event loop to allow forms to submit
48
- setTimeout(function () {
49
- state == 'loadingText' ?
50
- $el.addClass(d).attr(d, d) :
51
- $el.removeClass(d).removeAttr(d)
52
- }, 0)
53
- }
54
-
55
- , toggle: function () {
56
- var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
45
+ // push to event loop to allow forms to submit
46
+ setTimeout(function () {
47
+ state == 'loadingText' ?
48
+ $el.addClass(d).attr(d, d) :
49
+ $el.removeClass(d).removeAttr(d)
50
+ }, 0)
51
+ }
57
52
 
58
- $parent && $parent
59
- .find('.active')
60
- .removeClass('active')
53
+ Button.prototype.toggle = function () {
54
+ var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
61
55
 
62
- this.$element.toggleClass('active')
63
- }
56
+ $parent && $parent
57
+ .find('.active')
58
+ .removeClass('active')
64
59
 
60
+ this.$element.toggleClass('active')
65
61
  }
66
62
 
67
63
 
68
64
  /* BUTTON PLUGIN DEFINITION
69
65
  * ======================== */
70
66
 
71
- $.fn.button = function ( option ) {
67
+ $.fn.button = function (option) {
72
68
  return this.each(function () {
73
69
  var $this = $(this)
74
70
  , data = $this.data('button')
@@ -97,4 +93,4 @@
97
93
  })
98
94
  })
99
95
 
100
- }( window.jQuery );
96
+ }(window.jQuery);
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================
2
- * bootstrap-carousel.js v2.0.2
2
+ * bootstrap-carousel.js v2.0.3
3
3
  * http://twitter.github.com/bootstrap/javascript.html#carousel
4
4
  * ==========================================================
5
5
  * Copyright 2012 Twitter, Inc.
@@ -18,16 +18,17 @@
18
18
  * ========================================================== */
19
19
 
20
20
 
21
- !function( $ ){
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
22
24
 
23
- "use strict"
24
25
 
25
26
  /* CAROUSEL CLASS DEFINITION
26
27
  * ========================= */
27
28
 
28
29
  var Carousel = function (element, options) {
29
30
  this.$element = $(element)
30
- this.options = $.extend({}, $.fn.carousel.defaults, options)
31
+ this.options = options
31
32
  this.options.slide && this.slide(this.options.slide)
32
33
  this.options.pause == 'hover' && this.$element
33
34
  .on('mouseenter', $.proxy(this.pause, this))
@@ -36,8 +37,11 @@
36
37
 
37
38
  Carousel.prototype = {
38
39
 
39
- cycle: function () {
40
- this.interval = setInterval($.proxy(this.next, this), this.options.interval)
40
+ cycle: function (e) {
41
+ if (!e) this.paused = false
42
+ this.options.interval
43
+ && !this.paused
44
+ && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
41
45
  return this
42
46
  }
43
47
 
@@ -62,7 +66,8 @@
62
66
  return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
63
67
  }
64
68
 
65
- , pause: function () {
69
+ , pause: function (e) {
70
+ if (!e) this.paused = true
66
71
  clearInterval(this.interval)
67
72
  this.interval = null
68
73
  return this
@@ -85,6 +90,7 @@
85
90
  , direction = type == 'next' ? 'left' : 'right'
86
91
  , fallback = type == 'next' ? 'first' : 'last'
87
92
  , that = this
93
+ , e = $.Event('slide')
88
94
 
89
95
  this.sliding = true
90
96
 
@@ -94,24 +100,26 @@
94
100
 
95
101
  if ($next.hasClass('active')) return
96
102
 
97
- if (!$.support.transition && this.$element.hasClass('slide')) {
98
- this.$element.trigger('slide')
99
- $active.removeClass('active')
100
- $next.addClass('active')
101
- this.sliding = false
102
- this.$element.trigger('slid')
103
- } else {
103
+ if ($.support.transition && this.$element.hasClass('slide')) {
104
+ this.$element.trigger(e)
105
+ if (e.isDefaultPrevented()) return
104
106
  $next.addClass(type)
105
107
  $next[0].offsetWidth // force reflow
106
108
  $active.addClass(direction)
107
109
  $next.addClass(direction)
108
- this.$element.trigger('slide')
109
110
  this.$element.one($.support.transition.end, function () {
110
111
  $next.removeClass([type, direction].join(' ')).addClass('active')
111
112
  $active.removeClass(['active', direction].join(' '))
112
113
  that.sliding = false
113
114
  setTimeout(function () { that.$element.trigger('slid') }, 0)
114
115
  })
116
+ } else {
117
+ this.$element.trigger(e)
118
+ if (e.isDefaultPrevented()) return
119
+ $active.removeClass('active')
120
+ $next.addClass('active')
121
+ this.sliding = false
122
+ this.$element.trigger('slid')
115
123
  }
116
124
 
117
125
  isCycling && this.cycle()
@@ -125,15 +133,15 @@
125
133
  /* CAROUSEL PLUGIN DEFINITION
126
134
  * ========================== */
127
135
 
128
- $.fn.carousel = function ( option ) {
136
+ $.fn.carousel = function (option) {
129
137
  return this.each(function () {
130
138
  var $this = $(this)
131
139
  , data = $this.data('carousel')
132
- , options = typeof option == 'object' && option
140
+ , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
133
141
  if (!data) $this.data('carousel', (data = new Carousel(this, options)))
134
142
  if (typeof option == 'number') data.to(option)
135
143
  else if (typeof option == 'string' || (option = options.slide)) data[option]()
136
- else data.cycle()
144
+ else if (options.interval) data.cycle()
137
145
  })
138
146
  }
139
147
 
@@ -158,4 +166,4 @@
158
166
  })
159
167
  })
160
168
 
161
- }( window.jQuery );
169
+ }(window.jQuery);