merged master with dev

This commit is contained in:
David Baldwynn 2015-09-15 15:26:11 -07:00
commit caf0003dfb
22 changed files with 310 additions and 79 deletions

View File

@ -1,8 +1,8 @@
'use strict';
var raven = require('raven');
// var raven = require('raven');
var config = require('../../config/config');
var client = new raven.Client(config.DSN);
// var client = new raven.Client(config.DSN);
/**

View File

@ -275,31 +275,32 @@ exports.list = function(req, res) {
exports.formByID = function(req, res, next, id) {
if (!mongoose.Types.ObjectId.isValid(id)) {
res.status(400).send({
return res.status(400).send({
message: 'Form is invalid'
});
}
else {
Form.findById(id).populate('admin').exec(function(err, form) {
if (err) {
return next(err);
} else if (form === undefined || form === null) {
res.status(400).send({
message: 'Form not found'
});
}
else {
// console.log(form.admin);
Form.findById(id).populate('admin').exec(function(err, form) {
if (err) {
return next(err);
} else if (form === undefined || form === null) {
res.status(400).send({
message: 'Form not found'
});
}
else {
// console.log(form.admin);
//Remove sensitive information from User object
form.admin.password = undefined;
form.admin.salt = undefined;
form.provider = undefined;
//Remove sensitive information from User object
form.admin.password = undefined;
form.admin.salt = undefined;
form.provider = undefined;
req.form = form;
next();
}
});
req.form = form;
next();
}
});
}
};
/**

View File

@ -56,20 +56,35 @@ exports.signup = function(req, res) {
user.username = user.email;
// Then save the temporary user
nev.createTempUser(user, function(newTempUser) {
// new user created
if (newTempUser) {
nev.registerTempUser(newTempUser, function (err) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
}
res.status(200).send('An email has been sent to you. Please check it to verify your account.');
});
} else {
return res.status(400).send('Error: Temp user could NOT be created!');
}
nev.createTempUser(user, function(err, newTempUser) {
if (err) {
console.log('Error: ');
console.log(err);
res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
}else {
console.log('new tmpuser created');
// new user created
if (newTempUser) {
nev.registerTempUser(newTempUser, function (err) {
if (err) {
console.log('Error: ');
console.log(err);
res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
}else {
console.log('new tmpuser registered');
res.status(200).send('An email has been sent to you. Please check it to verify your account.');
}
});
} else {
console.log('Error: Temp user already exists!');
res.status(400).send('Error: Temp user already exists!');
}
}
});
};
@ -104,8 +119,8 @@ exports.signin = function(req, res, next) {
*/
exports.signout = function(req, res) {
req.logout();
res.status(200).send('Successfully logged out');
// res.redirect('/');
// res.status(200).send('Successfully logged out');
res.redirect('/');
};
/**

View File

@ -476,4 +476,6 @@ FormSchema.pre('save', function (next) {
}
});
mongoose.model('Form', FormSchema);

View File

@ -56,7 +56,7 @@ BooleanExpressionSchema.methods.evaluate = function(){
}
});
var code = node.compile();
var code = headNode.compile();
var result = code.eval(expressionScope);
this.result = result;
@ -64,7 +64,6 @@ BooleanExpressionSchema.methods.evaluate = function(){
};
mongoose.model('BooleanExpression', BooleanExpressionSchema);
/**
* Form Schema
*/

View File

@ -152,6 +152,7 @@
// // .expect(200)
// // .end(function(FormSaveErr, FormSaveRes) {
// // (FormSaveRes.text).should.equal('An email has been sent to you. Please check it to verify your account.');
// // userSession.post('/auth/signin')
// // .send(credentials)

View File

@ -0,0 +1,31 @@
##Tester 1: Justin Crosby
Browser: Chrome
Resolution: 1920x1080
OS: Windows 10
Landing Page:
Horizontal Scroll Bar Bug
create new form view (in listForms):
name field input is outside the red box
languages aren't capitalized
name field should be right next to label to be consistent
Admin Form View
it says drag and drop fields but there's no drag and drop, have to click
DropdownList Rendering Problems (see justin_testing2.jpg)
##Tester2: Evan Moore
Browser: FB Messenger Browser (Webkit)
Phone: iPhone 5
Well first thing I see is that some of the fields are compressed kinda weird on my iPhone (see evan_testing1.jpg)
And the settings button at the top right is a little hard to make out any of the detail, but that's a pretty minor fix
When I try to change the title of one of the fields, it bugs out quite a bit too
Like it seems to be trying to update the info before I've finished typing

View File

@ -62,6 +62,7 @@
"lodash": "~2.4.1",
"mailosaur": "^1.0.1",
"main-bower-files": "~2.8.2",
"math": "0.0.3",
"method-override": "~2.3.0",
"mocha": ">=1.20.0",
"mongoose": "~3.8.8",

