css-bootstrap-rails 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -14,13 +14,17 @@ and add bootstrap in manifest file css file. Add into application.css
14
14
 
15
15
  to use the bootstrap javascript add the ones you want to application.js
16
16
 
17
+ //= require bootstrap/transition
17
18
  //= require bootstrap/alerts
18
- //= require bootstrap/dropdown
19
19
  //= require bootstrap/modal
20
- //= require bootstrap/popover
20
+ //= require bootstrap/dropdown
21
21
  //= require bootstrap/scrollspy
22
22
  //= require bootstrap/tabs
23
23
  //= require bootstrap/twipsy
24
+ //= require bootstrap/popover
25
+ //= require bootstrap/button
26
+ //= require bootstrap/carousel
27
+ //= require bootstrap/collapse
24
28
 
25
29
  ## Thanks
26
30
  Thanks Twitter for Bootstrap
@@ -1,8 +1,8 @@
1
1
  module Css
2
2
  module Bootstrap
3
3
  module Rails
4
- VERSION = "0.0.6"
5
- TWITTER_BOOTSTRAP = "1.4.0"
4
+ VERSION = "0.0.7"
5
+ TWITTER_BOOTSTRAP = "2.0.0"
6
6
  end
7
7
  end
8
8
  end
@@ -1,5 +1,5 @@
1
1
  /* ==========================================================
2
- * bootstrap-alerts.js v1.4.0
2
+ * bootstrap-alert.js v2.0.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#alerts
4
4
  * ==========================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -22,57 +22,31 @@
22
22
 
23
23
  "use strict"
24
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
25
  /* ALERT CLASS DEFINITION
54
26
  * ====================== */
55
27
 
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
- }
28
+ var dismiss = '[data-dismiss="alert"]'
29
+ , Alert = function ( el ) {
30
+ $(el).delegate(dismiss, 'click', this.close)
31
+ }
61
32
 
