sass-twitter-bootstrap-rails 0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/README.md +24 -12
  2. data/lib/generators/bootstrap/install/install_generator.rb +26 -0
  3. data/lib/generators/bootstrap/install/templates/application.css.scss +1 -0
  4. data/lib/generators/bootstrap/install/templates/application.js +9 -0
  5. data/lib/sass-twitter-bootstrap/rails/version.rb +2 -3
  6. data/sass-twitter-bootstrap-rails.gemspec +1 -1
  7. data/vendor/assets/javascripts/twitter/bootstrap.js +1 -1
  8. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +91 -0
  9. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +98 -0
  10. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +154 -0
  11. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +136 -0
  12. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +92 -0
  13. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +209 -0
  14. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +95 -0
  15. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +125 -0
  16. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +130 -0
  17. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +270 -0
  18. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +51 -0
  19. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +271 -0
  20. data/vendor/assets/stylesheets/twitter/bootstrap.scss +49 -16
  21. data/vendor/assets/stylesheets/twitter/bootstrap/accordion.scss +28 -0
  22. data/vendor/assets/stylesheets/twitter/bootstrap/alerts.scss +70 -0
  23. data/vendor/assets/stylesheets/twitter/bootstrap/breadcrumbs.scss +22 -0
  24. data/vendor/assets/stylesheets/twitter/bootstrap/button-groups.scss +146 -0
  25. data/vendor/assets/stylesheets/twitter/bootstrap/buttons.scss +165 -0
  26. data/vendor/assets/stylesheets/twitter/bootstrap/carousel.scss +121 -0
  27. data/vendor/assets/stylesheets/twitter/bootstrap/close.scss +18 -0
  28. data/vendor/assets/stylesheets/twitter/bootstrap/code.scss +43 -0
  29. data/vendor/assets/stylesheets/twitter/bootstrap/component-animations.scss +18 -0
  30. data/vendor/assets/stylesheets/twitter/bootstrap/dropdowns.scss +131 -0
  31. data/vendor/assets/stylesheets/twitter/bootstrap/forms.scss +497 -0
  32. data/vendor/assets/stylesheets/twitter/bootstrap/grid.scss +8 -0
  33. data/vendor/assets/stylesheets/twitter/bootstrap/hero-unit.scss +20 -0
  34. data/vendor/assets/stylesheets/twitter/bootstrap/labels.scss +16 -0
  35. data/vendor/assets/stylesheets/twitter/bootstrap/layout.scss +15 -0
  36. data/vendor/assets/stylesheets/twitter/bootstrap/mixins.scss +461 -0
  37. data/vendor/assets/stylesheets/twitter/bootstrap/modals.scss +73 -0
  38. data/vendor/assets/stylesheets/twitter/bootstrap/navbar.scss +292 -0
  39. data/vendor/assets/stylesheets/twitter/bootstrap/navs.scss +344 -0
  40. data/vendor/assets/stylesheets/twitter/bootstrap/pager.scss +30 -0
  41. data/vendor/assets/stylesheets/twitter/bootstrap/pagination.scss +55 -0
  42. data/vendor/assets/stylesheets/twitter/bootstrap/popovers.scss +49 -0
  43. data/vendor/assets/stylesheets/twitter/bootstrap/progress-bars.scss +95 -0
  44. data/vendor/assets/stylesheets/twitter/{reset.scss → bootstrap/reset.scss} +37 -52
  45. data/vendor/assets/stylesheets/twitter/bootstrap/responsive.scss +323 -0
  46. data/vendor/assets/stylesheets/twitter/bootstrap/scaffolding.scss +27 -0
  47. data/vendor/assets/stylesheets/twitter/bootstrap/sprites.scss +156 -0
  48. data/vendor/assets/stylesheets/twitter/bootstrap/tables.scss +123 -0
  49. data/vendor/assets/stylesheets/twitter/bootstrap/thumbnails.scss +35 -0
  50. data/vendor/assets/stylesheets/twitter/bootstrap/tooltip.scss +35 -0
  51. data/vendor/assets/stylesheets/twitter/bootstrap/type.scss +214 -0
  52. data/vendor/assets/stylesheets/twitter/bootstrap/utilities.scss +23 -0
  53. data/vendor/assets/stylesheets/twitter/bootstrap/variables.scss +75 -0
  54. data/vendor/assets/stylesheets/twitter/bootstrap/wells.scss +17 -0
  55. metadata +56 -23
  56. data/vendor/assets/javascripts/twitter/bootstrap-alerts.js +0 -113
  57. data/vendor/assets/javascripts/twitter/bootstrap-buttons.js +0 -62
  58. data/vendor/assets/javascripts/twitter/bootstrap-dropdown.js +0 -55
  59. data/vendor/assets/javascripts/twitter/bootstrap-modal.js +0 -260
  60. data/vendor/assets/javascripts/twitter/bootstrap-popover.js +0 -86
  61. data/vendor/assets/javascripts/twitter/bootstrap-scrollspy.js +0 -107
  62. data/vendor/assets/javascripts/twitter/bootstrap-tabs.js +0 -80
  63. data/vendor/assets/javascripts/twitter/bootstrap-twipsy.js +0 -310
  64. data/vendor/assets/stylesheets/twitter/forms.scss +0 -478
  65. data/vendor/assets/stylesheets/twitter/mixins.scss +0 -220
  66. data/vendor/assets/stylesheets/twitter/patterns.scss +0 -1060
  67. data/vendor/assets/stylesheets/twitter/scaffolding.scss +0 -108
  68. data/vendor/assets/stylesheets/twitter/tables.scss +0 -224
  69. data/vendor/assets/stylesheets/twitter/type.scss +0 -187
  70. data/vendor/assets/stylesheets/twitter/variables.scss +0 -60
