increase autosaving efficiencies

This commit is contained in:
David Baldwynn 2015-08-04 14:06:16 -07:00
parent 6c671abd6b
commit 21a4eed173
20 changed files with 240 additions and 137 deletions

View file

@ -0,0 +1,24 @@
// var mongoose = require('mongoose'),
// Schema = mongoose.Schema,
// shortid = require('shortid');
// var ObjectId = Schema.ObjectId;
// var BaseSchema = function() {
// Schema.apply(this, arguments);
// this.add({
// created: {
// type: Date,
// default: Date.now
// },
// lastModified: {
// type: Date,
// },
// _id: {
// type: String,
// unique: true,
// 'default': shortid.generate
// },
// });
// }

View file

@ -4,8 +4,6 @@
* Module dependencies.
*/
var mongoose = require('mongoose'),
FieldSchema = require('./form_field.server.model.js'),
FormSubmissionSchema = require('./form_submission.server.model.js'),
Schema = mongoose.Schema,
pdfFiller = require('node-pdffiller'),
_ = require('lodash'),
@ -13,6 +11,11 @@ var mongoose = require('mongoose'),
path = require('path'),
fs = require('fs-extra'),
async = require('async'),
util = require('util');
//Mongoose Models
var FieldSchema = require('./form_field.server.model.js'),
FormSubmissionSchema = require('./form_submission.server.model.js'),
Field = mongoose.model('Field', FieldSchema),
FormSubmission = mongoose.model('FormSubmission', FormSubmissionSchema);
@ -27,7 +30,6 @@ var FormSchema = new Schema({
},
lastModified: {
type: Date,
default: Date.now
},
title: {
type: String,

View file

@ -68,6 +68,7 @@
"mongoose-relationship": "^0.1.4",
"morgan": "~1.4.1",
"multer": "~0.1.8",
"node-pdffiller": "~0.0.5",
"nodemailer": "~1.3.0",
"passport": "~0.2.0",
"passport-facebook": "~1.0.2",
@ -76,9 +77,9 @@
"passport-linkedin": "~0.1.3",
"passport-local": "~1.0.0",
"passport-twitter": "~1.0.2",
"node-pdffiller": "~0.0.5",
"raven": "^0.8.1",
"satelize": "~0.1.1",
"shortid": "^2.2.2",
"should": "~4.1.0",
"supertest": "~0.14.0",
"swig": "~1.4.1",

View file

@ -57,5 +57,36 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
});
}
};
$scope.remove = function(form_id) {
console.log('Remove existing form');
var form = {};
if(!form_id){
form = CurrentForm.getForm();
if(!form) form = $scope.myform;
}else {
form._id = form_id;
}
$http.delete('/forms/'+form._id)
.success(function(data, status, headers){
console.log('form deleted successfully');
if(!form_id){
$state.go('listForms', {}, {reload: true});
}
if($scope.myforms.length > 0){
$scope.myforms = _.filter($scope.myforms, function(myform){
return myform._id !== form._id;
});
}
}).error(function(error){
console.log('ERROR: Form could not be deleted.');
console.error(error);
});
};
}
]);

View file

