flatstrap-sass 2.3.1.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/LICENSE +14 -0
  2. data/README.md +52 -0
  3. data/lib/flatstrap-sass.rb +51 -0
  4. data/lib/flatstrap-sass/compass_functions.rb +19 -0
  5. data/lib/flatstrap-sass/engine.rb +7 -0
  6. data/lib/flatstrap-sass/sass_functions.rb +14 -0
  7. data/templates/project/manifest.rb +13 -0
  8. data/templates/project/styles.scss +5 -0
  9. data/vendor/assets/javascripts/application.js +154 -0
  10. data/vendor/assets/javascripts/bootstrap-affix.js +117 -0
  11. data/vendor/assets/javascripts/bootstrap-alert.js +99 -0
  12. data/vendor/assets/javascripts/bootstrap-button.js +105 -0
  13. data/vendor/assets/javascripts/bootstrap-carousel.js +207 -0
  14. data/vendor/assets/javascripts/bootstrap-collapse.js +167 -0
  15. data/vendor/assets/javascripts/bootstrap-dropdown.js +165 -0
  16. data/vendor/assets/javascripts/bootstrap-modal.js +247 -0
  17. data/vendor/assets/javascripts/bootstrap-popover.js +114 -0
  18. data/vendor/assets/javascripts/bootstrap-scrollspy.js +162 -0
  19. data/vendor/assets/javascripts/bootstrap-tab.js +144 -0
  20. data/vendor/assets/javascripts/bootstrap-tooltip.js +361 -0
  21. data/vendor/assets/javascripts/bootstrap-transition.js +60 -0
  22. data/vendor/assets/javascripts/bootstrap-typeahead.js +335 -0
  23. data/vendor/assets/javascripts/bootstrap.js +2159 -0
  24. data/vendor/assets/javascripts/bootstrap.min.js +6 -0
  25. data/vendor/assets/javascripts/google-code-prettify/prettify.js +28 -0
  26. data/vendor/assets/javascripts/jquery.js +2 -0
  27. data/vendor/assets/stylesheets/flatstrap-responsive.scss +1 -0
  28. data/vendor/assets/stylesheets/flatstrap.scss +1 -0
  29. data/vendor/assets/stylesheets/flatstrap/_accordion.scss +33 -0
  30. data/vendor/assets/stylesheets/flatstrap/_alerts.scss +78 -0
  31. data/vendor/assets/stylesheets/flatstrap/_breadcrumbs.scss +23 -0
  32. data/vendor/assets/stylesheets/flatstrap/_button-groups.scss +211 -0
  33. data/vendor/assets/stylesheets/flatstrap/_buttons.scss +215 -0
  34. data/vendor/assets/stylesheets/flatstrap/_carousel.scss +156 -0
  35. data/vendor/assets/stylesheets/flatstrap/_close.scss +32 -0
  36. data/vendor/assets/stylesheets/flatstrap/_code.scss +59 -0
  37. data/vendor/assets/stylesheets/flatstrap/_component-animations.scss +22 -0
  38. data/vendor/assets/stylesheets/flatstrap/_dropdowns.scss +231 -0
  39. data/vendor/assets/stylesheets/flatstrap/_font-awesome.scss +534 -0
  40. data/vendor/assets/stylesheets/flatstrap/_forms.scss +646 -0
  41. data/vendor/assets/stylesheets/flatstrap/_grid.scss +21 -0
  42. data/vendor/assets/stylesheets/flatstrap/_hero-unit.scss +24 -0
  43. data/vendor/assets/stylesheets/flatstrap/_labels-badges.scss +79 -0
  44. data/vendor/assets/stylesheets/flatstrap/_layouts.scss +16 -0
  45. data/vendor/assets/stylesheets/flatstrap/_media.scss +55 -0
  46. data/vendor/assets/stylesheets/flatstrap/_mixins.scss +654 -0
  47. data/vendor/assets/stylesheets/flatstrap/_modals.scss +91 -0
  48. data/vendor/assets/stylesheets/flatstrap/_navbar.scss +481 -0
  49. data/vendor/assets/stylesheets/flatstrap/_navs.scss +388 -0
  50. data/vendor/assets/stylesheets/flatstrap/_pager.scss +42 -0
  51. data/vendor/assets/stylesheets/flatstrap/_pagination.scss +94 -0
  52. data/vendor/assets/stylesheets/flatstrap/_popovers.scss +130 -0
  53. data/vendor/assets/stylesheets/flatstrap/_progress-bars.scss +118 -0
  54. data/vendor/assets/stylesheets/flatstrap/_reset.scss +216 -0
  55. data/vendor/assets/stylesheets/flatstrap/_responsive-1200px-min.scss +28 -0
  56. data/vendor/assets/stylesheets/flatstrap/_responsive-767px-max.scss +193 -0
  57. data/vendor/assets/stylesheets/flatstrap/_responsive-768px-979px.scss +19 -0
  58. data/vendor/assets/stylesheets/flatstrap/_responsive-navbar.scss +184 -0
  59. data/vendor/assets/stylesheets/flatstrap/_responsive-utilities.scss +74 -0
  60. data/vendor/assets/stylesheets/flatstrap/_scaffolding.scss +42 -0
  61. data/vendor/assets/stylesheets/flatstrap/_tables.scss +183 -0
  62. data/vendor/assets/stylesheets/flatstrap/_thumbnails.scss +50 -0
  63. data/vendor/assets/stylesheets/flatstrap/_tooltip.scss +69 -0
  64. data/vendor/assets/stylesheets/flatstrap/_type.scss +247 -0
  65. data/vendor/assets/stylesheets/flatstrap/_utilities.scss +45 -0
  66. data/vendor/assets/stylesheets/flatstrap/_variables.scss +296 -0
  67. data/vendor/assets/stylesheets/flatstrap/_wells.scss +25 -0
  68. data/vendor/assets/stylesheets/flatstrap/bootstrap-responsive.scss +48 -0
  69. data/vendor/assets/stylesheets/flatstrap/bootstrap.scss +63 -0
  70. metadata +180 -0
