sass-rails-bootstrap 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. data/LICENSE +13 -0
  2. data/README.md +99 -0
  3. data/Rakefile +38 -0
  4. data/lib/sass-rails-bootstrap/engine.rb +4 -0
  5. data/lib/sass-rails-bootstrap/version.rb +3 -0
  6. data/lib/sass-rails-bootstrap.rb +5 -0
  7. data/lib/tasks/sass-rails-bootstrap_tasks.rake +4 -0
  8. data/test/dummy/README.rdoc +261 -0
  9. data/test/dummy/Rakefile +7 -0
  10. data/test/dummy/app/assets/javascripts/application.js +15 -0
  11. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  12. data/test/dummy/app/controllers/application_controller.rb +3 -0
  13. data/test/dummy/app/helpers/application_helper.rb +2 -0
  14. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  15. data/test/dummy/config/application.rb +56 -0
  16. data/test/dummy/config/boot.rb +10 -0
  17. data/test/dummy/config/database.yml +25 -0
  18. data/test/dummy/config/environment.rb +5 -0
  19. data/test/dummy/config/environments/development.rb +37 -0
  20. data/test/dummy/config/environments/production.rb +67 -0
  21. data/test/dummy/config/environments/test.rb +37 -0
  22. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  23. data/test/dummy/config/initializers/inflections.rb +15 -0
  24. data/test/dummy/config/initializers/mime_types.rb +5 -0
  25. data/test/dummy/config/initializers/secret_token.rb +7 -0
  26. data/test/dummy/config/initializers/session_store.rb +8 -0
  27. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  28. data/test/dummy/config/locales/en.yml +5 -0
  29. data/test/dummy/config/routes.rb +58 -0
  30. data/test/dummy/config.ru +4 -0
  31. data/test/dummy/db/test.sqlite3 +0 -0
  32. data/test/dummy/log/test.log +2 -0
  33. data/test/dummy/public/404.html +26 -0
  34. data/test/dummy/public/422.html +26 -0
  35. data/test/dummy/public/500.html +25 -0
  36. data/test/dummy/public/favicon.ico +0 -0
  37. data/test/dummy/script/rails +6 -0
  38. data/test/sass-rails-bootstrap_test.rb +7 -0
  39. data/test/test_helper.rb +10 -0
  40. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  41. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  42. data/vendor/assets/javascripts/twitter/bootstrap/alert.js +94 -0
  43. data/vendor/assets/javascripts/twitter/bootstrap/button.js +100 -0
  44. data/vendor/assets/javascripts/twitter/bootstrap/carousel.js +161 -0
  45. data/vendor/assets/javascripts/twitter/bootstrap/collapse.js +138 -0
  46. data/vendor/assets/javascripts/twitter/bootstrap/dropdown.js +92 -0
  47. data/vendor/assets/javascripts/twitter/bootstrap/modal.js +210 -0
  48. data/vendor/assets/javascripts/twitter/bootstrap/popover.js +95 -0
  49. data/vendor/assets/javascripts/twitter/bootstrap/scrollspy.js +125 -0
  50. data/vendor/assets/javascripts/twitter/bootstrap/tab.js +130 -0
  51. data/vendor/assets/javascripts/twitter/bootstrap/tooltip.js +270 -0
  52. data/vendor/assets/javascripts/twitter/bootstrap/transition.js +51 -0
  53. data/vendor/assets/javascripts/twitter/bootstrap/typeahead.js +271 -0
  54. data/vendor/assets/javascripts/twitter/bootstrap.js +12 -0
  55. data/vendor/assets/stylesheets/twitter/_bootstrap.scss +66 -0
  56. data/vendor/assets/stylesheets/twitter/bootstrap/_accordion.sass +26 -0
  57. data/vendor/assets/stylesheets/twitter/bootstrap/_alerts.sass +54 -0
  58. data/vendor/assets/stylesheets/twitter/bootstrap/_badges.sass +44 -0
  59. data/vendor/assets/stylesheets/twitter/bootstrap/_breadcrumbs.sass +20 -0
  60. data/vendor/assets/stylesheets/twitter/bootstrap/_button-groups.sass +155 -0
  61. data/vendor/assets/stylesheets/twitter/bootstrap/_buttons.sass +161 -0
  62. data/vendor/assets/stylesheets/twitter/bootstrap/_carousel.sass +105 -0
  63. data/vendor/assets/stylesheets/twitter/bootstrap/_close.sass +16 -0
  64. data/vendor/assets/stylesheets/twitter/bootstrap/_code.sass +48 -0
  65. data/vendor/assets/stylesheets/twitter/bootstrap/_component-animations.sass +16 -0
  66. data/vendor/assets/stylesheets/twitter/bootstrap/_dropdowns.sass +130 -0
  67. data/vendor/assets/stylesheets/twitter/bootstrap/_forms.sass +492 -0
  68. data/vendor/assets/stylesheets/twitter/bootstrap/_grid.sass +8 -0
  69. data/vendor/assets/stylesheets/twitter/bootstrap/_hero-unit.sass +19 -0
  70. data/vendor/assets/stylesheets/twitter/bootstrap/_labels.sass +45 -0
  71. data/vendor/assets/stylesheets/twitter/bootstrap/_layouts.sass +13 -0
  72. data/vendor/assets/stylesheets/twitter/bootstrap/_mixins.sass +517 -0
  73. data/vendor/assets/stylesheets/twitter/bootstrap/_modals.sass +87 -0
  74. data/vendor/assets/stylesheets/twitter/bootstrap/_navbar.sass +300 -0
  75. data/vendor/assets/stylesheets/twitter/bootstrap/_navs.sass +332 -0
  76. data/vendor/assets/stylesheets/twitter/bootstrap/_pager.sass +29 -0
  77. data/vendor/assets/stylesheets/twitter/bootstrap/_pagination.sass +45 -0
  78. data/vendor/assets/stylesheets/twitter/bootstrap/_popovers.sass +54 -0
  79. data/vendor/assets/stylesheets/twitter/bootstrap/_progress-bars.sass +105 -0
  80. data/vendor/assets/stylesheets/twitter/bootstrap/_reset.sass +115 -0
  81. data/vendor/assets/stylesheets/twitter/bootstrap/_responsive.sass +333 -0
  82. data/vendor/assets/stylesheets/twitter/bootstrap/_scaffolding.sass +25 -0
  83. data/vendor/assets/stylesheets/twitter/bootstrap/_sprites.sass +273 -0
  84. data/vendor/assets/stylesheets/twitter/bootstrap/_tables.sass +158 -0
  85. data/vendor/assets/stylesheets/twitter/bootstrap/_thumbnails.sass +34 -0
  86. data/vendor/assets/stylesheets/twitter/bootstrap/_tooltip.sass +43 -0
  87. data/vendor/assets/stylesheets/twitter/bootstrap/_type.sass +209 -0
  88. data/vendor/assets/stylesheets/twitter/bootstrap/_utilities.sass +19 -0
  89. data/vendor/assets/stylesheets/twitter/bootstrap/_variables.sass +199 -0
  90. data/vendor/assets/stylesheets/twitter/bootstrap/_wells.sass +23 -0
  91. metadata +183 -0