data/README.md CHANGED
@@ -1,19 +1,21 @@
1
- # sass-twitter-bootstrap-rails
1
+ # Twitter Bootstrap for Rails 3.1 with Sass
2
2
 
3
- Twitter CSS Toolkit, Bootstrap, for Rails with Sass !
3
+ Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites.
4
+ It includes base CSS and javascripts for typography, forms, buttons, tables, grids, navigation, and more.
4
5
 
5
- This gem provides :
6
+ sass-twitter-bootstrap-rails project integrates Bootstrap for Rails 3.1+ applications with asset pipeline enabled
6
7
 
7
- * stylesheets converted to Sass [sass-twitter-bootstrap](http://github.com/jlong/sass-twitter-bootstrap)
8
- * javascripts from Bootstrap also
9
-
10
- The gem uses Twitter Bootstrap _1.4.0_
8
+ The `master` branch uses new __Twitter Bootstrap 2__. Version 1.4 of Bootstrap is kept in a branch now.
11
9
 
12
10
  ## Installation
13
11
 
14
12
  Include Boostrap in your `Gemfile`
15
13
 
16
- gem 'sass-twitter-bootstrap-rails'
14
+ gem 'sass-twitter-bootstrap-rails', '~> 1.0'
15
+
16
+ or, if you want to use the old version of Bootstrap
17
+
18
+ gem 'sass-twitter-bootstrap-rails', '~> 0.1'
17
19
 
18
20
  and run from command line
19
21
 
@@ -29,6 +31,11 @@ For Rails 3.1+, the files will be added to the assets pipeline and available for
29
31
  `app/assets/stylesheets/application.scss`
30
32
 
31
33
  @import "twitter/bootstrap";
34
+
35
+ You can also import additionnal files, like the responsive grid or only files you need
36
+
37
+ @import "twitter/bootstrap/responsiveness"
38
+ @import "twitter/bootstrap/forms"
32
39
 
33
40
  To use complementary javascripts files, you can use the `manifest` present in the gem by adding this line to the file
34
41
  `app/assets/javascripts/application.js`
@@ -37,8 +44,8 @@ To use complementary javascripts files, you can use the `manifest` present in th
37
44
 
38
45
  or if you do not wish to use all javascripts included, you can require them separalety
39
46
 
40
- /= require twitter/bootstrap-buttons
41
- /= require twitter/bootstrap-tabs
47
+ /= require twitter/bootstrap/bootstrap-button
48
+ /= require twitter/bootstrap/bootstrap-tab
42
49
 
43
50
  ### Rails 3.0
44
51
 
@@ -46,9 +53,14 @@ Not yet available
46
53
 
47
54
  ## Generators
48
55
 
49
- Not yet available
56
+ If you're the kind of developers that prefer action over explanation, there is a generator that will install all of
57
+ this, so you can start immediatly. Just run in the command line
58
+
59
+ rails g bootstrap:install
60
+
61
+ and start enjoying !
50
62
 
51
63
  ## Thanks
52
64
 
53
- Twitter Bootstrap http://twitter.github.com/bootstrap and http://github.com/jlong/sass-twitter-bootstrap for the Sass conversion
65
+ Twitter Bootstrap http://twitter.github.com/bootstrap
54
66
 
@@ -0,0 +1,26 @@
1
+ require 'rails/generators'
2
+
3
+ module Bootstrap
4
+ module Generators
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+ source_root File.expand_path('../templates', __FILE__)
7
+ desc "This generator installs Twitter Bootstrap to be used with assets pipeline"
8
+
9
+ def add_stylesheets
10
+ if File.exist?('app/assets/stylesheets/application.css.scss')
11
+ insert_into_file 'app/assets/stylesheets/application.css.scss', %Q{@import "twitter/bootstrap"\n}, :before => "@import"
12
+ else
13
+ copy_file 'application.css.scss', 'app/assets/stylesheets/application.css.scss'
14
+ end
15
+ end
16
+
17
+ def add_javascripts
18
+ if File.exist?('app/assets/javascripts/application.js')
19
+ insert_into_file 'app/assets/javascripts/application.js', "//= require twitter/bootstrap\n", :after => "jquery_ujs\n"
20
+ else
21
+ copy_file 'application.js', 'app/assets/javascripts/application.js'
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1 @@
1
+ @import "twitter/bootstrap"
@@ -0,0 +1,9 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require_tree bootstrap
9
+ //= require_tree .
@@ -1,7 +1,6 @@
1
1
  module SassTwitterBootstrap
2
2
  module Rails
3
- VERSION = '0.1'
4
- BOOTSTRAP_VERSION = '1.4'
5
- SASS_BOOTSTRAP_VERSION = '1.1'
3
+ VERSION = '1.0.0'
4
+ BOOTSTRAP_VERSION = '2.0.0'
6
5
  end
7
6
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
15
 
16
- s.add_dependency "railties", "~> 3.2"
16
+ s.add_dependency "railties", ">= 3.1"
17
17
 
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.files = `git ls-files`.split("\n")
@@ -1 +1 @@
1
- //= require_tree .
1
+ //= require_tree bootstrap
@@ -0,0 +1,91 @@
1
+ /* ==========================================================
2
+ * bootstrap-alert.js v2.0.0
3
+ * http://twitter.github.com/bootstrap/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"
24
+
25
+ /* ALERT CLASS DEFINITION
26
+ * ====================== */
27
+
28
+ var dismiss = '[data-dismiss="alert"]'
29
+ , Alert = function ( el ) {
30
+ $(el).on('click', dismiss, this.close)
31
+ }
32
+
33
+ Alert.prototype = {
34
+
35
+ constructor: Alert
36
+
37
+ , close: function ( e ) {
38
+ var $this = $(this)
39
+ , selector = $this.attr('data-target')
40
+ , $parent
41
+
42
+ if (!selector) {
43
+ selector = $this.attr('href')
44
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
45
+ }
46
+
47
+ $parent = $(selector)
48
+ $parent.trigger('close')
49
+
50
+ e && e.preventDefault()
51
+
52
+ $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
53
+
54
+ $parent.removeClass('in')
55
+
56
+ function removeElement() {
57
+ $parent.remove()
58
+ $parent.trigger('closed')
59
+ }
60
+
61
+ $.support.transition && $parent.hasClass('fade') ?
62
+ $parent.on($.support.transition.end, removeElement) :
63
+ removeElement()
64
+ }
65
+
66
+ }
67
+
68
+
69
+ /* ALERT PLUGIN DEFINITION
70
+ * ======================= */
71
+
72
+ $.fn.alert = function ( option ) {
73
+ return this.each(function () {
74
+ var $this = $(this)
75
+ , data = $this.data('alert')
76
+ if (!data) $this.data('alert', (data = new Alert(this)))
77
+ if (typeof option == 'string') data[option].call($this)
78
+ })
79
+ }
80
+
81
+ $.fn.alert.Constructor = Alert
82
+
83
+
84
+ /* ALERT DATA-API
85
+ * ============== */
86
+
87
+ $(function () {
88
+ $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
89
+ })
90
+
91
+ }( window.jQuery )
@@ -0,0 +1,98 @@
1
+ /* ============================================================
2
+ * bootstrap-button.js v2.0.0
3
+ * http://twitter.github.com/bootstrap/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
+ !function( $ ){
21
+
22
+ "use strict"
23
+
24
+ /* BUTTON PUBLIC CLASS DEFINITION
25
+ * ============================== */
26
+
27
+ var Button = function ( element, options ) {
28
+ this.$element = $(element)
29
+ this.options = $.extend({}, $.fn.button.defaults, options)
30
+ }
31
+
32
+ Button.prototype = {
33
+
34
+ constructor: Button
35
+
36
+ , setState: function ( state ) {
37
+ var d = 'disabled'
38
+ , $el = this.$element
39
+ , data = $el.data()
40
+ , val = $el.is('input') ? 'val' : 'html'
41
+
42
+ state = state + 'Text'
43
+ data.resetText || $el.data('resetText', $el[val]())
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"]')
57
+
58
+ $parent && $parent
59
+ .find('.active')
60
+ .removeClass('active')
61
+
62
+ this.$element.toggleClass('active')
63
+ }
64
+
65
+ }
66
+
67
+
68
+ /* BUTTON PLUGIN DEFINITION
69
+ * ======================== */
70
+
71
+ $.fn.button = function ( option ) {
72
+ return this.each(function () {
73
+ var $this = $(this)
74
+ , data = $this.data('button')
75
+ , options = typeof option == 'object' && option
76
+ if (!data) $this.data('button', (data = new Button(this, options)))
77
+ if (option == 'toggle') data.toggle()
78
+ else if (option) data.setState(option)
79
+ })
80
+ }
81
+
82
+ $.fn.button.defaults = {
83
+ loadingText: 'loading...'
84
+ }
85
+
86
+ $.fn.button.Constructor = Button
87
+
88
+
89
+ /* BUTTON DATA-API
90
+ * =============== */
91
+
92
+ $(function () {
93
+ $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
94
+ $(e.target).button('toggle')
95
+ })
96
+ })
97
+
98
+ }( window.jQuery )
@@ -0,0 +1,154 @@
1
+ /* ==========================================================
2
+ * bootstrap-carousel.js v2.0.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#carousel
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"
24
+
25
+ /* CAROUSEL CLASS DEFINITION
26
+ * ========================= */
27
+
28
+ var Carousel = function (element, options) {
29
+ this.$element = $(element)
30
+ this.options = $.extend({}, $.fn.carousel.defaults, options)
31
+ this.options.slide && this.slide(this.options.slide)
32
+ }
33
+
34
+ Carousel.prototype = {
35
+
36
+ cycle: function () {
37
+ this.interval = setInterval($.proxy(this.next, this), this.options.interval)
38
+ return this
39
+ }
40
+
41
+ , to: function (pos) {
42
+ var $active = this.$element.find('.active')
43
+ , children = $active.parent().children()
44
+ , activePos = children.index($active)
45
+ , that = this
46
+
47
+ if (pos > (children.length - 1) || pos < 0) return
48
+
49
+ if (this.sliding) {
50
+ return this.$element.one('slid', function () {
51
+ that.to(pos)
52
+ })
53
+ }
54
+
55
+ if (activePos == pos) {
56
+ return this.pause().cycle()
57
+ }
58
+
59
+ return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
60
+ }
61
+
62
+ , pause: function () {
63
+ clearInterval(this.interval)
64
+ return this
65
+ }
66
+
67
+ , next: function () {
68
+ if (this.sliding) return
69
+ return this.slide('next')
70
+ }
71
+
72
+ , prev: function () {
73
+ if (this.sliding) return
74
+ return this.slide('prev')
75
+ }
76
+
77
+ , slide: function (type, next) {
78
+ var $active = this.$element.find('.active')
79
+ , $next = next || $active[type]()
80
+ , isCycling = this.interval
81
+ , direction = type == 'next' ? 'left' : 'right'
82
+ , fallback = type == 'next' ? 'first' : 'last'
83
+ , that = this
84
+
85
+ this.sliding = true
86
+
87
+ isCycling && this.pause()
88
+
89
+ $next = $next.length ? $next : this.$element.find('.item')[fallback]()
90
+
91
+ if (!$.support.transition && this.$element.hasClass('slide')) {
92
+ this.$element.trigger('slide')
93
+ $active.removeClass('active')
94
+ $next.addClass('active')
95
+ this.sliding = false
96
+ this.$element.trigger('slid')
97
+ } else {
98
+ $next.addClass(type)
99
+ $next[0].offsetWidth // force reflow
100
+ $active.addClass(direction)
101
+ $next.addClass(direction)
102
+ this.$element.trigger('slide')
103
+ this.$element.one($.support.transition.end, function () {
104
+ $next.removeClass([type, direction].join(' ')).addClass('active')
105
+ $active.removeClass(['active', direction].join(' '))
106
+ that.sliding = false
107
+ setTimeout(function () { that.$element.trigger('slid') }, 0)
108
+ })
109
+ }
110
+
111
+ isCycling && this.cycle()
112
+
113
+ return this
114
+ }
115
+
116
+ }
117
+
118
+
119
+ /* CAROUSEL PLUGIN DEFINITION
120
+ * ========================== */
121
+
122
+ $.fn.carousel = function ( option ) {
123
+ return this.each(function () {
124
+ var $this = $(this)
125
+ , data = $this.data('carousel')
126
+ , options = typeof option == 'object' && option
127
+ if (!data) $this.data('carousel', (data = new Carousel(this, options)))
128
+ if (typeof option == 'number') data.to(option)
129
+ else if (typeof option == 'string' || (option = options.slide)) data[option]()
130
+ else data.cycle()
131
+ })
132
+ }
133
+
134
+ $.fn.carousel.defaults = {
135
+ interval: 5000
136
+ }
137
+
138
+ $.fn.carousel.Constructor = Carousel
139
+
140
+
141
+ /* CAROUSEL DATA-API
142
+ * ================= */
143
+
144
+ $(function () {
145
+ $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
146
+ var $this = $(this), href
147
+ , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
148
+ , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
149
+ $target.carousel(options)
150
+ e.preventDefault()
151
+ })
152
+ })
153
+
154
+ }( window.jQuery )