62
33
  Alert.prototype = {
63
34
 
64
- close: function (e) {
65
- var $element = $(this).parent('.alert-message')
35
+ constructor: Alert
66
36
 
37
+ , close: function ( e ) {
38
+ var $element = $(this)
39
+
40
+ $element = $element.hasClass('alert-message') ? $element : $element.parent()
67
41
  e && e.preventDefault()
68
42
  $element.removeClass('in')
69
43
 
70
- function removeElement () {
44
+ function removeElement() {
71
45
  $element.remove()
72
46
  }
73
47
 
74
48
  $.support.transition && $element.hasClass('fade') ?
75
- $element.bind(transitionEnd, removeElement) :
49
+ $element.bind($.support.transition.end, removeElement) :
76
50
  removeElement()
77
51
  }
78
52
 
@@ -82,32 +56,23 @@
82
56
  /* ALERT PLUGIN DEFINITION
83
57
  * ======================= */
84
58
 
85
- $.fn.alert = function ( options ) {
86
-
87
- if ( options === true ) {
88
- return this.data('alert')
89
- }
90
-
59
+ $.fn.alert = function ( option ) {
91
60
  return this.each(function () {
92
61
  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
-
62
+ , data = $this.data('alert')
63
+ if (!data) $this.data('alert', (data = new Alert(this)))
64
+ if (typeof option == 'string') data[option].call($this)
100
65
  })
101
66
  }
102
67
 
103
- $.fn.alert.defaults = {
104
- selector: '.close'
105
- }
68
+ $.fn.alert.Alert = Alert
106
69
 
107
- $(document).ready(function () {
108
- new Alert($('body'), {
109
- selector: '.alert-message[data-alert] .close'
110
- })
70
+
71
+ /* ALERT DATA-API
72
+ * ============== */
73
+
74
+ $(function () {
75
+ $('body').delegate(dismiss, 'click.alert.data-api', Alert.prototype.close)
111
76
  })
112
77
 
113
- }( window.jQuery || window.ender );
78
+ }( window.jQuery || window.ender )
@@ -0,0 +1,98 @@
1
+ /* ============================================================
2
+ * bootstrap-buttons.js v2.0.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
+ /* BUTTON PUBLIC CLASS DEFINITION
25
+ * ============================== */
26
+
27
+ var Button = function (element, options) {
28
+ this.$element = $(element)
29
+ this.settings = $.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.settings[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.Button = Button
87
+
88
+
89
+ /* BUTTON DATA-API
90
+ * =============== */
91
+
92
+ $(function () {
93
+ $('body').delegate('[data-toggle^=button]', 'click.button.data-api', function (e) {
94
+ $(e.srcElement).button('toggle')
95
+ })
96
+ })
97
+
98
+ }( window.jQuery || window.ender )
@@ -0,0 +1,59 @@
1
+ /* ==========================================================
2
+ * bootstrap-carousel.js v2.0.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
+ /* CAROUSEL CLASS DEFINITION
26
+ * ========================= */
27
+
28
+ var Carousel = function ( el ) {
29
+ $(el).delegate(dismiss, 'click', this.close)
30
+ }
31
+
32
+ Carousel.prototype = {
33
+
34
+ }
35
+
36
+
37
+ /* CAROUSEL PLUGIN DEFINITION
38
+ * ========================== */
39
+
40
+ $.fn.carousel = function ( option ) {
41
+ return this.each(function () {
42
+ var $this = $(this)
43
+ , data = $this.data('alert')
44
+ if (!data) $this.data('alert', (data = new Alert(this)))
45
+ if (typeof option == 'string') data[option].call($this)
46
+ })
47
+ }
48
+
49
+ $.fn.carousel.Carousel = Carousel
50
+
51
+
52
+ /* CAROUSEL DATA-API
53
+ * ================= */
54
+
55
+ // $(function () {
56
+ // $('body').delegate(dismiss, 'click.alert.data-api', Alert.prototype.close)
57
+ // })
58
+
59
+ }( window.jQuery || window.ender )
@@ -0,0 +1,135 @@
1
+ /* =============================================================
2
+ * bootstrap-collapsible.js v2.0.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#collapsible
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
+ var Collapse = function ( element, options ) {
25
+ this.$element = $(element)
26
+ this.settings = $.extend({}, $.fn.collapse.defaults, options)
27
+
28
+ if (this.settings["parent"]) {
29
+ this.$parent = $(this.settings["parent"])
30
+ }
31
+
32
+ this.settings.toggle && this.toggle()
33
+ }
34
+
35
+ Collapse.prototype = {
36
+
37
+ constructor: Collapse
38
+
39
+ , dimension: function () {
40
+ var hasWidth = this.$element.hasClass('width')
41
+ return hasWidth ? 'width' : 'height'
42
+ }
43
+
44
+ , show: function () {
45
+ var dimension = this.dimension()
46
+ , scroll = $.camelCase(['scroll', dimension].join('-'))
47
+ , actives = this.$parent && this.$parent.find('.in')
48
+ , hasData
49
+
50
+ if (actives && actives.length) {
51
+ hasData = actives.data('collapse')
52
+ actives.collapse('hide')
53
+ hasData || actives.data('collapse', null)
54
+ }
55
+
56
+ this.$element[dimension](0)
57
+ this.transition('addClass', 'show', 'shown')
58
+ this.$element[dimension](this.$element[0][scroll])
59
+
60
+ }
61
+
62
+ , hide: function () {
63
+ var dimension = this.dimension()
64
+ this.reset(this.$element[dimension]())
65
+ this.transition('removeClass', 'hide', 'hidden')
66
+ this.$element[dimension](0)
67
+ }
68
+
69
+ , reset: function ( size ) {
70
+ var dimension = this.dimension()
71
+
72
+ this.$element
73
+ .removeClass('collapse')
74
+ [dimension](size || '')
75
+ [0].offsetWidth
76
+
77
+ this.$element.addClass('collapse')
78
+ }
79
+
80
+ , transition: function ( method, startEvent, completeEvent ) {
81
+ var that = this
82
+ , complete = function () {
83
+ if (startEvent == 'show') that.reset()
84
+ that.$element.trigger(completeEvent)
85
+ }
86
+
87
+ this.$element
88
+ .trigger(startEvent)
89
+ [method]('in')
90
+
91
+ $.support.transition && this.$element.hasClass('collapse') ?
92
+ this.$element.one($.support.transition.end, complete) :
93
+ complete()
94
+ }
95
+
96
+ , toggle: function () {
97
+ this[this.$element.hasClass('in') ? 'hide' : 'show']()
98
+ }
99
+
100
+ }
101
+
102
+ /* COLLAPSIBLE PLUGIN DEFINITION
103
+ * ============================== */
104
+
105
+ $.fn.collapse = function ( option ) {
106
+ return this.each(function () {
107
+ var $this = $(this)
108
+ , data = $this.data('collapse')
109
+ , options = typeof option == 'object' && option
110
+ if (!data) $this.data('collapse', (data = new Collapse(this, options)))
111
+ if (typeof option == 'string') data[option]()
112
+ })
113
+ }
114
+
115
+ $.fn.collapse.defaults = {
116
+ toggle: true
117
+ }
118
+
119
+ $.fn.collapse.Collapse = Collapse
120
+
121
+
122
+ /* COLLAPSIBLE DATA-API
123
+ * ==================== */
124
+
125
+ $(function () {
126
+ $('body').delegate('[data-toggle=collapse]', 'click.collapse.data-api', function ( e ) {
127
+ var $this = $(this)
128
+ , target = $this.attr('data-target') || $this.attr('href')
129
+ , option = $(target).data('collapse') ? 'toggle' : $this.data()
130
+ e.preventDefault()
131
+ $(target).collapse(option)
132
+ })
133
+ })
134
+
135
+ })( window.jQuery || window.ender )
@@ -1,5 +1,5 @@
1
1
  /* ============================================================
2
- * bootstrap-dropdown.js v1.4.0
2
+ * bootstrap-dropdown.js v2.0.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#dropdown
4
4
  * ============================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -22,34 +22,54 @@
22
22
 
23
23
  "use strict"
24
24
 
25
+ /* DROPDOWN CLASS DEFINITION
26
+ * ========================= */
27
+
28
+ var toggle = '[data-toggle="dropdown"]'
29
+ , Dropdown = function ( element ) {
30
+ $(element).bind('click', this.toggle)
31
+ }
32
+
33
+ Dropdown.prototype = {
34
+
35
+ constructor: Dropdown
36
+
37
+ , toggle: function ( e ) {
38
+ var li = $(this).parent('li')
39
+ , isActive = li.hasClass('open')
40
+
41
+ clearMenus()
42
+ !isActive && li.toggleClass('open')
43
+
44
+ return false
45
+ }
46
+
47
+ }
48
+
49
+ function clearMenus() {
50
+ $(toggle).parent('li').removeClass('open')
51
+ }
52
+
53
+
25
54
  /* DROPDOWN PLUGIN DEFINITION
26
55
  * ========================== */
27
56
 
28
- $.fn.dropdown = function ( selector ) {
57
+ $.fn.dropdown = function ( option ) {
29
58
  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
- })
59
+ var $this = $(this)
60
+ , data = $this.data('dropdown')
61
+ if (!data) $this.data('dropdown', (data = new Dropdown(this)))
62
+ if (typeof option == 'string') data[option].call($this)
38
63
  })
39
64
  }
40
65
 
66
+
41
67
  /* APPLY TO STANDARD DROPDOWN ELEMENTS
42
68
  * =================================== */
43
69
 
44
- var d = 'a.menu, .dropdown-toggle'
45
-
46
- function clearMenus() {
47
- $(d).parent('li').removeClass('open')
48
- }
49
-
50
70
  $(function () {
51
- $('html').bind("click", clearMenus)
52
- $('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' )
71
+ $('html').bind('click.dropdown.data-api', clearMenus)
72
+ $('body').delegate(toggle, 'click.dropdown.data-api', Dropdown.prototype.toggle)
53
73
  })
54
74
 
55
- }( window.jQuery || window.ender );
75
+ }( window.jQuery || window.ender )