cmaitchison-bootstrap-rails 2.0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/README.md +97 -0
  4. data/Rakefile +45 -0
  5. data/bootstrap-rails.gemspec +23 -0
  6. data/lib/bootstrap-rails.rb +13 -0
  7. data/lib/bootstrap-rails/engine.rb +6 -0
  8. data/lib/bootstrap-rails/ie_hex_str.rb +16 -0
  9. data/lib/bootstrap-rails/railtie.rb +5 -0
  10. data/lib/bootstrap-rails/version.rb +5 -0
  11. data/test/ie_hex_str_test.rb +26 -0
  12. data/test/test_helper.rb +2 -0
  13. data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
  14. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  15. data/vendor/assets/javascripts/bootstrap-alert.js +94 -0
  16. data/vendor/assets/javascripts/bootstrap-button.js +100 -0
  17. data/vendor/assets/javascripts/bootstrap-carousel.js +157 -0
  18. data/vendor/assets/javascripts/bootstrap-collapse.js +136 -0
  19. data/vendor/assets/javascripts/bootstrap-dropdown.js +92 -0
  20. data/vendor/assets/javascripts/bootstrap-modal.js +210 -0
  21. data/vendor/assets/javascripts/bootstrap-popover.js +95 -0
  22. data/vendor/assets/javascripts/bootstrap-scrollspy.js +125 -0
  23. data/vendor/assets/javascripts/bootstrap-tab.js +130 -0
  24. data/vendor/assets/javascripts/bootstrap-tooltip.js +270 -0
  25. data/vendor/assets/javascripts/bootstrap-transition.js +51 -0
  26. data/vendor/assets/javascripts/bootstrap-typeahead.js +271 -0
  27. data/vendor/assets/javascripts/bootstrap.js +12 -0
  28. data/vendor/assets/stylesheets/accordion.scss +28 -0
  29. data/vendor/assets/stylesheets/alerts.scss +70 -0
  30. data/vendor/assets/stylesheets/bootstrap.scss +62 -0
  31. data/vendor/assets/stylesheets/breadcrumbs.scss +22 -0
  32. data/vendor/assets/stylesheets/button-groups.scss +148 -0
  33. data/vendor/assets/stylesheets/buttons.scss +183 -0
  34. data/vendor/assets/stylesheets/carousel.scss +121 -0
  35. data/vendor/assets/stylesheets/close.scss +18 -0
  36. data/vendor/assets/stylesheets/code.scss +57 -0
  37. data/vendor/assets/stylesheets/component-animations.scss +18 -0
  38. data/vendor/assets/stylesheets/dropdowns.scss +130 -0
  39. data/vendor/assets/stylesheets/forms.scss +523 -0
  40. data/vendor/assets/stylesheets/grid.scss +8 -0
  41. data/vendor/assets/stylesheets/hero-unit.scss +20 -0
  42. data/vendor/assets/stylesheets/labels.scss +32 -0
  43. data/vendor/assets/stylesheets/layouts.scss +17 -0
  44. data/vendor/assets/stylesheets/mixins.scss +560 -0
  45. data/vendor/assets/stylesheets/modals.scss +83 -0
  46. data/vendor/assets/stylesheets/navbar.scss +299 -0
  47. data/vendor/assets/stylesheets/navs.scss +353 -0
  48. data/vendor/assets/stylesheets/pager.scss +30 -0
  49. data/vendor/assets/stylesheets/pagination.scss +55 -0
  50. data/vendor/assets/stylesheets/popovers.scss +49 -0
  51. data/vendor/assets/stylesheets/progress-bars.scss +95 -0
  52. data/vendor/assets/stylesheets/reset.scss +126 -0
  53. data/vendor/assets/stylesheets/responsive.scss +327 -0
  54. data/vendor/assets/stylesheets/scaffolding.scss +29 -0
  55. data/vendor/assets/stylesheets/sprites.scss +158 -0
  56. data/vendor/assets/stylesheets/tables.scss +141 -0
  57. data/vendor/assets/stylesheets/thumbnails.scss +35 -0
  58. data/vendor/assets/stylesheets/tooltip.scss +35 -0
  59. data/vendor/assets/stylesheets/type.scss +218 -0
  60. data/vendor/assets/stylesheets/utilities.scss +23 -0
  61. data/vendor/assets/stylesheets/variables.scss +107 -0
  62. data/vendor/assets/stylesheets/wells.scss +17 -0
  63. metadata +154 -0
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bootstrap-rails.gemspec
4
+ gemspec
@@ -0,0 +1,97 @@
1
+ # Twitter Bootstrap v 2.0.1 for Rails 3
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
+
7
+ anjlab-bootstrap-rails project integrates Bootstrap CSS (with SASS flavour) and JS toolkits for Rails 3 projects
8
+
9
+ ## Rails > 3.1
10
+ Include Bootstrap in Gemfile;
11
+
12
+ ``` ruby
13
+ gem 'anjlab-bootstrap-rails', '>= 2.0', :require => 'bootstrap-rails'
14
+ ```
15
+
16
+ or you can install from latest build;
17
+
18
+ ``` ruby
19
+ gem 'anjlab-bootstrap-rails', :require => 'bootstrap-rails',
20
+ :git => 'git://github.com/anjlab/bootstrap-rails.git'
21
+ ```
22
+
23
+ and run bundle install.
24
+
25
+ ## Stylesheets
26
+
27
+ Add necessary stylesheet file to app/assets/stylesheets/application.css
28
+
29
+ ``` css
30
+ *= require bootstrap
31
+ *= require responsive
32
+ ```
33
+
34
+ You can override bootstrap variables:
35
+
36
+ 1. replace `*= require bootstrap` with `*= require app_bootstrap`
37
+ 2. create `app_bootstrap.css.scss` :
38
+
39
+ ```scss
40
+ // change colors
41
+ $linkColor: red;
42
+
43
+ // change grid
44
+ $gridColumnWidth: 70px;
45
+ $gridGutterWidth: 10px;
46
+
47
+ // import original bootstrap
48
+ @import "bootstrap";
49
+ @import "responsive";
50
+ ```
51
+
52
+ ## Javascripts
53
+
54
+ Add necessary javascript(s) files to app/assets/javascripts/application.js
55
+
56
+ ``` javascript
57
+ // Include all twitter's javascripts
58
+ //= require bootstrap
59
+
60
+ // Or peek any of them yourself
61
+ //= require bootstrap-transition
62
+ //= require bootstrap-alert
63
+ //= require bootstrap-modal
64
+ //= require bootstrap-dropdown
65
+ //= require bootstrap-scrollspy
66
+ //= require bootstrap-tab
67
+ //= require bootstrap-tooltip
68
+ //= require bootstrap-popover
69
+ //= require bootstrap-button
70
+ //= require bootstrap-collapse
71
+ //= require bootstrap-carousel
72
+ //= require bootstrap-typeahead
73
+ ```
74
+
75
+ ## Upgrade notes from 1.4
76
+
77
+ - [Twitter Bootstrap Upgrade](http://twitter.github.com/bootstrap/upgrading.html)
78
+ - rm -rf tmp/cache
79
+
80
+ ## For Developers
81
+
82
+ - Fork this repo if you want fix rails integration bug
83
+ - Fork [SASS repo](https://github.com/yury/bootstrap) if you want fix SASS bug
84
+
85
+ ## Thanks
86
+ Thanks Twitter for Bootstrap
87
+ http://twitter.github.com/bootstrap
88
+
89
+ Inspired by Seyhun Akyürek and his [twitter-bootstrap-rails gem](https://github.com/seyhunak/twitter-bootstrap-rails)
90
+
91
+
92
+ ## License
93
+ Copyright (c) 2011 AnjLab
94
+
95
+ 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:
96
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
97
+ 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.
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+ desc "Update Twitter's Bootstrap"
5
+ task "update-twitter" do
6
+
7
+ Dir["vendor/twitter/img/*.*"].each do |file|
8
+ cp file, "vendor/assets/images/", :verbose => true
9
+ end
10
+
11
+ Dir["vendor/assets/stylesheets/*.*"].each {|f| FileUtils.rm(f)}
12
+ Dir["vendor/twitter/scss/*.scss"].each do |file|
13
+ cp file, "vendor/assets/stylesheets/", :verbose => true
14
+ end
15
+
16
+ Dir["vendor/assets/javascripts/*.*"].each {|f| FileUtils.rm(f)}
17
+ js_files = Dir["vendor/twitter/js/*.js"].map()
18
+ js_files.each do |file|
19
+ cp file, "vendor/assets/javascripts/", :verbose => true
20
+ end
21
+
22
+ js_priorities = {}
23
+ js_files.each {|f| js_priorities[File.basename(f)] = 1}
24
+
25
+ # dependencies
26
+ js_priorities["bootstrap-transition.js"] = 0
27
+ js_priorities["bootstrap-tooltip.js"] = 2
28
+ js_priorities["bootstrap-popover.js"] = 3
29
+
30
+ js_list = js_priorities.to_a.sort {|a,b| a[1] <=> b[1]}.map{|p| p[0]}
31
+
32
+ File.open("vendor/assets/javascripts/bootstrap.js", "w") do |f|
33
+ js_list.each do |js|
34
+ f.write "//= require #{js}\n"
35
+ end
36
+ end
37
+ end
38
+
39
+ require 'rake/testtask'
40
+
41
+ Rake::TestTask.new do |t|
42
+ t.libs << "test"
43
+ t.test_files = FileList['test/*_test.rb']
44
+ t.verbose = true
45
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/bootstrap-rails/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Chris Aitchison"]
6
+ gem.email = ["cmaitchison@gmail.com"]
7
+ gem.description = %q{Twitter Bootstrap CSS (with SASS flavour) and JS toolkits for Rails 3 projects}
8
+ gem.summary = %q{Bootstrap CSS (with SASS flavour) and JS toolkits for Rails 3 projects}
9
+ gem.homepage = "https://github.com/cmaitchison/bootstrap-rails"
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.files.reject! { |fn| fn.include? "vendor/twitter" }
14
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ gem.name = "cmaitchison-bootstrap-rails"
16
+ gem.require_paths = ["lib"]
17
+ gem.version = Bootstrap::Rails::VERSION
18
+
19
+ gem.add_dependency "railties", ">= 3.0"
20
+ gem.add_dependency "sass"
21
+ gem.add_development_dependency "bundler", ">= 1.0"
22
+ gem.add_development_dependency "rails", ">= 3.1"
23
+ end
@@ -0,0 +1,13 @@
1
+ require "rails"
2
+ require "bootstrap-rails/version"
3
+
4
+ module Bootstrap
5
+ module Rails
6
+ require "bootstrap-rails/ie_hex_str"
7
+ if ::Rails.version < "3.1"
8
+ require "bootstrap-rails/railtie"
9
+ else
10
+ require "bootstrap-rails/engine"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+ module Bootstrap
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,16 @@
1
+ require "sass"
2
+
3
+ module Sass::Script::Functions
4
+ # returns an IE hex string for a color with an alpha channel
5
+ # suitable for passing to IE filters.
6
+ # see http://msdn.microsoft.com/en-us/library/ms532930%28v=vs.85%29.aspx
7
+ def ie_hex_str(color)
8
+ assert_type color, :Color
9
+ alpha = (color.alpha * 255).round
10
+ alpha = alpha.to_s(16).rjust(2, '0')
11
+ color_string = color.rgb.map {|num| num.to_s(16).rjust(2, '0')} .join
12
+
13
+ Sass::Script::String.new("##{alpha}#{color_string}")
14
+ end
15
+ declare :ie_hex_str, :args => [:color]
16
+ end
@@ -0,0 +1,5 @@
1
+ module Bootstrap
2
+ module Rails
3
+ class Railtie < ::Rails::Railtie; end
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Bootstrap
2
+ module Rails
3
+ VERSION = "2.0.1.1"
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+ require 'sass/script'
3
+
4
+ class IeHexStrText < Test::Unit::TestCase
5
+ def test_named_color
6
+ assert_equal("#ffffffff", evaluate("ie_hex_str(#ffffff)"))
7
+ end
8
+
9
+ def test_rgba_color
10
+ assert_equal("#1affffff", evaluate("ie_hex_str(rgba(255, 255, 255, 0.1))"))
11
+ end
12
+
13
+ def test_rgb_color
14
+ assert_equal("#ffffffff", evaluate("ie_hex_str(rgb(255, 255, 255))"))
15
+ end
16
+
17
+ def test_hsl_color
18
+ assert_equal("#ffffffff", evaluate("ie_hex_str(hsl(100%, 100%, 100%))"))
19
+ end
20
+
21
+ private
22
+
23
+ def evaluate(value)
24
+ Sass::Script::Parser.parse(value, 0, 0).perform(Sass::Environment.new).to_s
25
+ end
26
+ end
@@ -0,0 +1,2 @@
1
+ require "bootstrap-rails"
2
+ require 'test/unit'
@@ -0,0 +1,94 @@
1
+ /* ==========================================================
2
+ * bootstrap-alert.js v2.0.1
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
55
+ .trigger('close')
56
+ .removeClass('in')
57
+
58
+ function removeElement() {
59
+ $parent
60
+ .trigger('closed')
61
+ .remove()
62
+ }
63
+
64
+ $.support.transition && $parent.hasClass('fade') ?
65
+ $parent.on($.support.transition.end, removeElement) :
66
+ removeElement()
67
+ }
68
+
69
+ }
70
+
71
+
72
+ /* ALERT PLUGIN DEFINITION
73
+ * ======================= */
74
+
75
+ $.fn.alert = function ( option ) {
76
+ return this.each(function () {
77
+ var $this = $(this)
78
+ , data = $this.data('alert')
79
+ if (!data) $this.data('alert', (data = new Alert(this)))
80
+ if (typeof option == 'string') data[option].call($this)
81
+ })
82
+ }
83
+
84
+ $.fn.alert.Constructor = Alert
85
+
86
+
87
+ /* ALERT DATA-API
88
+ * ============== */
89
+
90
+ $(function () {
91
+ $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
92
+ })
93
+
94
+ }( window.jQuery );
@@ -0,0 +1,100 @@
1
+ /* ============================================================
2
+ * bootstrap-button.js v2.0.1
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
+ var $btn = $(e.target)
95
+ if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
96
+ $btn.button('toggle')
97
+ })
98
+ })
99
+
100
+ }( window.jQuery );