First commit

This commit is contained in:
Theodotos Andreou 2018-01-14 13:10:16 +00:00
commit c6e2478c40
13918 changed files with 2303184 additions and 0 deletions

View file

@ -0,0 +1,101 @@
#!/usr/bin/env node
var builder = require('buildify'),
path = require('path');
var templateData = {
version: '0.10.1'
};
var baseDir = __dirname + '/..',
sourceDir = baseDir + '/src',
outputDir = baseDir + '/distribution';
//Files to concatenate into main file
var fileList = [
'form.js',
'helpers.js',
'validators.js',
'field.js',
'editors.js',
'setup.js',
'templates/default.js'
];
//Concatenate the main files
var mainContents = builder(sourceDir)
.concat(fileList)
.getContent();
//Save regular dev and mini versions
builder(baseDir)
.setContent(mainContents)
.wrap('scripts/build-templates/main.js', templateData)
.save('distribution/backbone-forms.js')
.uglify()
.save('distribution/backbone-forms.min.js');
//Main AMD file (for RequireJS)
builder(baseDir)
.setContent(mainContents)
.wrap('scripts/build-templates/main.amd.js', templateData)
.save('distribution.amd/backbone-forms.js')
.uglify()
.save('distribution.amd/backbone-forms.min.js');
//Standalone template files
['default', 'bootstrap'].forEach(function(template) {
//HTML
builder(baseDir)
.load('src/templates/'+template+'.js')
.wrap('scripts/build-templates/standalone-template.js')
.save('distribution/templates/'+template+'.js');
//HTML (AMD)
builder(baseDir)
.load('src/templates/'+template+'.js')
.wrap('scripts/build-templates/standalone-template.amd.js')
.save('distribution.amd/templates/'+template+'.js');
//CSS
builder(baseDir)
.load('src/templates/'+template+'.css')
.save('distribution/templates/'+template+'.css')
.save('distribution.amd/templates/'+template+'.css');
});
//Extra editors
['list', 'jquery-ui'].forEach(function(name) {
//Save regular dev and mini versions
builder(baseDir)
.load('src/editors/'+name+'.js')
.save('distribution/editors/'+name+'.js')
.uglify()
.save('distribution/editors/'+name+'.min.js');
//CSS file
if (path.existsSync(baseDir + '/src/editors/'+name+'.css')) {
builder(baseDir)
.load('src/editors/'+name+'.css')
.save('distribution/editors/'+name+'.css')
.save('distribution.amd/editors/'+name+'.css');
}
//Save AMD version (for RequireJS)
builder(baseDir)
.load('src/editors/'+name+'.js')
.wrap('scripts/build-templates/simple.amd.js')
.save('distribution.amd/editors/'+name+'.js')
.uglify()
.save('distribution.amd/editors/'+name+'.min.js');
});
//Modal adapters
builder(baseDir)
.load('lib/backbone.bootstrap-modal/src/backbone.bootstrap-modal.js')
.save('distribution/adapters/backbone.bootstrap-modal.js')
.uglify()
.save('distribution/adapters/backbone.bootstrap-modal.min.js');

View file

@ -0,0 +1,25 @@
/**
* Backbone Forms v{{version}}
*
* NOTE:
* This version is for use with RequireJS
* If using regular <script> tags to include your files, use backbone-forms.min.js
*
* Copyright (c) 2012 Charles Davison, Pow Media Ltd
*
* License and more information at:
* http://github.com/powmedia/backbone-forms
*/
define(['jquery', 'underscore', 'backbone'], function($, _, Backbone) {
{{body}}
//Metadata
Form.VERSION = '{{version}}';
//Exports
Backbone.Form = Form;
return Form;
});

View file

@ -0,0 +1,38 @@
/**
* Backbone Forms v{{version}}
*
* Copyright (c) 2012 Charles Davison, Pow Media Ltd
*
* License and more information at:
* http://github.com/powmedia/backbone-forms
*/
;(function(root) {
//DEPENDENCIES
//CommonJS
if (typeof exports !== 'undefined' && typeof require !== 'undefined') {
var $ = root.jQuery || root.Zepto || root.ender || require('jquery'),
_ = root._ || require('underscore'),
Backbone = root.Backbone || require('backbone');
}
//Browser
else {
var $ = root.jQuery,
_ = root._,
Backbone = root.Backbone;
}
//SOURCE
{{body}}
//Metadata
Form.VERSION = '{{version}}';
//Exports
Backbone.Form = Form;
})(this);

View file

@ -0,0 +1,5 @@
define(['jquery', 'underscore', 'backbone', 'backbone-forms'], function($, _, Backbone) {
{{body}}
});

View file

@ -0,0 +1,12 @@
/**
* Requirements when customising templates:
* - Each template must have one 'parent' element tag.
* - "data-type" attributes are required.
* - The main placeholder tags such as the following are required: fieldsets, fields
*/
define(['jquery', 'underscore', 'backbone', 'backbone-forms'], function($, _, Backbone) {
var Form = Backbone.Form;
{{body}}
});

View file

@ -0,0 +1,15 @@
/**
* Include this file _after_ the main backbone-forms file to override the default templates.
* You only need to include templates you want to override.
*
* Requirements when customising templates:
* - Each template must have one 'parent' element tag.
* - "data-type" attributes are required.
* - The main placeholder tags such as the following are required: fieldsets, fields
*/
;(function() {
var Form = Backbone.Form;
{{body}}
})();

View file

@ -0,0 +1,2 @@
#Watches the /src directory for changes and builds the distribution files
supervisor --watch src,lib --no-restart-on exit --quiet --extensions 'js|css' --exec node scripts/build