data/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ Copyright 2011 Twitter, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+
@@ -0,0 +1,52 @@
1
+ # Flatstrap for Sass
2
+
3
+ `flatstrap-sass` is an Sass-powered version of [Little Spark's Flatstrap](http://littlesparkvt.com/flatstrap/), ready to drop right into your Sass powered applications.
4
+ It is based on the work by Thomas McDonald on [bootstrap-sass](https://github.com/thomas-mcdonald/bootstrap-sass).
5
+
6
+ Enjoy.
7
+
8
+ ## Usage
9
+
10
+ ### Rails
11
+
12
+ In your Gemfile:
13
+
14
+ ```ruby
15
+ gem 'sass-rails', '~> 3.2'
16
+ gem 'flatstrap-sass', '~> 2.3.1.0'
17
+ ```
18
+
19
+ `bundle install` and restart your server to make the files available.
20
+
21
+ #### CSS
22
+
23
+ In your application.css.scss file:
24
+
25
+ ```css
26
+ @import "flatstrap";
27
+ ```
28
+
29
+ #### Javascripts
30
+
31
+ You can include the Bootstrap javascripts through two methods. In this case, Sprocket's `//= require` directives are useful, since there is no better alternative.
32
+
33
+ We have a helper that includes all available javascripts:
34
+
35
+ ```js
36
+ // Loads all Bootstrap javascripts
37
+ //= require bootstrap
38
+ ```
39
+
40
+ You can also load individual modules, provided you sort out any related dependencies.
41
+
42
+ ```js
43
+ //= require bootstrap-scrollspy
44
+ //= require bootstrap-modal
45
+ //= require bootstrap-dropdown
46
+ ```
47
+
48
+ Simples.
49
+
50
+ ### Credits
51
+
52
+ All the credits goes to [Thomas McDonald](https://twitter.com/#!/thomasmcdonald_) and his fantastic job with [bootstrap-sass](https://github.com/thomas-mcdonald/bootstrap-sass). For further documentation, consult its page.
@@ -0,0 +1,51 @@
1
+ module Flatstrap
2
+ class FrameworkNotFound < StandardError; end
3
+
4
+ # Inspired by Kaminari
5
+ def self.load!
6
+ if compass?
7
+ require 'flatstrap-sass/compass_functions'
8
+ register_compass_extension
9
+ elsif asset_pipeline?
10
+ require 'flatstrap-sass/sass_functions'
11
+ end
12
+
13
+ if rails?
14
+ require 'sass-rails'
15
+ register_rails_engine
16
+ end
17
+
18
+ if !(rails? || compass?)
19
+ raise Flatstrap::FrameworkNotFound, "flatstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded"
20
+ end
21
+
22
+ stylesheets = File.expand_path(File.join("..", 'vendor', 'assets', 'stylesheets'))
23
+ ::Sass.load_paths << stylesheets
24
+ end
25
+
26
+ private
27
+ def self.asset_pipeline?
28
+ defined?(::Sprockets)
29
+ end
30
+
31
+ def self.compass?
32
+ defined?(::Compass)
33
+ end
34
+
35
+ def self.rails?
36
+ defined?(::Rails)
37
+ end
38
+
39
+ def self.register_compass_extension
40
+ base = File.join(File.dirname(__FILE__), '..')
41
+ styles = File.join(base, 'vendor', 'assets', 'stylesheets')
42
+ templates = File.join(base, 'templates')
43
+ ::Compass::Frameworks.register('flatstrap', :path => base, :stylesheets_directory => styles, :templates_directory => templates)
44
+ end
45
+
46
+ def self.register_rails_engine
47
+ require 'flatstrap-sass/engine'
48
+ end
49
+ end
50
+
51
+ Flatstrap.load!
@@ -0,0 +1,19 @@
1
+ # This contains functions for use with a project *only* using Compass.
2
+ module Sass::Script::Functions
3
+ def image_path(source, options = {})
4
+ if defined?(::Sprockets)
5
+ ::Sass::Script::String.new sprockets_context.image_path(source.value).to_s, :string
6
+ elsif defined?(::Compass)
7
+ image_url(source, Sass::Script::Bool.new(true))
8
+ else
9
+ # Revert to the old compass-agnostic path determination
10
+ asset_sans_quotes = source.value.gsub('"', '')
11
+ Sass::Script::String.new("/images/#{asset_sans_quotes}", :string)
12
+ end
13
+ end
14
+
15
+ protected
16
+ def sprockets_context # :nodoc:
17
+ options[:custom][:sprockets_context]
18
+ end
19
+ end
@@ -0,0 +1,7 @@
1
+ module Flatstrap
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ # Rails, will you please look in our vendor? kthx
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,14 @@
1
+ require 'sass'
2
+
3
+ module Sass::Script::Functions
4
+ # LARS: Snatched from compass - 2011-11-29 - used for gradients in IE6-9
5
+ # returns an IE hex string for a color with an alpha channel
6
+ # suitable for passing to IE filters.
7
+ def ie_hex_str(color)
8
+ assert_type color, :Color
9
+ alpha = (color.alpha * 255).round
10
+ alphastr = alpha.to_s(16).rjust(2, '0')
11
+ Sass::Script::String.new("##{alphastr}#{color.send(:hex_str)[1..-1]}".upcase)
12
+ end
13
+ declare :ie_hex_str, [:color]
14
+ end
@@ -0,0 +1,13 @@
1
+ description "Flatstrap for Sass"
2
+
3
+ # Stylesheet importing bootstrap
4
+ stylesheet 'styles.scss'
5
+
6
+ #
7
+ # Other Bootstrap assets
8
+ basedir = '../../vendor/assets'
9
+
10
+ # Javascripts
11
+ %w(alert button carousel collapse dropdown modal popover scrollspy tab tooltip transition typeahead).each do |file|
12
+ javascript "#{basedir}/javascripts/bootstrap-#{file}.js", :to => "bootstrap-#{file}.js"
13
+ end
@@ -0,0 +1,5 @@
1
+ // I gather this file is a starting point for the project.
2
+ @import "flatstrap";
3
+
4
+ // Include responsive Bootstrap styles
5
+ // @import "flatstrap-responsive";
@@ -0,0 +1,154 @@
1
+ // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2
+ // IT'S ALL JUST JUNK FOR OUR DOCS!
3
+ // ++++++++++++++++++++++++++++++++++++++++++
4
+
5
+ !function ($) {
6
+
7
+ $(function(){
8
+
9
+ var $window = $(window)
10
+
11
+ // Disable certain links in docs
12
+ $('section [href^=#]').click(function (e) {
13
+ e.preventDefault()
14
+ })
15
+
16
+ // side bar
17
+ $('.bs-docs-sidenav').affix({
18
+ offset: {
19
+ top: function () { return $window.width() <= 980 ? 290 : 210 }
20
+ , bottom: 270
21
+ }
22
+ })
23
+
24
+ // make code pretty
25
+ window.prettyPrint && prettyPrint()
26
+
27
+ // add-ons
28
+ $('.add-on :checkbox').on('click', function () {
29
+ var $this = $(this)
30
+ , method = $this.attr('checked') ? 'addClass' : 'removeClass'
31
+ $(this).parents('.add-on')[method]('active')
32
+ })
33
+
34
+ // add tipsies to grid for scaffolding
35
+ if ($('#gridSystem').length) {
36
+ $('#gridSystem').tooltip({
37
+ selector: '.show-grid > div'
38
+ , title: function () { return $(this).width() + 'px' }
39
+ })
40
+ }
41
+
42
+ // tooltip demo
43
+ $('.tooltip-demo').tooltip({
44
+ selector: "a[rel=tooltip]"
45
+ })
46
+
47
+ $('.tooltip-test').tooltip()
48
+ $('.popover-test').popover()
49
+
50
+ // popover demo
51
+ $("a[rel=popover]")
52
+ .popover()
53
+ .click(function(e) {
54
+ e.preventDefault()
55
+ })
56
+
57
+ // button state demo
58
+ $('#fat-btn')
59
+ .click(function () {
60
+ var btn = $(this)
61
+ btn.button('loading')
62
+ setTimeout(function () {
63
+ btn.button('reset')
64
+ }, 3000)
65
+ })
66
+
67
+ // carousel demo
68
+ $('#myCarousel').carousel()
69
+
70
+ // javascript build logic
71
+ var inputsComponent = $("#components.download input")
72
+ , inputsPlugin = $("#plugins.download input")
73
+ , inputsVariables = $("#variables.download input")
74
+
75
+ // toggle all plugin checkboxes
76
+ $('#components.download .toggle-all').on('click', function (e) {
77
+ e.preventDefault()
78
+ inputsComponent.attr('checked', !inputsComponent.is(':checked'))
79
+ })
80
+
81
+ $('#plugins.download .toggle-all').on('click', function (e) {
82
+ e.preventDefault()
83
+ inputsPlugin.attr('checked', !inputsPlugin.is(':checked'))
84
+ })
85
+
86
+ $('#variables.download .toggle-all').on('click', function (e) {
87
+ e.preventDefault()
88
+ inputsVariables.val('')
89
+ })
90
+
91
+ // request built javascript
92
+ $('.download-btn').on('click', function () {
93
+
94
+ var css = $("#components.download input:checked")
95
+ .map(function () { return this.value })
96
+ .toArray()
97
+ , js = $("#plugins.download input:checked")
98
+ .map(function () { return this.value })
99
+ .toArray()
100
+ , vars = {}
101
+ , img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png']
102
+
103
+ $("#variables.download input")
104
+ .each(function () {
105
+ $(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
106
+ })
107
+
108
+ $.ajax({
109
+ type: 'POST'
110
+ , url: /\?dev/.test(window.location) ? 'http://localhost:3000' : 'http://bootstrap.herokuapp.com'
111
+ , dataType: 'jsonpi'
112
+ , params: {
113
+ js: js
114
+ , css: css
115
+ , vars: vars
116
+ , img: img
117
+ }
118
+ })
119
+ })
120
+ })
121
+
122
+ // Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
123
+ $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
124
+ var url = opts.url;
125
+
126
+ return {
127
+ send: function(_, completeCallback) {
128
+ var name = 'jQuery_iframe_' + jQuery.now()
129
+ , iframe, form
130
+
131
+ iframe = $('<iframe>')
132
+ .attr('name', name)
133
+ .appendTo('head')
134
+
135
+ form = $('<form>')
136
+ .attr('method', opts.type) // GET or POST
137
+ .attr('action', url)
138
+ .attr('target', name)
139
+
140
+ $.each(opts.params, function(k, v) {
141
+
142
+ $('<input>')
143
+ .attr('type', 'hidden')
144
+ .attr('name', k)
145
+ .attr('value', typeof v == 'string' ? v : JSON.stringify(v))
146
+ .appendTo(form)
147
+ })
148
+
149
+ form.appendTo('body').submit()
150
+ }
151
+ }
152
+ })
153
+
154
+ }(window.jQuery)
@@ -0,0 +1,117 @@
1
+ /* ==========================================================
2
+ * bootstrap-affix.js v2.3.1
3
+ * http://twitter.github.com/bootstrap/javascript.html#affix
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"; // jshint ;_;
24
+
25
+
26
+ /* AFFIX CLASS DEFINITION
27
+ * ====================== */
28
+
29
+ var Affix = function (element, options) {
30
+ this.options = $.extend({}, $.fn.affix.defaults, options)
31
+ this.$window = $(window)
32
+ .on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
33
+ .on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
34
+ this.$element = $(element)
35
+ this.checkPosition()
36
+ }
37
+
38
+ Affix.prototype.checkPosition = function () {
39
+ if (!this.$element.is(':visible')) return
40
+
41
+ var scrollHeight = $(document).height()
42
+ , scrollTop = this.$window.scrollTop()
43
+ , position = this.$element.offset()
44
+ , offset = this.options.offset
45
+ , offsetBottom = offset.bottom
46
+ , offsetTop = offset.top
47
+ , reset = 'affix affix-top affix-bottom'
48
+ , affix
49
+
50
+ if (typeof offset != 'object') offsetBottom = offsetTop = offset
51
+ if (typeof offsetTop == 'function') offsetTop = offset.top()
52
+ if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
53
+
54
+ affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
55
+ false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
56
+ 'bottom' : offsetTop != null && scrollTop <= offsetTop ?
57
+ 'top' : false
58
+
59
+ if (this.affixed === affix) return
60
+
61
+ this.affixed = affix
62
+ this.unpin = affix == 'bottom' ? position.top - scrollTop : null
63
+
64
+ this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
65
+ }
66
+
67
+
68
+ /* AFFIX PLUGIN DEFINITION
69
+ * ======================= */
70
+
71
+ var old = $.fn.affix
72
+
73
+ $.fn.affix = function (option) {
74
+ return this.each(function () {
75
+ var $this = $(this)
76
+ , data = $this.data('affix')
77
+ , options = typeof option == 'object' && option
78
+ if (!data) $this.data('affix', (data = new Affix(this, options)))
79
+ if (typeof option == 'string') data[option]()
80
+ })
81
+ }
82
+
83
+ $.fn.affix.Constructor = Affix
84
+
85
+ $.fn.affix.defaults = {
86
+ offset: 0
87
+ }
88
+
89
+
90
+ /* AFFIX NO CONFLICT
91
+ * ================= */
92
+
93
+ $.fn.affix.noConflict = function () {
94
+ $.fn.affix = old
95
+ return this
96
+ }
97
+
98
+
99
+ /* AFFIX DATA-API
100
+ * ============== */
101
+
102
+ $(window).on('load', function () {
103
+ $('[data-spy="affix"]').each(function () {
104
+ var $spy = $(this)
105
+ , data = $spy.data()
106
+
107
+ data.offset = data.offset || {}
108
+
109
+ data.offsetBottom && (data.offset.bottom = data.offsetBottom)
110
+ data.offsetTop && (data.offset.top = data.offsetTop)
111
+
112
+ $spy.affix(data)
113
+ })
114
+ })
115
+
116
+
117
+ }(window.jQuery);