custom-twitter-bootstrap-rails 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/README.md +158 -0
  2. data/Rakefile +3 -0
  3. data/lib/generators/bootstrap/install/install_generator.rb +21 -0
  4. data/lib/generators/bootstrap/install/templates/bootstrap.coffee +21 -0
  5. data/lib/generators/bootstrap/install/templates/bootstrap.less +5 -0
  6. data/lib/twitter-bootstrap-rails.rb +10 -0
  7. data/lib/twitter/bootstrap/rails/bootstrap.rb +2 -0
  8. data/lib/twitter/bootstrap/rails/engine.rb +17 -0
  9. data/lib/twitter/bootstrap/rails/version.rb +8 -0
  10. data/vendor/assets/javascripts/twitter/bootstrap.js +8 -0
  11. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alerts.js +113 -0
  12. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-buttons.js +62 -0
  13. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +55 -0
  14. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +260 -0
  15. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +86 -0
  16. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +107 -0
  17. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tabs.js +80 -0
  18. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-twipsy.js +310 -0
  19. data/vendor/assets/stylesheets/twitter/bootstrap.css.less +1 -0
  20. data/vendor/toolkit/twitter/bootstrap.less +1 -0
  21. data/vendor/toolkit/twitter/bootstrap/bootstrap.less +26 -0
  22. data/vendor/toolkit/twitter/bootstrap/forms.less +479 -0
  23. data/vendor/toolkit/twitter/bootstrap/mixins.less +223 -0
  24. data/vendor/toolkit/twitter/bootstrap/patterns.less +1058 -0
  25. data/vendor/toolkit/twitter/bootstrap/reset.less +141 -0
  26. data/vendor/toolkit/twitter/bootstrap/scaffolding.less +137 -0
  27. data/vendor/toolkit/twitter/bootstrap/tables.less +224 -0
  28. data/vendor/toolkit/twitter/bootstrap/type.less +187 -0
  29. data/vendor/toolkit/twitter/bootstrap/variables.less +60 -0
  30. metadata +196 -0
