bootstrap-generators 1.0.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # Bootstrap Generators
2
2
 
3
- ## Installation
3
+ Bootstrap-generators provides Twitter Bootstrap generators for Rails 3.1. Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites. Checkout http://twitter.github.com/bootstrap.
4
4
 
5
- Add it to your Gemfile:
5
+ ## Rails 3.1 setup
6
+
7
+ This gem requires the use of rails 3.1.
8
+
9
+ ### Installation
10
+
11
+ In your Gemfile, add this line:
6
12
 
7
13
  `gem 'bootstrap-generators'`
8
14
 
@@ -12,7 +18,9 @@ By default Bootstrap Generators requires SimpleForm. Add the dependency on your
12
18
 
13
19
  If you don't want to use SimpleForm, and instead use the default Rails form builder, just call the install generator with `--form_builder=form_builder`.
14
20
 
15
- Run the generator:
21
+ Then run the following commands:
22
+
23
+ `bundle install`
16
24
 
17
25
  `rails generate bootstrap:install`
18
26
 
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Décio Ferreira"]
9
9
  s.email = ["decio.ferreira@decioferreira.com"]
10
10
  s.homepage = "https://github.com/decioferreira/bootstrap-generators"
11
- s.summary = %q{Bootstrap-generators provides Twitter Bootstrap generators for Rails 3.}
12
- s.description = %q{Bootstrap-generators provides Twitter Bootstrap generators for Rails 3. Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites. Checkout http://twitter.github.com/bootstrap.}
11
+ s.summary = %q{Bootstrap-generators provides Twitter Bootstrap generators for Rails 3.1.}
12
+ s.description = %q{Bootstrap-generators provides Twitter Bootstrap generators for Rails 3.1. Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites. Checkout http://twitter.github.com/bootstrap.}
13
13
 
14
14
  s.rubyforge_project = "bootstrap-generators"
15
15
 
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.add_development_dependency "bundler", "~> 1.0.0"
26
26
  s.add_development_dependency "test-unit"
27
- s.add_development_dependency "rails", "~> 3.0"
27
+ s.add_development_dependency "rails", "~> 3.1.0"
28
28
 
29
- s.add_runtime_dependency "railties", "~> 3.0"
29
+ s.add_runtime_dependency "railties", "~> 3.1.0"
30
30
  end
@@ -1,5 +1,5 @@
1
1
  module Bootstrap
2
2
  module Generators
3
- VERSION = "1.0.1"
3
+ VERSION = "1.4.0"
4
4
  end
5
5
  end
@@ -40,7 +40,7 @@ module Bootstrap
40
40
  end
41
41
 
42
42
  def create_assets
43
- if options[:stylesheet_engine].intern == :css
43
+ if options[:stylesheet_engine].nil? || options[:stylesheet_engine].to_sym == :css
44
44
  stylesheet_extension = 'css'
45
45
  else
46
46
  stylesheet_extension = "css.#{options[:stylesheet_engine]}"
@@ -29,7 +29,7 @@ body {
29
29
  }
30
30
 
31
31
  /* The white background content wrapper */
32
- .content {
32
+ .container > .content {
33
33
  background-color: #fff;
34
34
  padding: 20px;
35
35
  margin: 0 -20px; /* negative indent the amount of the padding to maintain the grid system */
@@ -42,7 +42,7 @@ body {
42
42
  }
43
43
 
44
44
  /* Page header tweaks */
45
- .content > .page-header {
45
+ .page-header {
46
46
  background-color: #f5f5f5;
47
47
  padding: 20px 20px 10px;
48
48
  margin: -20px -20px 20px;
@@ -50,5 +50,4 @@ body {
50
50
 
51
51
  .topbar .btn {
52
52
  border: 0;
53
- }
54
-
53
+ }
@@ -31,7 +31,7 @@ body {
31
31
  }
32
32
 
33
33
  /* The white background content wrapper */
34
- .content {
34
+ .container > .content {
35
35
  background-color: #fff;
36
36
  padding: 20px;
37
37
  margin: 0 -20px; /* negative indent the amount of the padding to maintain the grid system */
@@ -44,7 +44,7 @@ body {
44
44
  }
45
45
 
46
46
  /* Page header tweaks */
47
- .content > .page-header {
47
+ .page-header {
48
48
  background-color: #f5f5f5;
49
49
  padding: 20px 20px 10px;
50
50
  margin: -20px -20px 20px;
@@ -52,5 +52,4 @@ body {
52
52
 
53
53
  .topbar .btn {
54
54
  border: 0;
55
- }
56
-
55
+ }
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================
2
- * bootstrap-alerts.js v1.3.0
2
+ * bootstrap-alerts.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#alerts
4
4
  * ==========================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
20
20
 
21
21
  !function( $ ){
22
22
 
23
+ "use strict"
24
+
23
25
  /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
24
26
  * ======================================================= */
25
27
 
@@ -38,11 +40,11 @@
38
40
  if ( $.support.transition ) {
39
41
  transitionEnd = "TransitionEnd"
40
42
  if ( $.browser.webkit ) {
41
- transitionEnd = "webkitTransitionEnd"
43
+ transitionEnd = "webkitTransitionEnd"
42
44
  } else if ( $.browser.mozilla ) {
43
- transitionEnd = "transitionend"
45
+ transitionEnd = "transitionend"
44
46
  } else if ( $.browser.opera ) {
45
- transitionEnd = "oTransitionEnd"
47
+ transitionEnd = "oTransitionEnd"
46
48
  }
47
49
  }
48
50
 
@@ -0,0 +1,62 @@
1
+ /* ============================================================
2
+ * bootstrap-buttons.js v1.4.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#buttons
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 );
@@ -1,5 +1,5 @@
1
1
  /* ============================================================
2
- * bootstrap-dropdown.js v1.3.0
2
+ * bootstrap-dropdown.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#dropdown
4
4
  * ============================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
20
20
 
21
21
  !function( $ ){
22
22
 
23
+ "use strict"
24
+
23
25
  /* DROPDOWN PLUGIN DEFINITION
24
26
  * ========================== */
25
27
 
@@ -1,5 +1,5 @@
1
1
  /* =========================================================
2
- * bootstrap-modal.js v1.3.0
2
+ * bootstrap-modal.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#modal
4
4
  * =========================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
20
20
 
21
21
  !function( $ ){
22
22
 
23
+ "use strict"
24
+
23
25
  /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
24
26
  * ======================================================= */
25
27
 
@@ -87,8 +89,7 @@
87
89
  that.$element[0].offsetWidth // force reflow
88
90
  }
89
91
 
90
- that.$element
91
- .addClass('in')
92
+ that.$element.addClass('in')
92
93
 
93
94
  transition ?
94
95
  that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
@@ -115,17 +116,9 @@
115
116
  .trigger('hide')
116
117
  .removeClass('in')
117
118
 
118
- function removeElement () {
119
- that.$element
120
- .hide()
121
- .trigger('hidden')
122
-
123
- backdrop.call(that)
124
- }
125
-
126
119
  $.support.transition && this.$element.hasClass('fade') ?
127
- this.$element.one(transitionEnd, removeElement) :
128
- removeElement()
120
+ hideWithTransition.call(this) :
121
+ hideModal.call(this)
129
122
 
130
123
  return this
131
124
  }
@@ -136,6 +129,28 @@
136
129
  /* MODAL PRIVATE METHODS
137
130
  * ===================== */
138
131
 
132
+ function hideWithTransition() {
133
+ // firefox drops transitionEnd events :{o
134
+ var that = this
135
+ , timeout = setTimeout(function () {
136
+ that.$element.unbind(transitionEnd)
137
+ hideModal.call(that)
138
+ }, 500)
139
+
140
+ this.$element.one(transitionEnd, function () {
141
+ clearTimeout(timeout)
142
+ hideModal.call(that)
143
+ })
144
+ }
145
+
146
+ function hideModal (that) {
147
+ this.$element
148
+ .hide()
149
+ .trigger('hidden')
150
+
151
+ backdrop.call(this)
152
+ }
153
+
139
154
  function backdrop ( callback ) {
140
155
  var that = this
141
156
  , animate = this.$element.hasClass('fade') ? 'fade' : ''
@@ -162,19 +177,20 @@
162
177
  } else if ( !this.isShown && this.$backdrop ) {
163
178
  this.$backdrop.removeClass('in')
164
179
 
165
- function removeElement() {
166
- that.$backdrop.remove()
167
- that.$backdrop = null
168
- }
169
-
170
180
  $.support.transition && this.$element.hasClass('fade')?
171
- this.$backdrop.one(transitionEnd, removeElement) :
172
- removeElement()
181
+ this.$backdrop.one(transitionEnd, $.proxy(removeBackdrop, this)) :
182
+ removeBackdrop.call(this)
183
+
173
184
  } else if ( callback ) {
174
185
  callback()
175
186
  }
176
187
  }
177
188
 
189
+ function removeBackdrop() {
190
+ this.$backdrop.remove()
191
+ this.$backdrop = null
192
+ }
193
+
178
194
  function escape() {
179
195
  var that = this
180
196
  if ( this.isShown && this.settings.keyboard ) {
@@ -1,5 +1,5 @@
1
1
  /* ===========================================================
2
- * bootstrap-popover.js v1.3.0
2
+ * bootstrap-popover.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#popover
4
4
  * ===========================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
20
20
 
21
21
  !function( $ ) {
22
22
 
23
+ "use strict"
24
+
23
25
  var Popover = function ( element, options ) {
24
26
  this.$element = $(element)
25
27
  this.options = options
@@ -39,23 +41,28 @@
39
41
  $tip[0].className = 'popover'
40
42
  }
41
43
 
44
+ , hasContent: function () {
45
+ return this.getTitle() || this.getContent()
46
+ }
47
+
42
48
  , getContent: function () {
43
49
  var content
44
50
  , $e = this.$element
45
51
  , o = this.options
46
52
 
47
53
  if (typeof this.options.content == 'string') {
48
- content = $e.attr(o.content)
54
+ content = $e.attr(this.options.content)
49
55
  } else if (typeof this.options.content == 'function') {
50
56
  content = this.options.content.call(this.$element[0])
51
57
  }
58
+
52
59
  return content
53
60
  }
54
61
 
55
62
  , tip: function() {
56
63
  if (!this.$tip) {
57
64
  this.$tip = $('<div class="popover" />')
58
- .html('<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>')
65
+ .html(this.options.template)
59
66
  }
60
67
  return this.$tip
61
68
  }
@@ -72,6 +79,12 @@
72
79
  return this
73
80
  }
74
81
 
75
- $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'})
82
+ $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
83
+ placement: 'right'
84
+ , content: 'data-content'
85
+ , template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
86
+ })
87
+
88
+ $.fn.twipsy.rejectAttrOptions.push( 'content' )
76
89
 
77
90
  }( window.jQuery || window.ender );
@@ -1,5 +1,5 @@
1
1
  /* =============================================================
2
- * bootstrap-scrollspy.js v1.3.0
2
+ * bootstrap-scrollspy.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#scrollspy
4
4
  * =============================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
20
20
 
21
21
  !function ( $ ) {
22
22
 
23
+ "use strict"
24
+
23
25
  var $window = $(window)
24
26
 
25
27
  function ScrollSpy( topbar, selector ) {
@@ -1,5 +1,5 @@
1
1
  /* ========================================================
2
- * bootstrap-tabs.js v1.3.0
2
+ * bootstrap-tabs.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#tabs
4
4
  * ========================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
20
20
 
21
21
  !function( $ ){
22
22
 
23
+ "use strict"
24
+
23
25
  function activate ( element, container ) {
24
26
  container
25
27
  .find('> .active')
@@ -39,6 +41,7 @@
39
41
  , $ul = $this.closest('ul:not(.dropdown-menu)')
40
42
  , href = $this.attr('href')
41
43
  , previous
44
+ , $href
42
45
 
43
46
  if ( /^#\w+/.test(href) ) {
44
47
  e.preventDefault()
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================
2
- * bootstrap-twipsy.js v1.3.0
2
+ * bootstrap-twipsy.js v1.4.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#twipsy
4
4
  * Adapted from the original jQuery.tipsy by Jason Frame
5
5
  * ==========================================================
@@ -21,6 +21,8 @@
21
21
 
22
22
  !function( $ ) {
23
23
 
24
+ "use strict"
25
+
24
26
  /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
25
27
  * ======================================================= */
26
28
 
@@ -70,7 +72,7 @@
70
72
  , $tip
71
73
  , tp
72
74
 
73
- if (this.getTitle() && this.enabled) {
75
+ if (this.hasContent() && this.enabled) {
74
76
  $tip = this.tip()
75
77
  this.setContent()
76
78
 
@@ -143,6 +145,10 @@
143
145
  }
144
146
  }
145
147
 
148
+ , hasContent: function () {
149
+ return this.getTitle()
150
+ }
151
+
146
152
  , getTitle: function() {
147
153
  var title
148
154
  , $e = this.$element
@@ -162,10 +168,7 @@
162
168
  }
163
169
 
164
170
  , tip: function() {
165
- if (!this.$tip) {
166
- this.$tip = $('<div class="twipsy" />').html('<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>')
167
- }
168
- return this.$tip
171
+ return this.$tip = this.$tip || $('<div class="twipsy" />').html(this.options.template)
169
172
  }
170
173
 
171
174
  , validate: function() {
@@ -188,6 +191,10 @@
188
191
  this.enabled = !this.enabled
189
192
  }
190
193
 
194
+ , toggle: function () {
195
+ this[this.tip().hasClass('in') ? 'hide' : 'show']()
196
+ }
197
+
191
198
  }
192
199
 
193
200
 
@@ -294,10 +301,21 @@
294
301
  , offset: 0
295
302
  , title: 'title'
296
303
  , trigger: 'hover'
304
+ , template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
297
305
  }
298
306
 
307
+ $.fn.twipsy.rejectAttrOptions = [ 'title' ]
308
+
299
309
  $.fn.twipsy.elementOptions = function(ele, options) {
300
- return $.metadata ? $.extend({}, options, $(ele).metadata()) : options
310
+ var data = $(ele).data()
311
+ , rejects = $.fn.twipsy.rejectAttrOptions
312
+ , i = rejects.length
313
+
314
+ while (i--) {
315
+ delete data[rejects[i]]
316
+ }
317
+
318
+ return $.extend({}, options, data)
301
319
  }
302
320
 
303
321
  }( window.jQuery || window.ender );