Interim commit to get polymorphic migrations working

This commit is contained in:
Fergal Moran
2012-12-03 19:00:32 +00:00
parent 8c521099eb
commit 83e90d2383
14 changed files with 796 additions and 440 deletions

View File

@@ -3,8 +3,10 @@ from datetime import timedelta
from django.core.urlresolvers import reverse_lazy
import djcelery
import os
from dss import localsettings
import warnings
from dss import localsettings, warning_settings
from dss import logsettings
import dss.warning_settings
from utils import here
from django.conf import global_settings
@@ -159,13 +161,16 @@ INSTALLED_APPS = (
'allauth.socialaccount.providers.openid',
'allauth.socialaccount.providers.twitter',
'backbone_tastypie',
)
'polymodels'
)
# where to redirect users to after logging in
LOGIN_REDIRECT_URL = reverse_lazy('home')
LOGOUT_URL = reverse_lazy('home')
LOGGING = logsettings.LOGGING
#warnings.filterwarnings.append(warning_settings.FILTER_WARNINGS)
"""
if DEBUG:
# make all loggers use the console.

6
dss/warning_settings.py Normal file
View File

@@ -0,0 +1,6 @@
FILTER_WARNINGS = (
'ignore',
r"'override_urls' is a deprecated method & will be removed by v1.0.0. Please use ``prepend_urls`` instead.",
UserWarning,
r'tastypie.*'
)

View File

@@ -0,0 +1,18 @@
from tastypie.authentication import Authentication
from tastypie.authorization import Authorization
from spa.api.v1.BackboneCompatibleResource import BackboneCompatibleResource
from spa.models._Activity import _Activity
class ActivityResource(BackboneCompatibleResource):
class Meta:
queryset = _Activity.objects.all()
resource_name = 'activity'
authorization = Authorization()
authentication = Authentication()
always_return_data = True
def dehydrate(self, bundle):
return bundle

View File

@@ -1,14 +1,12 @@
from django.conf.urls import url
from tastypie import fields
from tastypie import fields
from tastypie.resources import ModelResource
__author__ = 'fergalm'
class BackboneCompatibleResource(ModelResource):
def override_urls(self):
urls = []
for name, field in self.fields.items():
if isinstance(field, fields.ToManyField):
resource = r"^(?P<resource_name>{resource_name})/(?P<{related_name}>.+)/{related_resource}/$".format(

View File

@@ -14,11 +14,14 @@ class CommentResource(BackboneCompatibleResource):
resource_name = 'comments'
filtering = {
"mix": ('exact',),
}
}
authorization = Authorization()
authentication = Authentication()
always_return_data = True
def prepend_urls(self):
urls = []
def obj_create(self, bundle, request=None, **kwargs):
bundle.data['user'] = {'pk': request.user.pk}
return super(CommentResource, self).obj_create(bundle, request, user=request.user)

View File

@@ -12,6 +12,9 @@ from spa.models.Mix import Mix
class MixResource(BackboneCompatibleResource):
comments = fields.ToManyField('spa.api.v1.CommentResource.CommentResource', 'comments', 'mix', null=True)
def prepend_urls(self):
urls = []
class Meta:
queryset = Mix.objects.filter(is_active=True)
excludes = ['download_url', 'is_active', 'local_file', 'upload_date']
@@ -25,7 +28,7 @@ class MixResource(BackboneCompatibleResource):
ret = []
for genre in genres:
if genre['id'] == genre['text']:
new_item = Genre(description = genre['text'])
new_item = Genre(description=genre['text'])
new_item.save()
ret.append(new_item)
else:
@@ -45,7 +48,8 @@ class MixResource(BackboneCompatibleResource):
bundle.data['is_featured'] = False
bundle.data['user'] = request.user.get_profile()
ret = super(MixResource, self).obj_create(bundle, request, user=request.user.get_profile(), local_file=file_name, uid=uid)
ret = super(MixResource, self).obj_create(bundle, request, user=request.user.get_profile(),
local_file=file_name, uid=uid)
self._unpackGenreList(ret, bundle.data['genre-list'])
#if ret is hunky dory
return ret

View File

@@ -1,12 +1,17 @@
import logging
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import ForeignKey
from django.utils import simplejson
import os
from polymodels.models import BasePolymorphicModel
from core.utils import url
from dss import localsettings, settings
class _BaseModel(models.Model):
class _BaseModel(BasePolymorphicModel):
logger = logging.getLogger(__name__)
content_type = ForeignKey(ContentType, null=True)
CONTENT_TYPE_FIELD = 'content_type'
class Meta:
abstract = True
@@ -21,7 +26,7 @@ class _BaseModel(models.Model):
filter_dict = {'%s__startswith' % filter_field: filter}
return cls.objects.all().filter(filter_dict).extra(select=transform)
else:
return cls.objects.all()#.extra(transform)
return cls.objects.all()
def get_image_url(self, image, default):
try:
@@ -29,6 +34,7 @@ class _BaseModel(models.Model):
images_root = localsettings.IMAGE_URL if hasattr(localsettings, 'IMAGE_URL') else "%s" % settings.MEDIA_URL
ret = "%s/%s" % (images_root, image)
return url.urlclean(ret)
except Exception, ex:
pass
@@ -36,7 +42,7 @@ class _BaseModel(models.Model):
@classmethod
def get_lookup_filter_field(cls):
field_list = cls._meta.get_all_field_names();
field_list = cls._meta.get_all_field_names()
for field in field_list:
if field.endswith("name") or field.endswith("description"):
return field

View File

@@ -9,6 +9,7 @@ from spa.api.v1.MixResource import MixResource
from spa.api.v1.ReleaseAudioResource import ReleaseAudioResource
from spa.api.v1.ReleaseResource import ReleaseResource
from spa.api.v1.UserResource import UserResource
from spa.api.v1.ActivityResource import ActivityResource
from spa.social import SocialHandler
v1_api = Api(api_name='v1')
@@ -18,7 +19,7 @@ v1_api.register(ReleaseResource())
v1_api.register(ReleaseAudioResource())
v1_api.register(EventResource())
v1_api.register(UserResource())
v1_api.register(ActivityResource())
ajax = AjaxHandler()
audio = AudioHandler()
social = SocialHandler()

View File

@@ -1,5 +1,5 @@
/*!
* Bootstrap Responsive v2.1.0
* Bootstrap Responsive v2.2.1
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
@@ -107,6 +107,7 @@
}
[class*="span"] {
float: left;
min-height: 1px;
margin-left: 30px;
}
.container,
@@ -214,6 +215,9 @@
.row-fluid [class*="span"]:first-child {
margin-left: 0;
}
.row-fluid .controls-row [class*="span"] + [class*="span"] {
margin-left: 2.564102564102564%;
}
.row-fluid .span12 {
width: 100%;
*width: 99.94680851063829%;
@@ -453,6 +457,7 @@
}
[class*="span"] {
float: left;
min-height: 1px;
margin-left: 20px;
}
.container,
@@ -560,6 +565,9 @@
.row-fluid [class*="span"]:first-child {
margin-left: 0;
}
.row-fluid .controls-row [class*="span"] + [class*="span"] {
margin-left: 2.7624309392265194%;
}
.row-fluid .span12 {
width: 100%;
*width: 99.94680851063829%;
@@ -780,7 +788,8 @@
padding-left: 20px;
}
.navbar-fixed-top,
.navbar-fixed-bottom {
.navbar-fixed-bottom,
.navbar-static-top {
margin-right: -20px;
margin-left: -20px;
}
@@ -811,11 +820,15 @@
margin-left: 0;
}
[class*="span"],
.uneditable-input[class*="span"],
.row-fluid [class*="span"] {
display: block;
float: none;
width: auto;
width: 100%;
margin-left: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.span12,
.row-fluid .span12 {
@@ -824,6 +837,9 @@
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.row-fluid [class*="offset"]:first-child {
margin-left: 0;
}
.input-large,
.input-xlarge,
.input-xxlarge,
@@ -845,6 +861,9 @@
display: inline-block;
width: auto;
}
.controls-row [class*="span"] + [class*="span"] {
margin-left: 0;
}
.modal {
position: fixed;
top: 20px;
@@ -853,8 +872,11 @@
width: auto;
margin: 0;
}
.modal.fade {
top: -100px;
}
.modal.fade.in {
top: auto;
top: 20px;
}
}
@@ -870,7 +892,7 @@
input[type="radio"] {
border: 1px solid #ccc;
}
.form-horizontal .control-group > label {
.form-horizontal .control-label {
float: none;
width: auto;
padding-top: 0;
@@ -886,6 +908,16 @@
padding-right: 10px;
padding-left: 10px;
}
.media .pull-left,
.media .pull-right {
display: block;
float: none;
margin-bottom: 10px;
}
.media-object {
margin-right: 0;
margin-left: 0;
}
.modal {
top: 10px;
right: 10px;
@@ -944,14 +976,14 @@
display: none;
}
.nav-collapse .nav .nav-header {
color: #555555;
color: #777777;
text-shadow: none;
}
.nav-collapse .nav > li > a,
.nav-collapse .dropdown-menu a {
padding: 9px 15px;
font-weight: bold;
color: #555555;
color: #777777;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
@@ -970,6 +1002,10 @@
.nav-collapse .dropdown-menu a:hover {
background-color: #f2f2f2;
}
.navbar-inverse .nav-collapse .nav > li > a,
.navbar-inverse .nav-collapse .dropdown-menu a {
color: #999999;
}
.navbar-inverse .nav-collapse .nav > li > a:hover,
.navbar-inverse .nav-collapse .dropdown-menu a:hover {
background-color: #111111;
@@ -982,7 +1018,7 @@
position: static;
top: auto;
left: auto;
display: block;
display: none;
float: none;
max-width: none;
padding: 0;
@@ -996,6 +1032,9 @@
-moz-box-shadow: none;
box-shadow: none;
}
.nav-collapse .open > .dropdown-menu {
display: block;
}
.nav-collapse .dropdown-menu:before,
.nav-collapse .dropdown-menu:after {
display: none;
@@ -1003,6 +1042,10 @@
.nav-collapse .dropdown-menu .divider {
display: none;
}
.nav-collapse .nav > li > .dropdown-menu:before,
.nav-collapse .nav > li > .dropdown-menu:after {
display: none;
}
.nav-collapse .navbar-form,
.nav-collapse .navbar-search {
float: none;
@@ -1014,6 +1057,11 @@
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
}
.navbar-inverse .nav-collapse .navbar-form,
.navbar-inverse .nav-collapse .navbar-search {
border-top-color: #111111;
border-bottom-color: #111111;
}
.navbar .nav-collapse .nav.pull-right {
float: none;
margin-left: 0;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
/* ===================================================
* bootstrap-transition.js v2.1.0
* bootstrap-transition.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#transitions
* ===================================================
* Copyright 2012 Twitter, Inc.
@@ -20,14 +20,14 @@
!function ($) {
"use strict"; // jshint ;_;
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */
$(function () {
"use strict"; // jshint ;_;
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */
$.support.transition = (function () {
var transitionEnd = (function () {
@@ -58,7 +58,7 @@
})
}(window.jQuery);/* ==========================================================
* bootstrap-alert.js v2.1.0
* bootstrap-alert.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
* Copyright 2012 Twitter, Inc.
@@ -142,12 +142,10 @@
/* ALERT DATA-API
* ============== */
$(function () {
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
})
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
}(window.jQuery);/* ============================================================
* bootstrap-button.js v2.1.0
* bootstrap-button.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#buttons
* ============================================================
* Copyright 2012 Twitter, Inc.
@@ -199,7 +197,7 @@
}
Button.prototype.toggle = function () {
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
$parent && $parent
.find('.active')
@@ -233,16 +231,14 @@
/* BUTTON DATA-API
* =============== */
$(function () {
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
$btn.button('toggle')
})
$(document).on('click.button.data-api', '[data-toggle^=button]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
$btn.button('toggle')
})
}(window.jQuery);/* ==========================================================
* bootstrap-carousel.js v2.1.0
* bootstrap-carousel.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#carousel
* ==========================================================
* Copyright 2012 Twitter, Inc.
@@ -337,9 +333,7 @@
, direction = type == 'next' ? 'left' : 'right'
, fallback = type == 'next' ? 'first' : 'last'
, that = this
, e = $.Event('slide', {
relatedTarget: $next[0]
})
, e
this.sliding = true
@@ -347,6 +341,10 @@
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
e = $.Event('slide', {
relatedTarget: $next[0]
})
if ($next.hasClass('active')) return
if ($.support.transition && this.$element.hasClass('slide')) {
@@ -406,18 +404,16 @@
/* CAROUSEL DATA-API
* ================= */
$(function () {
$('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
var $this = $(this), href
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
, options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
$target.carousel(options)
e.preventDefault()
})
$(document).on('click.carousel.data-api', '[data-slide]', function (e) {
var $this = $(this), href
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
, options = $.extend({}, $target.data(), $this.data())
$target.carousel(options)
e.preventDefault()
})
}(window.jQuery);/* =============================================================
* bootstrap-collapse.js v2.1.0
* bootstrap-collapse.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#collapse
* =============================================================
* Copyright 2012 Twitter, Inc.
@@ -561,20 +557,18 @@
/* COLLAPSIBLE DATA-API
* ==================== */
$(function () {
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
var $this = $(this), href
, target = $this.attr('data-target')
|| e.preventDefault()
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
, option = $(target).data('collapse') ? 'toggle' : $this.data()
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
$(target).collapse(option)
})
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
var $this = $(this), href
, target = $this.attr('data-target')
|| e.preventDefault()
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
, option = $(target).data('collapse') ? 'toggle' : $this.data()
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
$(target).collapse(option)
})
}(window.jQuery);/* ============================================================
* bootstrap-dropdown.js v2.1.0
* bootstrap-dropdown.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
* ============================================================
* Copyright 2012 Twitter, Inc.
@@ -675,8 +669,9 @@
}
function clearMenus() {
getParent($(toggle))
.removeClass('open')
$(toggle).each(function () {
getParent($(this)).removeClass('open')
})
}
function getParent($this) {
@@ -685,7 +680,7 @@
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
$parent = $(selector)
@@ -713,17 +708,14 @@
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
$(function () {
$('html')
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
$('body')
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
})
$(document)
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
}(window.jQuery);/* =========================================================
* bootstrap-modal.js v2.1.0
* bootstrap-modal.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#modals
* =========================================================
* Copyright 2012 Twitter, Inc.
@@ -773,8 +765,6 @@
if (this.isShown || e.isDefaultPrevented()) return
$('body').addClass('modal-open')
this.isShown = true
this.escape()
@@ -796,13 +786,12 @@
that.$element
.addClass('in')
.attr('aria-hidden', false)
.focus()
that.enforceFocus()
transition ?
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
that.$element.trigger('shown')
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
that.$element.focus().trigger('shown')
})
}
@@ -820,8 +809,6 @@
this.isShown = false
$('body').removeClass('modal-open')
this.escape()
$(document).off('focusin.modal')
@@ -891,9 +878,11 @@
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)
if (this.options.backdrop != 'static') {
this.$backdrop.click($.proxy(this.hide, this))
}
this.$backdrop.click(
this.options.backdrop == 'static' ?
$.proxy(this.$element[0].focus, this.$element[0])
: $.proxy(this.hide, this)
)
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
@@ -943,25 +932,24 @@
/* MODAL DATA-API
* ============== */
$(function () {
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
var $this = $(this)
, href = $this.attr('href')
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
, option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
$(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this = $(this)
, href = $this.attr('href')
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
, option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
e.preventDefault()
e.preventDefault()
$target
.modal(option)
.one('hide', function () {
$this.focus()
})
})
$target
.modal(option)
.one('hide', function () {
$this.focus()
})
})
}(window.jQuery);/* ===========================================================
* bootstrap-tooltip.js v2.1.0
}(window.jQuery);
/* ===========================================================
* bootstrap-tooltip.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#tooltips
* Inspired by the original jQuery.tipsy by Jason Frame
* ===========================================================
@@ -1081,9 +1069,9 @@
inside = /in/.test(placement)
$tip
.remove()
.detach()
.css({ top: 0, left: 0, display: 'block' })
.appendTo(inside ? this.$element : document.body)
.insertAfter(this.$element)
pos = this.getPosition(inside)
@@ -1106,7 +1094,7 @@
}
$tip
.css(tp)
.offset(tp)
.addClass(placement)
.addClass('in')
}
@@ -1128,18 +1116,18 @@
function removeWithAnimation() {
var timeout = setTimeout(function () {
$tip.off($.support.transition.end).remove()
$tip.off($.support.transition.end).detach()
}, 500)
$tip.one($.support.transition.end, function () {
clearTimeout(timeout)
$tip.remove()
$tip.detach()
})
}
$.support.transition && this.$tip.hasClass('fade') ?
removeWithAnimation() :
$tip.remove()
$tip.detach()
return this
}
@@ -1197,8 +1185,9 @@
this.enabled = !this.enabled
}
, toggle: function () {
this[this.tip().hasClass('in') ? 'hide' : 'show']()
, toggle: function (e) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
self[self.tip().hasClass('in') ? 'hide' : 'show']()
}
, destroy: function () {
@@ -1231,12 +1220,11 @@
, trigger: 'hover'
, title: ''
, delay: 0
, html: true
, html: false
}
}(window.jQuery);
/* ===========================================================
* bootstrap-popover.js v2.1.0
}(window.jQuery);/* ===========================================================
* bootstrap-popover.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#popovers
* ===========================================================
* Copyright 2012 Twitter, Inc.
@@ -1338,7 +1326,7 @@
})
}(window.jQuery);/* =============================================================
* bootstrap-scrollspy.js v2.1.0
* bootstrap-scrollspy.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
* =============================================================
* Copyright 2012 Twitter, Inc.
@@ -1488,7 +1476,7 @@
})
}(window.jQuery);/* ========================================================
* bootstrap-tab.js v2.1.0
* bootstrap-tab.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#tabs
* ========================================================
* Copyright 2012 Twitter, Inc.
@@ -1538,7 +1526,7 @@
if ( $this.parent('li').hasClass('active') ) return
previous = $ul.find('.active a').last()[0]
previous = $ul.find('.active:last a')[0]
e = $.Event('show', {
relatedTarget: previous
@@ -1614,15 +1602,13 @@
/* TAB DATA-API
* ============ */
$(function () {
$('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
e.preventDefault()
$(this).tab('show')
})
$(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
e.preventDefault()
$(this).tab('show')
})
}(window.jQuery);/* =============================================================
* bootstrap-typeahead.js v2.1.0
* bootstrap-typeahead.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#typeahead
* =============================================================
* Copyright 2012 Twitter, Inc.
@@ -1797,7 +1783,7 @@
.on('keypress', $.proxy(this.keypress, this))
.on('keyup', $.proxy(this.keyup, this))
if ($.browser.webkit || $.browser.msie) {
if (this.eventSupported('keydown')) {
this.$element.on('keydown', $.proxy(this.keydown, this))
}
@@ -1806,6 +1792,15 @@
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
}
, eventSupported: function(eventName) {
var isSupported = eventName in this.$element
if (!isSupported) {
this.$element.setAttribute(eventName, 'return;')
isSupported = typeof this.$element[eventName] === 'function'
}
return isSupported
}
, move: function (e) {
if (!this.shown) return
@@ -1844,6 +1839,9 @@
switch(e.keyCode) {
case 40: // down arrow
case 38: // up arrow
case 16: // shift
case 17: // ctrl
case 18: // alt
break
case 9: // tab
@@ -1911,18 +1909,16 @@
/* TYPEAHEAD DATA-API
* ================== */
$(function () {
$('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
var $this = $(this)
if ($this.data('typeahead')) return
e.preventDefault()
$this.typeahead($this.data())
})
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
var $this = $(this)
if ($this.data('typeahead')) return
e.preventDefault()
$this.typeahead($this.data())
})
}(window.jQuery);
/* ==========================================================
* bootstrap-affix.js v2.1.0
* bootstrap-affix.js v2.2.1
* http://twitter.github.com/bootstrap/javascript.html#affix
* ==========================================================
* Copyright 2012 Twitter, Inc.
@@ -1951,7 +1947,9 @@
var Affix = function (element, options) {
this.options = $.extend({}, $.fn.affix.defaults, options)
this.$window = $(window).on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
this.$window = $(window)
.on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
this.$element = $(element)
this.checkPosition()
}

File diff suppressed because one or more lines are too long