added responsiveness

This commit is contained in:
David Baldwynn 2015-08-05 22:52:59 -07:00
parent 942f6b73dc
commit c10fbbfd4f
42 changed files with 699 additions and 435 deletions

View file

@ -97,11 +97,13 @@ exports.createSubmission = function(req, res) {
fdfData, fdfData,
fdfTemplate, fdfTemplate,
that = this; that = this;
console.log(req.body.percentageComplete);
submission = new FormSubmission({ submission = new FormSubmission({
admin: req.user, admin: req.user,
form_fields: req.body.form_fields, form_fields: req.body.form_fields,
timeElapsed: req.body.timeElapsed timeElapsed: req.body.timeElapsed,
percentageComplete: req.body.percentageComplete
}); });
submission.form = form; submission.form = form;

View file

@ -68,6 +68,10 @@ var FormSchema = new Schema({
type: Schema.Types.Mixed type: Schema.Types.Mixed
}, },
showStart: {
type: Boolean,
default: false,
},
hideFooter: { hideFooter: {
type: Boolean, type: Boolean,
default: false, default: false,

View file

@ -28,7 +28,8 @@ function validateFormFieldType(value) {
'checkbox', 'checkbox',
'hidden', 'hidden',
'yes_no', 'yes_no',
'natural' 'natural',
'number'
]; ];
if (validTypes.indexOf(value) > -1) { if (validTypes.indexOf(value) > -1) {

View file

@ -64,6 +64,7 @@
<!-- </section> --> <!-- </section> -->
</section> </section>
<script src="https://rawgithub.com/eligrey/FileSaver.js/master/FileSaver.js" type="text/javascript"></script>
<!--Embedding The User Object--> <!--Embedding The User Object-->
<script type="text/javascript"> <script type="text/javascript">
var user = {{ user | json | safe }}; var user = {{ user | json | safe }};
@ -87,14 +88,14 @@
{% endif %} {% endif %}
<script> <script>
Raven.config('http://db01e03015ce48e2b68240ea8254b17c@sentry.polydaic.com/1', { // Raven.config('http://db01e03015ce48e2b68240ea8254b17c@sentry.polydaic.com/1', {
// Raven settings // // Raven settings
}) // })
.setUser({ // .setUser({
"id": "SERVER_RENDERED_ID", // "id": "SERVER_RENDERED_ID",
"email": "SERVER_RENDERED_EMAIL" // "email": "SERVER_RENDERED_EMAIL"
}) // })
.install() // .install()
</script> </script>
<!-- [if lt IE 9]> <!-- [if lt IE 9]>

View file

@ -537,24 +537,23 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
// Forms controller // Forms controller
angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScope', '$stateParams', '$state', 'Forms', 'CurrentForm', angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScope', '$stateParams', '$state', 'Forms', 'CurrentForm',
function($scope, $rootScope, $stateParams, $state, Forms, CurrentForm) { function($scope, $rootScope, $stateParams, $state, Forms, CurrentForm) {
Forms.get({ Forms.get({
formId: $stateParams.formId formId: $stateParams.formId
}).$promise.then( }).$promise.then(
//success //success
function(form){ function(form){
$scope.form = form; $scope.myform = form;
//Show navbar if form is not public AND user is loggedin // Show navbar if form is not public AND user is loggedin
if(!$scope.form.isLive && $rootScope.authentication.isAuthenticated()){ if(!$scope.myform.isLive && $rootScope.authentication.isAuthenticated()){
$rootScope.hideNav = false; $rootScope.hideNav = false;
}else if(!$scope.form.isLive){ }else if(!$scope.myform.isLive){
$state.go('access_denied'); $state.go('access_denied');
}else {
CurrentForm.setForm($scope.form);
} }
console.log('$rootScope.hideNav: '+$rootScope.hideNav); console.log('$rootScope.hideNav: '+$rootScope.hideNav);
console.log('$scope.form.isLive: '+$scope.form.isLive); console.log('$scope.form.isLive: '+$scope.myform.isLive);
}, },
//error //error
function( error ){ function( error ){
@ -562,6 +561,7 @@ angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScop
console.log('ERROR: '+error.message); console.log('ERROR: '+error.message);
$state.go('access_denied'); $state.go('access_denied');
}); });
} }
]); ]);
'use strict'; 'use strict';
@ -617,8 +617,9 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
$scope.toggleObjSelection = function($event, description) { $scope.toggleObjSelection = function($event, description) {
$event.stopPropagation(); $event.stopPropagation();
}; };
$scope.rowClicked = function(obj) { $scope.rowClicked = function(row_index) {
obj.selected = !obj.selected; // obj.selected = !obj.selected;
$scope.table.rows[row_index].selected = !$scope.table.rows[row_index].selected;
}; };
/* /*
@ -630,7 +631,6 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
var delete_ids = _.chain($scope.table.rows).filter(function(row){ var delete_ids = _.chain($scope.table.rows).filter(function(row){
return !!row.selected; return !!row.selected;
}).pluck('_id').value(); }).pluck('_id').value();
console.log(delete_ids);
$http({ url: '/forms/'+$scope.myform._id+'/submissions', $http({ url: '/forms/'+$scope.myform._id+'/submissions',
method: 'DELETE', method: 'DELETE',
@ -638,11 +638,14 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
headers: {"Content-Type": "application/json;charset=utf-8"} headers: {"Content-Type": "application/json;charset=utf-8"}
}).success(function(data, status, headers){ }).success(function(data, status, headers){
//Remove deleted ids from table //Remove deleted ids from table
var tmpArray = [];
for(var i=0; i<$scope.table.rows.length; i++){ for(var i=0; i<$scope.table.rows.length; i++){
if($scope.table.rows[i].selected){ if(!$scope.table.rows[i].selected){
$scope.table.rows.splice(i, 1); tmpArray.push($scope.table.rows[i]);
} }
} }
console.log(tmpArray);
$scope.table.rows = tmpArray;
}) })
.error(function(err){ .error(function(err){
console.log('Could not delete form submissions.\nError: '); console.log('Could not delete form submissions.\nError: ');
@ -650,6 +653,21 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
console.error = err; console.error = err;
}); });
}; };
//Export selected submissions of Form
$scope.exportSelectedSubmissions = function(){
// console.log('exportSelectedSubmissions');
var export_ids = _.chain($scope.table.rows).filter(function(row){
return !!row.selected;
}).pluck('_id').value();
var blob = new Blob([document.getElementById('table-submission-data').innerHTM], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
});
saveAs(blob, $scope.form.title+'_export_'+Date.now()+".xls");
};
//Fetch and display submissions of Form //Fetch and display submissions of Form
$scope.showSubmissions = function(){ $scope.showSubmissions = function(){
$scope.viewSubmissions = true; $scope.viewSubmissions = true;
@ -763,28 +781,31 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
// Update existing Form // Update existing Form
$scope.update = $rootScope.update = function(cb) { $scope.update = $rootScope.update = function(immediate, cb) {
if(!$rootScope.saveInProgress && $rootScope.finishedRender){ console.log('immediate: '+immediate);
var continueUpdate = true;
$rootScope.saveInProgress = true; if(immediate){
continueUpdate = !$rootScope.saveInProgress;
}
if(continueUpdate){
console.log('begin updating form'); console.log('begin updating form');
var err = null; var err = null;
if(immediate){ $rootScope.saveInProgress = true; }
$scope.updatePromise = $http.put('/forms/'+$scope.myform._id, {form: $scope.myform}) $scope.updatePromise = $http.put('/forms/'+$scope.myform._id, {form: $scope.myform})
.then(function(response){ .then(function(response){
$rootScope.myform = $scope.myform = response.data; $rootScope.myform = $scope.myform = response.data;
console.log(response.data); console.log(response.data);
if(!$scope.$digest){
$scope.$apply();
}
}).catch(function(response){ }).catch(function(response){
console.log('Error occured during form UPDATE.\n'); console.log('Error occured during form UPDATE.\n');
console.log(response.data); console.log(response.data);
err = response.data; err = response.data;
}).finally(function() { }).finally(function() {
console.log('finished updating'); console.log('finished updating');
$rootScope.saveInProgress = false; if(immediate){$rootScope.saveInProgress = false; }
cb(err); cb(err);
}); });
} }
}; };
@ -796,106 +817,99 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', function($rootScope, $timeout) { angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', function($rootScope, $timeout) {
return { return {
// require: ['^form'], require: ['^form'],
restrict: 'AE', restrict: 'AE',
controller: function ($scope) {
},
link: function($scope, $element, $attrs, $ctrls) { link: function($scope, $element, $attrs, $ctrls) {
angular.element(document).ready(function() { angular.element(document).ready(function() {
$rootScope.finishedRender = false;
var $formCtrl = $ctrls[0],
// Log that the directive has been linked.
// console.log( "Linked: autoSaveForm");
var $formCtrl = $scope.editForm,
savePromise = null; savePromise = null;
$rootScope.finishedRender = false;
$scope.$on('editFormFieldsStarted', function(ngRepeatFinishedEvent) { $scope.$on('editFormFieldsStarted', function(ngRepeatFinishedEvent) {
$rootScope.finishedRender = false; $rootScope.finishedRender = false;
}); });
$scope.$on('editFormFieldsFinished', function(ngRepeatFinishedEvent) { $scope.$on('editFormFieldsFinished', function(ngRepeatFinishedEvent) {
$rootScope.finishedRender = true; $rootScope.finishedRender = true;
}); });
$scope.anyDirtyAndTouched = function (form){ $scope.anyDirtyAndTouched = function(form){
var propCount = 0;
for(var prop in form) { for(var prop in form) {
if(form.hasOwnProperty(prop) && prop[0] !== '$') { if(form.hasOwnProperty(prop) && prop[0] !== '$') {
propCount++;
// console.log(form[prop]); if(form[prop].$touched && form[prop].$dirty) {
if(form[prop].$dirty && form[prop].$untouched) { return true;
return true; }
}
} }
} }
return false; return false;
}; };
// console.log('properties of $scope.editForm'); var updateFields = function () {
// for(var item in $scope.editForm){ $rootScope.saveInProgress = true;
// console.log(item); $rootScope[$attrs.autoSaveCallback](false,
// } function(err){
if(!err){
console.log('\n\nForm data persisted -- setting pristine flag');
// console.log('\n\n---------\nUpdate form CLIENT');
// console.log(Date.now());
$formCtrl.$setPristine();
}else{
console.error('Error form data NOT persisted');
console.error(err);
}
});
}
// console.log($scope.editForm);
// console.log($scope.watchModel); $scope.$watch(function(newValue, oldValue) {
if($scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){
// console.log('ready to save text input');
// console.log('Saving Form');
updateFields();
}
});
//Autosave Form when model (specificed in $attrs.autoSaveWatch) changes //Autosave Form when model (specificed in $attrs.autoSaveWatch) changes
$scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) { $scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) {
if( !newValue && !oldValue ){
var changedFields = !_.isEqual(oldValue,newValue);
if( (!newValue && !oldValue) || !oldValue ){
return; return;
} }
var changedFields = !_.isEqual(oldValue,newValue);
// console.log('\n\n----------'); // console.log('\n\n----------');
// console.log('$dirty: '+ $formCtrl.$dirty ); // console.log('$dirty: '+ $formCtrl.$dirty );
// console.log('oldValue: '+oldValue); // console.log('changedFields: '+changedFields);
// console.log('newValue: '+newValue);
// console.log('form_fields changed: '+changedFields);
// console.log('finishedRender: '+$rootScope.finishedRender); // console.log('finishedRender: '+$rootScope.finishedRender);
// console.log('saveInProgress: '+$rootScope.saveInProgress); // console.log('saveInProgress: '+$rootScope.saveInProgress);
// console.log($scope.editForm); // console.log('newValue: '+newValue);
var inputDirtyUntouched = $scope.anyDirtyAndTouched($scope.editForm); // console.log('oldValue: '+oldValue);
// console.log('properties of $scope.editForm');
// for(var item in $scope.editForm){
// console.log(item);
// }
// console.log('inputDirtyUntouched: '+inputDirtyUntouched);
// console.log($scope.editForm);
//Save form ONLY IF rendering is finished, form_fields have been change AND currently not save in progress //Save form ONLY IF rendering is finished, form_fields have been change AND currently not save in progress
if($rootScope.finishedRender && ($formCtrl.$dirty || changedFields) && !$rootScope.saveInProgress) { if($rootScope.finishedRender && (changedFields && !$formCtrl.$dirty) && !$rootScope.saveInProgress) {
if(savePromise) {
$timeout.cancel(savePromise);
savePromise = null;
}
savePromise = $timeout(function() {
console.log('Saving Form'); console.log('Saving Form');
if(savePromise) { updateFields();
$timeout.cancel(savePromise); });
} }else if($rootScope.finishedRender && $rootScope.saveInProgress){
$rootScope.saveInProgress = false;
savePromise = $timeout(function() {
savePromise = null;
$rootScope[$attrs.autoSaveCallback](
function(err){
if(!err){
console.log('\n\nForm data persisted -- setting pristine flag');
// console.log('\n\n---------\nUpdate form CLIENT');
// console.log(Date.now());
$formCtrl.$setPristine();
// $formCtrl.$setUntouched();
}else{
console.error('Error form data NOT persisted');
console.error(err);
}
});
});
// }
}else{
return;
} }
}, true); }, true);
}); });
} }
@ -905,20 +919,6 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
'use strict'; 'use strict';
angular.module('forms').directive('bnLifecycle',['$rootScope', function($rootScope) {
return {
// I link the DOM element to the view model.
restrict: 'A',
link: function( scope, element, attributes ) {
// Log that the directive has been linked.
console.log('aoeuaoeu');
// console.log( 'Linked:', attributes.id );
}
};
}]);
'use strict';
angular.module('forms').directive('changeFocus', function() { angular.module('forms').directive('changeFocus', function() {
return { return {
scope:{ scope:{
@ -1134,7 +1134,7 @@ angular.module('forms')
** Field CRUD Methods ** Field CRUD Methods
*/ */
// Add a new field // Add a new field
$scope.addNewField = function(fieldType){ $scope.addNewField = function(addOrReturn, fieldType){
// incr field_id counter // incr field_id counter
$scope.addField.lastAddedID++; $scope.addField.lastAddedID++;
@ -1156,10 +1156,17 @@ angular.module('forms')
'required' : true, 'required' : true,
'disabled' : false, 'disabled' : false,
}; };
console.log('\n\n---------\nAdded field CLIENT');
console.log(newField);
// put newField into fields array // put newField into fields array
$scope.myform.form_fields.unshift(newField); if(addOrReturn){
// console.log('\n\n---------\nAdded field CLIENT'); $scope.myform.form_fields.push(newField);
}else {
return newField;
}
// console.log(Date.now()); // console.log(Date.now());
// console.log($scope.myform.form_fields.length); // console.log($scope.myform.form_fields.length);
}; };
@ -1175,13 +1182,21 @@ angular.module('forms')
} }
} }
}; };
$scope.duplicateField = function (field, field_index){ $scope.duplicateField = function (field_index){
for(var i = 0; i < $scope.myform.form_fields.length; i++){ console.log('field_index: '+field_index);
if($scope.myform.form_fields[i].field_id === field.field_id){ var field = $scope.addNewField(false, $scope.myform.form_fields[field_index].fieldType);
$scope.addNewField($scope.myform.form_fields[i].fieldType); field.title = $scope.myform.form_fields[field_index].title;
break; console.log($scope.myform.form_fields[field_index]);
}
}
//Insert field at selected index
$scope.myform.form_fields.splice(field_index+1, 0, field);
// for(var i = 0; i < $scope.myform.form_fields.length; i++){
// if($scope.myform.form_fields[i].field_id === field.field_id){
// break;
// }
// }
}; };
/* /*
@ -1222,7 +1237,7 @@ angular.module('forms')
// decides whether field options block will be shown (true for dropdown and radio fields) // decides whether field options block will be shown (true for dropdown and radio fields)
$scope.showAddOptions = function (field){ $scope.showAddOptions = function (field){
if(field.fieldType === 'dropdown' || field.fieldType === 'checkbox' || field.fieldType === 'scale' || field.fieldType === 'rating' || field.fieldType === 'radio'){ if(field.fieldType === 'dropdown' || field.fieldType === 'checkbox' || field.fieldType === 'radio'){
return true; return true;
} else { } else {
return false; return false;
@ -1260,7 +1275,8 @@ angular.module('forms').directive('fieldIconDirective', function($http, $compile
'scale': 'fa fa-sliders', 'scale': 'fa fa-sliders',
'stripe': 'fa fa-credit-card', 'stripe': 'fa fa-credit-card',
'statement': 'fa fa-quote-left', 'statement': 'fa fa-quote-left',
'yes_no': 'fa fa-toggle-on' 'yes_no': 'fa fa-toggle-on',
'number': 'fa fa-slack'
} }
$scope.typeIcon = iconTypeMap[$scope.typeName]; $scope.typeIcon = iconTypeMap[$scope.typeName];
}, },
@ -1277,7 +1293,8 @@ var __indexOf = [].indexOf || function(item) {
return -1; return -1;
}; };
angular.module('forms').directive('fieldDirective', function($http, $compile) { angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$rootScope',
function($http, $compile, $rootScope) {
var getTemplateUrl = function(field) { var getTemplateUrl = function(field) {
@ -1298,6 +1315,7 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
'statement', 'statement',
'rating', 'rating',
'yes_no', 'yes_no',
'number',
'natural' 'natural'
]; ];
if (__indexOf.call(supported_fields, type) >= 0) { if (__indexOf.call(supported_fields, type) >= 0) {
@ -1307,6 +1325,7 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
var linker = function(scope, element) { var linker = function(scope, element) {
scope.setActiveField = $rootScope.setActiveField;
//Set format only if field is a date //Set format only if field is a date
if(scope.field.fieldType === 'date'){ if(scope.field.fieldType === 'date'){
scope.dateOptions = { scope.dateOptions = {
@ -1344,7 +1363,7 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
}, },
link: linker link: linker
}; };
}); }]);
'use strict'; 'use strict';
angular.module('forms').directive('formLocator', function() { angular.module('forms').directive('formLocator', function() {
return { return {
@ -1367,8 +1386,7 @@ angular.module('forms').directive('onFinishRender', function ($rootScope, $timeo
var broadcastMessage = attrs.onFinishRender || 'ngRepeat'; var broadcastMessage = attrs.onFinishRender || 'ngRepeat';
if(!scope.$last) {
if(scope.$first && !scope.$last) {
$timeout(function () { $timeout(function () {
// console.log(broadcastMessage+'Started'); // console.log(broadcastMessage+'Started');
$rootScope.$broadcast(broadcastMessage+'Started'); $rootScope.$broadcast(broadcastMessage+'Started');
@ -1387,8 +1405,8 @@ angular.module('forms').directive('onFinishRender', function ($rootScope, $timeo
'use strict'; 'use strict';
angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCounter', 'Auth', '$filter', angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCounter', 'Auth', '$filter', '$rootScope',
function ($http, $timeout, timeCounter, Auth, $filter) { function ($http, $timeout, timeCounter, Auth, $filter, $rootScope) {
return { return {
templateUrl: './modules/forms/views/directiveViews/form/submit-form.html', templateUrl: './modules/forms/views/directiveViews/form/submit-form.html',
restrict: 'E', restrict: 'E',
@ -1396,39 +1414,59 @@ angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCo
form:'=' form:'='
}, },
controller: function($scope){ controller: function($scope){
console.log('rendering submitFormDirective'); angular.element(document).ready(function() {
timeCounter.startClock();
$scope.submit = function(){ $scope.selected = null;
var _timeElapsed = timeCounter.stopClock(); $scope.startPage = true;
$scope.form.timeElapsed = _timeElapsed;
$scope.form.percentageComplete = $filter('formValidity')($scope.form.visible_form_fields)/$scope.visible_form_fields.length; $rootScope.setActiveField = function (field_id) {
delete $scope.form.visible_form_fields; console.log('form field clicked: '+field_id);
$scope.selected = field_id;
console.log($scope.selected);
}
$scope.hideOverlay = function (){
$scope.selected = null;
console.log($scope.myForm);
}
$scope.authentication = Auth; $scope.submit = function(){
var _timeElapsed = timeCounter.stopClock();
$scope.form.timeElapsed = _timeElapsed;
$scope.submitPromise = $http.post('/forms/'+$scope.form._id,$scope.form) // console.log('percentageComplete: '+$filter('formValidity')($scope.form)/$scope.form.visible_form_fields.length*100+'%');
.success(function(data, status, headers){ $scope.form.percentageComplete = $filter('formValidity')($scope.form)/$scope.form.visible_form_fields.length*100;
console.log('form submitted successfully'); console.log($scope.form.percentageComplete);
// alert('Form submitted..'); // delete $scope.form.visible_form_fields;
$scope.form.submitted = true;
})
.error(function(error){
console.log(error);
$scope.error = error.message;
});
};
$scope.reloadForm = function(){ $scope.authentication = Auth;
timeCounter.stopClock();
timeCounter.startClock(); $scope.submitPromise = $http.post('/forms/'+$scope.form._id,$scope.form)
$scope.form.submitted = false; .success(function(data, status, headers){
$scope.form.form_fields = _.chain($scope.form.form_fields).map(function(field){ console.log('form submitted successfully');
field.fieldValue = ''; // alert('Form submitted..');
return field; $scope.form.submitted = true;
}).value(); })
}; .error(function(error){
console.log(error);
$scope.error = error.message;
});
};
$scope.exitStartPage = function () {
$scope.startPage = false;
}
$scope.reloadForm = function(){
timeCounter.stopClock();
timeCounter.startClock();
$scope.form.submitted = false;
$scope.form.form_fields = _.chain($scope.form.form_fields).map(function(field){
field.fieldValue = '';
return field;
}).value();
};
});
} }
}; };
@ -1540,6 +1578,10 @@ angular.module('forms').service('FormFields', [
name : 'link', name : 'link',
value : 'Link' value : 'Link'
}, },
{
name : 'number',
value : 'Numbers'
},
// { // {
// name : 'scale', // name : 'scale',
// value : 'Opinion Scale' // value : 'Opinion Scale'
@ -1654,15 +1696,16 @@ angular.module('users').config(['$httpProvider',
return { return {
responseError: function(response) { responseError: function(response) {
// console.log($location.path()); // console.log($location.path());
if( response.config.url !== '/users/me' && $location.path() !== '/users/me' && response.config){ if( $location.path() !== '/users/me' && response.config){
if(response.config.url !== '/users/me'){
console.log('intercepted rejection of ', response.config.url, response.status); console.log('intercepted rejection of ', response.config.url, response.status);
if (response.status === 401) { if (response.status === 401) {
// save the current location so that login can redirect back // save the current location so that login can redirect back
$location.nextAfterLogin = $location.path(); $location.nextAfterLogin = $location.path();
$location.path('/signin'); $location.path('/signin');
}else if(response.status === 403){ }else if(response.status === 403){
$location.path('/access_denied'); $location.path('/access_denied');
}
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -27,6 +27,21 @@
padding-right: 20px; padding-right: 20px;
} }
.navbar-inverse .navbar-nav>li>a, .navbar li.dropdown a.dropdown-toggle > * {
color: rgb(131,131,131);
}
.navbar-inverse .navbar-nav .active > a, .navbar li.dropdown.open a.dropdown-toggle > *, .navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a, .navbar-inverse .navbar-nav>.open>a:focus, .navbar-inverse .navbar-nav>.open>a:hover {
background-color: rgb(131,131,131);
color: white!important;
}
.navbar-inverse .navbar-toggle {
background-color: #ddd;
border:none;
}
.navbar-inverse .navbar-collapse{
border: none;
}
.content { .content {
margin-top: 70px; margin-top: 70px;
} }
@ -57,10 +72,10 @@ section.hero-section .jumbotron {
color:#fff; color:#fff;
} }
.image-background { .image-background {
position: absolute; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
height: 230%; height: 100%;
width: 100%; width: 100%;
z-index: -98; z-index: -98;
background-image: url(http://yourplaceandmine.ie/wp-content/uploads/2014/09/Daingean-meeting-048_13-1080x675.jpg); background-image: url(http://yourplaceandmine.ie/wp-content/uploads/2014/09/Daingean-meeting-048_13-1080x675.jpg);
@ -70,10 +85,10 @@ section.hero-section .jumbotron {
} }
.opacity-background { .opacity-background {
position: absolute; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
height: 230%; height: 100%;
width: 100%; width: 100%;
background-color: rgba(0,0,0,0.5); background-color: rgba(0,0,0,0.5);
z-index: -97; z-index: -97;

View file

@ -39,7 +39,8 @@
<ul class="nav navbar-nav navbar-right" data-ng-show="authentication.isAuthenticated()"> <ul class="nav navbar-nav navbar-right" data-ng-show="authentication.isAuthenticated()">
<li class="dropdown" dropdown> <li class="dropdown" dropdown>
<a href="#" class="dropdown-toggle" data-toggle="dropdown" dropdown-toggle> <a href="#" class="dropdown-toggle" data-toggle="dropdown" dropdown-toggle>
<span data-ng-bind="authentication.currentUser.displayName"></span> <b class="caret"></b> <span>My Settings</span>
<b class="caret"></b>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>

View file

@ -1,16 +1,9 @@
<section data-ng-controller="HomeController" class="hero-section"> <section data-ng-controller="HomeController" class="hero-section" style="overflow:hidden;">
<div class="opacity-background"> <div class="opacity-background">
</div> </div>
<div class="image-background"> <div class="image-background">
</div> </div>
<div class="jumbotron text-center"> <div class="jumbotron text-center">
<!-- <div class="row">
<div class="col-md-6 col-md-offset-3 col-sm-6 col-sm-offset-3 col-xs-12">
<img alt="MEAN.JS" class="img-responsive text-center" src="modules/core/img/brand/logo.png" />
</div>
</div>
<br> -->
<div class="row" data-ng-if="!authentication.isAuthenticated()"> <div class="row" data-ng-if="!authentication.isAuthenticated()">
<div class="col-xs-12 row text-center logo" style="border-bottom: 1px solid rgba(255,255,255,.2); margin-bottom: 30px;"> <div class="col-xs-12 row text-center logo" style="border-bottom: 1px solid rgba(255,255,255,.2); margin-bottom: 30px;">
<h3 class="col-xs-12" style="color: #FA787E; margin-bottom:0px"> <h3 class="col-xs-12" style="color: #FA787E; margin-bottom:0px">
@ -21,12 +14,15 @@
</h2> </h2>
</div> </div>
<div class="col-xs-12 row" style="margin-top:0px"> <div class="col-xs-12 row" style="margin-top:0px">
<h1 class="lead col-xs-10 col-xs-offset-1" style="font-size:3.8em;"> <h1 class="lead col-md-10 col-md-offset-1 hidden-xs hidden-sm" style="font-size:3.8em;">
Craft beautiful forms in seconds. Craft beautiful forms in seconds.
</h1> </h1>
<p class="lead col-xs-12" style="font-size:1.5em; color:rgba(255,255,255,.75)"> <h2 class="lead col-xs-12 text-center hidden-md hidden-lg" style="font-size:2.8em;">
Craft beautiful forms.
</h2>
<p class="lead col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-1" style="font-size:1.5em; color:rgba(255,255,255,.75)">
<i>Medforms is an opensource <b>form builder</b> that can create stunning forms from PDFs or from scratch</i> <i>Medforms is an opensource <b>form builder</b> that can create stunning forms from PDFs or from scratch</i>
</h1> </p>
</div> </div>
<div class="col-xs-12" style="margin-top:7%;"> <div class="col-xs-12" style="margin-top:7%;">
@ -34,7 +30,6 @@
sign me up! sign me up!
</a> </a>
</div> </div>
</div> </div>
</div> </div>
</section> </section>

View file

@ -3,24 +3,23 @@
// Forms controller // Forms controller
angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScope', '$stateParams', '$state', 'Forms', 'CurrentForm', angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScope', '$stateParams', '$state', 'Forms', 'CurrentForm',
function($scope, $rootScope, $stateParams, $state, Forms, CurrentForm) { function($scope, $rootScope, $stateParams, $state, Forms, CurrentForm) {
Forms.get({ Forms.get({
formId: $stateParams.formId formId: $stateParams.formId
}).$promise.then( }).$promise.then(
//success //success
function(form){ function(form){
$scope.form = form; $scope.myform = form;
//Show navbar if form is not public AND user is loggedin // Show navbar if form is not public AND user is loggedin
if(!$scope.form.isLive && $rootScope.authentication.isAuthenticated()){ if(!$scope.myform.isLive && $rootScope.authentication.isAuthenticated()){
$rootScope.hideNav = false; $rootScope.hideNav = false;
}else if(!$scope.form.isLive){ }else if(!$scope.myform.isLive){
$state.go('access_denied'); $state.go('access_denied');
}else {
CurrentForm.setForm($scope.form);
} }
console.log('$rootScope.hideNav: '+$rootScope.hideNav); console.log('$rootScope.hideNav: '+$rootScope.hideNav);
console.log('$scope.form.isLive: '+$scope.form.isLive); console.log('$scope.form.isLive: '+$scope.myform.isLive);
}, },
//error //error
function( error ){ function( error ){
@ -28,5 +27,6 @@ angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScop
console.log('ERROR: '+error.message); console.log('ERROR: '+error.message);
$state.go('access_denied'); $state.go('access_denied');
}); });
} }
]); ]);

View file

@ -51,8 +51,8 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
$scope.toggleObjSelection = function($event, description) { $scope.toggleObjSelection = function($event, description) {
$event.stopPropagation(); $event.stopPropagation();
}; };
$scope.rowClicked = function(obj) { $scope.rowClicked = function(row_index) {
obj.selected = !obj.selected; $scope.table.rows[row_index].selected = !$scope.table.rows[row_index].selected;
}; };
/* /*
@ -64,7 +64,6 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
var delete_ids = _.chain($scope.table.rows).filter(function(row){ var delete_ids = _.chain($scope.table.rows).filter(function(row){
return !!row.selected; return !!row.selected;
}).pluck('_id').value(); }).pluck('_id').value();
console.log(delete_ids);
$http({ url: '/forms/'+$scope.myform._id+'/submissions', $http({ url: '/forms/'+$scope.myform._id+'/submissions',
method: 'DELETE', method: 'DELETE',
@ -72,11 +71,14 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
headers: {"Content-Type": "application/json;charset=utf-8"} headers: {"Content-Type": "application/json;charset=utf-8"}
}).success(function(data, status, headers){ }).success(function(data, status, headers){
//Remove deleted ids from table //Remove deleted ids from table
var tmpArray = [];
for(var i=0; i<$scope.table.rows.length; i++){ for(var i=0; i<$scope.table.rows.length; i++){
if($scope.table.rows[i].selected){ if(!$scope.table.rows[i].selected){
$scope.table.rows.splice(i, 1); tmpArray.push($scope.table.rows[i]);
} }
} }
console.log(tmpArray);
$scope.table.rows = tmpArray;
}) })
.error(function(err){ .error(function(err){
console.log('Could not delete form submissions.\nError: '); console.log('Could not delete form submissions.\nError: ');
@ -84,6 +86,21 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
console.error = err; console.error = err;
}); });
}; };
//Export selected submissions of Form
$scope.exportSubmissions = function(){
// console.log('exportSelectedSubmissions');
// var export_ids = _.chain($scope.table.rows).filter(function(row){
// return !!row.selected;
// }).pluck('_id').value();
var blob = new Blob([document.getElementById('table-submission-data').innerHTM], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
});
saveAs(blob, $scope.myform.title+'_export_'+Date.now()+".xls");
};
//Fetch and display submissions of Form //Fetch and display submissions of Form
$scope.showSubmissions = function(){ $scope.showSubmissions = function(){
$scope.viewSubmissions = true; $scope.viewSubmissions = true;

View file

@ -56,6 +56,11 @@ form .accordion-edit {
width: inherit; width: inherit;
} }
/*Styles for ui-datepicker*/
.ui-datepicker.ui-widget {
z-index: 99!important;
}
/* Styles for form submission view (/forms/:formID) */ /* Styles for form submission view (/forms/:formID) */
form .row.field { form .row.field {
padding: 1em 0 3em 0; padding: 1em 0 3em 0;
@ -80,6 +85,15 @@ form .row.field {
form.submission-form .select.radio > .field-input input, form.submission-form .select > .field-input input { form.submission-form .select.radio > .field-input input, form.submission-form .select > .field-input input {
width:20%; width:20%;
} }
form.submission-form .field.row.radio .btn.activeBtn {
background-color: rgba(0,0,0,0.7)!important;
color: white;
}
form.submission-form .field.row.radio .btn {
margin-right:1.2em;
}
form.submission-form .select > .field-input .btn { form.submission-form .select > .field-input .btn {
text-align: left; text-align: left;
margin-bottom:0.7em; margin-bottom:0.7em;
@ -88,11 +102,11 @@ form .row.field {
font-size: 1.10em; font-size: 1.10em;
} }
/*form.submission-form .row.field > .field-input > input:focus { /*form.submission-form .field-input > input:focus {
font-size:1em; font-size:1em;
}*/ }*/
form .row.field > .field-input > textarea{ form .field-input > textarea{
padding: 0.45em 0.9em; padding: 0.45em 0.9em;
width: 100%; width: 100%;
line-height: 160%; line-height: 160%;
@ -100,13 +114,13 @@ form .row.field {
} }
form .row.field > .field-input > input.text-field-input{ form .field-input > input.text-field-input{
padding: 0.45em 0.9em; padding: 0.45em 0.9em;
width: 100%; width: 100%;
line-height: 160%; line-height: 160%;
border: 2px dashed #ddd; border: 2px dashed #ddd;
} }
form .row.field > .field-input > input.text-field-input:focus{ form .field-input > input.text-field-input:focus{
border: 0; border: 0;
} }
form .required-error{ form .required-error{
@ -126,8 +140,11 @@ form .row.field {
border: 1px solid #ccc; border: 1px solid #ccc;
height: 34px; height: 34px;
} }
.config-form {
max-width: 100%;
}
div.config-form > .row { .config-form > .row {
padding: 19px; padding: 19px;
margin-bottom: 20px; margin-bottom: 20px;
background-color: #f5f5f5; background-color: #f5f5f5;
@ -135,7 +152,6 @@ div.config-form > .row {
border-radius: 4px; border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
width: 90%;
} }
div.config-form > .row > .container:nth-of-type(odd){ div.config-form > .row > .container:nth-of-type(odd){
@ -190,6 +206,15 @@ div.config-form > .row {
text-decoration: none; text-decoration: none;
} }
.current-fields .panel-body .row.question input[type='text'], .current-fields .panel-body .row.description textarea{
width: 100%;
}
.current-fields .panel-body .row.options input[type='text'] {
width: 80%;
}
.current-fields .tool-panel > .panel-default:hover { .current-fields .tool-panel > .panel-default:hover {
border-color: #9d9d9d; border-color: #9d9d9d;
cursor: pointer; cursor: pointer;
@ -211,6 +236,26 @@ div.config-form > .row {
text-decoration: none; text-decoration: none;
} }
/*Styles for submission table*/
.submissions-table .table-outer.row {
margin-top: 1.5em;
margin-bottom: 2em;
margin-left: 0px!important;
margin-right: 0px!important;
}
.submissions-table .table-outer .col-xs-12 {
padding-left: 0px!important;
border:1px solid #ddd;
overflow-x: scroll;
border-radius:3px;
}
.submissions-table .table > thead > tr > th {
min-width:8em;
}
.submissions-table .table > tbody > tr.selected {
background-color:#efefef;
}
/*Styles for add fields tab*/ /*Styles for add fields tab*/
.admin-form .add-field { .admin-form .add-field {
@ -228,8 +273,8 @@ div.config-form > .row {
border-radius: 4px; border-radius: 4px;
} }
.status-light { .view-form-btn.span {
padding-left:0.6em; padding-right:0.6em;
} }
.status-light.status-light-off { .status-light.status-light-off {
color: #BE0000; color: #BE0000;
@ -243,26 +288,32 @@ section > section.public-form {
padding: 0 6em 7em 6em; padding: 0 6em 7em 6em;
} }
.form-item.row { .form-item {
text-align: center; text-align: center;
border-bottom: 6px inset #ccc; border-bottom: 6px inset #ccc;
background-color: #eee; background-color: #eee;
width: 180px; /*width: 180px;*/
height: 215px; /*width:100%;*/
position: relative;
height: 0;/*215px;*/
padding-bottom: 25%;
margin-bottom: 45px; margin-bottom: 45px;
} }
.form-item.create-new input[type='text']{
width: inherit;
}
.form-item.row.create-new { .form-item.create-new {
background-color: rgb(131,131,131); background-color: rgb(131,131,131);
color: white; color: white;
} }
/*MODAL CSS */ /*MODAL CSS */
.form-item.row.create-new.new-form { .form-item.create-new.new-form {
background-color: rgb(300,131,131); background-color: rgb(300,131,131);
z-index: 11; z-index: 11;
} }
.form-item.row.create-new.new-form:hover { .form-item.create-new.new-form:hover {
background-color: rgb(300,100,100); background-color: rgb(300,100,100);
} }
@ -272,51 +323,66 @@ section > section.public-form {
/*Modal overlay (for lightbox effect)*/ /*Modal overlay (for lightbox effect)*/
.overlay { .overlay {
position: absolute; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
height: 193%; height: 100%;
width: 100%; width: 100%;
background-color: rgba(0,0,0,0.5); background-color: rgba(0,0,0,0.5);
z-index: 10; z-index: 10;
} }
.field-directive {
z-index: 9;
padding:25px;
border: 25px transparent solid;
position: relative;
}
.activeField {
z-index: 11;
position: relative;
display: inline-block;
background-color: white;
border-radius: 7px;
width:100%;
border: 25px white solid;
}
.form-item.row:hover, .form-item.row.create-new:hover { .form-item:hover, .form-item.create-new:hover {
border-bottom: 8px inset #ccc; border-bottom: 8px inset #ccc;
background-color: #d9d9d9; background-color: #d9d9d9;
} }
.form-item.row.create-new:hover { .form-item.create-new:hover {
/*color: #eee;*/ /*color: #eee;*/
background-color: rgb(81,81,81); background-color: rgb(81,81,81);
} }
.form-item.row > .title-row{ .form-item > .title-row{
position: relative; position: relative;
top: 15px; top: 15px;
padding-top:3em; padding-top:3em;
padding-bottom:3.65em; padding-bottom:3.65em;
} }
.form-item.row > .title-row h4 { .form-item > .title-row h4 {
font-size: 1.3em; font-size: 1.3em;
} }
.form-item.row.create-new > .title-row{ .form-item.create-new > .title-row{
padding: 0; padding: 0;
/*margin-top:1em; */ /*margin-top:1em; */
} }
.form-item.row.create-new > .title-row h4 { .form-item.create-new > .title-row h4 {
font-size: 7em; font-size: 7em;
} }
.form-item.row > .details-row{ .form-item > .details-row{
margin-top: 3.2em; margin-top: 3.2em;
} }
.form-item.row > .details-row small { .form-item > .details-row small {
font-size: 0.6em; font-size: 0.6em;
} }
.form-item.row.create-new > .details-row small { .form-item.create-new > .details-row small {
font-size: 0.95em; font-size: 0.95em;
} }

View file

@ -54,8 +54,6 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
$scope.$watch(function(newValue, oldValue) { $scope.$watch(function(newValue, oldValue) {
if($scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){ if($scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){
console.log('ready to save text input');
console.log('Saving Form');
updateFields(); updateFields();
} }
}); });

View file

@ -114,7 +114,9 @@ angular.module('forms')
'required' : true, 'required' : true,
'disabled' : false, 'disabled' : false,
}; };
console.log('\n\n---------\nAdded field CLIENT');
console.log(newField);
// put newField into fields array // put newField into fields array
if(addOrReturn){ if(addOrReturn){
$scope.myform.form_fields.push(newField); $scope.myform.form_fields.push(newField);
@ -122,7 +124,7 @@ angular.module('forms')
return newField; return newField;
} }
console.log('\n\n---------\nAdded field CLIENT');
// console.log(Date.now()); // console.log(Date.now());
// console.log($scope.myform.form_fields.length); // console.log($scope.myform.form_fields.length);
}; };
@ -193,7 +195,7 @@ angular.module('forms')
// decides whether field options block will be shown (true for dropdown and radio fields) // decides whether field options block will be shown (true for dropdown and radio fields)
$scope.showAddOptions = function (field){ $scope.showAddOptions = function (field){
if(field.fieldType === 'dropdown' || field.fieldType === 'checkbox' || field.fieldType === 'scale' || field.fieldType === 'rating' || field.fieldType === 'radio'){ if(field.fieldType === 'dropdown' || field.fieldType === 'checkbox' || field.fieldType === 'radio'){
return true; return true;
} else { } else {
return false; return false;

View file

@ -24,7 +24,8 @@ angular.module('forms').directive('fieldIconDirective', function($http, $compile
'scale': 'fa fa-sliders', 'scale': 'fa fa-sliders',
'stripe': 'fa fa-credit-card', 'stripe': 'fa fa-credit-card',
'statement': 'fa fa-quote-left', 'statement': 'fa fa-quote-left',
'yes_no': 'fa fa-toggle-on' 'yes_no': 'fa fa-toggle-on',
'number': 'fa fa-slack'
} }
$scope.typeIcon = iconTypeMap[$scope.typeName]; $scope.typeIcon = iconTypeMap[$scope.typeName];
}, },

View file

@ -8,7 +8,8 @@ var __indexOf = [].indexOf || function(item) {
return -1; return -1;
}; };
angular.module('forms').directive('fieldDirective', function($http, $compile) { angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$rootScope',
function($http, $compile, $rootScope) {
var getTemplateUrl = function(field) { var getTemplateUrl = function(field) {
@ -29,6 +30,7 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
'statement', 'statement',
'rating', 'rating',
'yes_no', 'yes_no',
'number',
'natural' 'natural'
]; ];
if (__indexOf.call(supported_fields, type) >= 0) { if (__indexOf.call(supported_fields, type) >= 0) {
@ -38,6 +40,7 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
var linker = function(scope, element) { var linker = function(scope, element) {
scope.setActiveField = $rootScope.setActiveField;
//Set format only if field is a date //Set format only if field is a date
if(scope.field.fieldType === 'date'){ if(scope.field.fieldType === 'date'){
scope.dateOptions = { scope.dateOptions = {
@ -75,4 +78,4 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
}, },
link: linker link: linker
}; };
}); }]);

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCounter', 'Auth', '$filter', angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCounter', 'Auth', '$filter', '$rootScope',
function ($http, $timeout, timeCounter, Auth, $filter) { function ($http, $timeout, timeCounter, Auth, $filter, $rootScope) {
return { return {
templateUrl: './modules/forms/views/directiveViews/form/submit-form.html', templateUrl: './modules/forms/views/directiveViews/form/submit-form.html',
restrict: 'E', restrict: 'E',
@ -9,39 +9,59 @@ angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCo
form:'=' form:'='
}, },
controller: function($scope){ controller: function($scope){
console.log('rendering submitFormDirective'); angular.element(document).ready(function() {
timeCounter.startClock();
$scope.submit = function(){ $scope.selected = null;
var _timeElapsed = timeCounter.stopClock(); $scope.startPage = true;
$scope.form.timeElapsed = _timeElapsed;
$scope.form.percentageComplete = $filter('formValidity')($scope.form.visible_form_fields)/$scope.visible_form_fields.length; $rootScope.setActiveField = function (field_id) {
delete $scope.form.visible_form_fields; console.log('form field clicked: '+field_id);
$scope.selected = field_id;
console.log($scope.selected);
}
$scope.hideOverlay = function (){
$scope.selected = null;
console.log($scope.myForm);
}
$scope.authentication = Auth; $scope.submit = function(){
var _timeElapsed = timeCounter.stopClock();
$scope.form.timeElapsed = _timeElapsed;
$scope.submitPromise = $http.post('/forms/'+$scope.form._id,$scope.form) // console.log('percentageComplete: '+$filter('formValidity')($scope.form)/$scope.form.visible_form_fields.length*100+'%');
.success(function(data, status, headers){ $scope.form.percentageComplete = $filter('formValidity')($scope.form)/$scope.form.visible_form_fields.length*100;
console.log('form submitted successfully'); console.log($scope.form.percentageComplete);
// alert('Form submitted..'); // delete $scope.form.visible_form_fields;
$scope.form.submitted = true;
})
.error(function(error){
console.log(error);
$scope.error = error.message;
});
};
$scope.reloadForm = function(){ $scope.authentication = Auth;
timeCounter.stopClock();
timeCounter.startClock(); $scope.submitPromise = $http.post('/forms/'+$scope.form._id,$scope.form)
$scope.form.submitted = false; .success(function(data, status, headers){
$scope.form.form_fields = _.chain($scope.form.form_fields).map(function(field){ console.log('form submitted successfully');
field.fieldValue = ''; // alert('Form submitted..');
return field; $scope.form.submitted = true;
}).value(); })
}; .error(function(error){
console.log(error);
$scope.error = error.message;
});
};
$scope.exitStartPage = function () {
$scope.startPage = false;
}
$scope.reloadForm = function(){
timeCounter.stopClock();
timeCounter.startClock();
$scope.form.submitted = false;
$scope.form.form_fields = _.chain($scope.form.form_fields).map(function(field){
field.fieldValue = '';
return field;
}).value();
};
});
} }
}; };

View file

@ -55,6 +55,10 @@ angular.module('forms').service('FormFields', [
name : 'link', name : 'link',
value : 'Link' value : 'Link'
}, },
{
name : 'number',
value : 'Numbers'
},
// { // {
// name : 'scale', // name : 'scale',
// value : 'Opinion Scale' // value : 'Opinion Scale'
@ -67,10 +71,10 @@ angular.module('forms').service('FormFields', [
name : 'statement', name : 'statement',
value : 'Statement' value : 'Statement'
}, },
{ // {
name : 'natural', // name : 'natural',
value : 'Natural Language Input' // value : 'Natural Language Input'
}, // },
]; ];
} }

View file

@ -1,13 +1,13 @@
<div class="field row" ng-if="field.fieldOptions.length > 0"> <div class="field row" ng-click="setActiveField(field._id)" ng-if="field.fieldOptions.length > 0">
<div class="col-xs-12 field-title field-title">{{field.title}} </div> <div class="col-xs-12 field-title field-title">{{field.title}} </div>
<div class="col-xs-12 field-input"> <div class="col-xs-12 field-input">
<div ng-repeat="option in field.fieldOptions" class="row-fluid"> <div ng-repeat="option in field.fieldOptions" class="row-fluid">
<label class="btn btn-info col-xs-3"> <label class="btn btn-info col-xs-3">
<input type="checkbox" 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 ng-focus="setActiveField(field._id)"type="checkbox" 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> <span ng-bind="option.option_title"></span>
</label> </label>
</div> </div>
<span class="required-error" ng-show="field.required && field.fieldValue == 0">(* required)</span> <span class="required-error" ng-show="field.required && field.fieldValue == 0">(* required)</span>
</div> </div>
<div class="field row"> <div class="field row" ng-click="setActiveField(field._id)">

View file

@ -1,4 +1,4 @@
<div class="field row"> <div class="field row" ng-click="setActiveField(field._id)">
<div class="col-xs-12 field-title"> <div class="col-xs-12 field-title">
<h3> <h3>
<span class="fa fa-angle-double-right"></span> <span class="fa fa-angle-double-right"></span>
@ -8,7 +8,7 @@
</div> </div>
<div class="col-xs-12 field-input"> <div class="col-xs-12 field-input">
<div class="control-group input-append"> <div class="control-group input-append">
<input ui-date="dateOptions" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled"> <input ng-focus="setActiveField(field._id)"ui-date="dateOptions" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled">
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,4 +1,4 @@
<div class="field row dropdown" ng-if="field.fieldOptions.length > 0"> <div class="field row dropdown" ng-click="setActiveField(field._id)" ng-if="field.fieldOptions.length > 0">
<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><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-input "> <div class="col-xs-12 field-input ">
<select ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled"> <select ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled">

View file

@ -1,7 +1,7 @@
<div class="field row"> <div class="field row" ng-click="setActiveField(field._id)">
<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><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-input"> <div class="col-xs-12 field-input">
<input type="email" <input ng-focus="setActiveField(field._id)"type="email"
class="text-field-input" class="text-field-input"
placeholder="email@example.com" placeholder="email@example.com"
value="{{field.fieldValue}}" value="{{field.fieldValue}}"

View file

@ -1 +1 @@
<input type="hidden" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" value="{{field.fieldValue}}" ng-disabled="field.disabled"> <input ng-focus="setActiveField(field._id)"type="hidden" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" value="{{field.fieldValue}}" ng-disabled="field.disabled">

View file

@ -1,4 +1,4 @@
<div class="field row radio legal"> <div class="field row radio legal" ng-click="setActiveField(field._id)">
<div class="col-xs-12 field-title"> <div class="col-xs-12 field-title">
<h3>{{field.title}} <span class="required-error" ng-show="field.required && !field.fieldValue">*(required)</span></h3> <h3>{{field.title}} <span class="required-error" ng-show="field.required && !field.fieldValue">*(required)</span></h3>
<br> <br>
@ -7,11 +7,11 @@
<div class="col-xs-6 field-input container"> <div class="col-xs-6 field-input container">
<div class="row-fluid"> <div class="row-fluid">
<label class="btn col-xs-4"> <label class="btn col-xs-4">
<input type="radio" value="true" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled"/> <input ng-focus="setActiveField(field._id)"type="radio" value="true" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled"/>
<span> I accept </span> <span> I accept </span>
</label> </label>
<label class="btn col-xs-5 col-xs-offset-1"> <label class="btn col-xs-5 col-xs-offset-1">
<input type="radio" value="false" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled"/> <input ng-focus="setActiveField(field._id)"type="radio" value="false" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled"/>
<span>I don't accept </span> <span>I don't accept </span>
</label> </label>
</div> </div>

View file

@ -1,7 +1,7 @@
<div class="field row"> <div class="field row" ng-click="setActiveField(field._id)">
<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><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-input"> <div class="col-xs-12 field-input">
<input type="url" class="text-field-input" placeholder="https://example.com/something" value="{{field.fieldValue}}" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled"/> <input ng-focus="setActiveField(field._id)"type="url" class="text-field-input" placeholder="https://example.com/something" value="{{field.fieldValue}}" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled"/>
<span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span>
</div> </div>
</div> </div>

View file

@ -1,7 +1,7 @@
<div class="textfield natural field row"> <div class="textfield natural field row" ng-click="setActiveField(field._id)">
<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><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-input"> <div class="col-xs-12 field-input">
<input type="text" <input ng-focus="setActiveField(field._id)"type="text"
class="text-field-input" class="text-field-input"
ng-model="field.fieldValue" ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }" ng-model-options="{ debounce: 250 }"

View file

@ -0,0 +1,6 @@
<div class="field row" ng-click="setActiveField(field._id)">
<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-input">
<input ng-focus="setActiveField(field._id)"type="number" class="text-field-input" placeholder="" value="{{field.fieldValue}}" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled"/>
</div>
</div>

View file

@ -1,7 +1,7 @@
<div class="field row"> <div class="field row" ng-click="setActiveField(field._id)">
<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><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-input"> <div class="col-xs-12 field-input">
<input type="password" class="text-field-input" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" value="{{field.fieldValue}}" ng-required="field.required" ng-disabled="field.disabled"> <input ng-focus="setActiveField(field._id)"type="password" class="text-field-input" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" value="{{field.fieldValue}}" ng-required="field.required" ng-disabled="field.disabled">
<span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span>
</div> </div>
</div> </div>

View file

@ -1,19 +1,19 @@
<div class="field row radio" ng-if="field.fieldOptions.length > 0"> <div class="field row radio" ng-click="setActiveField(field._id)" ng-if="field.fieldOptions.length > 0">
<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><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-input"> <div class="col-xs-12 field-input">
<div ng-repeat="option in field.fieldOptions" class="row-fluid"> <div ng-repeat="option in field.fieldOptions" class="row-fluid">
<label class="btn btn-info col-xs-3"> <label class="btn col-xs-3" ng-class="{activeBtn: field.fieldValue == field.fieldOptions[$index].option_value}">
<input type="radio" <input ng-focus="setActiveField(field._id)"
type="radio"
value="{{option.option_value}}" value="{{option.option_value}}"
ng-model="field.fieldValue" ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }" ng-model-options="{ debounce: 250 }"
ng-required="field.required" ng-required="field.required"
ng-disabled="field.disabled" ng-disabled="field.disabled"
ng-init="field.fieldValue = field.fieldOptions[0].option_value"/> />
<span ng-bind="option.option_title"></span> <span ng-bind="option.option_title"></span>
</label> </label>
</div> </div>
<span class="required-error" ng-show="field.required && !field.fieldValue">* required</span>
</div> </div>
</div> </div>
<br> <br>

View file

@ -1,4 +1,4 @@
<div class="textfield field row"> <div class="textfield field row" ng-click="setActiveField(field._id)">
<div class="col-xs-12 field-title"> <div class="col-xs-12 field-title">
<h3> <h3>
<span class="fa fa-angle-double-right"></span> <span class="fa fa-angle-double-right"></span>
@ -7,12 +7,13 @@
</h3> </h3>
</div> </div>
<div class="col-xs-12 field-input"> <div class="col-xs-12 field-input">
<input-stars max="5" <input-stars max="5" ng-focus="setActiveField(field._id)"
icon-full="fa-star" icon-base="fa fa-3x" icon-empty="fa-star-o" icon-full="fa-star"
icon-base="fa fa-3x"
icon-empty="fa-star-o"
ng-init="field.fieldValue = 1" ng-init="field.fieldValue = 1"
ng-model="field.fieldValue" ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }" ng-model-options="{ debounce: 250 }"
value="field.fieldValue"
ng-required="field.required" ng-required="field.required"
ng-disabled="field.disabled" ng-disabled="field.disabled"
class="angular-input-stars"> class="angular-input-stars">

View file

@ -1,4 +1,4 @@
<div class="statement field row container"> <div class="statement field row container" ng-click="setActiveField(field._id)">
<div class="col-xs-12 row field-title field-title"> <div class="col-xs-12 row field-title field-title">
<i class="fa fa-quote-left fa-3 col-xs-1"></i> <i class="fa fa-quote-left fa-3 col-xs-1"></i>
<h2 class="text-center col-xs-8 ">{{field.title}} </h2> <h2 class="text-center col-xs-8 ">{{field.title}} </h2>

View file

@ -1,4 +1,4 @@
<div class="field row"> <div class="field row" ng-click="setActiveField(field._id)">
<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><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-input"> <div class="col-xs-12 field-input">
<textarea type="text" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" value="{{field.fieldValue}}" ng-required="field.required" ng-disabled="field.disabled"></textarea> <textarea type="text" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" value="{{field.fieldValue}}" ng-required="field.required" ng-disabled="field.disabled"></textarea>

View file

@ -1,7 +1,7 @@
<div class="textfield field row"> <div class="textfield field row" ng-click="setActiveField(field._id)">
<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><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-input"> <div class="col-xs-12 field-input">
<input type="text" <input ng-focus="setActiveField(field._id)"type="text"
class="text-field-input" class="text-field-input"
ng-model="field.fieldValue" ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }" ng-model-options="{ debounce: 250 }"

View file

@ -1,4 +1,4 @@
<div class="field row radio"> <div class="field row radio" ng-click="setActiveField(field._id)">
<div class="col-xs-12 field-title"> <div class="col-xs-12 field-title">
<h3 class="row"> <h3 class="row">
<span class="fa fa-angle-double-right"></span> {{field.title}} <span class="fa fa-angle-double-right"></span> {{field.title}}
@ -14,12 +14,12 @@
<div class="col-xs-12 field-input"> <div class="col-xs-12 field-input">
<div class="row-fluid"> <div class="row-fluid">
<label class="btn btn-success col-xs-3"> <label class="btn btn-success col-xs-3">
<input type="radio" value="true" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled" ng-init="field.fieldValue = true"/> <input ng-focus="setActiveField(field._id)"type="radio" value="true" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled" ng-init="field.fieldValue = true"/>
<span>Yes</span> <span>Yes</span>
</label> </label>
<label class="btn btn-danger col-xs-3"> <label class="btn btn-danger col-xs-3">
<input type="radio" value="false" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled"/> <input ng-focus="setActiveField(field._id)"type="radio" value="false" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled"/>
<span>No</span> <span>No</span>
</label> </label>
</div> </div>

View file

@ -1,9 +1,10 @@
<div class="config-form container"> <div class="config-form container">
<div class="row"> <div class="row">
<div class="col-sm-6 container"> <div class="col-md-6 col-sm-12 container">
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<h2>PDF Generation</h2> <h2 class="hidden-sm hidden-xs">PDF Generation</h2>
<h3 class="hidden-lg hidden-md">PDF Generation</h3>
</div> </div>
</div> </div>
@ -13,7 +14,6 @@
</div> </div>
<div class="field-input col-sm-6"> <div class="field-input col-sm-6">
<label> <label>
<input type="radio" data-ng-value="true" ng-model="myform.hideFooter" ng-required="true" /> <input type="radio" data-ng-value="true" ng-model="myform.hideFooter" ng-required="true" />
&nbsp;<span>Yes</span> &nbsp;<span>Yes</span>
@ -23,8 +23,6 @@
<input type="radio" data-ng-value="false" ng-model="myform.hideFooter" ng-required="true" /> <input type="radio" data-ng-value="false" ng-model="myform.hideFooter" ng-required="true" />
&nbsp;<span>No</span> &nbsp;<span>No</span>
</label> </label>
<!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> -->
</div> </div>
</div> </div>
@ -123,23 +121,29 @@
</div> --> </div> -->
</div> </div>
<div class="col-sm-5 col-sm-offset-1 container"> <div class="col-sm-12 hidden-md hidden-lg">
<br>
<hr>
</div>
<div class="col-md-5 col-md-offset-1 col-sm-12 container">
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<h2>Advanced Settings</h2> <h2 class="hidden-sm hidden-xs">Advanced Settings</h2>
<h3 class="hidden-lg hidden-md">PDF Generation</h3>
</div> </div>
</div> </div>
<div class="row field"> <div class="row field">
<div class="field-title col-sm-6"> <div class="field-title col-sm-4">
<h5>Form Name</h5> <h5>Form Name</h5>
</div> </div>
<div class="col-sm-6 field-input field-input"> <div class="col-sm-8">
<input type="text" <input type="text"
ng-model="myform.title" ng-model="myform.title"
value="{{myform.title}}"> value="{{myform.title}}"
<span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> style="width: 100%;">
</div> </div>
</div> </div>
@ -163,6 +167,26 @@
<!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> --> <!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> -->
</div> </div>
</div> </div>
<div class="row field">
<div class="field-title col-sm-6">
<h5>Display Start Page?</h5>
</div>
<div class="field-input col-sm-6">
<label>
<input type="radio" data-ng-value="true" ng-model="myform.showStart" ng-required="true" style="background-color:#33CC00;"/>
&nbsp;<span>Yes</span>
</label>
<label>
<input type="radio" data-ng-value="false" ng-model="myform.showStart" ng-required="true" />
&nbsp;<span>No</span>
</label>
<!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> -->
</div>
</div>
<div class="row field"> <div class="row field">
<div class="col-xs-6 field-title">Language</div> <div class="col-xs-6 field-title">Language</div>
<div class="col-xs-4 field-input"> <div class="col-xs-4 field-input">

View file

@ -1,29 +1,30 @@
<form class="row" name="editForm" auto-save-form auto-save-watch="myform.form_fields" auto-save-callback="update"> <form class="row container" name="editForm" auto-save-form auto-save-watch="myform.form_fields" auto-save-callback="update">
<div class="col-xs-5 add-field" id="hello"> <div class="col-xs-2 col-sm-4 col-md-5 add-field" id="hello">
<div class="row add-field-title"> <div class="row add-field-title">
<h3 class="col-xs-12">Add New Field</h3> <h3 class="col-md-12 hidden-sm hidden-xs">Click to Add New Field</h3>
<h5 class="col-sm-12 hidden-sm hidden-md hidden-lg">Add Field</h5>
</div> </div>
<div class="panel-group row" class="draggable" ng-model="addField.types"> <div class="panel-group row" class="draggable" ng-model="addField.types">
<div class="col-xs-6" ng-repeat="type in addField.types"> <div class="col-xs-12 col-sm-12 col-md-6" ng-repeat="type in addField.types">
<div class="panel panel-default" style="background-color:#f5f5f5;"> <div class="panel panel-default" style="background-color:#f5f5f5;">
<div class="panel-heading" ng-click="addNewField(true, type.name)" style="cursor: pointer; font-size:14px;"> <div class="panel-heading" ng-click="addNewField(true, type.name)" style="cursor: pointer; font-size:14px;">
<span class="pull-left"> <span>
<field-icon-directive type-name="{{type.name}}"></field-icon-directive> <field-icon-directive type-name="{{type.name}}"></field-icon-directive>
</span> </span>
<span style="padding-left:0.3em;">{{type.value}}</span> <span class="hidden-xs" style="padding-left:0.3em;">{{type.value}}</span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="col-xs-7 current-fields container"> <div class="col-xs-10 col-sm-8 col-md-7 current-fields container">
<div class="row"> <div class="row">
<div class="col-xs-10"> <div class="col-sm-12 col-md-10">
<accordion close-others="accordion.oneAtATime" ui-sortable="dropzone" ng-model="myform.form_fields" class="dropzone"> <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="editFormFields" ng-if="!field.deletePreserved"> <accordion-group ng-repeat="field in myform.form_fields" is-open="accordion[$index].isOpen" on-finish-render="editFormFields" ng-if="!field.deletePreserved">
@ -35,7 +36,10 @@
<span class="pull-left" ng-switch="field.fieldType"> <span class="pull-left" ng-switch="field.fieldType">
<field-icon-directive type-name="{{field.fieldType}}"></field-icon-directive> <field-icon-directive type-name="{{field.fieldType}}"></field-icon-directive>
</span> </span>
<span style="padding-left:1.2em;">{{field.title}}</span> <span style="padding-left:1.2em;">
{{field.title}}
<span ng-show="field.required">*</span>
</span>
<span class="pull-right"> <span class="pull-right">
<i class="fa fa-chevron-right" ng-hide="accordion[$index].isOpen"> <i class="fa fa-chevron-right" ng-hide="accordion[$index].isOpen">
</i> </i>
@ -46,60 +50,65 @@
</accordion-heading> </accordion-heading>
<div class="accordion-edit container"> <div class="accordion-edit container">
<div class="row"> <div class="row hidden-sm hidden-xs">
<div class="col-xs-12"> <div class="col-md-12">
<h4>Preview Field</h4> <h4>Preview Field</h4>
</div> </div>
<ul class="col-xs-12 container" style="list-style:none;border:2px lightgray solid;"> <ul class="col-md-12 container" style="list-style:none;border:2px lightgray solid;">
<field-directive field="field" validate="false"> <field-directive field="field" validate="false">
</field-directive> </field-directive>
</ul> </ul>
<hr>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<hr>
<h4>Edit Field</h4> <h4>Edit Field</h4>
<br> <br>
</div> </div>
</div> </div>
<div class="row"> <div class="row question">
<div class="col-xs-4">Question Title:</div> <div class="col-md-4 col-sm-12">Question Title:</div>
<div class="col-xs-8"> <div class="col-md-8 col-sm-12">
<input type="text" ng-model="field.title" name="title{{field._id}}" value="{{field.title}}" required></div> <input type="text" ng-model="field.title" name="title{{field._id}}" value="{{field.title}}" required></div>
</div> </div>
<div class="row"><br></div> <div class="row"><br></div>
<div class="row"> <div class="row description">
<div class="col-xs-4">Description:</div> <div class="col-md-4 col-sm-12">Description:</div>
<div class="col-xs-8"><textarea type="text" ng-model="field.description" name="description{{field._id}}"value="{{field.description}}"></textarea> </div> <div class="col-md-8 col-sm-12"><textarea type="text" ng-model="field.description" name="description{{field._id}}"value="{{field.description}}"></textarea> </div>
</div> </div>
<div class="row" ng-show="showAddOptions(field)"><br></div> <div class="row" ng-show="showAddOptions(field)"><br></div>
<div class="row" ng-show="showAddOptions(field)"> <div class="row options" ng-show="showAddOptions(field)">
<div class="col-xs-4">Options:</div> <div class="col-md-4 col-xs-12">Options:</div>
<div class="col-xs-8 container"> <div class="col-md-8 col-xs-12">
<div ng-repeat="option in field.fieldOptions" class="row"> <div ng-repeat="option in field.fieldOptions" class="row">
<input type="text" name="{{option.option_title}}{{field._id}}" 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"> <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> <i class="fa fa-trash-o"></i>
</a> </a>
<span class="label label-inverse col-xs-4"> <span class="label label-inverse col-md-4 hidden-xs hidden-sm">
Value: {{ option.option_value }} Value: {{ option.option_value }}
</span> </span>
</div> </div>
<button class="btn btn-primary btn-small" type="button" ng-click="addOption(field)"><i class="icon-plus icon-white"></i> Add Option</button> <div class="row">
<button class="btn btn-primary btn-small ol-md-12 col-sm-4 col-sm-offset-4 col-xs-6 col-xs-offset-6" type="button" ng-click="addOption(field)">
<i class="icon-plus icon-white"></i> Add Option
</button>
</div>
</div> </div>
</div> </div>
<div class="row"><br></div> <div class="row"><br></div>
<div class="row"> <div class="row">
<div class="col-xs-4 field-title">Required:</div> <div class="col-md-4 col-xs-12 field-title">Required:</div>
<div class="col-xs-8 field-input"> <div class="col-md-8 col-xs-12 field-input">
<label class="btn col-xs-5"> <label class="btn col-xs-5">
<input type="radio" ng-value="true" ng-model="field.required" name="required{{field._id}}"/> <input type="radio" ng-value="true" ng-model="field.required" name="required{{field._id}}"/>
<span> &nbsp; Yes</span> <span> &nbsp; Yes</span>
@ -113,8 +122,8 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-4 field-input">Disabled:</div> <div class="col-md-4 col-xs-12 field-input">Disabled:</div>
<div class="col-xs-8 field-input"> <div class="col-md-8 col-xs-12 field-input">
<label class="btn col-xs-5"> <label class="btn col-xs-5">
<input type="radio" ng-value="true" <input type="radio" ng-value="true"
ng-model="field.disabled" name="disabled{{field._id}}"/> ng-model="field.disabled" name="disabled{{field._id}}"/>
@ -151,7 +160,7 @@
</accordion> </accordion>
</div> </div>
<div class="col-xs-1" style="padding:0 5px;" > <div class="col-md-1 hidden-xs hidden-sm" 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 myform.form_fields" ng-if="!field.deletePreserved"> <div class="panel panel-default" ng-repeat="field in myform.form_fields" ng-if="!field.deletePreserved">
<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)">
@ -162,7 +171,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-xs-1" style="padding:0 5px;"> <div class="col-md-1 hidden-xs hidden-sm" 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 myform.form_fields" ng-if="!field.deletePreserved"> <div class="panel panel-default" ng-repeat="field in myform.form_fields" ng-if="!field.deletePreserved">
<div class="panel-heading" style="padding: 10px 10px; height: 37px;" ng-click="duplicateField($index)"> <div class="panel-heading" style="padding: 10px 10px; height: 37px;" ng-click="duplicateField($index)">

View file

@ -1,27 +1,48 @@
<div cg-busy="{promise:submitPromise,message:'Submitting form...',backdrop:true}"></div> <div cg-busy="{promise:submitPromise,message:'Submitting form...',backdrop:true}"></div>
<div ng-hide="form.submitted"> <section class="overlay" ng-if="selected" ng-click="hideOverlay()"></section>
<div ng-show="!form.submitted && startPage && form.showStart" class="form-submitted">
<div class="field row text-center">
<div class="col-xs-6 col-xs-offset-3 text-center">
<h1>Welcome to {{form.title}}</h1>
</div>
</div>
<div class="row form-actions">
<p class="text-center col-xs-4 col-xs-offset-4">
<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>
</button>
</p>
</div>
</div>
<div ng-hide="form.submitted || startPage" data-ng-init="initFocus()">
<div class="field row" style="padding-bottom:5em;"> <div class="field row" style="padding-bottom:5em;">
<div class="col-sm-10 col-sm-offset-1"> <div class="col-sm-10 col-sm-offset-1">
<h1>{{ form.title }}</h1> <h1>{{ form.title }} <span style="font-size:0.8em; color: #bbb;" ng-if="!form.isLive">(private preview)</span></h1>
<hr> <hr>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<form name="myForm" class="submission-form col-sm-offset-1 col-sm-10" ng-model="form" ng-repeat="field in form.form_fields" > <form name="myForm" class="submission-form col-sm-offset-1 col-sm-10">
<field-directive field="field" ng-if="!field.deletePreserved"> <div ng-repeat="field in form.form_fields" ng-if="!field.deletePreserved" ng-class="{activeField: selected == field._id }" class="row field-directive">
</field-directive> <field-directive field="field" >
</field-directive>
</div>
</form> </form>
</div> </div>
<hr> <hr>
<div class="row form-actions"> <div class="row form-actions">
<button class="btn btn-success col-sm-2 col-sm-offset-5" type="button" ng-disabled="myForm.$valid" ng-click="submit()" style="font-size: 1.6em;"> <button class="btn btn-success col-sm-2 col-sm-offset-5" type="button" ng-disabled="myForm.$invalid" ng-click="submit()" style="font-size: 1.6em;">
Submit Submit
</button> </button>
</div> </div>
</div> </div>
<div ng-show="form.submitted" class="form-submitted"> <div ng-show="form.submitted && !startPage" class="form-submitted">
<!-- <div class="field row"> <!-- <div class="field row">
<div class="col-sm-11 col-sm-offset-1"><h1>{{ form.title }}</h1> <div class="col-sm-11 col-sm-offset-1"><h1>{{ form.title }}</h1>
@ -35,7 +56,7 @@
<div class="row form-actions"> <div class="row form-actions">
<p class="text-center col-xs-4 col-xs-offset-4"> <p class="text-center col-xs-4 col-xs-offset-4">
<button class="btn btn-info" type="button"> <button class="btn btn-info" type="button">
<a href="#" ng-click="reloadForm()" style="color:white; font-size: 1.6em; text-decoration: none;" > Go back to Form</a> <a ng-click="reloadForm()" style="color:white; font-size: 1.6em; text-decoration: none;" > Go back to Form</a>
</button> </button>
</p> </p>
<!-- <p class="text-center col-xs-2" ng-if="authentication.isAuthenticated()"> <!-- <p class="text-center col-xs-2" ng-if="authentication.isAuthenticated()">

View file

@ -8,7 +8,7 @@
</div> --> </div> -->
<br> <br>
<div class="row"> <div class="row">
<div ng-click="openCreateModal()" class="col-xs-2 col-xs-offset-1 form-item row create-new"> <div ng-click="openCreateModal()" class="col-xs-6 col-xs-offset-3 col-sm-4 col-sm-offset-1 col-md-3 col-md-offset-1 form-item create-new">
<div class="title-row col-xs-12"> <div class="title-row col-xs-12">
<h4 class="fa fa-plus fa-6"></h4> <h4 class="fa fa-plus fa-6"></h4>
</div> </div>
@ -21,11 +21,11 @@
</div> </div>
</div> </div>
<form name="createForm" class="col-xs-2 col-xs-offset-1 form-item row create-new new-form" ng-show="showCreateModal"> <form name="createForm" class="col-xs-6 col-xs-offset-3 col-sm-4 col-sm-offset-1 col-md-3 col-md-offset-1 form-item create-new new-form" ng-show="showCreateModal">
<div ng-init="setForm(createForm);" style="display:none;"></div> <div ng-init="setForm(createForm);" style="display:none;"></div>
<div class="title-row row"> <div class="title-row row">
<div class="col-xs-5 field-title">Name </div> <div class="col-xs-5 field-title">Name </div>
<div class="col-xs-8 field-input"> <div class="col-xs-12 field-input">
<input type="text" name="name" ng-model="name" required style="color:black; border:none;" ng-pattern="/^[a-zA-Z0-9 ]*$/"/> <input type="text" name="name" ng-model="name" required style="color:black; border:none;" ng-pattern="/^[a-zA-Z0-9 ]*$/"/>
</div> </div>
</div> </div>
@ -50,7 +50,7 @@
</div> </div>
</form> </form>
<div data-ng-repeat="form in myforms" class="col-xs-2 col-xs-offset-1 form-item row"> <div data-ng-repeat="form in myforms" class="col-xs-6 col-xs-offset-3 col-sm-4 col-sm-offset-1 col-md-3 col-md-offset-1 form-item">
<span class="pull-right"> <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> </span>
@ -59,15 +59,14 @@
</a> </a>
<div class="col-xs-12 details-row"> <div class="col-xs-12 details-row">
<small class="list-group-item-text"> <!-- <small class="list-group-item-text">
Created on Created on
<span data-ng-bind="form.created | date:'mediumDate'"></span> <span data-ng-bind="form.created | date:'shortDate'"></span>
by by
<span data-ng-bind="form.admin.username"></span> <span data-ng-bind="form.admin.username"></span>
</small> </small> -->
</div> </div>
</div> </div>
</div> </div>
</section> </section>

View file

@ -3,13 +3,16 @@
<!-- Modal Delete Dialog Template --> <!-- Modal Delete Dialog Template -->
<script type="text/ng-template" id="myModalContent.html"> <script type="text/ng-template" id="myModalContent.html">
<div class="modal-header"> <div class="modal-header">
<h2 class="modal-title">Are you ABSOLUTELY sure?</h3> <h2 class="modal-title hidden-md hidden-lg">Are you ABSOLUTELY sure?</h2>
<h3 class="modal-title hidden-xs hidden-sm">Are you ABSOLUTELY sure?</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="modal-body-alert"> <div class="modal-body-alert">
Unexpected bad things will happen if you dont read this! Unexpected bad things will happen if you dont read this!
</div> </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 class="hidden-xs hidden-sm">
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 form to confirm.</p> <p>Please type in the name of the form to confirm.</p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -23,23 +26,36 @@
</script> </script>
<div class="page-header row" style="padding-bottom: 0px;"> <div class="page-header row" style="padding-bottom: 0px;">
<div class="col-xs-8"> <div class="col-xs-10 col-sm-8">
<h1 data-ng-bind="myform.title" style="margin-bottom: 0px;"></h1> <h1 class="hidden-sm hidden-xs" data-ng-bind="myform.title" style="margin-bottom: 0px;"></h1>
<h2 class="hidden-md hidden-lg" data-ng-bind="myform.title" style="margin-bottom: 0px;"></h2>
</div> </div>
<div class="col-xs-2"> <div class="col-xs-1 col-sm-2">
<small class=" pull-right"> <small class="pull-right">
<button class="btn btn-danger" ng-click="openDeleteModal()"><i class="fa fa-trash-o"></i> Delete Form</button> <button class="btn btn-danger" ng-click="openDeleteModal()">
<i class="fa fa-trash-o"></i>
<span class="hidden-xs">Delete</span>
<span class="hidden-xs hidden-sm">Form</span>
</button>
</small> </small>
</div> </div>
<div class="col-xs-2"> <div class="col-xs-1 col-sm-2">
<small class="pull-right"> <small class="pull-right">
<a class="btn btn-default" href="/#!/forms/{{myform._id}}"> <a class="btn btn-default view-form-btn" href="/#!/forms/{{myform._id}}">
<span ng-show="myform.isLive"> <span class="hidden-xs hidden-sm">
View Live View
</span> <span ng-show="myform.isLive">
<span ng-hide="myform.isLive">Preview</span> Form Live
<i class="status-light status-light-on fa fa-dot-circle-o" ng-show="myform.isLive"></i> </span>
<i class="status-light status-light-off fa fa-dot-circle-o" ng-hide="myform.isLive"></i> <span ng-hide="myform.isLive">Preview</span> Form
</span>
<span class="hidden-xs hidden-md hidden-lg">
View
<span ng-if="myform.isLive">Live</span>
<span ng-if="!myform.isLive">Preview</span>
</span>
<i class="status-light status-light-on fa fa-dot-circle-o" ng-if="myform.isLive"></i>
<i class="status-light status-light-off fa fa-dot-circle-o" ng-if="!myform.isLive"></i>
</a> </a>
</small> </small>
</div> </div>
@ -70,61 +86,75 @@
<tab-heading> <tab-heading>
View Submissions View Submissions
</tab-heading> </tab-heading>
<div class="submissions-table" ng-show="viewSubmissions"> <div class="submissions-table row container" ng-show="viewSubmissions">
<div class="row"> <div class="row">
<div class="col-xs-1"> <div class="col-xs-2">
<button class="btn btn-danger" ng-click="deleteSelectedSubmissions()" ng-disabled="!isAtLeastOneChecked();"> <button class="btn btn-danger" ng-click="deleteSelectedSubmissions()" ng-disabled="!isAtLeastOneChecked();">
<i class="fa fa-trash-o"></i> Delete Selected <i class="fa fa-trash-o"></i> Delete Selected
</button> </button>
</div> </div>
<div class="col-xs-2">
<button class="btn btn-default" ng-click="exportSubmissions()">
Export to XLS
</button>
</div>
</div> </div>
<div class="row table-outer">
<div class="col-xs-12">
<table id="table-submission-data" class="table table-striped table-hover table-condensed">
<thead>
<tr>
<th>
<input ng-model="table.masterChecker" ng-change="toggleAllCheckers()" type="checkbox"/>
</th>
<th>#</th>
<th data-ng-repeat="(key, value) in myform.form_fields">
{{value.title}}
</th>
<th>
Percentage Complete
</th>
<th>
Time Elapsed
</th>
<th>
Date Submitted (UTC)
</th>
<th ng-if="myform.autofillPDFs">
Generated PDF
</th>
</tr>
</thead>
<table class="table table-striped table-hover table-condensed"> <tbody>
<thead> <tr data-ng-repeat="row in table.rows" ng-click="rowClicked($index)" ng-class="{selected: row.selected === true}">
<tr> <td>
<th> <input ng-model="row.selected" type="checkbox"/>
<input ng-model="table.masterChecker" ng-change="toggleAllCheckers()" type="checkbox"/> </td>
</th> <th class="scope">
<th>#</th> {{$index+1}}
<th data-ng-repeat="(key, value) in myform.form_fields"> </th>
{{value.title}} <td data-ng-repeat="(key, value) in row.form_fields">
</th> {{value.fieldValue}}
<th> </td>
Time Elapsed <td>
</th> {{row.percentageComplete}}%
<th> </td>
Date Submitted (UTC) <td>
</th> {{row.timeElapsed}}
<th ng-if="myform.autofillPDFs"> </td>
Generated PDF <td>
</th> {{row.created | date:'yyyy-MM-dd HH:mm:ss'}}
</tr> </td>
</thead> <td ng-if="row.pdf">
<a href="{{row.pdfFilePath}}" download="{{row.pdf.name}}" target="_self">Generated PDF</a>
<tbody> </td>
<tr data-ng-repeat="row in table.rows" ng-click="rowClicked(row)"> </tr>
<td> </tbody>
<input ng-model="row.selected" type="checkbox"/> </table>
</td> </div>
<th class="scope"> </div>
{{$index+1}}
</th>
<td data-ng-repeat="(key, value) in row.form_fields">
{{value.fieldValue}}
</td>
<td>
{{row.timeElapsed}}
</td>
<td>
{{row.created | date:'yyyy-MM-dd HH:mm:ss'}}
</td>
<td ng-if="row.pdf">
<a href="{{row.pdfFilePath}}" download="{{row.pdf.name}}" target="_self">Generated PDF</a>
</td>
</tr>
</tbody>
</table>
</div> </div>
</tab> </tab>
</tabset> </tabset>

View file

@ -1,16 +1,16 @@
<!-- <link rel="stylesheet" href="./modules/forms/css/form.css"> <!-- <link rel="stylesheet" href="./modules/forms/css/myform.css">
--> -->
<section data-ng-controller="SubmitFormController" class="public-form"> <section data-ng-controller="SubmitFormController" class="public-form">
<form-directive form="form"></form-directive> <form-directive form="myform"></form-directive>
<section ng-if="!form.hideFooter" class="navbar navbar-fixed-bottom" style="background-color:rgba(242,242,242,0.5); padding-top:15px;"> <section ng-if="!myform.hideFooter" class="navbar navbar-fixed-bottom" style="background-color:rgba(242,242,242,0.5); padding-top:15px;">
<div class="container" > <div class="container" >
<nav role="navigation"> <nav role="navigation">
<ul class="nav navbar-nav navbar-left" > <ul class="nav navbar-nav navbar-left" >
<li ng-show="!form.submitted"> <li ng-show="!myform.submitted">
<p class="lead">{{form | formValidity}} out of {{form.visible_form_fields.length}} answered</p> <p class="lead">{{myform | formValidity}} out of {{myform.visible_form_fields.length}} answered</p>
</li> </li>
</ul> </ul>
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
@ -18,7 +18,7 @@
<a href="/#!/forms" class="btn btn-default" ng-hide="authentication.isAuthenticated()">Create a Medform</a> <a href="/#!/forms" class="btn btn-default" ng-hide="authentication.isAuthenticated()">Create a Medform</a>
</li> </li>
<li style="padding-right:20px; padding-bottom:10px;" ng-show="authentication.isAuthenticated()"> <li style="padding-right:20px; padding-bottom:10px;" ng-show="authentication.isAuthenticated()">
<a href="/#!/forms/{{form._id}}/admin" class="btn btn-default">Edit this Medform</a> <a href="/#!/forms/{{myform._id}}/admin" class="btn btn-default">Edit this Medform</a>
</li> </li>
<li style="padding-left:5px"> <li style="padding-left:5px">
<div class="btn btn-info" id="focusDownButton" style="padding: 15px;">\/</div> <div class="btn btn-info" id="focusDownButton" style="padding: 15px;">\/</div>

View file

@ -7,15 +7,16 @@ angular.module('users').config(['$httpProvider',
return { return {
responseError: function(response) { responseError: function(response) {
// console.log($location.path()); // console.log($location.path());
if( response.config.url !== '/users/me' && $location.path() !== '/users/me' && response.config){ if( $location.path() !== '/users/me' && response.config){
if(response.config.url !== '/users/me'){
console.log('intercepted rejection of ', response.config.url, response.status); console.log('intercepted rejection of ', response.config.url, response.status);
if (response.status === 401) { if (response.status === 401) {
// save the current location so that login can redirect back // save the current location so that login can redirect back
$location.nextAfterLogin = $location.path(); $location.nextAfterLogin = $location.path();
$location.path('/signin'); $location.path('/signin');
}else if(response.status === 403){ }else if(response.status === 403){
$location.path('/access_denied'); $location.path('/access_denied');
}
} }
} }