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,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
@@ -0,0 +1,8 @@
1
+ CHANGELOG
2
+ =========
3
+
4
+ 1.3.0 (Sept 25, 2011)
5
+ ---------------------
6
+
7
+ * Initial 1.3.0 release (68605bdd51760a929cc661607f06f479c53b0bee)
8
+
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
@@ -0,0 +1,99 @@
1
+
2
+ # Less Rails Bootstrap
3
+
4
+ Bootstrap is Twitter's toolkit for kickstarting CSS for websites, apps, and more. It includes base CSS styles for typography, forms, buttons, tables, grids, navigation, alerts, and more. To get started -- checkout http://twitter.github.com/bootstrap!
5
+
6
+ The less-rails-bootstrap project hooks into less-rails (https://github.com/metaskills/less-rails) to provide both compiled and LESS CSS source files from the Twitter Bootstrap project within the Rails 3.1 asset pipeline. Benefits:
7
+
8
+ * Assets are namespaced in twitter/bootstrap to avoid asset conflicts.
9
+ * Top level requires to get all stylesheets or javascripts.
10
+ *
11
+
12
+
13
+ ## Versioning
14
+
15
+ This gem will directly track the semantic versioning releases of the Twitter Bootstrap project. Our major and minor versions will always match to theirs. Tho we may have tiny patch level releases specific to this gem.
16
+
17
+
18
+ ## Installing
19
+
20
+ This library requires the less-rails gem to work. Unfortunately, I have yet to publish my gem in the abandoned less-rails space on rubygems.org. Till then, please bundle less-rails using the git repo.
21
+
22
+ ```ruby
23
+ gem 'less-rails', :git => 'git://github.com/metaskills/less-rails.git'
24
+ gem 'less-rails-bootstrap', '1.3.0'
25
+ ```
26
+
27
+
28
+ ## Usage
29
+
30
+ The easiest way to use Twitter Bootstrap is require it in your `application.css` file. Doing so will compile the libraries LESS files.
31
+
32
+ ```css
33
+ /*
34
+ *= require twitter/bootstrap
35
+ */
36
+
37
+ #foo {
38
+ /* Your styles... */
39
+ }
40
+ ```
41
+
42
+ In a file with the `.css.less` extension, you can import the entire Bootstrap LESS framework. This will allow you to use Bootstrap's variables and mixins in your CSS that follows. Remember, unlike other CSS frameworks, requiring or importing Bootstrap will include all the CSS for building a bootstrapped website. If you only want variables or mixins, you will have to import those discreet files.
43
+
44
+ ```css
45
+ @import "twitter/bootstrap";
46
+
47
+ #foo {
48
+ .border-radius(4px);
49
+ }
50
+ ```
51
+
52
+ Maybe all you want to use is the variables and mixins that come with Twitter Bootstrap. No problem, just import them individually from you own `.css.less` file. In this case only the `#foo` selector is output.
53
+
54
+ ```css
55
+ @import "twitter/bootstrap/variables";
56
+ @import "twitter/bootstrap/mixins";
57
+
58
+ .myButton(@radius: 5px) {
59
+ .border-radius(@radius);
60
+ }
61
+
62
+ #foo {
63
+ .myButton(10px);
64
+ }
65
+ ```
66
+
67
+ Using the JavaScript files is just as easy. Again, you can include all them with a single directive from your `application.js` file. Optionally, you can require only the files you need like `require twitter/bootstrap/modal`.
68
+
69
+ ```javascript
70
+ //= require twitter/bootstrap
71
+
72
+ $(document).ready(function(){
73
+
74
+ });
75
+ ```
76
+
77
+
78
+ ## License
79
+
80
+ Twitter Bootstrap Project: http://twitter.github.com/bootstrap
81
+
82
+ Copyright 2011 Twitter, Inc.
83
+
84
+ Licensed under the Apache License, Version 2.0 (the "License");
85
+ you may not use this file except in compliance with the License.
86
+ You may obtain a copy of the License at
87
+
88
+ http://www.apache.org/licenses/LICENSE-2.0
89
+
90
+ Unless required by applicable law or agreed to in writing, software
91
+ distributed under the License is distributed on an "AS IS" BASIS,
92
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
93
+ See the License for the specific language governing permissions and
94
+ limitations under the License.
95
+
96
+ Less::Rails is Copyright (c) 2011 Ken Collins, <ken@metaskills.net> and is distributed under the MIT license.
97
+
98
+
99
+
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "less/rails/bootstrap/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "less-rails-bootstrap"
7
+ s.version = Less::Rails::Bootstrap::VERSION
8
+ s.authors = ["Ken Collins"]
9
+ s.email = ["ken@metaskills.net"]
10
+ s.homepage = "http://github.com/metaskills/less-rails-bootstrap"
11
+ s.summary = %q{CSS toolkit from Twitter For Rails 3.1 Asset Pipeline}
12
+ s.description = %q{CSS toolkit from Twitter For Rails 3.1 Asset Pipeline}
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ s.require_paths = ["lib"]
17
+ s.add_runtime_dependency "less-rails", "~> 2.0.0"
18
+ end
@@ -0,0 +1,8 @@
1
+ module Less
2
+ module Rails
3
+ module Bootstrap
4
+ end
5
+ end
6
+ end
7
+
8
+ require "less/rails/bootstrap"
@@ -0,0 +1,2 @@
1
+ require "less/rails/bootstrap/version"
2
+ require "less/rails/bootstrap/engine"
@@ -0,0 +1,14 @@
1
+ module Less
2
+ module Rails
3
+ module Bootstrap
4
+ class Engine < ::Rails::Engine
5
+
6
+ config.after_initialize do |app|
7
+ bootstrap_less_files = config.root + 'vendor/stylesheets/twitter/bootstrap'
8
+ app.config.less.paths << bootstrap_less_files
9
+ end
10
+
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ module Less
2
+ module Rails
3
+ module Bootstrap
4
+ VERSION = "1.3.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ //= require twitter/bootstrap/alerts
2
+ //= require twitter/bootstrap/dropdown
3
+ //= require twitter/bootstrap/modal
4
+ //= require twitter/bootstrap/popover
5
+ //= require twitter/bootstrap/scrollspy
6
+ //= require twitter/bootstrap/tabs
7
+ //= require twitter/bootstrap/twipsy
@@ -0,0 +1,104 @@
1
+ /* ==========================================================
2
+ * bootstrap-alerts.js v1.3.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#alerts
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
+ /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
24
+ * ======================================================= */
25
+
26
+ var transitionEnd
27
+
28
+ $(document).ready(function () {
29
+
30
+ $.support.transition = (function () {
31
+ var thisBody = document.body || document.documentElement
32
+ , thisStyle = thisBody.style
33
+ , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
34
+ return support
35
+ })()
36
+
37
+ // set CSS transition event type
38
+ if ( $.support.transition ) {
39
+ transitionEnd = "TransitionEnd"
40
+ if ( $.browser.webkit ) {
41
+ transitionEnd = "webkitTransitionEnd"
42
+ } else if ( $.browser.mozilla ) {
43
+ transitionEnd = "transitionend"
44
+ } else if ( $.browser.opera ) {
45
+ transitionEnd = "oTransitionEnd"
46
+ }
47
+ }
48
+
49
+ })
50
+
51
+ /* ALERT CLASS DEFINITION
52
+ * ====================== */
53
+
54
+ var Alert = function ( content, selector ) {
55
+ this.$element = $(content)
56
+ .delegate(selector || '.close', 'click', this.close)
57
+ }
58
+
59
+ Alert.prototype = {
60
+
61
+ close: function (e) {
62
+ var $element = $(this).parent('.alert-message')
63
+
64
+ e && e.preventDefault()
65
+ $element.removeClass('in')
66
+
67
+ function removeElement () {
68
+ $element.remove()
69
+ }
70
+
71
+ $.support.transition && $element.hasClass('fade') ?
72
+ $element.bind(transitionEnd, removeElement) :
73
+ removeElement()
74
+ }
75
+
76
+ }
77
+
78
+
79
+ /* ALERT PLUGIN DEFINITION
80
+ * ======================= */
81
+
82
+ $.fn.alert = function ( options ) {
83
+
84
+ if ( options === true ) {
85
+ return this.data('alert')
86
+ }
87
+
88
+ return this.each(function () {
89
+ var $this = $(this)
90
+
91
+ if ( typeof options == 'string' ) {
92
+ return $this.data('alert')[options]()
93
+ }
94
+
95
+ $(this).data('alert', new Alert( this ))
96
+
97
+ })
98
+ }
99
+
100
+ $(document).ready(function () {
101
+ new Alert($('body'), '.alert-message[data-alert] .close')
102
+ })
103
+
104
+ }( window.jQuery || window.ender );
@@ -0,0 +1,50 @@
1
+ /* ============================================================
2
+ * bootstrap-dropdown.js v1.3.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#dropdown
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 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
+ })
33
+
34
+ /* DROPDOWN PLUGIN DEFINITION
35
+ * ========================== */
36
+
37
+ $.fn.dropdown = function ( selector ) {
38
+ return this.each(function () {
39
+ $(this).delegate(selector || d, 'click', function (e) {
40
+ var li = $(this).parent('li')
41
+ , isActive = li.hasClass('open')
42
+
43
+ clearMenus()
44
+ !isActive && li.toggleClass('open')
45
+ return false
46
+ })
47
+ })
48
+ }
49
+
50
+ }( window.jQuery || window.ender );
@@ -0,0 +1,238 @@
1
+ /* =========================================================
2
+ * bootstrap-modal.js v1.3.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#modal
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
+ /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
24
+ * ======================================================= */
25
+
26
+ var transitionEnd
27
+
28
+ $(document).ready(function () {
29
+
30
+ $.support.transition = (function () {
31
+ var thisBody = document.body || document.documentElement
32
+ , thisStyle = thisBody.style
33
+ , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
34
+ return support
35
+ })()
36
+
37
+ // set CSS transition event type
38
+ if ( $.support.transition ) {
39
+ transitionEnd = "TransitionEnd"
40
+ if ( $.browser.webkit ) {
41
+ transitionEnd = "webkitTransitionEnd"
42
+ } else if ( $.browser.mozilla ) {
43
+ transitionEnd = "transitionend"
44
+ } else if ( $.browser.opera ) {
45
+ transitionEnd = "oTransitionEnd"
46
+ }
47
+ }
48
+
49
+ })
50
+
51
+
52
+ /* MODAL PUBLIC CLASS DEFINITION
53
+ * ============================= */
54
+
55
+ var Modal = function ( content, options ) {
56
+ this.settings = $.extend({}, $.fn.modal.defaults)
57
+ this.$element = $(content)
58
+ .delegate('.close', 'click.modal', $.proxy(this.hide, this))
59
+
60
+ if ( options ) {
61
+ $.extend( this.settings, options )
62
+
63
+ if ( options.show ) {
64
+ this.show()
65
+ }
66
+ }
67
+
68
+ return this
69
+ }
70
+
71
+ Modal.prototype = {
72
+
73
+ toggle: function () {
74
+ return this[!this.isShown ? 'show' : 'hide']()
75
+ }
76
+
77
+ , show: function () {
78
+ var that = this
79
+ this.isShown = true
80
+ this.$element.trigger('show')
81
+
82
+ escape.call(this)
83
+ backdrop.call(this, function () {
84
+ that.$element
85
+ .appendTo(document.body)
86
+ .show()
87
+
88
+ if ($.support.transition && that.$element.hasClass('fade')) {
89
+ that.$element[0].offsetWidth // force reflow
90
+ }
91
+
92
+ that.$element
93
+ .addClass('in')
94
+ .trigger('shown')
95
+ })
96
+
97
+ return this
98
+ }
99
+
100
+ , hide: function (e) {
101
+ e && e.preventDefault()
102
+
103
+ var that = this
104
+ this.isShown = false
105
+
106
+ escape.call(this)
107
+
108
+ this.$element
109
+ .trigger('hide')
110
+ .removeClass('in')
111
+
112
+ function removeElement () {
113
+ that.$element
114
+ .hide()
115
+ .trigger('hidden')
116
+
117
+ backdrop.call(that)
118
+ }
119
+
120
+ $.support.transition && this.$element.hasClass('fade') ?
121
+ this.$element.one(transitionEnd, removeElement) :
122
+ removeElement()
123
+
124
+ return this
125
+ }
126
+
127
+ }
128
+
129
+
130
+ /* MODAL PRIVATE METHODS
131
+ * ===================== */
132
+
133
+ function backdrop ( callback ) {
134
+ var that = this
135
+ , animate = this.$element.hasClass('fade') ? 'fade' : ''
136
+ if ( this.isShown && this.settings.backdrop ) {
137
+ var doAnimate = $.support.transition && animate
138
+
139
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
140
+ .appendTo(document.body)
141
+
142
+ if ( this.settings.backdrop != 'static' ) {
143
+ this.$backdrop.click($.proxy(this.hide, this))
144
+ }
145
+
146
+ if ( doAnimate ) {
147
+ this.$backdrop[0].offsetWidth // force reflow
148
+ }
149
+
150
+ this.$backdrop.addClass('in')
151
+
152
+ doAnimate ?
153
+ this.$backdrop.one(transitionEnd, callback) :
154
+ callback()
155
+
156
+ } else if ( !this.isShown && this.$backdrop ) {
157
+ this.$backdrop.removeClass('in')
158
+
159
+ function removeElement() {
160
+ that.$backdrop.remove()
161
+ that.$backdrop = null
162
+ }
163
+
164
+ $.support.transition && this.$element.hasClass('fade')?
165
+ this.$backdrop.one(transitionEnd, removeElement) :
166
+ removeElement()
167
+ } else if ( callback ) {
168
+ callback()
169
+ }
170
+ }
171
+
172
+ function escape() {
173
+ var that = this
174
+ if ( this.isShown && this.settings.keyboard ) {
175
+ $(document).bind('keyup.modal', function ( e ) {
176
+ if ( e.which == 27 ) {
177
+ that.hide()
178
+ }
179
+ })
180
+ } else if ( !this.isShown ) {
181
+ $(document).unbind('keyup.modal')
182
+ }
183
+ }
184
+
185
+
186
+ /* MODAL PLUGIN DEFINITION
187
+ * ======================= */
188
+
189
+ $.fn.modal = function ( options ) {
190
+ var modal = this.data('modal')
191
+
192
+ if (!modal) {
193
+
194
+ if (typeof options == 'string') {
195
+ options = {
196
+ show: /show|toggle/.test(options)
197
+ }
198
+ }
199
+
200
+ return this.each(function () {
201
+ $(this).data('modal', new Modal(this, options))
202
+ })
203
+ }
204
+
205
+ if ( options === true ) {
206
+ return modal
207
+ }
208
+
209
+ if ( typeof options == 'string' ) {
210
+ modal[options]()
211
+ } else if ( modal ) {
212
+ modal.toggle()
213
+ }
214
+
215
+ return this
216
+ }
217
+
218
+ $.fn.modal.Modal = Modal
219
+
220
+ $.fn.modal.defaults = {
221
+ backdrop: false
222
+ , keyboard: false
223
+ , show: true
224
+ }
225
+
226
+
227
+ /* MODAL DATA- IMPLEMENTATION
228
+ * ========================== */
229
+
230
+ $(document).ready(function () {
231
+ $('body').delegate('[data-controls-modal]', 'click', function (e) {
232
+ e.preventDefault()
233
+ var $this = $(this).data('show', true)
234
+ $('#' + $this.attr('data-controls-modal')).modal( $this.data() )
235
+ })
236
+ })
237
+
238
+ }( window.jQuery || window.ender );