added postinstall grunt script

This commit is contained in:
David Baldwynn 2015-07-10 13:31:09 -07:00
parent d8401e841f
commit 612fedbb79
5 changed files with 31 additions and 85 deletions

View file

@ -1,6 +1,6 @@
# DOCKER-VERSION 1.7.0
FROM ubuntu:13.10
FROM ubuntu
# make sure apt is up to date
RUN apt-get update

View file

@ -15,7 +15,7 @@
"scripts": {
"start": "grunt",
"test": "grunt test",
"postinstall": "bower install --config.interactive=false"
"postinstall": "bower install --config.interactive=false; ./node_modules/grunt-cli/bin/grunt"
},
"dependencies": {
"async": "~0.9.0",

View file

@ -6,6 +6,9 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
require: ['^form'],
link: function($scope, $element, $attrs, $ctrls) {
if(!$rootScope.watchCount === undefined){
$rootScope.watchCount = 0;
}
var difference = function(array){
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';
$scope.$on('ngRepeatStarted', function(ngRepeatFinishedEvent) {
// $scope.finishedRender = false;
$scope.finishedRender = false;
$rootScope.watchCount = 0;
});
$scope.$on('ngRepeatFinished', function(ngRepeatFinishedEvent) {
$scope.finishedRender = true;
});
$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){
console.log('returning');
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('$dirty: '+( $formCtrl.$dirty ) );
// console.log('form_fields changed: '+difference(oldValue.form_fields,newValue.form_fields).length );
// console.log('$valid: '+$formCtrl.$valid);
// console.log('finishedRender: '+$scope.finishedRender);
// console.log('saveInProgress: '+$scope.saveInProgress);
if($scope.finishedRender && ($formCtrl.$dirty || difference(oldValue,newValue).length !== 0)) {
// console.log('auto saving');
if(savePromise) {
$timeout.cancel(savePromise);
}
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($scope.finishedRender && ($formCtrl.$dirty || difference(oldValue,newValue).length !== 0) ) {
$rootScope.watchCount++;
if($rootScope.watchCount === 1) {
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);

View file

@ -1,5 +1,5 @@
<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>
<button type="submit" class="btn" ng-click="addNewField()">
<i class="icon-plus"></i> Add Field
@ -23,7 +23,7 @@
</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> -->
<div class="row">
<div class="col-xs-10">
@ -125,7 +125,7 @@
</div>
<div class="col-xs-1" style="padding:0 5px;" >
<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)">
<span class="text-center">
<a href="" class="fa fa-trash-o"></a>
@ -136,7 +136,7 @@
</div>
<div class="col-xs-1" style="padding:0 5px;">
<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)">
<span class="text-center">
<a href="" class="fa fa-files-o"></a>

View file

@ -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>