twitter-bootstrap-rails 2.2.8 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of twitter-bootstrap-rails might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +160 -228
- data/Rakefile +4 -6
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +279 -38
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/javascripts/twitter/bootstrap/affix.js +142 -0
- data/app/assets/javascripts/twitter/bootstrap/alert.js +92 -0
- data/app/assets/javascripts/twitter/bootstrap/button.js +110 -0
- data/app/assets/javascripts/twitter/bootstrap/carousel.js +223 -0
- data/app/assets/javascripts/twitter/bootstrap/collapse.js +170 -0
- data/app/assets/javascripts/twitter/bootstrap/dropdown.js +151 -0
- data/app/assets/javascripts/twitter/bootstrap/modal.js +280 -0
- data/app/assets/javascripts/twitter/bootstrap/popover.js +113 -0
- data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +170 -0
- data/app/assets/javascripts/twitter/bootstrap/tab.js +128 -0
- data/app/assets/javascripts/twitter/bootstrap/tooltip.js +457 -0
- data/app/assets/javascripts/twitter/bootstrap/transition.js +59 -0
- data/app/assets/javascripts/twitter/bootstrap.js +12 -13
- data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +1 -890
- data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +2026 -787
- data/app/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +1 -146
- data/app/helpers/bootstrap_flash_helper.rb +14 -7
- data/app/helpers/form_errors_helper.rb +22 -0
- data/app/helpers/glyph_helper.rb +8 -5
- data/app/helpers/modal_helper.rb +26 -22
- data/app/helpers/navbar_helper.rb +47 -32
- data/app/helpers/twitter_breadcrumbs_helper.rb +6 -2
- data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +8 -8
- data/lib/generators/bootstrap/install/install_generator.rb +3 -2
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +13 -11
- data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +5 -0
- data/lib/generators/bootstrap/layout/layout_generator.rb +1 -4
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +27 -48
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +19 -34
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +13 -30
- data/lib/generators/bootstrap/partial/templates/_login.html.erb +2 -3
- data/lib/generators/bootstrap/themed/templates/_form.html.erb +30 -10
- data/lib/generators/bootstrap/themed/templates/_form.html.haml +10 -8
- data/lib/generators/bootstrap/themed/templates/_form.html.slim +11 -9
- data/lib/generators/bootstrap/themed/templates/edit.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/index.html.erb +2 -2
- data/lib/generators/bootstrap/themed/templates/index.html.haml +2 -2
- data/lib/generators/bootstrap/themed/templates/index.html.slim +4 -5
- data/lib/generators/bootstrap/themed/templates/new.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.erb +5 -7
- data/lib/generators/bootstrap/themed/templates/show.html.haml +4 -4
- data/lib/generators/bootstrap/themed/templates/show.html.slim +6 -7
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +5 -5
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +3 -3
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +4 -4
- data/lib/generators/bootstrap/themed/themed_generator.rb +2 -2
- data/lib/twitter/bootstrap/rails/breadcrumbs.rb +69 -0
- data/lib/twitter/bootstrap/rails/engine.rb +17 -10
- data/lib/twitter/bootstrap/rails/version.rb +2 -2
- data/spec/lib/breadcrumbs_spec.rb +99 -0
- data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +12 -4
- data/spec/lib/twitter_bootstrap_rails/bootstrap_flash_helper_spec.rb +128 -0
- data/spec/lib/twitter_bootstrap_rails/form_errors_helper_spec.rb +148 -0
- data/spec/lib/twitter_bootstrap_rails/glyph_helper_spec.rb +24 -0
- data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +15 -15
- data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +207 -173
- data/spec/lib/twitter_bootstrap_rails/uri_state_spec.rb +18 -16
- data/spec/spec_helper.rb +11 -1
- data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +5796 -1
- data/vendor/static-source/bootstrap.less +0 -1
- data/vendor/static-source/fontawesome.less +0 -1
- data/vendor/static-source/sprites.less +1 -1
- data/vendor/toolkit/fontawesome/bordered-pulled.less +16 -0
- data/vendor/toolkit/fontawesome/core.less +8 -126
- data/vendor/toolkit/fontawesome/fixed-width.less +6 -0
- data/vendor/toolkit/fontawesome/font-awesome.less +9 -25
- data/vendor/toolkit/fontawesome/icons.less +549 -378
- data/vendor/toolkit/fontawesome/larger.less +13 -0
- data/vendor/toolkit/fontawesome/list.less +19 -0
- data/vendor/toolkit/fontawesome/mixins.less +16 -39
- data/vendor/toolkit/fontawesome/path.less +5 -5
- data/vendor/toolkit/fontawesome/rotated-flipped.less +20 -0
- data/vendor/toolkit/fontawesome/spinning.less +29 -0
- data/vendor/toolkit/fontawesome/stacked.less +20 -0
- data/vendor/toolkit/fontawesome/variables.less +557 -731
- data/vendor/toolkit/twitter/bootstrap/alerts.less +47 -58
- data/vendor/toolkit/twitter/bootstrap/badges.less +55 -0
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +26 -39
- data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +11 -9
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +168 -152
- data/vendor/toolkit/twitter/bootstrap/buttons.less +101 -170
- data/vendor/toolkit/twitter/bootstrap/carousel.less +150 -65
- data/vendor/toolkit/twitter/bootstrap/close.less +20 -19
- data/vendor/toolkit/twitter/bootstrap/code.less +38 -30
- data/vendor/toolkit/twitter/bootstrap/component-animations.less +12 -3
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +115 -148
- data/vendor/toolkit/twitter/bootstrap/forms.less +401 -547
- data/vendor/toolkit/twitter/bootstrap/glyphicons.less +234 -0
- data/vendor/toolkit/twitter/bootstrap/grid.less +74 -11
- data/vendor/toolkit/twitter/bootstrap/input-groups.less +166 -0
- data/vendor/toolkit/twitter/bootstrap/jumbotron.less +48 -0
- data/vendor/toolkit/twitter/bootstrap/labels.less +64 -0
- data/vendor/toolkit/twitter/bootstrap/list-group.less +132 -0
- data/vendor/toolkit/twitter/bootstrap/media.less +8 -7
- data/vendor/toolkit/twitter/bootstrap/mixins/alerts.less +14 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/background-variant.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/border-radius.less +18 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/buttons.less +52 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/center-block.less +7 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/clearfix.less +22 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/forms.less +85 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/gradients.less +59 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/grid-framework.less +91 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/grid.less +122 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/hide-text.less +21 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/image.less +33 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/labels.less +12 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/list-group.less +29 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/nav-divider.less +10 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/nav-vertical-align.less +9 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/opacity.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/pagination.less +23 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/panels.less +24 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/progress-bar.less +10 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/reset-filter.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/resize.less +6 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/responsive-visibility.less +15 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/size.less +10 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/tab-focus.less +9 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/table-row.less +28 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/text-emphasis.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/text-overflow.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/mixins/vendor-prefixes.less +224 -0
- data/vendor/toolkit/twitter/bootstrap/mixins.less +36 -699
- data/vendor/toolkit/twitter/bootstrap/modals.less +109 -54
- data/vendor/toolkit/twitter/bootstrap/navbar.less +542 -384
- data/vendor/toolkit/twitter/bootstrap/navs.less +192 -359
- data/vendor/toolkit/twitter/bootstrap/normalize.less +425 -0
- data/vendor/toolkit/twitter/bootstrap/pager.less +46 -34
- data/vendor/toolkit/twitter/bootstrap/pagination.less +70 -105
- data/vendor/toolkit/twitter/bootstrap/panels.less +248 -0
- data/vendor/toolkit/twitter/bootstrap/popovers.less +61 -61
- data/vendor/toolkit/twitter/bootstrap/print.less +101 -0
- data/vendor/toolkit/twitter/bootstrap/progress-bars.less +51 -73
- data/vendor/toolkit/twitter/bootstrap/responsive-embed.less +34 -0
- data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +177 -42
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +120 -23
- data/vendor/toolkit/twitter/bootstrap/tables.less +171 -182
- data/vendor/toolkit/twitter/bootstrap/theme.less +260 -0
- data/vendor/toolkit/twitter/bootstrap/thumbnails.less +26 -43
- data/vendor/toolkit/twitter/bootstrap/tooltip.less +49 -24
- data/vendor/toolkit/twitter/bootstrap/type.less +208 -147
- data/vendor/toolkit/twitter/bootstrap/utilities.less +33 -7
- data/vendor/toolkit/twitter/bootstrap/variables.less +761 -215
- data/vendor/toolkit/twitter/bootstrap/wells.less +7 -7
- metadata +156 -130
- data/app/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- data/app/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-affix.js +0 -117
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +0 -99
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-button.js +0 -105
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +0 -207
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +0 -167
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +0 -169
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +0 -247
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +0 -114
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +0 -162
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +0 -144
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +0 -361
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +0 -60
- data/app/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +0 -335
- data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +0 -42
- data/test/lib/breadcrumbs_test.rb +0 -75
- data/test/test_helper.rb +0 -11
- data/vendor/toolkit/fontawesome/bootstrap.less +0 -84
- data/vendor/toolkit/fontawesome/extras.less +0 -93
- data/vendor/toolkit/fontawesome/font-awesome-ie7.less +0 -1953
- data/vendor/toolkit/twitter/bootstrap/accordion.less +0 -34
- data/vendor/toolkit/twitter/bootstrap/hero-unit.less +0 -25
- data/vendor/toolkit/twitter/bootstrap/labels-badges.less +0 -84
- data/vendor/toolkit/twitter/bootstrap/layouts.less +0 -16
- data/vendor/toolkit/twitter/bootstrap/reset.less +0 -216
- data/vendor/toolkit/twitter/bootstrap/responsive-1200px-min.less +0 -28
- data/vendor/toolkit/twitter/bootstrap/responsive-767px-max.less +0 -193
- data/vendor/toolkit/twitter/bootstrap/responsive-768px-979px.less +0 -19
- data/vendor/toolkit/twitter/bootstrap/responsive-navbar.less +0 -189
- data/vendor/toolkit/twitter/bootstrap/responsive.less +0 -48
- data/vendor/toolkit/twitter/bootstrap/sprites.less +0 -197
@@ -1,335 +0,0 @@
|
|
1
|
-
/* =============================================================
|
2
|
-
* bootstrap-typeahead.js v2.3.2
|
3
|
-
* http://twitter.github.com/bootstrap/javascript.html#typeahead
|
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
|
-
/* TYPEAHEAD PUBLIC CLASS DEFINITION
|
27
|
-
* ================================= */
|
28
|
-
|
29
|
-
var Typeahead = function (element, options) {
|
30
|
-
this.$element = $(element)
|
31
|
-
this.options = $.extend({}, $.fn.typeahead.defaults, options)
|
32
|
-
this.matcher = this.options.matcher || this.matcher
|
33
|
-
this.sorter = this.options.sorter || this.sorter
|
34
|
-
this.highlighter = this.options.highlighter || this.highlighter
|
35
|
-
this.updater = this.options.updater || this.updater
|
36
|
-
this.source = this.options.source
|
37
|
-
this.$menu = $(this.options.menu)
|
38
|
-
this.shown = false
|
39
|
-
this.listen()
|
40
|
-
}
|
41
|
-
|
42
|
-
Typeahead.prototype = {
|
43
|
-
|
44
|
-
constructor: Typeahead
|
45
|
-
|
46
|
-
, select: function () {
|
47
|
-
var val = this.$menu.find('.active').attr('data-value')
|
48
|
-
this.$element
|
49
|
-
.val(this.updater(val))
|
50
|
-
.change()
|
51
|
-
return this.hide()
|
52
|
-
}
|
53
|
-
|
54
|
-
, updater: function (item) {
|
55
|
-
return item
|
56
|
-
}
|
57
|
-
|
58
|
-
, show: function () {
|
59
|
-
var pos = $.extend({}, this.$element.position(), {
|
60
|
-
height: this.$element[0].offsetHeight
|
61
|
-
})
|
62
|
-
|
63
|
-
this.$menu
|
64
|
-
.insertAfter(this.$element)
|
65
|
-
.css({
|
66
|
-
top: pos.top + pos.height
|
67
|
-
, left: pos.left
|
68
|
-
})
|
69
|
-
.show()
|
70
|
-
|
71
|
-
this.shown = true
|
72
|
-
return this
|
73
|
-
}
|
74
|
-
|
75
|
-
, hide: function () {
|
76
|
-
this.$menu.hide()
|
77
|
-
this.shown = false
|
78
|
-
return this
|
79
|
-
}
|
80
|
-
|
81
|
-
, lookup: function (event) {
|
82
|
-
var items
|
83
|
-
|
84
|
-
this.query = this.$element.val()
|
85
|
-
|
86
|
-
if (!this.query || this.query.length < this.options.minLength) {
|
87
|
-
return this.shown ? this.hide() : this
|
88
|
-
}
|
89
|
-
|
90
|
-
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
|
91
|
-
|
92
|
-
return items ? this.process(items) : this
|
93
|
-
}
|
94
|
-
|
95
|
-
, process: function (items) {
|
96
|
-
var that = this
|
97
|
-
|
98
|
-
items = $.grep(items, function (item) {
|
99
|
-
return that.matcher(item)
|
100
|
-
})
|
101
|
-
|
102
|
-
items = this.sorter(items)
|
103
|
-
|
104
|
-
if (!items.length) {
|
105
|
-
return this.shown ? this.hide() : this
|
106
|
-
}
|
107
|
-
|
108
|
-
return this.render(items.slice(0, this.options.items)).show()
|
109
|
-
}
|
110
|
-
|
111
|
-
, matcher: function (item) {
|
112
|
-
return ~item.toLowerCase().indexOf(this.query.toLowerCase())
|
113
|
-
}
|
114
|
-
|
115
|
-
, sorter: function (items) {
|
116
|
-
var beginswith = []
|
117
|
-
, caseSensitive = []
|
118
|
-
, caseInsensitive = []
|
119
|
-
, item
|
120
|
-
|
121
|
-
while (item = items.shift()) {
|
122
|
-
if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
|
123
|
-
else if (~item.indexOf(this.query)) caseSensitive.push(item)
|
124
|
-
else caseInsensitive.push(item)
|
125
|
-
}
|
126
|
-
|
127
|
-
return beginswith.concat(caseSensitive, caseInsensitive)
|
128
|
-
}
|
129
|
-
|
130
|
-
, highlighter: function (item) {
|
131
|
-
var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
|
132
|
-
return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
|
133
|
-
return '<strong>' + match + '</strong>'
|
134
|
-
})
|
135
|
-
}
|
136
|
-
|
137
|
-
, render: function (items) {
|
138
|
-
var that = this
|
139
|
-
|
140
|
-
items = $(items).map(function (i, item) {
|
141
|
-
i = $(that.options.item).attr('data-value', item)
|
142
|
-
i.find('a').html(that.highlighter(item))
|
143
|
-
return i[0]
|
144
|
-
})
|
145
|
-
|
146
|
-
items.first().addClass('active')
|
147
|
-
this.$menu.html(items)
|
148
|
-
return this
|
149
|
-
}
|
150
|
-
|
151
|
-
, next: function (event) {
|
152
|
-
var active = this.$menu.find('.active').removeClass('active')
|
153
|
-
, next = active.next()
|
154
|
-
|
155
|
-
if (!next.length) {
|
156
|
-
next = $(this.$menu.find('li')[0])
|
157
|
-
}
|
158
|
-
|
159
|
-
next.addClass('active')
|
160
|
-
}
|
161
|
-
|
162
|
-
, prev: function (event) {
|
163
|
-
var active = this.$menu.find('.active').removeClass('active')
|
164
|
-
, prev = active.prev()
|
165
|
-
|
166
|
-
if (!prev.length) {
|
167
|
-
prev = this.$menu.find('li').last()
|
168
|
-
}
|
169
|
-
|
170
|
-
prev.addClass('active')
|
171
|
-
}
|
172
|
-
|
173
|
-
, listen: function () {
|
174
|
-
this.$element
|
175
|
-
.on('focus', $.proxy(this.focus, this))
|
176
|
-
.on('blur', $.proxy(this.blur, this))
|
177
|
-
.on('keypress', $.proxy(this.keypress, this))
|
178
|
-
.on('keyup', $.proxy(this.keyup, this))
|
179
|
-
|
180
|
-
if (this.eventSupported('keydown')) {
|
181
|
-
this.$element.on('keydown', $.proxy(this.keydown, this))
|
182
|
-
}
|
183
|
-
|
184
|
-
this.$menu
|
185
|
-
.on('click', $.proxy(this.click, this))
|
186
|
-
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
|
187
|
-
.on('mouseleave', 'li', $.proxy(this.mouseleave, this))
|
188
|
-
}
|
189
|
-
|
190
|
-
, eventSupported: function(eventName) {
|
191
|
-
var isSupported = eventName in this.$element
|
192
|
-
if (!isSupported) {
|
193
|
-
this.$element.setAttribute(eventName, 'return;')
|
194
|
-
isSupported = typeof this.$element[eventName] === 'function'
|
195
|
-
}
|
196
|
-
return isSupported
|
197
|
-
}
|
198
|
-
|
199
|
-
, move: function (e) {
|
200
|
-
if (!this.shown) return
|
201
|
-
|
202
|
-
switch(e.keyCode) {
|
203
|
-
case 9: // tab
|
204
|
-
case 13: // enter
|
205
|
-
case 27: // escape
|
206
|
-
e.preventDefault()
|
207
|
-
break
|
208
|
-
|
209
|
-
case 38: // up arrow
|
210
|
-
e.preventDefault()
|
211
|
-
this.prev()
|
212
|
-
break
|
213
|
-
|
214
|
-
case 40: // down arrow
|
215
|
-
e.preventDefault()
|
216
|
-
this.next()
|
217
|
-
break
|
218
|
-
}
|
219
|
-
|
220
|
-
e.stopPropagation()
|
221
|
-
}
|
222
|
-
|
223
|
-
, keydown: function (e) {
|
224
|
-
this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
|
225
|
-
this.move(e)
|
226
|
-
}
|
227
|
-
|
228
|
-
, keypress: function (e) {
|
229
|
-
if (this.suppressKeyPressRepeat) return
|
230
|
-
this.move(e)
|
231
|
-
}
|
232
|
-
|
233
|
-
, keyup: function (e) {
|
234
|
-
switch(e.keyCode) {
|
235
|
-
case 40: // down arrow
|
236
|
-
case 38: // up arrow
|
237
|
-
case 16: // shift
|
238
|
-
case 17: // ctrl
|
239
|
-
case 18: // alt
|
240
|
-
break
|
241
|
-
|
242
|
-
case 9: // tab
|
243
|
-
case 13: // enter
|
244
|
-
if (!this.shown) return
|
245
|
-
this.select()
|
246
|
-
break
|
247
|
-
|
248
|
-
case 27: // escape
|
249
|
-
if (!this.shown) return
|
250
|
-
this.hide()
|
251
|
-
break
|
252
|
-
|
253
|
-
default:
|
254
|
-
this.lookup()
|
255
|
-
}
|
256
|
-
|
257
|
-
e.stopPropagation()
|
258
|
-
e.preventDefault()
|
259
|
-
}
|
260
|
-
|
261
|
-
, focus: function (e) {
|
262
|
-
this.focused = true
|
263
|
-
}
|
264
|
-
|
265
|
-
, blur: function (e) {
|
266
|
-
this.focused = false
|
267
|
-
if (!this.mousedover && this.shown) this.hide()
|
268
|
-
}
|
269
|
-
|
270
|
-
, click: function (e) {
|
271
|
-
e.stopPropagation()
|
272
|
-
e.preventDefault()
|
273
|
-
this.select()
|
274
|
-
this.$element.focus()
|
275
|
-
}
|
276
|
-
|
277
|
-
, mouseenter: function (e) {
|
278
|
-
this.mousedover = true
|
279
|
-
this.$menu.find('.active').removeClass('active')
|
280
|
-
$(e.currentTarget).addClass('active')
|
281
|
-
}
|
282
|
-
|
283
|
-
, mouseleave: function (e) {
|
284
|
-
this.mousedover = false
|
285
|
-
if (!this.focused && this.shown) this.hide()
|
286
|
-
}
|
287
|
-
|
288
|
-
}
|
289
|
-
|
290
|
-
|
291
|
-
/* TYPEAHEAD PLUGIN DEFINITION
|
292
|
-
* =========================== */
|
293
|
-
|
294
|
-
var old = $.fn.typeahead
|
295
|
-
|
296
|
-
$.fn.typeahead = function (option) {
|
297
|
-
return this.each(function () {
|
298
|
-
var $this = $(this)
|
299
|
-
, data = $this.data('typeahead')
|
300
|
-
, options = typeof option == 'object' && option
|
301
|
-
if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
|
302
|
-
if (typeof option == 'string') data[option]()
|
303
|
-
})
|
304
|
-
}
|
305
|
-
|
306
|
-
$.fn.typeahead.defaults = {
|
307
|
-
source: []
|
308
|
-
, items: 8
|
309
|
-
, menu: '<ul class="typeahead dropdown-menu"></ul>'
|
310
|
-
, item: '<li><a href="#"></a></li>'
|
311
|
-
, minLength: 1
|
312
|
-
}
|
313
|
-
|
314
|
-
$.fn.typeahead.Constructor = Typeahead
|
315
|
-
|
316
|
-
|
317
|
-
/* TYPEAHEAD NO CONFLICT
|
318
|
-
* =================== */
|
319
|
-
|
320
|
-
$.fn.typeahead.noConflict = function () {
|
321
|
-
$.fn.typeahead = old
|
322
|
-
return this
|
323
|
-
}
|
324
|
-
|
325
|
-
|
326
|
-
/* TYPEAHEAD DATA-API
|
327
|
-
* ================== */
|
328
|
-
|
329
|
-
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
|
330
|
-
var $this = $(this)
|
331
|
-
if ($this.data('typeahead')) return
|
332
|
-
$this.typeahead($this.data())
|
333
|
-
})
|
334
|
-
|
335
|
-
}(window.jQuery);
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module Twitter
|
2
|
-
module Bootstrap
|
3
|
-
module BreadCrumbs
|
4
|
-
def self.included(base)
|
5
|
-
base.extend(ClassMethods)
|
6
|
-
end
|
7
|
-
|
8
|
-
module ClassMethods
|
9
|
-
def add_breadcrumb(name, url, options = {})
|
10
|
-
class_name = self.name
|
11
|
-
before_filter options do |controller|
|
12
|
-
name = controller.send :translate_breadcrumb, name, class_name if name.is_a?(Symbol)
|
13
|
-
controller.send :add_breadcrumb, name, url
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
protected
|
19
|
-
|
20
|
-
def add_breadcrumb(name, url = '', options = {})
|
21
|
-
@breadcrumbs ||= []
|
22
|
-
name = translate_breadcrumb(name, self.class.name) if name.is_a?(Symbol)
|
23
|
-
url = eval(url.to_s) if url =~ /_path|_url|@/
|
24
|
-
@breadcrumbs << {:name => name, :url => url, :options => options}
|
25
|
-
end
|
26
|
-
|
27
|
-
def translate_breadcrumb(name, class_name)
|
28
|
-
scope = [:breadcrumbs]
|
29
|
-
namespace = class_name.underscore.split('/')
|
30
|
-
namespace.last.sub!('_controller', '')
|
31
|
-
scope += namespace
|
32
|
-
|
33
|
-
I18n.t name, :scope => scope
|
34
|
-
end
|
35
|
-
|
36
|
-
def render_breadcrumbs(divider = '/')
|
37
|
-
s = render :partial => 'twitter-bootstrap/breadcrumbs', :locals => {:divider => divider}
|
38
|
-
s.first
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
module AbstractController
|
4
|
-
module Testing
|
5
|
-
|
6
|
-
class TestHelper
|
7
|
-
BREADCRUMB_NAMES = [:class_level, :class_level_i18n, :instance_level,
|
8
|
-
:instance_level_i18n, :base_level, :base_level_i18n]
|
9
|
-
|
10
|
-
class << self
|
11
|
-
BREADCRUMB_NAMES.each do |name|
|
12
|
-
define_method "#{name}_name" do
|
13
|
-
"test-breadcrumb-#{name}"
|
14
|
-
end
|
15
|
-
|
16
|
-
define_method "#{name}_path" do
|
17
|
-
"/test/breadcrumb/#{name}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class BaseTestController < AbstractController::Base
|
24
|
-
include Twitter::Bootstrap::BreadCrumbs
|
25
|
-
include AbstractController::Callbacks
|
26
|
-
|
27
|
-
add_breadcrumb TestHelper.base_level_name, TestHelper.base_level_path
|
28
|
-
add_breadcrumb :base_level_i18n, TestHelper.base_level_i18n_path
|
29
|
-
|
30
|
-
def breadcrumbs
|
31
|
-
@breadcrumbs
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
class TestController < BaseTestController
|
36
|
-
add_breadcrumb TestHelper.class_level_name, TestHelper.class_level_path
|
37
|
-
add_breadcrumb :class_level_i18n, TestHelper.class_level_i18n_path
|
38
|
-
|
39
|
-
def index
|
40
|
-
add_breadcrumb TestHelper.instance_level_name, TestHelper.instance_level_path
|
41
|
-
add_breadcrumb :instance_level_i18n, TestHelper.instance_level_i18n_path
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
class BreadcrumbsTest < MiniTest::Unit::TestCase
|
46
|
-
def setup
|
47
|
-
options = { :scope => [:breadcrumbs, 'abstract_controller', 'testing', 'test'] }
|
48
|
-
[:class_level_i18n, :instance_level_i18n].each do |name|
|
49
|
-
I18n.expects(:t).with(name, options).returns(TestHelper.send("#{name}_name"))
|
50
|
-
end
|
51
|
-
|
52
|
-
name = :base_level_i18n
|
53
|
-
options = { :scope => [:breadcrumbs, 'abstract_controller', 'testing', 'base_test'] }
|
54
|
-
I18n.expects(:t).with(name, options).returns(TestHelper.send("#{name}_name"))
|
55
|
-
|
56
|
-
@controller = TestController.new
|
57
|
-
@controller.process(:index)
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_should_have_breadcrumbs
|
61
|
-
TestHelper::BREADCRUMB_NAMES.each do |name|
|
62
|
-
assert include_breadcrumb?(name), "#{name} breadcrumb not found"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def include_breadcrumb?(name)
|
67
|
-
selected = @controller.breadcrumbs.select { |b|
|
68
|
-
b[:name] == TestHelper.send("#{name}_name") &&
|
69
|
-
b[:url] == TestHelper.send("#{name}_path")
|
70
|
-
}
|
71
|
-
selected.any?
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
/* BOOTSTRAP SPECIFIC CLASSES
|
2
|
-
* -------------------------- */
|
3
|
-
|
4
|
-
/* Bootstrap 2.0 sprites.less reset */
|
5
|
-
[class^="icon-"],
|
6
|
-
[class*=" icon-"] {
|
7
|
-
display: inline;
|
8
|
-
width: auto;
|
9
|
-
height: auto;
|
10
|
-
line-height: normal;
|
11
|
-
vertical-align: baseline;
|
12
|
-
background-image: none;
|
13
|
-
background-position: 0% 0%;
|
14
|
-
background-repeat: repeat;
|
15
|
-
margin-top: 0;
|
16
|
-
}
|
17
|
-
|
18
|
-
/* more sprites.less reset */
|
19
|
-
.icon-white,
|
20
|
-
.nav-pills > .active > a > [class^="icon-"],
|
21
|
-
.nav-pills > .active > a > [class*=" icon-"],
|
22
|
-
.nav-list > .active > a > [class^="icon-"],
|
23
|
-
.nav-list > .active > a > [class*=" icon-"],
|
24
|
-
.navbar-inverse .nav > .active > a > [class^="icon-"],
|
25
|
-
.navbar-inverse .nav > .active > a > [class*=" icon-"],
|
26
|
-
.dropdown-menu > li > a:hover > [class^="icon-"],
|
27
|
-
.dropdown-menu > li > a:hover > [class*=" icon-"],
|
28
|
-
.dropdown-menu > .active > a > [class^="icon-"],
|
29
|
-
.dropdown-menu > .active > a > [class*=" icon-"],
|
30
|
-
.dropdown-submenu:hover > a > [class^="icon-"],
|
31
|
-
.dropdown-submenu:hover > a > [class*=" icon-"] {
|
32
|
-
background-image: none;
|
33
|
-
}
|
34
|
-
|
35
|
-
|
36
|
-
/* keeps Bootstrap styles with and without icons the same */
|
37
|
-
.btn, .nav {
|
38
|
-
[class^="icon-"],
|
39
|
-
[class*=" icon-"] {
|
40
|
-
// display: inline;
|
41
|
-
&.icon-large { line-height: .9em; }
|
42
|
-
&.icon-spin { display: inline-block; }
|
43
|
-
}
|
44
|
-
}
|
45
|
-
.nav-tabs, .nav-pills {
|
46
|
-
[class^="icon-"],
|
47
|
-
[class*=" icon-"] {
|
48
|
-
&, &.icon-large { line-height: .9em; }
|
49
|
-
}
|
50
|
-
}
|
51
|
-
.btn {
|
52
|
-
[class^="icon-"],
|
53
|
-
[class*=" icon-"] {
|
54
|
-
&.pull-left, &.pull-right {
|
55
|
-
&.icon-2x { margin-top: .18em; }
|
56
|
-
}
|
57
|
-
&.icon-spin.icon-large { line-height: .8em; }
|
58
|
-
}
|
59
|
-
}
|
60
|
-
.btn.btn-small {
|
61
|
-
[class^="icon-"],
|
62
|
-
[class*=" icon-"] {
|
63
|
-
&.pull-left, &.pull-right {
|
64
|
-
&.icon-2x { margin-top: .25em; }
|
65
|
-
}
|
66
|
-
}
|
67
|
-
}
|
68
|
-
.btn.btn-large {
|
69
|
-
[class^="icon-"],
|
70
|
-
[class*=" icon-"] {
|
71
|
-
margin-top: 0; // overrides bootstrap default
|
72
|
-
&.pull-left, &.pull-right {
|
73
|
-
&.icon-2x { margin-top: .05em; }
|
74
|
-
}
|
75
|
-
&.pull-left.icon-2x { margin-right: .2em; }
|
76
|
-
&.pull-right.icon-2x { margin-left: .2em; }
|
77
|
-
}
|
78
|
-
}
|
79
|
-
|
80
|
-
/* Fixes alignment in nav lists */
|
81
|
-
.nav-list [class^="icon-"],
|
82
|
-
.nav-list [class*=" icon-"] {
|
83
|
-
line-height: inherit;
|
84
|
-
}
|
@@ -1,93 +0,0 @@
|
|
1
|
-
/* EXTRAS
|
2
|
-
* -------------------------- */
|
3
|
-
|
4
|
-
/* Stacked and layered icon */
|
5
|
-
.icon-stack();
|
6
|
-
|
7
|
-
/* Animated rotating icon */
|
8
|
-
.icon-spin {
|
9
|
-
display: inline-block;
|
10
|
-
-moz-animation: spin 2s infinite linear;
|
11
|
-
-o-animation: spin 2s infinite linear;
|
12
|
-
-webkit-animation: spin 2s infinite linear;
|
13
|
-
animation: spin 2s infinite linear;
|
14
|
-
}
|
15
|
-
|
16
|
-
/* Prevent stack and spinners from being taken inline when inside a link */
|
17
|
-
a .icon-stack,
|
18
|
-
a .icon-spin {
|
19
|
-
display: inline-block;
|
20
|
-
text-decoration: none;
|
21
|
-
}
|
22
|
-
|
23
|
-
@-moz-keyframes spin {
|
24
|
-
0% { -moz-transform: rotate(0deg); }
|
25
|
-
100% { -moz-transform: rotate(359deg); }
|
26
|
-
}
|
27
|
-
@-webkit-keyframes spin {
|
28
|
-
0% { -webkit-transform: rotate(0deg); }
|
29
|
-
100% { -webkit-transform: rotate(359deg); }
|
30
|
-
}
|
31
|
-
@-o-keyframes spin {
|
32
|
-
0% { -o-transform: rotate(0deg); }
|
33
|
-
100% { -o-transform: rotate(359deg); }
|
34
|
-
}
|
35
|
-
@-ms-keyframes spin {
|
36
|
-
0% { -ms-transform: rotate(0deg); }
|
37
|
-
100% { -ms-transform: rotate(359deg); }
|
38
|
-
}
|
39
|
-
@keyframes spin {
|
40
|
-
0% { transform: rotate(0deg); }
|
41
|
-
100% { transform: rotate(359deg); }
|
42
|
-
}
|
43
|
-
|
44
|
-
/* Icon rotations and mirroring */
|
45
|
-
.icon-rotate-90:before {
|
46
|
-
-webkit-transform: rotate(90deg);
|
47
|
-
-moz-transform: rotate(90deg);
|
48
|
-
-ms-transform: rotate(90deg);
|
49
|
-
-o-transform: rotate(90deg);
|
50
|
-
transform: rotate(90deg);
|
51
|
-
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
|
52
|
-
}
|
53
|
-
|
54
|
-
.icon-rotate-180:before {
|
55
|
-
-webkit-transform: rotate(180deg);
|
56
|
-
-moz-transform: rotate(180deg);
|
57
|
-
-ms-transform: rotate(180deg);
|
58
|
-
-o-transform: rotate(180deg);
|
59
|
-
transform: rotate(180deg);
|
60
|
-
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
|
61
|
-
}
|
62
|
-
|
63
|
-
.icon-rotate-270:before {
|
64
|
-
-webkit-transform: rotate(270deg);
|
65
|
-
-moz-transform: rotate(270deg);
|
66
|
-
-ms-transform: rotate(270deg);
|
67
|
-
-o-transform: rotate(270deg);
|
68
|
-
transform: rotate(270deg);
|
69
|
-
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
|
70
|
-
}
|
71
|
-
|
72
|
-
.icon-flip-horizontal:before {
|
73
|
-
-webkit-transform: scale(-1, 1);
|
74
|
-
-moz-transform: scale(-1, 1);
|
75
|
-
-ms-transform: scale(-1, 1);
|
76
|
-
-o-transform: scale(-1, 1);
|
77
|
-
transform: scale(-1, 1);
|
78
|
-
}
|
79
|
-
|
80
|
-
.icon-flip-vertical:before {
|
81
|
-
-webkit-transform: scale(1, -1);
|
82
|
-
-moz-transform: scale(1, -1);
|
83
|
-
-ms-transform: scale(1, -1);
|
84
|
-
-o-transform: scale(1, -1);
|
85
|
-
transform: scale(1, -1);
|
86
|
-
}
|
87
|
-
|
88
|
-
/* ensure rotation occurs inside anchor tags */
|
89
|
-
a {
|
90
|
-
.icon-rotate-90, .icon-rotate-180, .icon-rotate-270, .icon-flip-horizontal, .icon-flip-vertical {
|
91
|
-
&:before { display: inline-block; }
|
92
|
-
}
|
93
|
-
}
|