@ -4,8 +4,9 @@
angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$modal',
function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http, $modal) {
$scope = $rootScope;
var deleteModal;
$scope = $rootScope;
$scope.myform = CurrentForm.getForm();
$rootScope.saveInProgress = false;
$scope.viewSubmissions = false;
@ -25,6 +26,11 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
$scope.setForm = function (form) {
$scope.myform = form;
};
$rootScope.resetForm = function(){
$scope.myform = Forms.get({
formId: $stateParams.formId
});
};
/*
* Table Functions
@ -217,11 +223,5 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
}
};
$rootScope.resetForm = function(){
$scope.myform = Forms.get({
formId: $stateParams.formId
});
};
}
]);

View file

@ -4,60 +4,59 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
return {
require: ['^form'],
// scope: {
// callback: '&autoSaveCallback'
// },
link: function($scope, $element, $attrs, $ctrls) {
$rootScope.finishedRender = false;
if($rootScope.watchCount === undefined){
$rootScope.watchCount = 0;
}
var $formCtrl = $ctrls[0],
savePromise = null;
var difference = function(array){
var rest = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
var containsEquals = function(obj, target) {
if (obj === null) return false;
return _.any(obj, function(value) {
return _.isEqual(value, target);
});
};
return _.filter(array, function(value){ return !containsEquals(rest, value); });
};
var $formCtrl = $ctrls[0];
var savePromise = null;
// $scope.finishedRender = false;
var expression = $attrs.autoSaveForm || 'true';
$scope.$on('ngRepeatStarted', function(ngRepeatFinishedEvent) {
$scope.$on('editFormFieldsStarted', function(ngRepeatFinishedEvent) {
$rootScope.finishedRender = false;
$rootScope.watchCount = 0;
});
$scope.$on('ngRepeatFinished', function(ngRepeatFinishedEvent) {
$scope.$on('editFormFieldsFinished', function(ngRepeatFinishedEvent) {
$rootScope.finishedRender = true;
});
$scope.$watch('myform.form_fields', function(newValue, oldValue) {
console.log('watchCount: '+$rootScope.watchCount);
if(difference(oldValue,newValue).length === 0 || oldValue === undefined){
// $scope.anyDirtyAndTouched = function (form){
// console.log(form);
// console.log($scope.myform);
// for(var prop in form) {
// if(form.hasOwnProperty(prop) && prop[0] !== '$') {
// if(form[prop].$dirty && form[prop].$touched) {
// return true;
// }
// }
// }
// return false;
// };
// console.log($scope.watchModel);
$scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) {
console.log('hello');
if( !newValue && !oldValue ){
return;
}
var changedFields = !_.isEqual(oldValue,newValue);
// console.log('\n\n----------\n$dirty: '+( $formCtrl.$dirty ) );
// console.log('form_fields changed: '+difference(oldValue,newValue).length );
// console.log('\n\n----------');
console.log('$dirty: '+( $formCtrl.$dirty ) );
// console.log('oldValue: '+oldValue);
// console.log('newValue: '+newValue);
// console.log('form_fields changed: '+changedFields);
// console.log('$valid: '+$formCtrl.$valid);
// console.log('finishedRender: '+$rootScope.finishedRender);
// console.log('saveInProgress: '+$rootScope.saveInProgress);
// var inputDirtyUntouched = $scope.anyDirtyAndTouched($scope.editForm);
if($rootScope.finishedRender && ($formCtrl.$dirty || difference(oldValue,newValue).length !== 0) && !$rootScope.saveInProgress) {
$rootScope.watchCount++;
// if($rootScope.watchCount === 1) {
//Save form ONLY IF rendering is finished, form_fields have been change AND currently not save in progress
if($rootScope.finishedRender && (inputDirtyUntouched || changedFields) && !$rootScope.saveInProgress) {
console.log('Saving Form');
if(savePromise) {
$timeout.cancel(savePromise);
}
@ -71,12 +70,11 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
console.log('\n\nForm data persisted -- setting pristine flag');
// console.log('\n\n---------\nUpdate form CLIENT');
// console.log(Date.now());
$rootScope.watchCount = 0;
$formCtrl.$setPristine();
// $rootScope.saveInProgress = false;
}else{
console.log('Error form data NOT persisted');
console.log(err);
console.error('Error form data NOT persisted');
console.error(err);
}
});

View file

@ -3,6 +3,14 @@
angular.module('forms').directive('configureFormDirective', ['$rootScope', '$http', 'Upload', '$timeout', 'timeCounter', 'Auth', 'FormFields',
function ($rootScope, $http, Upload, $timeout, timeCounter, Auth, FormFields) {
return {
templateUrl: './modules/forms/views/directiveViews/form/configure-form.html',
restrict: 'E',
scope: {
myform:'=',
user:'=',
pdfFields:'@',
formFields:'@'
},
controller: function($scope){
$scope.log = '';
$scope.pdfLoading = false;
@ -73,14 +81,6 @@ angular.module('forms').directive('configureFormDirective', ['$rootScope', '$htt
}
};
},
templateUrl: './modules/forms/views/directiveViews/form/configure-form.html',
restrict: 'E',
scope: {
myform:'=',
user:'=',
pdfFields:'@',
formFields:'@'
}
};
}

View file

@ -7,8 +7,8 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
restrict: 'E',
scope: {
myform:'=',
user:'='
},
transclude: true,
controller: function($scope){
//Populate local scope with rootScope methods/variables
$scope.update = $rootScope.update;
@ -20,7 +20,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
handle: ' .handle'
}
console.log($scope.myform);
// console.log($scope.myform);
// $scope.draggable = {
// connectWith: ".dropzone",

View file

@ -37,7 +37,6 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
};
var linker = function(scope, element) {
// scope.field.required = scope.required;
//Set format only if field is a date
if(scope.field.fieldType === 'date'){
@ -51,10 +50,11 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
}
//Set only if we have a natural lang processing field
else if(scope.field.fieldType === 'natural'){
scope.field.fieldMatchValue = '';
//Fires when field is changed
scope.$watch('scope.field', function(newValue, oldValue) {
scope.$watch('scope.field', function(newField, oldField) {
});
}

View file

@ -3,17 +3,27 @@
angular.module('forms').directive('onFinishRender', function ($rootScope, $timeout) {
return {
restrict: 'A',
link: function (scope, element, attr) {
if (scope.$first === true) {
$timeout(function () {
$rootScope.$broadcast('ngRepeatStarted');
});
link: function (scope, element, attrs) {
//Don't do anything if we don't have a ng-repeat on the current element
if(!element.attr('ng-repeat')){
return;
}
if (scope.$last === true) {
console.log(element);
var broadcastMessage = attrs.onFinishRender || 'ngRepeat';
if(scope.$first && !scope.$last) {
$timeout(function () {
// console.log(broadcastMessage+'Started');
$rootScope.$broadcast(broadcastMessage+'Started');
});
}else if(scope.$last) {
$timeout(function () {
console.log('ngRepeatFinished')
$rootScope.$broadcast('ngRepeatFinished');
element.ready(function () {
// console.log(broadcastMessage+'Finished');
$rootScope.$broadcast(broadcastMessage+'Finished');
});
});
}
}

View file

@ -3,7 +3,13 @@
angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCounter', 'Auth', '$filter',
function ($http, $timeout, timeCounter, Auth, $filter) {
return {
templateUrl: './modules/forms/views/directiveViews/form/submit-form.html',
restrict: 'E',
scope: {
form:'='
},
controller: function($scope){
console.log('rendering submitFormDirective');
timeCounter.startClock();
$scope.submit = function(){
@ -14,18 +20,17 @@ angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCo
delete $scope.form.visible_form_fields;
$scope.authentication = Auth;
// console.log($scope.authentication.isAuthenticated());
$scope.submitPromise = $http.post('/forms/'+$scope.form._id,$scope.form).
success(function(data, status, headers){
console.log('form submitted successfully');
// alert('Form submitted..');
$scope.form.submitted = true;
})
.error(function(error){
console.log(error);
$scope.error = error.message;
});
$scope.submitPromise = $http.post('/forms/'+$scope.form._id,$scope.form)
.success(function(data, status, headers){
console.log('form submitted successfully');
// alert('Form submitted..');
$scope.form.submitted = true;
})
.error(function(error){
console.log(error);
$scope.error = error.message;
});
};
$scope.reloadForm = function(){
@ -38,11 +43,6 @@ angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCo
}).value();
};
},
templateUrl: './modules/forms/views/directiveViews/form/submit-form.html',
restrict: 'E',
scope: {
form:'='
}
};
}

View file

@ -17,7 +17,7 @@ angular.module('forms').service('FormFields', [
},
{
name : 'dropdown',
value : 'Dropdown List'
value : 'Dropdown'
},
{
name : 'date',
@ -25,7 +25,7 @@ angular.module('forms').service('FormFields', [
},
{
name : 'textarea',
value : 'Long Text'
value : 'Paragraph Text'
},
{
name : 'checkbox',
@ -40,6 +40,10 @@ angular.module('forms').service('FormFields', [
value : 'Legal'
},
// {
// name : 'sig',
// value : 'Signature'
// },
// {
// name : 'file',
// value : 'File Upload'
// },

View file

@ -3,7 +3,13 @@
<div class="col-xs-12 field-input">
<div ng-repeat="option in field.fieldOptions" class="row-fluid">
<label class="btn btn-info col-xs-3">
<input type="radio" value="{{option.option_value}}" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled" ng-init="field.fieldValue = field.fieldOptions[0].option_value"/>
<input type="radio"
value="{{option.option_value}}"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
ng-init="field.fieldValue = field.fieldOptions[0].option_value"/>
<span ng-bind="option.option_title"></span>
</label>
</div>

View file

@ -3,10 +3,12 @@
<div class="col-xs-12 field-input">
<input type="text"
class="text-field-input"
ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
value="field.fieldValue"
ng-required="field.required"
ng-disabled="field.disabled" changeFocus focus-up-id="focusUpButton" focus-down-id="focusDownButton">
ng-disabled="field.disabled"
changeFocus focus-up-id="focusUpButton" focus-down-id="focusDownButton">
<span class="required-error" ng-show="field.required && !field.fieldValue">* required</span>
</div>
</div>

View file

@ -1,5 +1,16 @@
<div class="field row radio">
<div class="col-xs-12 field-title"><h3><span class="fa fa-angle-double-right"></span> {{field.title}} <span class="required-error" ng-show="field.required && !field.fieldValue">*(required)</span></h3></div>
<div class="col-xs-12 field-title">
<h3 class="row">
<span class="fa fa-angle-double-right"></span> {{field.title}}
<span class="required-error" ng-show="field.required && !field.fieldValue">
*(required)
</span>
</h3>
<p class="row">
{{field.description}}
</p>
</div>
<div class="col-xs-12 field-input">
<div class="row-fluid">
<label class="btn btn-success col-xs-3">
@ -12,7 +23,6 @@
<span>No</span>
</label>
</div>
<span class="required-error" ng-show="field.required && !field.fieldValue">* required</span>
</div>
</div>
<br>

View file

@ -1,4 +1,4 @@
<form class="row" name="fieldForm" form-locator auto-save-form auto-save-callback="update" form="myform" novalidation>
<form class="row" name="editForm" auto-save-form auto-save-watch="myform.form_fields" auto-save-callback="update" novalidation>
<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>
@ -24,16 +24,16 @@
</div>
<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">
<accordion close-others="accordion.oneAtATime" ui-sortable="dropzone" ng-model="myform.form_fields" class="dropzone">
<accordion-group ng-repeat="field in myform.form_fields" is-open="accordion[$index].isOpen" on-finish-render ng-show="!field.deletePreserved">
<accordion-group ng-repeat="field in myform.form_fields" is-open="accordion[$index].isOpen" on-finish-render="editFormFields" ng-if="!field.deletePreserved">
<accordion-heading>
<div class="handle">
<span class="pull-left" ng-switch="field.fieldType">
<field-icon-directive type-name="{{field.fieldType}}"></field-icon-directive>
</span>
@ -54,33 +54,37 @@
</div>
<div class="row">
<ul class="col-xs-12 container" style="list-style:none;border:2px lightgray solid;">
<field-directive field="field">
<field-directive field="field" validate="false">
</field-directive>
</ul>
</div>
<div class="row">
<hr>
<div class="row">
<div class="col-xs-12">
<hr>
<h4>Edit</h4>
<br>
</div>
</div>
<div class="row">
<div class="col-xs-5">Field Title:</div>
<div class="col-xs-7">
<input type="text" ng-model="field.title" value="{{field.title}}" required></div>
<div class="col-xs-4">Question Title:</div>
<div class="col-xs-8">
<input type="text" ng-model="field.title" name="title{{field._id}}" value="{{field.title}}" required></div>
</div>
<br>
<div class="row">
<div class="col-xs-5">Field Decription:</div>
<div class="col-xs-7"><textarea type="text" ng-model="field.description" value="{{field.description}}"></textarea> </div>
<div class="col-xs-4">Description:</div>
<div class="col-xs-8"><textarea type="text" ng-model="field.description" name="description{{field._id}}"value="{{field.description}}"></textarea> </div>
</div>
<div class="row" ng-show="showAddOptions(field)"><hr></div>
<div class="row" ng-show="showAddOptions(field)"><br></div>
<div class="row" ng-show="showAddOptions(field)">
<div class="col-xs-4">Field Options:</div>
<div class="col-xs-4">Options:</div>
<div class="col-xs-8 container">
<div ng-repeat="option in field.fieldOptions" class="row">
<input type="text" name="{{option.option_title}}" ng-model="option.option_title" value="{{option.option_title}}" class="col-xs-5">
<input type="text" name="{{option.option_title}}{{field._id}}" ng-model="option.option_title" value="{{option.option_title}}" class="col-xs-5">
<a class="btn btn-danger btn-mini right" type="button" ng-click="deleteOption(field, option)" class="col-xs-3">
<i class="fa fa-trash-o"></i>
@ -93,33 +97,35 @@
</div>
</div>
<div class="row"> <hr></div>
<div class="row"><br></div>
<div class="row">
<div class="col-xs-5 field-title">Required:</div>
<div class="col-xs-7 field-input">
<div class="col-xs-4 field-title">Required:</div>
<div class="col-xs-8 field-input">
<label class="btn col-xs-5">
<input type="radio" value="true" ng-model="field.fieldValue" required />
<input type="radio" ng-value="true" ng-model="field.required" name="required{{field._id}}"/>
<span> &nbsp; Yes</span>
</label>
<label class="btn col-xs-5 col-xs-offset-1">
<input type="radio" value="false" ng-model="field.fieldValue" required />
<input type="radio" ng-value="false" ng-model="field.required" name="required{{field._id}}"/>/>
<span> &nbsp; No</span>
</label>
</div>
</div>
<br>
<div class="row">
<div class="col-xs-5 field-input">Disabled:</div>
<div class="col-xs-7 field-input">
<div class="col-xs-4 field-input">Disabled:</div>
<div class="col-xs-8 field-input">
<label class="btn col-xs-5">
<input type="radio" value="true" ng-model="field.fieldValue" required />
<input type="radio" ng-value="true"
ng-model="field.disabled" name="disabled{{field._id}}"/>/>
<span> &nbsp; Yes</span>
</label>
<label class="btn col-xs-5 col-xs-offset-1">
<input type="radio" value="false" ng-model="field.fieldValue" required />
<input type="radio" ng-value="false"
ng-model="field.disabled" name="disabled{{field._id}}"/>/>
<span> &nbsp; No</span>
</label>
</div>

View file

@ -1,4 +1,5 @@
<div cg-busy="{promise:submitPromise,message:'Submitting form...',backdrop:true}"></div>
<div ng-hide="form.submitted">
<div class="field row" style="padding-bottom:5em;">
<div class="col-sm-10 col-sm-offset-1">
@ -7,7 +8,7 @@
</div>
</div>
<div class="row">
<form name="form" class="submission-form col-sm-offset-1 col-sm-10" name="form" ng-model="form" ng-repeat="field in form.form_fields" >
<form name="myForm" class="submission-form col-sm-offset-1 col-sm-10" ng-model="form" ng-repeat="field in form.form_fields" >
<field-directive field="field" ng-if="!field.deletePreserved">
</field-directive>
</form>

View file

@ -52,7 +52,7 @@
<div data-ng-repeat="form in myforms" class="col-xs-2 col-xs-offset-1 form-item row">
<span class="pull-right">
<i style="cursor:pointer;" class="fa fa-trash-o" ng-click="remove(form._id);"></i>
<i style="cursor:pointer;" class="fa fa-trash-o" ng-click="remove(form._id)"></i>
</span>
<a data-ng-href="#!/forms/{{form._id}}/admin" class="title-row col-xs-12">
<h4 class="list-group-item-heading" data-ng-bind="form.title"></h4>

View file

@ -10,13 +10,15 @@
Unexpected bad things will happen if you dont read this!
</div>
<p>This action <strong>CANNOT</strong> be undone. This will permanently delete the <strong>{{myform.title}}</strong> form, form submissions and remove all associated pdfs.</p>
<p>Please type in the name of the repository to confirm.</p>
<p>Please type in the name of the form to confirm.</p>
</div>
<div class="modal-footer">
<p>
<input type="text" data-ng-model="deleteConfirm" class="input-block" autofocus required aria-label="Type in the name of the form to confirm that you want to delete this form.">
</p>
<button type="submit" ng-click="remove()" class="btn btn-block btn-danger" ng-disabled="myform.title != deleteConfirm">I understand the consequences, delete this form</button>
<p>
<input type="text" data-ng-model="deleteConfirm" class="input-block" autofocus required aria-label="Type in the name of the form to confirm that you want to delete this form.">
</p>
<button type="submit" ng-click="remove()" class="btn btn-block btn-danger" ng-disabled="myform.title != deleteConfirm">
I understand the consequences, delete this form
</button>
</div>
</script>
@ -30,9 +32,12 @@
</small>
</div>
<div class="col-xs-2">
<small class=" pull-right">
<small class="pull-right">
<a class="btn btn-default" href="/#!/forms/{{myform._id}}">
<span ng-show="myform.isLive">View Live</span> <span ng-hide="myform.isLive">Preview</span> Form
<span ng-show="myform.isLive">
View Live
</span>
<span ng-hide="myform.isLive">Preview</span> Form
<i class="status-light status-light-on fa fa-dot-circle-o" ng-show="myform.isLive"></i>
<i class="status-light status-light-off fa fa-dot-circle-o" ng-hide="myform.isLive"></i>
<!-- <i class="fa fa-sign-out"></i> -->
@ -48,21 +53,19 @@
<tab-heading>
Edit Form Fields
</tab-heading>
<edit-form-directive myform="myform" user="user"></edit-form-directive>
<edit-form-directive myform="myform"></edit-form-directive>
</tab>
<tab disabled="true">
<tab-heading >
Edit Design
</tab-heading>
<div cg-busy="promise:updatePromise"></div>
<edit-form-directive myform="myform" user="user">
</edit-form-directive>
<div cg-busy="{promise:updatePromise}"></div>
</tab>
<tab>
<tab-heading>
Configure
</tab-heading>
<div cg-busy="promise:updatePromise"></div>
<div cg-busy="{promise:updatePromise}"></div>
<configure-form-directive myform="myform" user="user">
</configure-form-directive>
</tab>
@ -74,10 +77,12 @@
<div class="row">
<div class="col-xs-1">
<button class="btn btn-danger" ng-click="deleteSelectedSubmissions()" ng-disabled="!isAtLeastOneChecked();"><i class="fa fa-trash-o"></i> Delete Selected</button>
<button class="btn btn-danger" ng-click="deleteSelectedSubmissions()" ng-disabled="!isAtLeastOneChecked();">
<i class="fa fa-trash-o"></i> Delete Selected
</button>
</div>
</div>
<table class="table table-striped table-hover table-condensed">
<thead>
<tr>
@ -99,18 +104,21 @@
</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="row in table.rows" ng-click="rowClicked(row)">
<td>
<input ng-model="row.selected" type="checkbox"/>
</td>
<th class="scope">{{$index+1}}</th>
<th class="scope">
{{$index+1}}
</th>
<td data-ng-repeat="(key, value) in row.form_fields">
{{value.fieldValue}}
</td>
<td>
{{row.timeElapsed}}
</th>
</td>
<td>
{{row.created | date:'yyyy-MM-dd HH:mm:ss'}}
</td>

View file

@ -13,9 +13,9 @@ angular.module('users').factory('Auth', function($window) {
// because that would create a circular dependency
// Auth <- $http <- $resource <- LoopBackResource <- User <- Auth
ensureHasCurrentUser: function(User) {
if (service.currentUser && service.currentUser.displayName) {
if (service.currentUser && service.currentUser.username) {
console.log('Using local current user.');
console.log(service.currentUser);
// console.log(service.currentUser);
return service.currentUser;
}
else if ($window.user){