twitter-bootstrap 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +39 -0
  4. data/app/assets/javascripts/bootstrap-alerts.js +111 -0
  5. data/app/assets/javascripts/bootstrap-dropdown.js +53 -0
  6. data/app/assets/javascripts/bootstrap-modal.js +244 -0
  7. data/app/assets/javascripts/bootstrap-popover.js +77 -0
  8. data/app/assets/javascripts/bootstrap-scrollspy.js +105 -0
  9. data/app/assets/javascripts/bootstrap-tabs.js +77 -0
  10. data/app/assets/javascripts/bootstrap-twipsy.js +303 -0
  11. data/app/assets/javascripts/twitter_bootstrap/application.js +9 -0
  12. data/app/assets/stylesheets/bootsrap-defaults.css.less +26 -0
  13. data/app/assets/stylesheets/bootsrap-forms.css.less +464 -0
  14. data/app/assets/stylesheets/bootsrap-mixins.css.less +217 -0
  15. data/app/assets/stylesheets/bootsrap-patterns.css.less +1006 -0
  16. data/app/assets/stylesheets/bootsrap-reset.css.less +141 -0
  17. data/app/assets/stylesheets/bootsrap-scaffolding.css.less +135 -0
  18. data/app/assets/stylesheets/bootsrap-tables.css.less +170 -0
  19. data/app/assets/stylesheets/bootsrap-type.css.less +187 -0
  20. data/app/assets/stylesheets/bootsrap-variables.css.less +60 -0
  21. data/app/controllers/twitter_bootstrap/application_controller.rb +4 -0
  22. data/app/helpers/twitter_bootstrap/application_helper.rb +4 -0
  23. data/app/views/layouts/twitter_bootstrap/application.html.erb +14 -0
  24. data/config/routes.rb +2 -0
  25. data/lib/tasks/twitter_bootstrap_tasks.rake +4 -0
  26. data/lib/twitter_bootstrap.rb +4 -0
  27. data/lib/twitter_bootstrap/engine.rb +5 -0
  28. data/lib/twitter_bootstrap/version.rb +3 -0
  29. data/test/dummy/Rakefile +7 -0
  30. data/test/dummy/app/assets/javascripts/application.js +9 -0
  31. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  32. data/test/dummy/app/controllers/application_controller.rb +3 -0
  33. data/test/dummy/app/helpers/application_helper.rb +2 -0
  34. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  35. data/test/dummy/config.ru +4 -0
  36. data/test/dummy/config/application.rb +45 -0
  37. data/test/dummy/config/boot.rb +10 -0
  38. data/test/dummy/config/database.yml +25 -0
  39. data/test/dummy/config/environment.rb +5 -0
  40. data/test/dummy/config/environments/development.rb +30 -0
  41. data/test/dummy/config/environments/production.rb +60 -0
  42. data/test/dummy/config/environments/test.rb +42 -0
  43. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  44. data/test/dummy/config/initializers/inflections.rb +10 -0
  45. data/test/dummy/config/initializers/mime_types.rb +5 -0
  46. data/test/dummy/config/initializers/secret_token.rb +7 -0
  47. data/test/dummy/config/initializers/session_store.rb +8 -0
  48. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  49. data/test/dummy/config/locales/en.yml +5 -0
  50. data/test/dummy/config/routes.rb +4 -0
  51. data/test/dummy/public/404.html +26 -0
  52. data/test/dummy/public/422.html +26 -0
  53. data/test/dummy/public/500.html +26 -0
  54. data/test/dummy/public/favicon.ico +0 -0
  55. data/test/dummy/script/rails +6 -0
  56. data/test/integration/navigation_test.rb +10 -0
  57. data/test/test_helper.rb +10 -0
  58. data/test/twitter_bootstrap_test.rb +7 -0
  59. metadata +168 -0
