Skip to content

Instantly share code, notes, and snippets.

View hellsingblack's full-sized avatar
🎯
Focusing

Gaby Hourlier hellsingblack

🎯
Focusing
View GitHub Profile
/* =============================================================
* bootstrap-typeahead-backbone.js v2.0.0
* http://twitter.github.com/bootstrap/javascript.html#typeahead
* https://github.com/twitter/bootstrap/blob/master/js/bootstrap-typeahead.js
* Modified by Marius Andreiana to work with Backbone Collection, Model, View
* - custom results formatting
* - custom behavior on selected item (Model with complex information)
* =============================================================
* Copyright 2012 Twitter, Inc.
*
/* =============================================================
* bootstrap-typeahead-backbone.js v2.0.0
* http://twitter.github.com/bootstrap/javascript.html#typeahead
* https://github.com/twitter/bootstrap/blob/master/js/bootstrap-typeahead.js
* Modified by Marius Andreiana to work with Backbone Collection, Model, View
* - custom results formatting
* - custom behavior on selected item (Model with complex information)
* =============================================================
* Copyright 2012 Twitter, Inc.
*
/* =============================================================
* bootstrap-typeahead-backbone.js v2.0.0
* http://twitter.github.com/bootstrap/javascript.html#typeahead
* https://github.com/twitter/bootstrap/blob/master/js/bootstrap-typeahead.js
* Modified by Marius Andreiana to work with Backbone Collection, Model, View
* - custom results formatting
* - custom behavior on selected item (Model with complex information)
* =============================================================
* Copyright 2012 Twitter, Inc.
*
@hellsingblack
hellsingblack / gist:4252843
Created December 10, 2012 19:46 — forked from billyvg/gist:2839956
Bootstrap Typeahead + Backbone.js
class TypeaheadView extends Backbone.View
tagName: 'input'
initialize: (@options) ->
@source = options.source if options.source?
@
# Retrieves the Backbone Model that matches this view's value
# Will have problems if you have multiple Models with the same attribute that
# you are using as the typeahead's source.
getModel: () ->
@hellsingblack
hellsingblack / Backbone.View.Autocomplete.js
Created December 10, 2012 19:43 — forked from marksteve/Backbone.View.Autocomplete.js
Backbone View for jQuery UI Autocomplete inputs
var Autocomplete = Backbone.View.extend({
render: function() {
var choices = this.options.choices,
selected = this.options.selected,
iterator = this.options.iterator,
label = this.options.label,
allowDupes = this.options.allowDupes,
$el = $(this.el);
$el.autocomplete({
source: function(request, response) {