Skip to content

Instantly share code, notes, and snippets.

View m-vdb's full-sized avatar

Maxime Vdb m-vdb

  • Rasa
  • Berlin
View GitHub Profile
@m-vdb
m-vdb / paramForm.js
Created June 4, 2013 15:37
Param form (Backbone.Form)
var ParamForm = window.Interface.BaseForm.extend({
initialize: function(options){
options.schema = {
client_name: {type: 'Text', title: 'Client Name', validators: ['required'], editorClass: 'client_name'},
name: {type: 'Text', title: 'Short Name', editorClass: 'name', fieldClass: 'hidden'},
urls: {type: 'List', title: 'Source urls', validators: ['url']},
exporters: {type: 'List', title: 'Facebook Pages', itemType: 'InlineObject', validators: [this.validateListExporter],
subSchema: {
name: {type: 'Text', title: 'Name', validators: ['required']},
exporter: {type: 'Exporter', title: 'Type',
@m-vdb
m-vdb / backbone-forms-ListKeyValue.css
Created December 14, 2012 08:08
backbone-forms-ListKeyValue.css
.bbf-field .bbf-keyvalue-editor input {
width: 45%;
}
@m-vdb
m-vdb / backbone-forms-ListKeyValue-Editors.js
Created December 13, 2012 14:07
Backbone.Forms editors for List accepting objects, and rendering them as key-value pairs
/*
Currently, the Object ItemType is not supported.
*/
var Form = Backbone.Form,
editors = Form.editors;
Form.setTemplates({
listKeyValueItem: '\
<li>\
@m-vdb
m-vdb / backbone-forms-validators.js
Created December 11, 2012 12:58
Backbone forms validator
(function(){
var validators = Backbone.Form.validators;
//a validator verifying if an element is not in a given list
validators.errMessages.notInList = 'Must not be in list {{list}}';
validators.notInList = function(options) {
if (!options.list) throw new Error('Missing required "list" options for "notInList" validator');
options = _.extend({
type: 'notInList',
@m-vdb
m-vdb / inlinenestedmodel.js
Created December 5, 2012 11:11 — forked from alexstrat/inlinenestedmodel.js
Backbone-Forms InlineObject
var Form = Backbone.Form,
editors = Form.editors;
// we don't want our nested form to have a (nested) <form> tag
// (currently bbf includes form tags: https://github.com/powmedia/backbone-forms/issues/8)
// aside from being strange html to have nested form tags, it causes submission-upon-enter
Form.setTemplates({
nestedForm: '<div class="bbf-nested-form">{{fieldsets}}</div>'
});
@m-vdb
m-vdb / .screenrc
Created December 3, 2012 15:06
Screen configuration
#
# Example of a user's .screenrc file
#
# no annoying audible bell, please
#vbell on
vbell off
# detach on hangup
autodetach on