@@ -0,0 +1,20 @@
1
+ Copyright 2011 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = TwitterBootstrap
2
+
3
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'TwitterBootstrap'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+ Bundler::GemHelper.install_tasks
28
+
29
+ require 'rake/testtask'
30
+
31
+ Rake::TestTask.new(:test) do |t|
32
+ t.libs << 'lib'
33
+ t.libs << 'test'
34
+ t.pattern = 'test/**/*_test.rb'
35
+ t.verbose = false
36
+ end
37
+
38
+
39
+ task :default => :test
@@ -0,0 +1,111 @@
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, options ) {
55
+ this.settings = $.extend({}, $.fn.alert.defaults, options)
56
+ this.$element = $(content)
57
+ .delegate(this.settings.selector, 'click', this.close)
58
+ }
59
+
60
+ Alert.prototype = {
61
+
62
+ close: function (e) {
63
+ var $element = $(this).parent('.alert-message')
64
+
65
+ e && e.preventDefault()
66
+ $element.removeClass('in')
67
+
68
+ function removeElement () {
69
+ $element.remove()
70
+ }
71
+
72
+ $.support.transition && $element.hasClass('fade') ?
73
+ $element.bind(transitionEnd, removeElement) :
74
+ removeElement()
75
+ }
76
+
77
+ }
78
+
79
+
80
+ /* ALERT PLUGIN DEFINITION
81
+ * ======================= */
82
+
83
+ $.fn.alert = function ( options ) {
84
+
85
+ if ( options === true ) {
86
+ return this.data('alert')
87
+ }
88
+
89
+ return this.each(function () {
90
+ var $this = $(this)
91
+
92
+ if ( typeof options == 'string' ) {
93
+ return $this.data('alert')[options]()
94
+ }
95
+
96
+ $(this).data('alert', new Alert( this, options ))
97
+
98
+ })
99
+ }
100
+
101
+ $.fn.alert.defaults = {
102
+ selector: '.close'
103
+ }
104
+
105
+ $(document).ready(function () {
106
+ new Alert($('body'), {
107
+ selector: '.alert-message[data-alert] .close'
108
+ })
109
+ })
110
+
111
+ }( window.jQuery || window.ender );
@@ -0,0 +1,53 @@
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
+ /* DROPDOWN PLUGIN DEFINITION
24
+ * ========================== */
25
+
26
+ $.fn.dropdown = function ( selector ) {
27
+ return this.each(function () {
28
+ $(this).delegate(selector || d, 'click', function (e) {
29
+ var li = $(this).parent('li')
30
+ , isActive = li.hasClass('open')
31
+
32
+ clearMenus()
33
+ !isActive && li.toggleClass('open')
34
+ return false
35
+ })
36
+ })
37
+ }
38
+
39
+ /* APPLY TO STANDARD DROPDOWN ELEMENTS
40
+ * =================================== */
41
+
42
+ var d = 'a.menu, .dropdown-toggle'
43
+
44
+ function clearMenus() {
45
+ $(d).parent('li').removeClass('open')
46
+ }
47
+
48
+ $(function () {
49
+ $('html').bind("click", clearMenus)
50
+ $('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' )
51
+ })
52
+
53
+ }( window.jQuery || window.ender );
@@ -0,0 +1,244 @@
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, options)
57
+ this.$element = $(content)
58
+ .delegate('.close', 'click.modal', $.proxy(this.hide, this))
59
+
60
+ if ( this.settings.show ) {
61
+ this.show()
62
+ }
63
+
64
+ return this
65
+ }
66
+
67
+ Modal.prototype = {
68
+
69
+ toggle: function () {
70
+ return this[!this.isShown ? 'show' : 'hide']()
71
+ }
72
+
73
+ , show: function () {
74
+ var that = this
75
+ this.isShown = true
76
+ this.$element.trigger('show')
77
+
78
+ escape.call(this)
79
+ backdrop.call(this, function () {
80
+ var transition = $.support.transition && that.$element.hasClass('fade')
81
+
82
+ that.$element
83
+ .appendTo(document.body)
84
+ .show()
85
+
86
+ if (transition) {
87
+ that.$element[0].offsetWidth // force reflow
88
+ }
89
+
90
+ that.$element
91
+ .addClass('in')
92
+
93
+ transition ?
94
+ that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
95
+ that.$element.trigger('shown')
96
+
97
+ })
98
+
99
+ return this
100
+ }
101
+
102
+ , hide: function (e) {
103
+ e && e.preventDefault()
104
+
105
+ if ( !this.isShown ) {
106
+ return this
107
+ }
108
+
109
+ var that = this
110
+ this.isShown = false
111
+
112
+ escape.call(this)
113
+
114
+ this.$element
115
+ .trigger('hide')
116
+ .removeClass('in')
117
+
118
+ function removeElement () {
119
+ that.$element
120
+ .hide()
121
+ .trigger('hidden')
122
+
123
+ backdrop.call(that)
124
+ }
125
+
126
+ $.support.transition && this.$element.hasClass('fade') ?
127
+ this.$element.one(transitionEnd, removeElement) :
128
+ removeElement()
129
+
130
+ return this
131
+ }
132
+
133
+ }
134
+
135
+
136
+ /* MODAL PRIVATE METHODS
137
+ * ===================== */
138
+
139
+ function backdrop ( callback ) {
140
+ var that = this
141
+ , animate = this.$element.hasClass('fade') ? 'fade' : ''
142
+ if ( this.isShown && this.settings.backdrop ) {
143
+ var doAnimate = $.support.transition && animate
144
+
145
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
146
+ .appendTo(document.body)
147
+
148
+ if ( this.settings.backdrop != 'static' ) {
149
+ this.$backdrop.click($.proxy(this.hide, this))
150
+ }
151
+
152
+ if ( doAnimate ) {
153
+ this.$backdrop[0].offsetWidth // force reflow
154
+ }
155
+
156
+ this.$backdrop.addClass('in')
157
+
158
+ doAnimate ?
159
+ this.$backdrop.one(transitionEnd, callback) :
160
+ callback()
161
+
162
+ } else if ( !this.isShown && this.$backdrop ) {
163
+ this.$backdrop.removeClass('in')
164
+
165
+ function removeElement() {
166
+ that.$backdrop.remove()
167
+ that.$backdrop = null
168
+ }
169
+
170
+ $.support.transition && this.$element.hasClass('fade')?
171
+ this.$backdrop.one(transitionEnd, removeElement) :
172
+ removeElement()
173
+ } else if ( callback ) {
174
+ callback()
175
+ }
176
+ }
177
+
178
+ function escape() {
179
+ var that = this
180
+ if ( this.isShown && this.settings.keyboard ) {
181
+ $(document).bind('keyup.modal', function ( e ) {
182
+ if ( e.which == 27 ) {
183
+ that.hide()
184
+ }
185
+ })
186
+ } else if ( !this.isShown ) {
187
+ $(document).unbind('keyup.modal')
188
+ }
189
+ }
190
+
191
+
192
+ /* MODAL PLUGIN DEFINITION
193
+ * ======================= */
194
+
195
+ $.fn.modal = function ( options ) {
196
+ var modal = this.data('modal')
197
+
198
+ if (!modal) {
199
+
200
+ if (typeof options == 'string') {
201
+ options = {
202
+ show: /show|toggle/.test(options)
203
+ }
204
+ }
205
+
206
+ return this.each(function () {
207
+ $(this).data('modal', new Modal(this, options))
208
+ })
209
+ }
210
+
211
+ if ( options === true ) {
212
+ return modal
213
+ }
214
+
215
+ if ( typeof options == 'string' ) {
216
+ modal[options]()
217
+ } else if ( modal ) {
218
+ modal.toggle()
219
+ }
220
+
221
+ return this
222
+ }
223
+
224
+ $.fn.modal.Modal = Modal
225
+
226
+ $.fn.modal.defaults = {
227
+ backdrop: false
228
+ , keyboard: false
229
+ , show: false
230
+ }
231
+
232
+
233
+ /* MODAL DATA- IMPLEMENTATION
234
+ * ========================== */
235
+
236
+ $(document).ready(function () {
237
+ $('body').delegate('[data-controls-modal]', 'click', function (e) {
238
+ e.preventDefault()
239
+ var $this = $(this).data('show', true)
240
+ $('#' + $this.attr('data-controls-modal')).modal( $this.data() )
241
+ })
242
+ })
243
+
244
+ }( window.jQuery || window.ender );