Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
app/index.js
app/index.js.map
3 changes: 2 additions & 1 deletion .jscsrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{

"preset": "airbnb",
"esnext": true
}
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{

"esnext": true
}
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
index.js
node_modules
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Textalk
Copyright (c) 2015 Simon Korn

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

168 changes: 0 additions & 168 deletions app/index.js

This file was deleted.

12 changes: 12 additions & 0 deletions app/templates/base/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
"name": "<%= paramName %>",
"version": "1.0.0",
"license": "MIT",
"author": "<%= username %>",
"main": [
"dist/<%= paramName %>.min.js"
],
"keywords": [
"angular-schema-form",
"schema-form",
"form",
"json",
"json-schema",
"schema"
],
"ignore": [
"**/.*",
"node_modules",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

$scope.model = {};

$scope.debug = {schema: $scope.schema, form: $scope.form};
$scope.debug = {schema: angular.copy($scope.schema), form: angular.copy($scope.form)};

});

Expand Down
File renamed without changes.
7 changes: 0 additions & 7 deletions app/templates/base/gulp/index.js

This file was deleted.

3 changes: 0 additions & 3 deletions app/templates/base/gulp/tasks/default.js

This file was deleted.

24 changes: 0 additions & 24 deletions app/templates/base/gulp/tasks/minify.js

This file was deleted.

17 changes: 0 additions & 17 deletions app/templates/base/gulp/tasks/server.js

This file was deleted.

44 changes: 43 additions & 1 deletion app/templates/base/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
require('./gulp');
var gulp = require('gulp');
var connect = require('gulp-connect');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var templateCache = require('gulp-angular-templatecache');
var streamqueue = require('streamqueue');
var fs = require('fs');

gulp.task('default', ['minify', 'connect', 'watch']);

gulp.task('connect', function () {
connect.server({
root: ['demo', './'],
livereload: true,
});
});

gulp.task('reload', ['minify'], function () {
gulp.src('./dist/**/*.*').pipe(connect.reload());
});

gulp.task('watch', function () {
gulp.watch(['./src/**', './demo/**'], ['reload']);
});

gulp.task('minify', function () {
var files = JSON.parse(fs.readFileSync('sources.json', 'utf-8'));
var stream = streamqueue({ objectMode: true },
gulp.src(['src/templates/**/*.html']).pipe(templateCache({
standalone: true,
root: 'src/templates/',
})),
gulp.src(files)
)
.pipe(concat('<%= paramName %>.js'))
.pipe(gulp.dest('./dist'))
.pipe(uglify())
.pipe(rename('<%= paramName %>.min.js'))
.pipe(gulp.dest('./dist'));

return stream;
});
8 changes: 2 additions & 6 deletions app/templates/base/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
"name": "<%= paramName %>",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"directories": {
"test": "test"
},
"author": "",
"description": "<%= name %> add-on for Angular Schema Form.",
"author": "<%= username %>",
"license": "MIT",
"devDependencies": {}
}
1 change: 1 addition & 0 deletions app/templates/base/sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%- sources -%>
15 changes: 15 additions & 0 deletions app/templates/input/src/directives/update-on-blur.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
angular.module('<%= module %>').directive('updateOnBlur', function () {
return {
restrict: 'E',
require: 'ngModel',
scope: {},
template: '<input type="text" class="form-control" ng-model="modelValue" ng-blur="updateModel(modelValue)"></input>',
link: function (scope, element, attrs, ngModel) {
scope.modelValue = ngModel.$viewValue;

scope.updateModel = function (modelValue) {
ngModel.$setViewValue(modelValue);
};
},
};
});
4 changes: 2 additions & 2 deletions app/templates/input/src/module.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
angular.module('<%= directive %>', [
angular.module('<%= module %>', [
'schemaForm',
'templates'
]).config(function(schemaFormDecoratorsProvider, sfBuilderProvider) {

schemaFormDecoratorsProvider.defineAddOn(
'bootstrapDecorator', // Name of the decorator you want to add to.
'<%= typeName %>', // Form type that should render this add-on
'<%= formType %>', // Form type that should render this add-on
'src/templates/<%= paramName %>.html', // Template name in $templateCache
sfBuilderProvider.stdBuilders // List of builder functions to apply.
);
Expand Down
6 changes: 5 additions & 1 deletion app/templates/input/src/templates/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ <h2>{{form.myOwnFormOption}}</h2>
<!-- Create your own form options -->

<label>{{form.title}}</label>

<% if (directive) { %>
<update-on-blur sf-field-model schema-validate="form"></update-on-blur>
<em>Blur this field to update the model.</em>
<% } else { %>
<input sf-field-model schema-validate="form" type="text" class="form-control">
<% } %>
<!-- sf-field-model let's the ngModel builder know that you want a ng-model that matches against the form key here -->
<!-- schema-validate="form" validates the form against the schema -->

Expand Down
Loading