View File

@ -1,3 +1,7 @@
body {
overflow-x: hidden;
}
/*Navbar Custom CSS*/
.navbar-inverse {
background-color:#fafafa;

View File

@ -13,19 +13,20 @@ angular.module('forms').config(['$stateProvider',
permissions: [ 'editForm' ]
}
}).
state('submitForm', {
url: '/forms/:formId',
templateUrl: 'modules/forms/views/submit-form.client.view.html',
data: {
hideNav: true,
},
}).
state('viewForm', {
url: '/forms/:formId/admin',
templateUrl: 'modules/forms/views/admin-form.client.view.html',
data: {
permissions: [ 'editForm' ]
}
}).
state('viewPublicForm', {
url: '/forms/:formId',
templateUrl: 'modules/forms/views/view-public-form.client.view.html',
data: {
hideNav: true,
},
});
});
}
]);

View File

@ -7,15 +7,23 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
$scope = $rootScope;
$scope.myform = CurrentForm.getForm();
$scope.myform._id = $stateParams.formId;
$rootScope.saveInProgress = false;
// Find a specific Form
$scope.findOne = function(){
$scope.myform = Forms.get({
Forms.get({
formId: $stateParams.formId
}, function(form){
CurrentForm.setForm(form);
$scope.myform = form;
$scope.myform._id = $stateParams.formId;
}, function(err){
console.error('Could not fetch form');
console.error(err);
});
CurrentForm.setForm($scope.myform);
};
$scope.setForm = function(form){
$scope.myform = form;
};

View File

@ -15,7 +15,6 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
rows: []
};
/*
** Table Functions
*/
@ -46,8 +45,6 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
$http.get('/forms/'+$scope.myform._id+'/submissions')
.success(function(data, status, headers){
console.log(data[0].form_fields);
var _tmpSubFormFields,
defaultFormFields = _.cloneDeep($scope.myform.form_fields);
@ -68,7 +65,9 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
.error(function(err){
console.error('Could not fetch form submissions.\nError: '+err);
});
};
};
//Delete selected submissions of Form
$scope.deleteSelectedSubmissions = function(){

View File

@ -0,0 +1,47 @@
// 'use strict';
// angular.module('forms').directive('entryPage', ['$templateCache', '$http', '$compile', '$rootScope',
// function($templateCache, $http, $compile, $rootScope) {
// var getTemplateUrl = function(type) {
// var templateUrl = 'modules/forms/views/directiveViews/entryPage/';
// var supported_pages = [
// 'welcome',
// 'thankyou'
// ];
// if (__indexOf.call(supported_pages, type) >= 0) {
// templateUrl += type + '.html';
// }
// var template = $templateCache.get(templateUrl);
// return template;
// };
// return {
// restrict: 'E',
// template: '<div>Start Page</div>',
// scope: {
// 'pageData': '=',
// 'pageType': '&'
// },
// link: function(scope, element) {
// // console.log(attrs);
// console.log('scope.pageData');
// // console.log(scope);
// scope.exitStartPage = function() {
// // console.log(scope.pageData);
// // if(attrs.pageData.showStart) attrs.pageData.showStart = false;
// };
// var template = getTemplateUrl(scope.pageType);
// element.html(template);
// $compile(element.contents())(scope);
// },
// controller: function($scope){
// console.log('entryPage Controller');
// console.log($scope.pageData);
// // $scope.exitStartPage = function() {
// // if($scope.pageData.showStart) scope.pageData.showStart = false;
// // };
// }
// };
// }]);

View File

@ -18,6 +18,7 @@ angular.module('forms').directive('fieldDirective', ['$templateCache', '$http',
var templateUrl = 'modules/forms/views/directiveViews/field/';
var supported_fields = [
'textfield',
'welcome_page',
'email',
'textarea',
'checkbox',
@ -65,6 +66,7 @@ angular.module('forms').directive('fieldDirective', ['$templateCache', '$http',
// }
// GET template content from path
console.log(scope.field);
var template = getTemplateUrl(scope.field);
// $http.get(templateUrl).success(function(data) {
element.html(template);

View File

@ -16,6 +16,9 @@ angular.module('forms').directive('submitFormDirective', ['$http', '$timeout', '
TimeCounter.startClock()
$scope.exitStartPage = function(){
$scope.myform.startPage.showStart = false;
}
$rootScope.setActiveField = function (field_id) {
$scope.selected = field_id;
};
@ -47,11 +50,6 @@ angular.module('forms').directive('submitFormDirective', ['$http', '$timeout', '
});
};
$scope.exitStartPage = function () {
$scope.myform.startPage.showStart = false;
};
$scope.reloadForm = function(){
//Reset Timer
TimeCounter.stopClock();

View File

@ -154,7 +154,6 @@
});
}));
beforeEach(inject(function($modal) {
spyOn($modal, 'open').and.returnValue(new fakeModal());
}));
@ -210,7 +209,7 @@
$httpBackend.flush();
// Test scope value
expect( scope.myform.toJSON() ).toEqualData(expectedFormObj.toJSON());
expect( scope.myform.toJSON() ).toEqualData(expectedFormObj);
}));
it('$scope.removeCurrentForm() with valid form data should send a DELETE request with the id of form', function() {

View File

@ -0,0 +1,94 @@
// 'use strict';
// (function() {
// // Forms Controller Spec
// describe('entryPage Directive Tests', function() {
// // Initialize global variables
// var scope,
// $templateCache,
// $httpBackend,
// $compile;
// var sampleStartPage = {
// showStart: true,
// introTitle: 'Welcome to Form',
// introParagraph: 'Sample intro paragraph',
// buttons:[
// {
// url: 'http://google.com',
// action: '',
// text: 'Google',
// bgColor: '#ffffff',
// color: '#000000',
// },
// {
// url: 'http://facebook.com',
// action: '',
// text: 'Facebook',
// bgColor: '#0000ff',
// color: '#000000',
// }
// ]
// };
// // The $resource service augments the response object with methods for updating and deleting the resource.
// // If we were to use the standard toEqual matcher, our tests would fail because the test values would not match
// // the responses exactly. To solve the problem, we define a new toEqualData Jasmine matcher.
// // When the toEqualData matcher compares two objects, it takes only object properties into
// // account and ignores methods.
// beforeEach(function() {
// jasmine.addMatchers({
// toEqualData: function(util, customEqualityTesters) {
// return {
// compare: function(actual, expected) {
// return {
// pass: angular.equals(actual, expected)
// };
// }
// };
// }
// });
// });
// // Load the main application module
// beforeEach(module(ApplicationConfiguration.applicationModuleName));
// beforeEach(module('module-templates'));
// beforeEach(inject(function($rootScope, _$compile_, _$httpBackend_) {
// scope = $rootScope.$new();
// $compile = _$compile_;
// // Point global variables to injected services
// $httpBackend = _$httpBackend_;
// }));
// it('should be able to render entryPage in html', function() {
// scope.myStartPage = _.cloneDeep(sampleStartPage);
// console.log(scope.myStartPage);
// var element = angular.element('<entry-page pageData="myStartPage" pageType="startPage"></entry-page>');
// $compile(element)(scope);
// scope.$digest();
// // console.log(element.html());
// expect(element.html()).not.toEqual('<div class="ng-scope">Start Page</div>');
// });
// // it('exitStartPage should work for "startPage" type of entryPage', inject(function($rootScope) {
// // scope.myPage = _.cloneDeep(sampleStartPage);
// // var el = angular.element('<entry-page pageData="myPage" pageType="startPage"></entry-page>');
// // $compile(el)(scope);
// // scope.$digest();
// // $httpBackend.whenGET(/.+\.html$/).respond('');
// // $httpBackend.whenGET('/users/me/').respond('');
// // scope = el.isolateScope() || el.scope();
// // scope.exitStartPage();
// // // expect(scope.myStartPage.showStart).toBe(false);
// // expect(el.html()).not.toEqual('<div>Start Page</div>');
// // }));
// });
// }());

View File

@ -90,9 +90,9 @@
</edit-submissions-form-directive>
</tab>
</tabset>
<!--
<!--
<div class="cg-busy cg-busy-backdrop cg-busy-backdrop-animation ng-show ng-scope"></div> -->
<!--
<!--
<div class="cg-busy cg-busy-animation cg-busy-default-wrapper">
<div class="cg-busy-default-sign">
<div class="cg-busy-default-spinner">
@ -113,7 +113,7 @@
</div>
</div> -->
<!-- <div class="cg-busy cg-busy-animation cg-busy-default-wrapper">
<!-- <div class="cg-busy cg-busy-animation cg-busy-default-wrapper">
<div style="position: absolute; top: 0px; right: 0px;">
<div class="cg-busy-default-spinner">
<div class="bar1"></div>
@ -133,7 +133,7 @@
</div>
</div> -->
<!-- <div class="cg-busy cg-busy-backdrop cg-busy-backdrop-animation ng-show ng-scope"></div>
<!-- <div class="cg-busy cg-busy-backdrop cg-busy-backdrop-animation ng-show ng-scope"></div>
<div class="cg-busy cg-busy-animation">
<div style="position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px;">

View File

@ -0,0 +1,24 @@
<div class="field row text-center">
<div class="col-xs-12 text-center">
<h1>{{pageData.introTitle}}</h1>
</div>
<div class="col-xs-10 col-xs-offset-1 text-left">
<p style="color:#ddd;">{{pageData.introParagraph}}</p>
</div>
</div>
<div class="row form-actions" style="padding-bottom:3em; padding-left: 1em; padding-right: 1em;">
<p ng-repeat="button in pageData.buttons" class="text-center" style="display:inline;">
<button class="btn btn-info" type="button" ng-style="{'background-color':button.bgColor, 'color':button.color}">
<a href="{{button.url}}" style="font-size: 1.6em; text-decoration: none; color: inherit;" >
{{button.text}}
</a>
</button>
</p>
</div>
<div class="row form-actions">
<p class="col-xs-3 col-xs-offset-3 text-center">
<button class="btn btn-info" type="button">
<a ng-click="exitpageData()" style="color:white; font-size: 1.6em; text-decoration: none;">Continue to Form</a>
</button>
</p>
</div>

View File

@ -50,16 +50,17 @@
<h4>Preview Start Page</h4>
</div>
<ul class="col-md-12 container" style="list-style:none;border:2px lightgray solid;">
<!-- <entryPage pageData="myform.startPage" pageType="startPage"></entryPage> -->
<div class="field row text-center">
<div class="col-xs-12 text-center">
<h1>{{myform.startPage.introTitle}}</h1>
<h1>{{pageData.introTitle}}</h1>
</div>
<div class="col-xs-10 col-xs-offset-1 text-left">
<p style="color:#ddd;">{{myform.startPage.introParagraph}}</p>
<p style="color:#ddd;">{{pageData.introParagraph}}</p>
</div>
</div>
<div class="row form-actions" style="padding-bottom:3em; padding-left: 1em; padding-right: 1em;">
<p ng-repeat="button in myform.startPage.buttons" class="text-center" style="display:inline;">
<div class="row form-actions" style="padding-bottom:3em; padding-left: 1em; padding-right: 1em;">
<p ng-repeat="button in pageData.buttons" class="text-center" style="display:inline;">
<button class="btn btn-info" type="button" ng-style="{'background-color':button.bgColor, 'color':button.color}">
<a href="{{button.url}}" style="font-size: 1.6em; text-decoration: none; color: inherit;" >
{{button.text}}
@ -70,7 +71,7 @@
<div class="row form-actions">
<p class="col-xs-3 col-xs-offset-3 text-center">
<button class="btn btn-info" type="button">
<a ng-click="exitstartPage()" style="color:white; font-size: 1.6em; text-decoration: none;">Continue to Form</a>
<a ng-click="exitpageData()" style="color:white; font-size: 1.6em; text-decoration: none;">Continue to Form</a>
</button>
</p>
</div>

View File

@ -5,23 +5,25 @@
<div ng-show="!myform.submitted && myform.startPage.showStart" class="form-submitted">
<div class="field row text-center">
<div class="col-xs-12 text-center">
<h1>Welcome to {{myform.title}}</h1>
<h1>{{myform.startPage.introTitle}}</h1>
</div>
<div class="col-xs-10 col-xs-offset-1 text-center">
<p>{{myform.startPage.introText}}</p>
<div class="col-xs-10 col-xs-offset-1 text-left">
<p style="color:#ddd;">{{myform.startPage.introParagraph}}</p>
</div>
</div>
<div class="row form-actions">
<p ng-repeat="button in myform.startPage.buttons" class="col-xs-6 col-xs-offset-3 text-center">
<button class="btn btn-info" type="button">
<a href="{{button.url}}" style="font-size: 1.6em; text-decoration: none;">{{button.buttonText}}</a>
<div class="row form-actions" style="padding-bottom:3em; padding-left: 1em; padding-right: 1em;">
<p ng-repeat="button in myform.startPage.buttons" class="text-center" style="display:inline;">
<button class="btn btn-info" type="button" ng-style="{'background-color':button.bgColor, 'color':button.color}">
<a href="{{button.url}}" style="font-size: 1.6em; text-decoration: none; color: inherit;" >
{{button.text}}
</a>
</button>
</p>
</div>
<div class="row form-actions">
<p class="col-xs-6 col-xs-offset-3 text-center">
<p class="col-xs-3 col-xs-offset-3 text-center">
<button class="btn btn-info" type="button">
<a ng-click="exitStartPage()" style="font-size: 1.6em; text-decoration: none;">Continue to Form</a>
<a ng-click="exitStartPage()" style="color:white; font-size: 1.6em; text-decoration: none;">Continue to Form</a>
</button>
</p>
</div>

View File

@ -36,6 +36,8 @@ angular.module('users').controller('AuthenticationController', ['$scope', '$loca
$state.go('signup-success');
},
function(error) {
console.log('Error: ');
console.log(error);
if(error) {
$scope.error = error;
console.log(error);