@@ -0,0 +1,161 @@
1
+ /* ==========================================================
2
+ * bootstrap-carousel.js v2.0.2
3
+ * http://twitter.github.com/bootstrap/javascript.html#carousel
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
+ /* CAROUSEL CLASS DEFINITION
26
+ * ========================= */
27
+
28
+ var Carousel = function (element, options) {
29
+ this.$element = $(element)
30
+ this.options = $.extend({}, $.fn.carousel.defaults, options)
31
+ this.options.slide && this.slide(this.options.slide)
32
+ this.options.pause == 'hover' && this.$element
33
+ .on('mouseenter', $.proxy(this.pause, this))
34
+ .on('mouseleave', $.proxy(this.cycle, this))
35
+ }
36
+
37
+ Carousel.prototype = {
38
+
39
+ cycle: function () {
40
+ this.interval = setInterval($.proxy(this.next, this), this.options.interval)
41
+ return this
42
+ }
43
+
44
+ , to: function (pos) {
45
+ var $active = this.$element.find('.active')
46
+ , children = $active.parent().children()
47
+ , activePos = children.index($active)
48
+ , that = this
49
+
50
+ if (pos > (children.length - 1) || pos < 0) return
51
+
52
+ if (this.sliding) {
53
+ return this.$element.one('slid', function () {
54
+ that.to(pos)
55
+ })
56
+ }
57
+
58
+ if (activePos == pos) {
59
+ return this.pause().cycle()
60
+ }
61
+
62
+ return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
63
+ }
64
+
65
+ , pause: function () {
66
+ clearInterval(this.interval)
67
+ this.interval = null
68
+ return this
69
+ }
70
+
71
+ , next: function () {
72
+ if (this.sliding) return
73
+ return this.slide('next')
74
+ }
75
+
76
+ , prev: function () {
77
+ if (this.sliding) return
78
+ return this.slide('prev')
79
+ }
80
+
81
+ , slide: function (type, next) {
82
+ var $active = this.$element.find('.active')
83
+ , $next = next || $active[type]()
84
+ , isCycling = this.interval
85
+ , direction = type == 'next' ? 'left' : 'right'
86
+ , fallback = type == 'next' ? 'first' : 'last'
87
+ , that = this
88
+
89
+ this.sliding = true
90
+
91
+ isCycling && this.pause()
92
+
93
+ $next = $next.length ? $next : this.$element.find('.item')[fallback]()
94
+
95
+ if ($next.hasClass('active')) return
96
+
97
+ if (!$.support.transition && this.$element.hasClass('slide')) {
98
+ this.$element.trigger('slide')
99
+ $active.removeClass('active')
100
+ $next.addClass('active')
101
+ this.sliding = false
102
+ this.$element.trigger('slid')
103
+ } else {
104
+ $next.addClass(type)
105
+ $next[0].offsetWidth // force reflow
106
+ $active.addClass(direction)
107
+ $next.addClass(direction)
108
+ this.$element.trigger('slide')
109
+ this.$element.one($.support.transition.end, function () {
110
+ $next.removeClass([type, direction].join(' ')).addClass('active')
111
+ $active.removeClass(['active', direction].join(' '))
112
+ that.sliding = false
113
+ setTimeout(function () { that.$element.trigger('slid') }, 0)
114
+ })
115
+ }
116
+
117
+ isCycling && this.cycle()
118
+
119
+ return this
120
+ }
121
+
122
+ }
123
+
124
+
125
+ /* CAROUSEL PLUGIN DEFINITION
126
+ * ========================== */
127
+
128
+ $.fn.carousel = function ( option ) {
129
+ return this.each(function () {
130
+ var $this = $(this)
131
+ , data = $this.data('carousel')
132
+ , options = typeof option == 'object' && option
133
+ if (!data) $this.data('carousel', (data = new Carousel(this, options)))
134
+ if (typeof option == 'number') data.to(option)
135
+ else if (typeof option == 'string' || (option = options.slide)) data[option]()
136
+ else data.cycle()
137
+ })
138
+ }
139
+
140
+ $.fn.carousel.defaults = {
141
+ interval: 5000
142
+ , pause: 'hover'
143
+ }
144
+
145
+ $.fn.carousel.Constructor = Carousel
146
+
147
+
148
+ /* CAROUSEL DATA-API
149
+ * ================= */
150
+
151
+ $(function () {
152
+ $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
153
+ var $this = $(this), href
154
+ , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
155
+ , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
156
+ $target.carousel(options)
157
+ e.preventDefault()
158
+ })
159
+ })
160
+
161
+ }( window.jQuery );
@@ -0,0 +1,138 @@
1
+ /* =============================================================
2
+ * bootstrap-collapse.js v2.0.2
3
+ * http://twitter.github.com/bootstrap/javascript.html#collapse
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
+ var Collapse = function ( element, options ) {
25
+ this.$element = $(element)
26
+ this.options = $.extend({}, $.fn.collapse.defaults, options)
27
+
28
+ if (this.options["parent"]) {
29
+ this.$parent = $(this.options["parent"])
30
+ }
31
+
32
+ this.options.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 || 'auto')
75
+ [0].offsetWidth
76
+
77
+ this.$element[size ? 'addClass' : 'removeClass']('collapse')
78
+
79
+ return this
80
+ }
81
+
82
+ , transition: function ( method, startEvent, completeEvent ) {
83
+ var that = this
84
+ , complete = function () {
85
+ if (startEvent == 'show') that.reset()
86
+ that.$element.trigger(completeEvent)
87
+ }
88
+
89
+ this.$element
90
+ .trigger(startEvent)
91
+ [method]('in')
92
+
93
+ $.support.transition && this.$element.hasClass('collapse') ?
94
+ this.$element.one($.support.transition.end, complete) :
95
+ complete()
96
+ }
97
+
98
+ , toggle: function () {
99
+ this[this.$element.hasClass('in') ? 'hide' : 'show']()
100
+ }
101
+
102
+ }
103
+
104
+ /* COLLAPSIBLE PLUGIN DEFINITION
105
+ * ============================== */
106
+
107
+ $.fn.collapse = function ( option ) {
108
+ return this.each(function () {
109
+ var $this = $(this)
110
+ , data = $this.data('collapse')
111
+ , options = typeof option == 'object' && option
112
+ if (!data) $this.data('collapse', (data = new Collapse(this, options)))
113
+ if (typeof option == 'string') data[option]()
114
+ })
115
+ }
116
+
117
+ $.fn.collapse.defaults = {
118
+ toggle: true
119
+ }
120
+
121
+ $.fn.collapse.Constructor = Collapse
122
+
123
+
124
+ /* COLLAPSIBLE DATA-API
125
+ * ==================== */
126
+
127
+ $(function () {
128
+ $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
129
+ var $this = $(this), href
130
+ , target = $this.attr('data-target')
131
+ || e.preventDefault()
132
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
133
+ , option = $(target).data('collapse') ? 'toggle' : $this.data()
134
+ $(target).collapse(option)
135
+ })
136
+ })
137
+
138
+ }( window.jQuery );
@@ -0,0 +1,92 @@
1
+ /* ============================================================
2
+ * bootstrap-dropdown.js v2.0.2
3
+ * http://twitter.github.com/bootstrap/javascript.html#dropdowns
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
+ /* DROPDOWN CLASS DEFINITION
26
+ * ========================= */
27
+
28
+ var toggle = '[data-toggle="dropdown"]'
29
+ , Dropdown = function ( element ) {
30
+ var $el = $(element).on('click.dropdown.data-api', this.toggle)
31
+ $('html').on('click.dropdown.data-api', function () {
32
+ $el.parent().removeClass('open')
33
+ })
34
+ }
35
+
36
+ Dropdown.prototype = {
37
+
38
+ constructor: Dropdown
39
+
40
+ , toggle: function ( e ) {
41
+ var $this = $(this)
42
+ , selector = $this.attr('data-target')
43
+ , $parent
44
+ , isActive
45
+
46
+ if (!selector) {
47
+ selector = $this.attr('href')
48
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
49
+ }
50
+
51
+ $parent = $(selector)
52
+ $parent.length || ($parent = $this.parent())
53
+
54
+ isActive = $parent.hasClass('open')
55
+
56
+ clearMenus()
57
+ !isActive && $parent.toggleClass('open')
58
+
59
+ return false
60
+ }
61
+
62
+ }
63
+
64
+ function clearMenus() {
65
+ $(toggle).parent().removeClass('open')
66
+ }
67
+
68
+
69
+ /* DROPDOWN PLUGIN DEFINITION
70
+ * ========================== */
71
+
72
+ $.fn.dropdown = function ( option ) {
73
+ return this.each(function () {
74
+ var $this = $(this)
75
+ , data = $this.data('dropdown')
76
+ if (!data) $this.data('dropdown', (data = new Dropdown(this)))
77
+ if (typeof option == 'string') data[option].call($this)
78
+ })
79
+ }
80
+
81
+ $.fn.dropdown.Constructor = Dropdown
82
+
83
+
84
+ /* APPLY TO STANDARD DROPDOWN ELEMENTS
85
+ * =================================== */
86
+
87
+ $(function () {
88
+ $('html').on('click.dropdown.data-api', clearMenus)
89
+ $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
90
+ })
91
+
92
+ }( window.jQuery );
@@ -0,0 +1,210 @@
1
+ /* =========================================================
2
+ * bootstrap-modal.js v2.0.2
3
+ * http://twitter.github.com/bootstrap/javascript.html#modals
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
+ /* MODAL CLASS DEFINITION
26
+ * ====================== */
27
+
28
+ var Modal = function ( content, options ) {
29
+ this.options = options
30
+ this.$element = $(content)
31
+ .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
32
+ }
33
+
34
+ Modal.prototype = {
35
+
36
+ constructor: Modal
37
+
38
+ , toggle: function () {
39
+ return this[!this.isShown ? 'show' : 'hide']()
40
+ }
41
+
42
+ , show: function () {
43
+ var that = this
44
+
45
+ if (this.isShown) return
46
+
47
+ $('body').addClass('modal-open')
48
+
49
+ this.isShown = true
50
+ this.$element.trigger('show')
51
+
52
+ escape.call(this)
53
+ backdrop.call(this, function () {
54
+ var transition = $.support.transition && that.$element.hasClass('fade')
55
+
56
+ !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
57
+
58
+ that.$element
59
+ .show()
60
+
61
+ if (transition) {
62
+ that.$element[0].offsetWidth // force reflow
63
+ }
64
+
65
+ that.$element.addClass('in')
66
+
67
+ transition ?
68
+ that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
69
+ that.$element.trigger('shown')
70
+
71
+ })
72
+ }
73
+
74
+ , hide: function ( e ) {
75
+ e && e.preventDefault()
76
+
77
+ if (!this.isShown) return
78
+
79
+ var that = this
80
+ this.isShown = false
81
+
82
+ $('body').removeClass('modal-open')
83
+
84
+ escape.call(this)
85
+
86
+ this.$element
87
+ .trigger('hide')
88
+ .removeClass('in')
89
+
90
+ $.support.transition && this.$element.hasClass('fade') ?
91
+ hideWithTransition.call(this) :
92
+ hideModal.call(this)
93
+ }
94
+
95
+ }
96
+
97
+
98
+ /* MODAL PRIVATE METHODS
99
+ * ===================== */
100
+
101
+ function hideWithTransition() {
102
+ var that = this
103
+ , timeout = setTimeout(function () {
104
+ that.$element.off($.support.transition.end)
105
+ hideModal.call(that)
106
+ }, 500)
107
+
108
+ this.$element.one($.support.transition.end, function () {
109
+ clearTimeout(timeout)
110
+ hideModal.call(that)
111
+ })
112
+ }
113
+
114
+ function hideModal( that ) {
115
+ this.$element
116
+ .hide()
117
+ .trigger('hidden')
118
+
119
+ backdrop.call(this)
120
+ }
121
+
122
+ function backdrop( callback ) {
123
+ var that = this
124
+ , animate = this.$element.hasClass('fade') ? 'fade' : ''
125
+
126
+ if (this.isShown && this.options.backdrop) {
127
+ var doAnimate = $.support.transition && animate
128
+
129
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
130
+ .appendTo(document.body)
131
+
132
+ if (this.options.backdrop != 'static') {
133
+ this.$backdrop.click($.proxy(this.hide, this))
134
+ }
135
+
136
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
137
+
138
+ this.$backdrop.addClass('in')
139
+
140
+ doAnimate ?
141
+ this.$backdrop.one($.support.transition.end, callback) :
142
+ callback()
143
+
144
+ } else if (!this.isShown && this.$backdrop) {
145
+ this.$backdrop.removeClass('in')
146
+
147
+ $.support.transition && this.$element.hasClass('fade')?
148
+ this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
149
+ removeBackdrop.call(this)
150
+
151
+ } else if (callback) {
152
+ callback()
153
+ }
154
+ }
155
+
156
+ function removeBackdrop() {
157
+ this.$backdrop.remove()
158
+ this.$backdrop = null
159
+ }
160
+
161
+ function escape() {
162
+ var that = this
163
+ if (this.isShown && this.options.keyboard) {
164
+ $(document).on('keyup.dismiss.modal', function ( e ) {
165
+ e.which == 27 && that.hide()
166
+ })
167
+ } else if (!this.isShown) {
168
+ $(document).off('keyup.dismiss.modal')
169
+ }
170
+ }
171
+
172
+
173
+ /* MODAL PLUGIN DEFINITION
174
+ * ======================= */
175
+
176
+ $.fn.modal = function ( option ) {
177
+ return this.each(function () {
178
+ var $this = $(this)
179
+ , data = $this.data('modal')
180
+ , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
181
+ if (!data) $this.data('modal', (data = new Modal(this, options)))
182
+ if (typeof option == 'string') data[option]()
183
+ else if (options.show) data.show()
184
+ })
185
+ }
186
+
187
+ $.fn.modal.defaults = {
188
+ backdrop: true
189
+ , keyboard: true
190
+ , show: true
191
+ }
192
+
193
+ $.fn.modal.Constructor = Modal
194
+
195
+
196
+ /* MODAL DATA-API
197
+ * ============== */
198
+
199
+ $(function () {
200
+ $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
201
+ var $this = $(this), href
202
+ , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
203
+ , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
204
+
205
+ e.preventDefault()
206
+ $target.modal(option)
207
+ })
208
+ })
209
+
210
+ }( window.jQuery );
@@ -0,0 +1,95 @@
1
+ /* ===========================================================
2
+ * bootstrap-popover.js v2.0.2
3
+ * http://twitter.github.com/bootstrap/javascript.html#popovers
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
+ var Popover = function ( element, options ) {
26
+ this.init('popover', element, options)
27
+ }
28
+
29
+ /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
30
+ ========================================== */
31
+
32
+ Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
33
+
34
+ constructor: Popover
35
+
36
+ , setContent: function () {
37
+ var $tip = this.tip()
38
+ , title = this.getTitle()
39
+ , content = this.getContent()
40
+
41
+ $tip.find('.popover-title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
42
+ $tip.find('.popover-content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content)
43
+
44
+ $tip.removeClass('fade top bottom left right in')
45
+ }
46
+
47
+ , hasContent: function () {
48
+ return this.getTitle() || this.getContent()
49
+ }
50
+
51
+ , getContent: function () {
52
+ var content
53
+ , $e = this.$element
54
+ , o = this.options
55
+
56
+ content = $e.attr('data-content')
57
+ || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
58
+
59
+ content = content.toString().replace(/(^\s*|\s*$)/, "")
60
+
61
+ return content
62
+ }
63
+
64
+ , tip: function() {
65
+ if (!this.$tip) {
66
+ this.$tip = $(this.options.template)
67
+ }
68
+ return this.$tip
69
+ }
70
+
71
+ })
72
+
73
+
74
+ /* POPOVER PLUGIN DEFINITION
75
+ * ======================= */
76
+
77
+ $.fn.popover = function ( option ) {
78
+ return this.each(function () {
79
+ var $this = $(this)
80
+ , data = $this.data('popover')
81
+ , options = typeof option == 'object' && option
82
+ if (!data) $this.data('popover', (data = new Popover(this, options)))
83
+ if (typeof option == 'string') data[option]()
84
+ })
85
+ }
86
+
87
+ $.fn.popover.Constructor = Popover
88
+
89
+ $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
90
+ placement: 'right'
91
+ , content: ''
92
+ , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
93
+ })
94
+
95
+ }( window.jQuery );