padrino-admin 0.11.3 → 0.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.rdoc +3 -3
- data/lib/padrino-admin/access_control.rb +46 -47
- data/lib/padrino-admin/bootstrap-less/alerts.less +29 -55
- data/lib/padrino-admin/bootstrap-less/badges.less +13 -15
- data/lib/padrino-admin/bootstrap-less/bootstrap.less +17 -21
- data/lib/padrino-admin/bootstrap-less/breadcrumbs.less +6 -11
- data/lib/padrino-admin/bootstrap-less/button-groups.less +114 -32
- data/lib/padrino-admin/bootstrap-less/buttons.less +41 -41
- data/lib/padrino-admin/bootstrap-less/carousel.less +43 -18
- data/lib/padrino-admin/bootstrap-less/close.less +4 -4
- data/lib/padrino-admin/bootstrap-less/code.less +8 -10
- data/lib/padrino-admin/bootstrap-less/component-animations.less +10 -4
- data/lib/padrino-admin/bootstrap-less/dropdowns.less +78 -51
- data/lib/padrino-admin/bootstrap-less/forms.less +183 -274
- data/lib/padrino-admin/bootstrap-less/glyphicons.less +232 -0
- data/lib/padrino-admin/bootstrap-less/grid.less +230 -88
- data/lib/padrino-admin/bootstrap-less/input-groups.less +127 -0
- data/lib/padrino-admin/bootstrap-less/jumbotron.less +16 -8
- data/lib/padrino-admin/bootstrap-less/labels.less +25 -37
- data/lib/padrino-admin/bootstrap-less/list-group.less +34 -35
- data/lib/padrino-admin/bootstrap-less/media.less +7 -5
- data/lib/padrino-admin/bootstrap-less/mixins.less +321 -108
- data/lib/padrino-admin/bootstrap-less/modals.less +24 -20
- data/lib/padrino-admin/bootstrap-less/navbar.less +474 -216
- data/lib/padrino-admin/bootstrap-less/navs.less +67 -85
- data/lib/padrino-admin/bootstrap-less/pager.less +4 -4
- data/lib/padrino-admin/bootstrap-less/pagination.less +64 -69
- data/lib/padrino-admin/bootstrap-less/panels.less +114 -62
- data/lib/padrino-admin/bootstrap-less/popovers.less +18 -18
- data/lib/padrino-admin/bootstrap-less/print.less +22 -7
- data/lib/padrino-admin/bootstrap-less/progress-bars.less +10 -33
- data/lib/padrino-admin/bootstrap-less/responsive-utilities.less +141 -40
- data/lib/padrino-admin/bootstrap-less/scaffolding.less +66 -19
- data/lib/padrino-admin/bootstrap-less/tables.less +154 -158
- data/lib/padrino-admin/bootstrap-less/theme.less +232 -0
- data/lib/padrino-admin/bootstrap-less/thumbnails.less +9 -20
- data/lib/padrino-admin/bootstrap-less/tooltip.less +3 -3
- data/lib/padrino-admin/bootstrap-less/type.less +47 -55
- data/lib/padrino-admin/bootstrap-less/utilities.less +2 -2
- data/lib/padrino-admin/bootstrap-less/variables.less +289 -93
- data/lib/padrino-admin/bootstrap-less/wells.less +2 -2
- data/lib/padrino-admin/generators/actions.rb +11 -10
- data/lib/padrino-admin/generators/admin_app.rb +11 -11
- data/lib/padrino-admin/generators/admin_page.rb +9 -9
- data/lib/padrino-admin/generators/orm.rb +6 -7
- data/lib/padrino-admin/generators/templates/account/activerecord.rb.tt +7 -7
- data/lib/padrino-admin/generators/templates/account/couchrest.rb.tt +16 -16
- data/lib/padrino-admin/generators/templates/account/datamapper.rb.tt +7 -7
- data/lib/padrino-admin/generators/templates/account/minirecord.rb.tt +7 -7
- data/lib/padrino-admin/generators/templates/account/mongoid.rb.tt +8 -8
- data/lib/padrino-admin/generators/templates/account/mongomapper.rb.tt +7 -7
- data/lib/padrino-admin/generators/templates/account/ohm.rb.tt +9 -9
- data/lib/padrino-admin/generators/templates/account/sequel.rb.tt +8 -8
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/affix.js +9 -3
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/alert.js +4 -2
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap.min.js +4 -4
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/button.js +9 -5
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/carousel.js +19 -12
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/collapse.js +68 -45
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/dropdown.js +6 -7
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/modal.js +43 -40
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/popover.js +16 -10
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/scrollspy.js +6 -4
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/tab.js +4 -2
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/tooltip.js +78 -48
- data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/transition.js +10 -1
- data/lib/padrino-admin/generators/templates/assets/stylesheets/application.css +1 -0
- data/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap.css +622 -334
- data/lib/padrino-admin/generators/templates/erb/app/layouts/error.erb.tt +2 -2
- data/lib/padrino-admin/generators/templates/erb/app/sessions/new.erb.tt +9 -9
- data/lib/padrino-admin/generators/templates/erb/page/_form.erb.tt +3 -3
- data/lib/padrino-admin/generators/templates/erb/page/index.erb.tt +3 -3
- data/lib/padrino-admin/generators/templates/haml/app/layouts/error.haml.tt +1 -1
- data/lib/padrino-admin/generators/templates/haml/app/sessions/new.haml.tt +9 -7
- data/lib/padrino-admin/generators/templates/haml/page/_form.haml.tt +2 -2
- data/lib/padrino-admin/generators/templates/haml/page/index.haml.tt +2 -2
- data/lib/padrino-admin/generators/templates/page/controller.rb.tt +3 -3
- data/lib/padrino-admin/generators/templates/slim/app/layouts/error.slim.tt +1 -1
- data/lib/padrino-admin/generators/templates/slim/app/sessions/new.slim.tt +9 -7
- data/lib/padrino-admin/generators/templates/slim/page/_form.slim.tt +2 -2
- data/lib/padrino-admin/generators/templates/slim/page/index.slim.tt +2 -2
- data/lib/padrino-admin/helpers/authentication_helpers.rb +35 -35
- data/lib/padrino-admin/helpers/view_helpers.rb +12 -19
- data/lib/padrino-admin/utils/crypt.rb +10 -9
- data/lib/padrino-admin.rb +4 -5
- data/test/fixtures/data_mapper.rb +10 -9
- data/test/generators/test_account_model_generator.rb +2 -2
- metadata +14 -21
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ========================================================================
|
2
2
|
* Bootstrap: tooltip.js v3.0.0
|
3
|
-
* http://
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#tooltip
|
4
4
|
* Inspired by the original jQuery.tipsy by Jason Frame
|
5
5
|
* ========================================================================
|
6
6
|
* Copyright 2012 Twitter, Inc.
|
@@ -64,7 +64,7 @@
|
|
64
64
|
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
|
65
65
|
var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
|
66
66
|
|
67
|
-
this.$element.on(eventIn
|
67
|
+
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
|
68
68
|
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
|
69
69
|
}
|
70
70
|
}
|
@@ -91,37 +91,43 @@
|
|
91
91
|
return options
|
92
92
|
}
|
93
93
|
|
94
|
-
Tooltip.prototype.
|
95
|
-
var defaults = this.getDefaults()
|
94
|
+
Tooltip.prototype.getDelegateOptions = function () {
|
96
95
|
var options = {}
|
96
|
+
var defaults = this.getDefaults()
|
97
97
|
|
98
98
|
this._options && $.each(this._options, function (key, value) {
|
99
99
|
if (defaults[key] != value) options[key] = value
|
100
100
|
})
|
101
101
|
|
102
|
-
|
103
|
-
|
102
|
+
return options
|
103
|
+
}
|
104
104
|
|
105
|
-
|
105
|
+
Tooltip.prototype.enter = function (obj) {
|
106
|
+
var self = obj instanceof this.constructor ?
|
107
|
+
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
|
106
108
|
|
107
|
-
clearTimeout(
|
109
|
+
clearTimeout(self.timeout)
|
108
110
|
|
109
111
|
self.hoverState = 'in'
|
110
|
-
|
112
|
+
|
113
|
+
if (!self.options.delay || !self.options.delay.show) return self.show()
|
114
|
+
|
115
|
+
self.timeout = setTimeout(function () {
|
111
116
|
if (self.hoverState == 'in') self.show()
|
112
117
|
}, self.options.delay.show)
|
113
118
|
}
|
114
119
|
|
115
120
|
Tooltip.prototype.leave = function (obj) {
|
116
121
|
var self = obj instanceof this.constructor ?
|
117
|
-
obj : $(obj.currentTarget)[this.type](this.
|
122
|
+
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
|
118
123
|
|
119
|
-
clearTimeout(
|
124
|
+
clearTimeout(self.timeout)
|
125
|
+
|
126
|
+
self.hoverState = 'out'
|
120
127
|
|
121
128
|
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
122
129
|
|
123
|
-
self.
|
124
|
-
this.timeout = setTimeout(function () {
|
130
|
+
self.timeout = setTimeout(function () {
|
125
131
|
if (self.hoverState == 'out') self.hide()
|
126
132
|
}, self.options.delay.hide)
|
127
133
|
}
|
@@ -144,33 +150,44 @@
|
|
144
150
|
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
145
151
|
this.options.placement
|
146
152
|
|
153
|
+
var autoToken = /\s?auto?\s?/i
|
154
|
+
var autoPlace = autoToken.test(placement)
|
155
|
+
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
|
156
|
+
|
147
157
|
$tip
|
148
158
|
.detach()
|
149
159
|
.css({ top: 0, left: 0, display: 'block' })
|
160
|
+
.addClass(placement)
|
150
161
|
|
151
162
|
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
152
163
|
|
153
|
-
var tp
|
154
164
|
var pos = this.getPosition()
|
155
165
|
var actualWidth = $tip[0].offsetWidth
|
156
166
|
var actualHeight = $tip[0].offsetHeight
|
157
167
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
168
|
+
if (autoPlace) {
|
169
|
+
var $parent = this.$element.parent()
|
170
|
+
|
171
|
+
var orgPlacement = placement
|
172
|
+
var docScroll = document.documentElement.scrollTop || document.body.scrollTop
|
173
|
+
var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
|
174
|
+
var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
|
175
|
+
var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
|
176
|
+
|
177
|
+
placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
|
178
|
+
placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
|
179
|
+
placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
|
180
|
+
placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
|
181
|
+
placement
|
182
|
+
|
183
|
+
$tip
|
184
|
+
.removeClass(orgPlacement)
|
185
|
+
.addClass(placement)
|
171
186
|
}
|
172
187
|
|
173
|
-
this.
|
188
|
+
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
|
189
|
+
|
190
|
+
this.applyPlacement(calculatedOffset, placement)
|
174
191
|
this.$element.trigger('shown.bs.' + this.type)
|
175
192
|
}
|
176
193
|
}
|
@@ -181,23 +198,34 @@
|
|
181
198
|
var width = $tip[0].offsetWidth
|
182
199
|
var height = $tip[0].offsetHeight
|
183
200
|
|
201
|
+
// manually read margins because getBoundingClientRect includes difference
|
202
|
+
var marginTop = parseInt($tip.css('margin-top'), 10)
|
203
|
+
var marginLeft = parseInt($tip.css('margin-left'), 10)
|
204
|
+
|
205
|
+
// we must check for NaN for ie 8/9
|
206
|
+
if (isNaN(marginTop)) marginTop = 0
|
207
|
+
if (isNaN(marginLeft)) marginLeft = 0
|
208
|
+
|
209
|
+
offset.top = offset.top + marginTop
|
210
|
+
offset.left = offset.left + marginLeft
|
211
|
+
|
184
212
|
$tip
|
185
213
|
.offset(offset)
|
186
|
-
.addClass(placement)
|
187
214
|
.addClass('in')
|
188
215
|
|
216
|
+
// check to see if placing tip in new offset caused the tip to resize itself
|
189
217
|
var actualWidth = $tip[0].offsetWidth
|
190
218
|
var actualHeight = $tip[0].offsetHeight
|
191
219
|
|
192
220
|
if (placement == 'top' && actualHeight != height) {
|
193
221
|
replace = true
|
194
|
-
offset.top
|
222
|
+
offset.top = offset.top + height - actualHeight
|
195
223
|
}
|
196
224
|
|
197
|
-
if (
|
225
|
+
if (/bottom|top/.test(placement)) {
|
198
226
|
var delta = 0
|
199
227
|
|
200
|
-
if (offset.left < 0){
|
228
|
+
if (offset.left < 0) {
|
201
229
|
delta = offset.left * -2
|
202
230
|
offset.left = 0
|
203
231
|
|
@@ -232,26 +260,21 @@
|
|
232
260
|
var $tip = this.tip()
|
233
261
|
var e = $.Event('hide.bs.' + this.type)
|
234
262
|
|
263
|
+
function complete() {
|
264
|
+
if (that.hoverState != 'in') $tip.detach()
|
265
|
+
}
|
266
|
+
|
235
267
|
this.$element.trigger(e)
|
236
268
|
|
237
269
|
if (e.isDefaultPrevented()) return
|
238
270
|
|
239
271
|
$tip.removeClass('in')
|
240
272
|
|
241
|
-
function removeWithAnimation() {
|
242
|
-
var timeout = setTimeout(function () {
|
243
|
-
$tip.off($.support.transition.end).detach()
|
244
|
-
}, 500)
|
245
|
-
|
246
|
-
$tip.one($.support.transition.end, function () {
|
247
|
-
clearTimeout(timeout)
|
248
|
-
$tip.detach()
|
249
|
-
})
|
250
|
-
}
|
251
|
-
|
252
273
|
$.support.transition && this.$tip.hasClass('fade') ?
|
253
|
-
|
254
|
-
|
274
|
+
$tip
|
275
|
+
.one($.support.transition.end, complete)
|
276
|
+
.emulateTransitionEnd(150) :
|
277
|
+
complete()
|
255
278
|
|
256
279
|
this.$element.trigger('hidden.bs.' + this.type)
|
257
280
|
|
@@ -277,6 +300,13 @@
|
|
277
300
|
}, this.$element.offset())
|
278
301
|
}
|
279
302
|
|
303
|
+
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
|
304
|
+
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
|
305
|
+
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
|
306
|
+
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
|
307
|
+
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
|
308
|
+
}
|
309
|
+
|
280
310
|
Tooltip.prototype.getTitle = function () {
|
281
311
|
var title
|
282
312
|
var $e = this.$element
|
@@ -292,8 +322,8 @@
|
|
292
322
|
return this.$tip = this.$tip || $(this.options.template)
|
293
323
|
}
|
294
324
|
|
295
|
-
Tooltip.prototype.arrow =function(){
|
296
|
-
return this.$arrow = this.$arrow || this.tip().find(
|
325
|
+
Tooltip.prototype.arrow = function () {
|
326
|
+
return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
|
297
327
|
}
|
298
328
|
|
299
329
|
Tooltip.prototype.validate = function () {
|
@@ -317,7 +347,7 @@
|
|
317
347
|
}
|
318
348
|
|
319
349
|
Tooltip.prototype.toggle = function (e) {
|
320
|
-
var self = e ? $(e.currentTarget)[this.type](this.
|
350
|
+
var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
|
321
351
|
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
|
322
352
|
}
|
323
353
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ========================================================================
|
2
2
|
* Bootstrap: transition.js v3.0.0
|
3
|
-
* http://
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#transitions
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2013 Twitter, Inc.
|
6
6
|
*
|
@@ -40,6 +40,15 @@
|
|
40
40
|
}
|
41
41
|
}
|
42
42
|
|
43
|
+
// http://blog.alexmaccaw.com/css-transitions
|
44
|
+
$.fn.emulateTransitionEnd = function (duration) {
|
45
|
+
var called = false, $el = this
|
46
|
+
$(this).one($.support.transition.end, function () { called = true })
|
47
|
+
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
|
48
|
+
setTimeout(callback, duration)
|
49
|
+
return this
|
50
|
+
}
|
51
|
+
|
43
52
|
$(function () {
|
44
53
|
$.support.transition = transitionEnd()
|
45
54
|
})
|