@@ -0,0 +1,158 @@
1
+ # Twitter Bootstrap for Rails 3.1 Asset Pipeline
2
+ Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites.
3
+ It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more.
4
+
5
+
6
+ twitter-bootstrap-rails project integrates Bootstrap CSS toolkit for Rails 3.1 Asset Pipeline
7
+
8
+
9
+ ## Installing Gem
10
+
11
+ Include Bootstrap in Gemfile;
12
+
13
+ gem 'twitter-bootstrap-rails'
14
+
15
+ or you can install from latest build;
16
+
17
+ gem 'twitter-bootstrap-rails', :git => 'http://github.com/seyhunak/twitter-bootstrap-rails.git'
18
+
19
+ You can run bundle from command line
20
+
21
+ bundle install
22
+
23
+ ## Installing to App
24
+ Run generator to install Twitter Bootstrap
25
+ You can run generator from command line
26
+
27
+
28
+ rails g bootstrap:install
29
+
30
+ Generator;
31
+
32
+ Adds bootstrap requires to application.css and application.js.
33
+ Adds bootstrap boilerplate Less and Coffee files to build with Twitter Bootstrap easily.
34
+
35
+
36
+ ## Using with Less
37
+
38
+ Bootstrap was built with Preboot, an open-source pack of mixins and variables to be used in conjunction with Less, a CSS preprocessor for faster and easier web development.
39
+
40
+ ## Using stylesheets with Less
41
+
42
+ You have to require Bootstrap LESS (bootstrap.less) in your application.css
43
+
44
+ /*
45
+ *= require twitter/bootstrap
46
+ */
47
+
48
+ /* Your stylesheets goes here... */
49
+
50
+
51
+ Now, you can override LESS files provided by Twitter Bootstrap
52
+
53
+ @import "twitter/bootstrap";
54
+
55
+ // Baseline grid
56
+ @basefont: 13px;
57
+ @baseline: 18px;
58
+
59
+
60
+ ## Using Javascripts
61
+
62
+ You have to require Bootstrap JS (bootstrap.js) in your application.js
63
+
64
+ //= require twitter/bootstrap
65
+
66
+ $(document).ready(function(){
67
+ /* Your javascripts goes here... */
68
+ });
69
+
70
+
71
+ ## Using With Coffeescript
72
+
73
+ Using Twitter Bootstrap with the CoffeeScript is easy.
74
+ Just create a "bootstrap.js.coffee" file to /app/assets/javascripts/ folder and put lines below.
75
+
76
+ $ ->
77
+ $("body > .topbar").scrollSpy()
78
+ $ ->
79
+ $(".tabs").tabs()
80
+ $ ->
81
+ $("a[rel=twipsy]").twipsy live: true
82
+ $ ->
83
+ $("a[rel=popover]").popover offset: 10
84
+ $ ->
85
+ $(".topbar-wrapper").dropdown()
86
+ $ ->
87
+ $(".alert-message").alert()
88
+ $ ->
89
+ domModal = $(".modal").modal(
90
+ backdrop: true
91
+ closeOnEscape: true
92
+ )
93
+ $(".open-modal").click ->
94
+ domModal.toggle()
95
+ $ ->
96
+ $(".btn").button "complete"
97
+
98
+
99
+ ## Using Static CSS, JS (w/o Less)
100
+
101
+ twitter-bootstrap-rails has seperate branch (w/o Less) that just serves latest static CSS, JS files.
102
+
103
+ You can install from latest build (from branch);
104
+
105
+ gem 'twitter-bootstrap-rails', :git => "git://github.com/seyhunak/twitter-bootstrap-rails.git", :branch => "static"
106
+
107
+
108
+ ## Changelog
109
+ <ul>
110
+ <li>Version 0.0.5 deprecated</li>
111
+ <li>Asset files updated to latest and removed version numbers</li>
112
+ <li>Implemented Less::Rails Railtie to use with LESS</li>
113
+ <li>Fixed railtie to only initialize Less when installed</li>
114
+ <li>Created new branch for the static version of Bootstrap (w/o Less) - check static branch</li>
115
+ <li>Added path to support heroku deploy</li>
116
+ <li>Rake precompile issue fixed</li>
117
+ <li>Updated asset files to 1.4.0</li>
118
+ <li>Updated dependency less-rails (now requires 2.1.0)</li>
119
+ <li>Added generators</li>
120
+ </ul>
121
+
122
+
123
+ ## Future
124
+ <ul>
125
+ <li>Writing tests (not implemented yet)</li>
126
+ </ul>
127
+
128
+
129
+ ## Credits
130
+ Seyhun Akyürek - seyhunak [at] gmail com
131
+
132
+ [Follow me on Twitter](http://twitter.com/seyhunak "Twitter")
133
+
134
+
135
+ ## Contributors & Patches
136
+ <ul>
137
+ <li>Daniel Morris</li>
138
+ <li>Bradly Feeley</li>
139
+ <li>Guilherme Moreira</li>
140
+ <li>Alex Behar</li>
141
+ <li>Brandon Keene</li>
142
+ <li>Anthony Corcutt</li>
143
+ <li>Colin Warren</li>
144
+ </ul>
145
+
146
+
147
+ ## Thanks
148
+ Twitter Bootstrap
149
+ http://twitter.github.com/bootstrap
150
+
151
+
152
+ ## License
153
+ Copyright (c) 2011 Seyhun Akyürek
154
+
155
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
156
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
157
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
158
+
@@ -0,0 +1,3 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
@@ -0,0 +1,21 @@
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 Asset Pipeline"
8
+
9
+ def add_assets
10
+ insert_into_file "app/assets/javascripts/application.js", "//= require twitter/bootstrap\n", :after => "jquery_ujs\n"
11
+ insert_into_file "app/assets/stylesheets/application.css", " *= require twitter/bootstrap\n", :after => "require_self\n"
12
+ end
13
+
14
+ def add_bootstrap
15
+ copy_file "bootstrap.coffee", "app/assets/javascripts/bootstrap.js.coffee"
16
+ copy_file "bootstrap.less", "app/assets/stylesheets/bootstrap.css.less"
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ $ ->
2
+ $("body > .topbar").scrollSpy()
3
+ $ ->
4
+ $(".tabs").tabs()
5
+ $ ->
6
+ $("a[rel=twipsy]").twipsy live: true
7
+ $ ->
8
+ $("a[rel=popover]").popover offset: 10
9
+ $ ->
10
+ $(".topbar-wrapper").dropdown()
11
+ $ ->
12
+ $(".alert-message").alert()
13
+ $ ->
14
+ domModal = $(".modal").modal(
15
+ backdrop: true
16
+ closeOnEscape: true
17
+ )
18
+ $(".open-modal").click ->
19
+ domModal.toggle()
20
+ $ ->
21
+ $(".btn").button "complete"
@@ -0,0 +1,5 @@
1
+ @import "twitter/bootstrap";
2
+
3
+ // Baseline grid
4
+ @basefont: 13px;
5
+ @baseline: 18px;
@@ -0,0 +1,10 @@
1
+ module Twitter
2
+ module Bootstrap
3
+ module Rails
4
+ require 'twitter/bootstrap/rails/engine' if defined?(Rails)
5
+ end
6
+ end
7
+ end
8
+
9
+ require 'less-rails'
10
+ require 'twitter/bootstrap/rails/bootstrap'
@@ -0,0 +1,2 @@
1
+ require "twitter/bootstrap/rails/version"
2
+ require "twitter/bootstrap/rails/engine"
@@ -0,0 +1,17 @@
1
+ require 'rails'
2
+
3
+ module Twitter
4
+ module Bootstrap
5
+ module Rails
6
+ class Engine < ::Rails::Engine
7
+
8
+ initializer 'twitter-bootstrap-rails.setup',
9
+ :after => 'less-rails.after.load_config_initializers',
10
+ :group => :all do |app|
11
+ app.config.less.paths << File.join(config.root, 'vendor', 'toolkit')
12
+ end
13
+
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ module Twitter
2
+ module Bootstrap
3
+ module Rails
4
+ VERSION = "1.4.1"
5
+ end
6
+ end
7
+ end
8
+
@@ -0,0 +1,8 @@
1
+ //= require twitter/bootstrap/bootstrap-alerts
2
+ //= require twitter/bootstrap/bootstrap-dropdown
3
+ //= require twitter/bootstrap/bootstrap-modal
4
+ //= require twitter/bootstrap/bootstrap-twipsy
5
+ //= require twitter/bootstrap/bootstrap-popover
6
+ //= require twitter/bootstrap/bootstrap-scrollspy
7
+ //= require twitter/bootstrap/bootstrap-tabs
8
+ //= require twitter/bootstrap/bootstrap-buttons
@@ -0,0 +1,113 @@
1
+ /* ==========================================================
2
+ * bootstrap-alerts.js v1.4.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
+ "use strict"
24
+
25
+ /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
26
+ * ======================================================= */
27
+
28
+ var transitionEnd
29
+
30
+ $(document).ready(function () {
31
+
32
+ $.support.transition = (function () {
33
+ var thisBody = document.body || document.documentElement
34
+ , thisStyle = thisBody.style
35
+ , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
36
+ return support
37
+ })()
38
+
39
+ // set CSS transition event type
40
+ if ( $.support.transition ) {
41
+ transitionEnd = "TransitionEnd"
42
+ if ( $.browser.webkit ) {
43
+ transitionEnd = "webkitTransitionEnd"
44
+ } else if ( $.browser.mozilla ) {
45
+ transitionEnd = "transitionend"
46
+ } else if ( $.browser.opera ) {
47
+ transitionEnd = "oTransitionEnd"
48
+ }
49
+ }
50
+
51
+ })
52
+
53
+ /* ALERT CLASS DEFINITION
54
+ * ====================== */
55
+
56
+ var Alert = function ( content, options ) {
57
+ this.settings = $.extend({}, $.fn.alert.defaults, options)
58
+ this.$element = $(content)
59
+ .delegate(this.settings.selector, 'click', this.close)
60
+ }
61
+
62
+ Alert.prototype = {
63
+
64
+ close: function (e) {
65
+ var $element = $(this).parent('.alert-message')
66
+
67
+ e && e.preventDefault()
68
+ $element.removeClass('in')
69
+
70
+ function removeElement () {
71
+ $element.remove()
72
+ }
73
+
74
+ $.support.transition && $element.hasClass('fade') ?
75
+ $element.bind(transitionEnd, removeElement) :
76
+ removeElement()
77
+ }
78
+
79
+ }
80
+
81
+
82
+ /* ALERT PLUGIN DEFINITION
83
+ * ======================= */
84
+
85
+ $.fn.alert = function ( options ) {
86
+
87
+ if ( options === true ) {
88
+ return this.data('alert')
89
+ }
90
+
91
+ return this.each(function () {
92
+ var $this = $(this)
93
+
94
+ if ( typeof options == 'string' ) {
95
+ return $this.data('alert')[options]()
96
+ }
97
+
98
+ $(this).data('alert', new Alert( this, options ))
99
+
100
+ })
101
+ }
102
+
103
+ $.fn.alert.defaults = {
104
+ selector: '.close'
105
+ }
106
+
107
+ $(document).ready(function () {
108
+ new Alert($('body'), {
109
+ selector: '.alert-message[data-alert] .close'
110
+ })
111
+ })
112
+
113
+ }( window.jQuery || window.ender );
@@ -0,0 +1,62 @@
1
+ /* ============================================================
2
+ * bootstrap-dropdown.js v1.4.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
+ !function( $ ){
21
+
22
+ "use strict"
23
+
24
+ function setState(el, state) {
25
+ var d = 'disabled'
26
+ , $el = $(el)
27
+ , data = $el.data()
28
+
29
+ state = state + 'Text'
30
+ data.resetText || $el.data('resetText', $el.html())
31
+
32
+ $el.html( data[state] || $.fn.button.defaults[state] )
33
+
34
+ state == 'loadingText' ?
35
+ $el.addClass(d).attr(d, d) :
36
+ $el.removeClass(d).removeAttr(d)
37
+ }
38
+
39
+ function toggle(el) {
40
+ $(el).toggleClass('active')
41
+ }
42
+
43
+ $.fn.button = function(options) {
44
+ return this.each(function () {
45
+ if (options == 'toggle') {
46
+ return toggle(this)
47
+ }
48
+ options && setState(this, options)
49
+ })
50
+ }
51
+
52
+ $.fn.button.defaults = {
53
+ loadingText: 'loading...'
54
+ }
55
+
56
+ $(function () {
57
+ $('body').delegate('.btn[data-toggle]', 'click', function () {
58
+ $(this).button('toggle')
59
+ })
60
+ })
61
+
62
+ }( window.jQuery || window.ender );
@@ -0,0 +1,55 @@
1
+ /* ============================================================
2
+ * bootstrap-dropdown.js v1.4.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
+ "use strict"
24
+
25
+ /* DROPDOWN PLUGIN DEFINITION
26
+ * ========================== */
27
+
28
+ $.fn.dropdown = function ( selector ) {
29
+ return this.each(function () {
30
+ $(this).delegate(selector || d, 'click', function (e) {
31
+ var li = $(this).parent('li')
32
+ , isActive = li.hasClass('open')
33
+
34
+ clearMenus()
35
+ !isActive && li.toggleClass('open')
36
+ return false
37
+ })
38
+ })
39
+ }
40
+
41
+ /* APPLY TO STANDARD DROPDOWN ELEMENTS
42
+ * =================================== */
43
+
44
+ var d = 'a.menu, .dropdown-toggle'
45
+
46
+ function clearMenus() {
47
+ $(d).parent('li').removeClass('open')
48
+ }
49
+
50
+ $(function () {
51
+ $('html').bind("click", clearMenus)
52
+ $('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' )
53
+ })
54
+
55
+ }( window.jQuery || window.ender );