added postinstall grunt script
This commit is contained in:
parent
d8401e841f
commit
612fedbb79
|
@ -1,6 +1,6 @@
|
||||||
# DOCKER-VERSION 1.7.0
|
# DOCKER-VERSION 1.7.0
|
||||||
|
|
||||||
FROM ubuntu:13.10
|
FROM ubuntu
|
||||||
|
|
||||||
# make sure apt is up to date
|
# make sure apt is up to date
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "grunt",
|
"start": "grunt",
|
||||||
"test": "grunt test",
|
"test": "grunt test",
|
||||||
"postinstall": "bower install --config.interactive=false"
|
"postinstall": "bower install --config.interactive=false; ./node_modules/grunt-cli/bin/grunt"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "~0.9.0",
|
"async": "~0.9.0",
|
||||||
|
|
|
@ -6,6 +6,9 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
|
||||||
require: ['^form'],
|
require: ['^form'],
|
||||||
link: function($scope, $element, $attrs, $ctrls) {
|
link: function($scope, $element, $attrs, $ctrls) {
|
||||||
|
|
||||||
|
if(!$rootScope.watchCount === undefined){
|
||||||
|
$rootScope.watchCount = 0;
|
||||||
|
}
|
||||||
var difference = function(array){
|
var difference = function(array){
|
||||||
var rest = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
|
var rest = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
|
||||||
|
|
||||||
|
@ -25,56 +28,47 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
|
||||||
var expression = $attrs.autoSaveForm || 'true';
|
var expression = $attrs.autoSaveForm || 'true';
|
||||||
|
|
||||||
$scope.$on('ngRepeatStarted', function(ngRepeatFinishedEvent) {
|
$scope.$on('ngRepeatStarted', function(ngRepeatFinishedEvent) {
|
||||||
// $scope.finishedRender = false;
|
$scope.finishedRender = false;
|
||||||
|
$rootScope.watchCount = 0;
|
||||||
});
|
});
|
||||||
$scope.$on('ngRepeatFinished', function(ngRepeatFinishedEvent) {
|
$scope.$on('ngRepeatFinished', function(ngRepeatFinishedEvent) {
|
||||||
$scope.finishedRender = true;
|
$scope.finishedRender = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$watch('myform.form_fields', function(newValue, oldValue) {
|
$scope.$watch('myform.form_fields', function(newValue, oldValue) {
|
||||||
// console.log('auto saving');
|
|
||||||
console.log(oldValue);
|
|
||||||
console.log(newValue);
|
|
||||||
if(difference(oldValue,newValue).length === 0 || oldValue === undefined){
|
if(difference(oldValue,newValue).length === 0 || oldValue === undefined){
|
||||||
console.log('returning');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(difference(oldValue,newValue).length !== 0 && !$formCtrl.$dirty) {
|
|
||||||
$formCtrl.$setDirty();
|
|
||||||
}
|
|
||||||
// else if(difference(oldValue.form_fields,newValue.form_fields).length === 0 ){
|
|
||||||
// $scope.finishedRender = true;
|
|
||||||
// }
|
|
||||||
// console.log('\n\n-------\n$pristine: '+( $formCtrl.$pristine ) );
|
// console.log('\n\n-------\n$pristine: '+( $formCtrl.$pristine ) );
|
||||||
// console.log('$dirty: '+( $formCtrl.$dirty ) );
|
// console.log('$dirty: '+( $formCtrl.$dirty ) );
|
||||||
// console.log('form_fields changed: '+difference(oldValue.form_fields,newValue.form_fields).length );
|
// console.log('form_fields changed: '+difference(oldValue.form_fields,newValue.form_fields).length );
|
||||||
// console.log('$valid: '+$formCtrl.$valid);
|
// console.log('$valid: '+$formCtrl.$valid);
|
||||||
// console.log('finishedRender: '+$scope.finishedRender);
|
// console.log('finishedRender: '+$scope.finishedRender);
|
||||||
// console.log('saveInProgress: '+$scope.saveInProgress);
|
// console.log('saveInProgress: '+$scope.saveInProgress);
|
||||||
|
|
||||||
if($scope.finishedRender && ($formCtrl.$dirty || difference(oldValue,newValue).length !== 0)) {
|
|
||||||
// console.log('auto saving');
|
|
||||||
|
|
||||||
if(savePromise) {
|
if($scope.finishedRender && ($formCtrl.$dirty || difference(oldValue,newValue).length !== 0) ) {
|
||||||
$timeout.cancel(savePromise);
|
$rootScope.watchCount++;
|
||||||
}
|
if($rootScope.watchCount === 1) {
|
||||||
|
|
||||||
savePromise = $timeout(function() {
|
|
||||||
savePromise = null;
|
|
||||||
|
|
||||||
// Still valid?
|
|
||||||
if(true) {
|
|
||||||
// console.log('inside');
|
|
||||||
|
|
||||||
if($scope.$eval(expression) !== false) {
|
|
||||||
// console.log('Form data persisted -- setting pristine flag');
|
|
||||||
$formCtrl.$setPristine();
|
|
||||||
// $scope.finishedRender = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(savePromise) {
|
||||||
|
$timeout.cancel(savePromise);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
savePromise = $timeout(function() {
|
||||||
|
savePromise = null;
|
||||||
|
|
||||||
|
// Still valid?
|
||||||
|
// if($formCtrl.$valid) {
|
||||||
|
if($scope.$eval(expression) !== false) {
|
||||||
|
console.log('Form data persisted -- setting pristine flag');
|
||||||
|
$formCtrl.$setPristine();
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, true);
|
}, true);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<form class="row" name="fieldForm" form-locator auto-save-form="update()" form="myform" novalidation>
|
<form class="row" name="fieldForm" form-locator auto-save-form="update()" form="myform" novalidation>
|
||||||
<div class="add-field col-xs-5">
|
<div class="col-xs-5 add-field">
|
||||||
<!-- <select ng-model="addField.new" ng-options="type.name as type.value for type in addField.types"></select>
|
<!-- <select ng-model="addField.new" ng-options="type.name as type.value for type in addField.types"></select>
|
||||||
<button type="submit" class="btn" ng-click="addNewField()">
|
<button type="submit" class="btn" ng-click="addNewField()">
|
||||||
<i class="icon-plus"></i> Add Field
|
<i class="icon-plus"></i> Add Field
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-7 current-fields">
|
<div class="col-xs-7 current-fields container">
|
||||||
<!-- <p ng-show="form.form_fields.length == 0">No fields added yet.</p> -->
|
<!-- <p ng-show="form.form_fields.length == 0">No fields added yet.</p> -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-10">
|
<div class="col-xs-10">
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-1" style="padding:0 5px;" >
|
<div class="col-xs-1" style="padding:0 5px;" >
|
||||||
<div class="panel-group tool-panel text-center">
|
<div class="panel-group tool-panel text-center">
|
||||||
<div class="panel panel-default" ng-repeat="field in form.form_fields">
|
<div class="panel panel-default" ng-repeat="field in myform.form_fields">
|
||||||
<div class="panel-heading" style="padding: 10px 10px; height: 37px;" ng-click="deleteField(field.$$hashKey)">
|
<div class="panel-heading" style="padding: 10px 10px; height: 37px;" ng-click="deleteField(field.$$hashKey)">
|
||||||
<span class="text-center">
|
<span class="text-center">
|
||||||
<a href="" class="fa fa-trash-o"></a>
|
<a href="" class="fa fa-trash-o"></a>
|
||||||
|
@ -136,7 +136,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-1" style="padding:0 5px;">
|
<div class="col-xs-1" style="padding:0 5px;">
|
||||||
<div class="panel-group tool-panel text-center">
|
<div class="panel-group tool-panel text-center">
|
||||||
<div class="panel panel-default" ng-repeat="field in form.form_fields">
|
<div class="panel panel-default" ng-repeat="field in myform.form_fields">
|
||||||
<div class="panel-heading" style="padding: 10px 10px; height: 37px;" ng-click="duplicateField(field, $index)">
|
<div class="panel-heading" style="padding: 10px 10px; height: 37px;" ng-click="duplicateField(field, $index)">
|
||||||
<span class="text-center">
|
<span class="text-center">
|
||||||
<a href="" class="fa fa-files-o"></a>
|
<a href="" class="fa fa-files-o"></a>
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
<section data-ng-controller="ViewSubmissionController" data-ng-init="findAll()">
|
|
||||||
<div class="page-header row" style="padding-bottom: 0px;">
|
|
||||||
<div class="col-xs-9">
|
|
||||||
<h1 data-ng-bind="form.title" style="margin-bottom: 0px;"></h1> <small>Submissions </small>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-3">
|
|
||||||
<small class=" pull-right">
|
|
||||||
<a class="btn btn-default" href="/#!/forms/{{form._id}}" disabled="form.isLive">
|
|
||||||
View Live Form
|
|
||||||
<i class="status-light status-light-on fa fa-dot-circle-o fa-3" ng-show="form.isLive"></i>
|
|
||||||
<i class="status-light status-light-off fa fa-circle-o fa-3" ng-hide="form.isLive"></i>
|
|
||||||
</a>
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
<table class="table table-striped col-xs-7">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>#</th>
|
|
||||||
<th data-ng-repeat="(key, val) in submissions[0].form_fields">
|
|
||||||
{{key}}
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr data-ng-repeat="submission in submissions">
|
|
||||||
<td>{{$index+1}}</td>
|
|
||||||
<td data-ng-repeat="(key, val) in submission.form_fields">
|
|
||||||
{{value}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<a data-ng-repeat="submission in submissions" data-ng-href="#!/forms/{{form._id}}/admin" class="list-group-item">
|
|
||||||
<small class="list-group-item-text">
|
|
||||||
Created on
|
|
||||||
<span data-ng-bind="submission.created | date:'mediumDate'"></span>
|
|
||||||
by
|
|
||||||
<span data-ng-bind="form.user.displayName"></span>
|
|
||||||
</small>
|
|
||||||
<h4 class="list-group-item-heading" data-ng-bind="submission.title"></h4>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
Loading…
Reference in a new issue