Skip to content

Instantly share code, notes, and snippets.

View powmedia's full-sized avatar

Charles Davison powmedia

View GitHub Profile
/**
* Select2
*
* Renders Select2 - jQuery based replacement for select boxes
*
* Simply pass a 'config' object on your schema, with any options to pass into Select2.
* See http://ivaynberg.github.com/select2/#documentation
*/
Backbone.Form.editors.Select2 = Backbone.Form.editors.Base.extend({
@powmedia
powmedia / gist:3879951
Created October 12, 2012 16:03
Backbone Forms custom editor for Ajax Chosen select
/**
* Creates an ajax-chosen instance
* @see https://github.com/powmedia/ajax-chosen
*
* @param {String} options.schema.queryUrl URL for ajax queries
* @param {Function} options.schema.itemToString Function that takes an item and returns how it should be displayed
*/
module.exports = Backbone.Form.editors.Select.extend({
render: function() {
@powmedia
powmedia / gist:1081802
Created July 14, 2011 01:58
Backbone.sync for Titanium
//Customise Backbone.sync to work with Titanium rather than jQuery
Backbone.sync = (function() {
var methodMap = {
'create': 'POST',
'read' : 'GET',
'update': 'PUT',
'delete': 'DELETE'
};
var xhr = Ti.Network.createHTTPClient({ timeout: 5000 });