added responsiveness
This commit is contained in:
parent
942f6b73dc
commit
c10fbbfd4f
@ -97,11 +97,13 @@ exports.createSubmission = function(req, res) {
|
||||
fdfData,
|
||||
fdfTemplate,
|
||||
that = this;
|
||||
console.log(req.body.percentageComplete);
|
||||
|
||||
submission = new FormSubmission({
|
||||
admin: req.user,
|
||||
form_fields: req.body.form_fields,
|
||||
timeElapsed: req.body.timeElapsed
|
||||
timeElapsed: req.body.timeElapsed,
|
||||
percentageComplete: req.body.percentageComplete
|
||||
});
|
||||
|
||||
submission.form = form;
|
||||
|
@ -68,6 +68,10 @@ var FormSchema = new Schema({
|
||||
type: Schema.Types.Mixed
|
||||
},
|
||||
|
||||
showStart: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
hideFooter: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
@ -28,7 +28,8 @@ function validateFormFieldType(value) {
|
||||
'checkbox',
|
||||
'hidden',
|
||||
'yes_no',
|
||||
'natural'
|
||||
'natural',
|
||||
'number'
|
||||
];
|
||||
|
||||
if (validTypes.indexOf(value) > -1) {
|
||||
|
@ -64,6 +64,7 @@
|
||||
<!-- </section> -->
|
||||
</section>
|
||||
|
||||
<script src="https://rawgithub.com/eligrey/FileSaver.js/master/FileSaver.js" type="text/javascript"></script>
|
||||
<!--Embedding The User Object-->
|
||||
<script type="text/javascript">
|
||||
var user = {{ user | json | safe }};
|
||||
@ -87,14 +88,14 @@
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
Raven.config('http://db01e03015ce48e2b68240ea8254b17c@sentry.polydaic.com/1', {
|
||||
// Raven settings
|
||||
})
|
||||
.setUser({
|
||||
"id": "SERVER_RENDERED_ID",
|
||||
"email": "SERVER_RENDERED_EMAIL"
|
||||
})
|
||||
.install()
|
||||
// Raven.config('http://db01e03015ce48e2b68240ea8254b17c@sentry.polydaic.com/1', {
|
||||
// // Raven settings
|
||||
// })
|
||||
// .setUser({
|
||||
// "id": "SERVER_RENDERED_ID",
|
||||
// "email": "SERVER_RENDERED_EMAIL"
|
||||
// })
|
||||
// .install()
|
||||
</script>
|
||||
|
||||
<!-- [if lt IE 9]>
|
||||
|
357
public/dist/application.js
vendored
357
public/dist/application.js
vendored
@ -537,24 +537,23 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
|
||||
// Forms controller
|
||||
angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScope', '$stateParams', '$state', 'Forms', 'CurrentForm',
|
||||
function($scope, $rootScope, $stateParams, $state, Forms, CurrentForm) {
|
||||
|
||||
|
||||
Forms.get({
|
||||
formId: $stateParams.formId
|
||||
}).$promise.then(
|
||||
//success
|
||||
function(form){
|
||||
$scope.form = form;
|
||||
$scope.myform = form;
|
||||
|
||||
//Show navbar if form is not public AND user is loggedin
|
||||
if(!$scope.form.isLive && $rootScope.authentication.isAuthenticated()){
|
||||
// Show navbar if form is not public AND user is loggedin
|
||||
if(!$scope.myform.isLive && $rootScope.authentication.isAuthenticated()){
|
||||
$rootScope.hideNav = false;
|
||||
}else if(!$scope.form.isLive){
|
||||
}else if(!$scope.myform.isLive){
|
||||
$state.go('access_denied');
|
||||
}else {
|
||||
CurrentForm.setForm($scope.form);
|
||||
}
|
||||
console.log('$rootScope.hideNav: '+$rootScope.hideNav);
|
||||
console.log('$scope.form.isLive: '+$scope.form.isLive);
|
||||
console.log('$scope.form.isLive: '+$scope.myform.isLive);
|
||||
},
|
||||
//error
|
||||
function( error ){
|
||||
@ -562,6 +561,7 @@ angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScop
|
||||
console.log('ERROR: '+error.message);
|
||||
$state.go('access_denied');
|
||||
});
|
||||
|
||||
}
|
||||
]);
|
||||
'use strict';
|
||||
@ -617,8 +617,9 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
||||
$scope.toggleObjSelection = function($event, description) {
|
||||
$event.stopPropagation();
|
||||
};
|
||||
$scope.rowClicked = function(obj) {
|
||||
obj.selected = !obj.selected;
|
||||
$scope.rowClicked = function(row_index) {
|
||||
// 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){
|
||||
return !!row.selected;
|
||||
}).pluck('_id').value();
|
||||
console.log(delete_ids);
|
||||
|
||||
$http({ url: '/forms/'+$scope.myform._id+'/submissions',
|
||||
method: 'DELETE',
|
||||
@ -638,11 +638,14 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
||||
headers: {"Content-Type": "application/json;charset=utf-8"}
|
||||
}).success(function(data, status, headers){
|
||||
//Remove deleted ids from table
|
||||
var tmpArray = [];
|
||||
for(var i=0; i<$scope.table.rows.length; i++){
|
||||
if($scope.table.rows[i].selected){
|
||||
$scope.table.rows.splice(i, 1);
|
||||
if(!$scope.table.rows[i].selected){
|
||||
tmpArray.push($scope.table.rows[i]);
|
||||
}
|
||||
}
|
||||
console.log(tmpArray);
|
||||
$scope.table.rows = tmpArray;
|
||||
})
|
||||
.error(function(err){
|
||||
console.log('Could not delete form submissions.\nError: ');
|
||||
@ -650,6 +653,21 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
||||
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
|
||||
$scope.showSubmissions = function(){
|
||||
$scope.viewSubmissions = true;
|
||||
@ -763,28 +781,31 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
||||
|
||||
|
||||
// Update existing Form
|
||||
$scope.update = $rootScope.update = function(cb) {
|
||||
if(!$rootScope.saveInProgress && $rootScope.finishedRender){
|
||||
|
||||
$rootScope.saveInProgress = true;
|
||||
$scope.update = $rootScope.update = function(immediate, cb) {
|
||||
console.log('immediate: '+immediate);
|
||||
var continueUpdate = true;
|
||||
if(immediate){
|
||||
continueUpdate = !$rootScope.saveInProgress;
|
||||
}
|
||||
|
||||
if(continueUpdate){
|
||||
console.log('begin updating form');
|
||||
var err = null;
|
||||
|
||||
if(immediate){ $rootScope.saveInProgress = true; }
|
||||
|
||||
$scope.updatePromise = $http.put('/forms/'+$scope.myform._id, {form: $scope.myform})
|
||||
.then(function(response){
|
||||
$rootScope.myform = $scope.myform = response.data;
|
||||
console.log(response.data);
|
||||
if(!$scope.$digest){
|
||||
$scope.$apply();
|
||||
}
|
||||
}).catch(function(response){
|
||||
console.log('Error occured during form UPDATE.\n');
|
||||
console.log(response.data);
|
||||
err = response.data;
|
||||
}).finally(function() {
|
||||
console.log('finished updating');
|
||||
$rootScope.saveInProgress = false;
|
||||
cb(err);
|
||||
if(immediate){$rootScope.saveInProgress = false; }
|
||||
cb(err);
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -796,106 +817,99 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
||||
angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', function($rootScope, $timeout) {
|
||||
|
||||
return {
|
||||
// require: ['^form'],
|
||||
require: ['^form'],
|
||||
restrict: 'AE',
|
||||
controller: function ($scope) {
|
||||
|
||||
},
|
||||
link: function($scope, $element, $attrs, $ctrls) {
|
||||
angular.element(document).ready(function() {
|
||||
$rootScope.finishedRender = false;
|
||||
|
||||
|
||||
// Log that the directive has been linked.
|
||||
// console.log( "Linked: autoSaveForm");
|
||||
|
||||
var $formCtrl = $scope.editForm,
|
||||
|
||||
var $formCtrl = $ctrls[0],
|
||||
savePromise = null;
|
||||
|
||||
|
||||
$rootScope.finishedRender = false;
|
||||
$scope.$on('editFormFieldsStarted', function(ngRepeatFinishedEvent) {
|
||||
$rootScope.finishedRender = false;
|
||||
});
|
||||
$rootScope.finishedRender = false;
|
||||
});
|
||||
$scope.$on('editFormFieldsFinished', function(ngRepeatFinishedEvent) {
|
||||
$rootScope.finishedRender = true;
|
||||
});
|
||||
|
||||
$scope.anyDirtyAndTouched = function (form){
|
||||
$scope.anyDirtyAndTouched = function(form){
|
||||
var propCount = 0;
|
||||
for(var prop in form) {
|
||||
if(form.hasOwnProperty(prop) && prop[0] !== '$') {
|
||||
|
||||
// console.log(form[prop]);
|
||||
if(form[prop].$dirty && form[prop].$untouched) {
|
||||
return true;
|
||||
}
|
||||
propCount++;
|
||||
if(form[prop].$touched && form[prop].$dirty) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// console.log('properties of $scope.editForm');
|
||||
// for(var item in $scope.editForm){
|
||||
// console.log(item);
|
||||
// }
|
||||
var updateFields = function () {
|
||||
$rootScope.saveInProgress = true;
|
||||
$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
|
||||
$scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) {
|
||||
if( !newValue && !oldValue ){
|
||||
|
||||
var changedFields = !_.isEqual(oldValue,newValue);
|
||||
if( (!newValue && !oldValue) || !oldValue ){
|
||||
return;
|
||||
}
|
||||
var changedFields = !_.isEqual(oldValue,newValue);
|
||||
|
||||
// console.log('\n\n----------');
|
||||
// console.log('$dirty: '+ $formCtrl.$dirty );
|
||||
// console.log('oldValue: '+oldValue);
|
||||
// console.log('newValue: '+newValue);
|
||||
// console.log('form_fields changed: '+changedFields);
|
||||
// console.log('changedFields: '+changedFields);
|
||||
// console.log('finishedRender: '+$rootScope.finishedRender);
|
||||
// console.log('saveInProgress: '+$rootScope.saveInProgress);
|
||||
// console.log($scope.editForm);
|
||||
var inputDirtyUntouched = $scope.anyDirtyAndTouched($scope.editForm);
|
||||
// console.log('newValue: '+newValue);
|
||||
// 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
|
||||
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');
|
||||
if(savePromise) {
|
||||
$timeout.cancel(savePromise);
|
||||
}
|
||||
|
||||
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;
|
||||
updateFields();
|
||||
});
|
||||
}else if($rootScope.finishedRender && $rootScope.saveInProgress){
|
||||
$rootScope.saveInProgress = false;
|
||||
}
|
||||
|
||||
}, true);
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
@ -905,20 +919,6 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
|
||||
|
||||
'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() {
|
||||
return {
|
||||
scope:{
|
||||
@ -1134,7 +1134,7 @@ angular.module('forms')
|
||||
** Field CRUD Methods
|
||||
*/
|
||||
// Add a new field
|
||||
$scope.addNewField = function(fieldType){
|
||||
$scope.addNewField = function(addOrReturn, fieldType){
|
||||
|
||||
// incr field_id counter
|
||||
$scope.addField.lastAddedID++;
|
||||
@ -1156,10 +1156,17 @@ angular.module('forms')
|
||||
'required' : true,
|
||||
'disabled' : false,
|
||||
};
|
||||
|
||||
console.log('\n\n---------\nAdded field CLIENT');
|
||||
console.log(newField);
|
||||
|
||||
// put newField into fields array
|
||||
$scope.myform.form_fields.unshift(newField);
|
||||
// console.log('\n\n---------\nAdded field CLIENT');
|
||||
if(addOrReturn){
|
||||
$scope.myform.form_fields.push(newField);
|
||||
}else {
|
||||
return newField;
|
||||
}
|
||||
|
||||
|
||||
// console.log(Date.now());
|
||||
// console.log($scope.myform.form_fields.length);
|
||||
};
|
||||
@ -1175,13 +1182,21 @@ angular.module('forms')
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.duplicateField = function (field, field_index){
|
||||
for(var i = 0; i < $scope.myform.form_fields.length; i++){
|
||||
if($scope.myform.form_fields[i].field_id === field.field_id){
|
||||
$scope.addNewField($scope.myform.form_fields[i].fieldType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$scope.duplicateField = function (field_index){
|
||||
console.log('field_index: '+field_index);
|
||||
var field = $scope.addNewField(false, $scope.myform.form_fields[field_index].fieldType);
|
||||
field.title = $scope.myform.form_fields[field_index].title;
|
||||
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)
|
||||
$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;
|
||||
} else {
|
||||
return false;
|
||||
@ -1260,7 +1275,8 @@ angular.module('forms').directive('fieldIconDirective', function($http, $compile
|
||||
'scale': 'fa fa-sliders',
|
||||
'stripe': 'fa fa-credit-card',
|
||||
'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];
|
||||
},
|
||||
@ -1277,7 +1293,8 @@ var __indexOf = [].indexOf || function(item) {
|
||||
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) {
|
||||
@ -1298,6 +1315,7 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
|
||||
'statement',
|
||||
'rating',
|
||||
'yes_no',
|
||||
'number',
|
||||
'natural'
|
||||
];
|
||||
if (__indexOf.call(supported_fields, type) >= 0) {
|
||||
@ -1307,6 +1325,7 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
|
||||
|
||||
var linker = function(scope, element) {
|
||||
|
||||
scope.setActiveField = $rootScope.setActiveField;
|
||||
//Set format only if field is a date
|
||||
if(scope.field.fieldType === 'date'){
|
||||
scope.dateOptions = {
|
||||
@ -1344,7 +1363,7 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
|
||||
},
|
||||
link: linker
|
||||
};
|
||||
});
|
||||
}]);
|
||||
'use strict';
|
||||
angular.module('forms').directive('formLocator', function() {
|
||||
return {
|
||||
@ -1367,8 +1386,7 @@ angular.module('forms').directive('onFinishRender', function ($rootScope, $timeo
|
||||
|
||||
var broadcastMessage = attrs.onFinishRender || 'ngRepeat';
|
||||
|
||||
|
||||
if(scope.$first && !scope.$last) {
|
||||
if(!scope.$last) {
|
||||
$timeout(function () {
|
||||
// console.log(broadcastMessage+'Started');
|
||||
$rootScope.$broadcast(broadcastMessage+'Started');
|
||||
@ -1387,8 +1405,8 @@ angular.module('forms').directive('onFinishRender', function ($rootScope, $timeo
|
||||
|
||||
'use strict';
|
||||
|
||||
angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCounter', 'Auth', '$filter',
|
||||
function ($http, $timeout, timeCounter, Auth, $filter) {
|
||||
angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCounter', 'Auth', '$filter', '$rootScope',
|
||||
function ($http, $timeout, timeCounter, Auth, $filter, $rootScope) {
|
||||
return {
|
||||
templateUrl: './modules/forms/views/directiveViews/form/submit-form.html',
|
||||
restrict: 'E',
|
||||
@ -1396,39 +1414,59 @@ angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCo
|
||||
form:'='
|
||||
},
|
||||
controller: function($scope){
|
||||
console.log('rendering submitFormDirective');
|
||||
timeCounter.startClock();
|
||||
angular.element(document).ready(function() {
|
||||
|
||||
$scope.submit = function(){
|
||||
var _timeElapsed = timeCounter.stopClock();
|
||||
$scope.form.timeElapsed = _timeElapsed;
|
||||
$scope.selected = null;
|
||||
$scope.startPage = true;
|
||||
|
||||
$scope.form.percentageComplete = $filter('formValidity')($scope.form.visible_form_fields)/$scope.visible_form_fields.length;
|
||||
delete $scope.form.visible_form_fields;
|
||||
$rootScope.setActiveField = function (field_id) {
|
||||
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)
|
||||
.success(function(data, status, headers){
|
||||
console.log('form submitted successfully');
|
||||
// alert('Form submitted..');
|
||||
$scope.form.submitted = true;
|
||||
})
|
||||
.error(function(error){
|
||||
console.log(error);
|
||||
$scope.error = error.message;
|
||||
});
|
||||
};
|
||||
// console.log('percentageComplete: '+$filter('formValidity')($scope.form)/$scope.form.visible_form_fields.length*100+'%');
|
||||
$scope.form.percentageComplete = $filter('formValidity')($scope.form)/$scope.form.visible_form_fields.length*100;
|
||||
console.log($scope.form.percentageComplete);
|
||||
// delete $scope.form.visible_form_fields;
|
||||
|
||||
$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();
|
||||
};
|
||||
$scope.authentication = Auth;
|
||||
|
||||
$scope.submitPromise = $http.post('/forms/'+$scope.form._id,$scope.form)
|
||||
.success(function(data, status, headers){
|
||||
console.log('form submitted successfully');
|
||||
// alert('Form submitted..');
|
||||
$scope.form.submitted = true;
|
||||
})
|
||||
.error(function(error){
|
||||
console.log(error);
|
||||
$scope.error = error.message;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$scope.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',
|
||||
value : 'Link'
|
||||
},
|
||||
{
|
||||
name : 'number',
|
||||
value : 'Numbers'
|
||||
},
|
||||
// {
|
||||
// name : 'scale',
|
||||
// value : 'Opinion Scale'
|
||||
@ -1654,15 +1696,16 @@ angular.module('users').config(['$httpProvider',
|
||||
return {
|
||||
responseError: function(response) {
|
||||
// console.log($location.path());
|
||||
if( response.config.url !== '/users/me' && $location.path() !== '/users/me' && response.config){
|
||||
|
||||
console.log('intercepted rejection of ', response.config.url, response.status);
|
||||
if (response.status === 401) {
|
||||
// save the current location so that login can redirect back
|
||||
$location.nextAfterLogin = $location.path();
|
||||
$location.path('/signin');
|
||||
}else if(response.status === 403){
|
||||
$location.path('/access_denied');
|
||||
if( $location.path() !== '/users/me' && response.config){
|
||||
if(response.config.url !== '/users/me'){
|
||||
console.log('intercepted rejection of ', response.config.url, response.status);
|
||||
if (response.status === 401) {
|
||||
// save the current location so that login can redirect back
|
||||
$location.nextAfterLogin = $location.path();
|
||||
$location.path('/signin');
|
||||
}else if(response.status === 403){
|
||||
$location.path('/access_denied');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
2
public/dist/application.min.css
vendored
2
public/dist/application.min.css
vendored
File diff suppressed because one or more lines are too long
4
public/dist/application.min.js
vendored
4
public/dist/application.min.js
vendored
File diff suppressed because one or more lines are too long
@ -27,6 +27,21 @@
|
||||
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 {
|
||||
margin-top: 70px;
|
||||
}
|
||||
@ -57,10 +72,10 @@ section.hero-section .jumbotron {
|
||||
color:#fff;
|
||||
}
|
||||
.image-background {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 230%;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: -98;
|
||||
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 {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 230%;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
z-index: -97;
|
||||
|
@ -39,7 +39,8 @@
|
||||
<ul class="nav navbar-nav navbar-right" data-ng-show="authentication.isAuthenticated()">
|
||||
<li class="dropdown" dropdown>
|
||||
<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>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
|
@ -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>
|
||||
<div class="image-background">
|
||||
</div>
|
||||
<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="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">
|
||||
@ -21,12 +14,15 @@
|
||||
</h2>
|
||||
</div>
|
||||
<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.
|
||||
</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>
|
||||
</h1>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12" style="margin-top:7%;">
|
||||
@ -34,7 +30,6 @@
|
||||
sign me up!
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -3,24 +3,23 @@
|
||||
// Forms controller
|
||||
angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScope', '$stateParams', '$state', 'Forms', 'CurrentForm',
|
||||
function($scope, $rootScope, $stateParams, $state, Forms, CurrentForm) {
|
||||
|
||||
|
||||
Forms.get({
|
||||
formId: $stateParams.formId
|
||||
}).$promise.then(
|
||||
//success
|
||||
function(form){
|
||||
$scope.form = form;
|
||||
$scope.myform = form;
|
||||
|
||||
//Show navbar if form is not public AND user is loggedin
|
||||
if(!$scope.form.isLive && $rootScope.authentication.isAuthenticated()){
|
||||
// Show navbar if form is not public AND user is loggedin
|
||||
if(!$scope.myform.isLive && $rootScope.authentication.isAuthenticated()){
|
||||
$rootScope.hideNav = false;
|
||||
}else if(!$scope.form.isLive){
|
||||
}else if(!$scope.myform.isLive){
|
||||
$state.go('access_denied');
|
||||
}else {
|
||||
CurrentForm.setForm($scope.form);
|
||||
}
|
||||
console.log('$rootScope.hideNav: '+$rootScope.hideNav);
|
||||
console.log('$scope.form.isLive: '+$scope.form.isLive);
|
||||
console.log('$scope.form.isLive: '+$scope.myform.isLive);
|
||||
},
|
||||
//error
|
||||
function( error ){
|
||||
@ -28,5 +27,6 @@ angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScop
|
||||
console.log('ERROR: '+error.message);
|
||||
$state.go('access_denied');
|
||||
});
|
||||
|
||||
}
|
||||
]);
|
@ -51,8 +51,8 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
||||
$scope.toggleObjSelection = function($event, description) {
|
||||
$event.stopPropagation();
|
||||
};
|
||||
$scope.rowClicked = function(obj) {
|
||||
obj.selected = !obj.selected;
|
||||
$scope.rowClicked = function(row_index) {
|
||||
$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){
|
||||
return !!row.selected;
|
||||
}).pluck('_id').value();
|
||||
console.log(delete_ids);
|
||||
|
||||
$http({ url: '/forms/'+$scope.myform._id+'/submissions',
|
||||
method: 'DELETE',
|
||||
@ -72,11 +71,14 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
||||
headers: {"Content-Type": "application/json;charset=utf-8"}
|
||||
}).success(function(data, status, headers){
|
||||
//Remove deleted ids from table
|
||||
var tmpArray = [];
|
||||
for(var i=0; i<$scope.table.rows.length; i++){
|
||||
if($scope.table.rows[i].selected){
|
||||
$scope.table.rows.splice(i, 1);
|
||||
if(!$scope.table.rows[i].selected){
|
||||
tmpArray.push($scope.table.rows[i]);
|
||||
}
|
||||
}
|
||||
console.log(tmpArray);
|
||||
$scope.table.rows = tmpArray;
|
||||
})
|
||||
.error(function(err){
|
||||
console.log('Could not delete form submissions.\nError: ');
|
||||
@ -84,6 +86,21 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
||||
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
|
||||
$scope.showSubmissions = function(){
|
||||
$scope.viewSubmissions = true;
|
||||
|
@ -56,6 +56,11 @@ form .accordion-edit {
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
/*Styles for ui-datepicker*/
|
||||
.ui-datepicker.ui-widget {
|
||||
z-index: 99!important;
|
||||
}
|
||||
|
||||
/* Styles for form submission view (/forms/:formID) */
|
||||
form .row.field {
|
||||
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 {
|
||||
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 {
|
||||
text-align: left;
|
||||
margin-bottom:0.7em;
|
||||
@ -88,11 +102,11 @@ form .row.field {
|
||||
font-size: 1.10em;
|
||||
}
|
||||
|
||||
/*form.submission-form .row.field > .field-input > input:focus {
|
||||
/*form.submission-form .field-input > input:focus {
|
||||
font-size:1em;
|
||||
}*/
|
||||
|
||||
form .row.field > .field-input > textarea{
|
||||
form .field-input > textarea{
|
||||
padding: 0.45em 0.9em;
|
||||
width: 100%;
|
||||
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;
|
||||
width: 100%;
|
||||
line-height: 160%;
|
||||
border: 2px dashed #ddd;
|
||||
}
|
||||
form .row.field > .field-input > input.text-field-input:focus{
|
||||
form .field-input > input.text-field-input:focus{
|
||||
border: 0;
|
||||
}
|
||||
form .required-error{
|
||||
@ -126,8 +140,11 @@ form .row.field {
|
||||
border: 1px solid #ccc;
|
||||
height: 34px;
|
||||
}
|
||||
.config-form {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
div.config-form > .row {
|
||||
.config-form > .row {
|
||||
padding: 19px;
|
||||
margin-bottom: 20px;
|
||||
background-color: #f5f5f5;
|
||||
@ -135,7 +152,6 @@ div.config-form > .row {
|
||||
border-radius: 4px;
|
||||
-webkit-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){
|
||||
@ -190,6 +206,15 @@ div.config-form > .row {
|
||||
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 {
|
||||
border-color: #9d9d9d;
|
||||
cursor: pointer;
|
||||
@ -211,6 +236,26 @@ div.config-form > .row {
|
||||
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*/
|
||||
.admin-form .add-field {
|
||||
@ -228,8 +273,8 @@ div.config-form > .row {
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.status-light {
|
||||
padding-left:0.6em;
|
||||
.view-form-btn.span {
|
||||
padding-right:0.6em;
|
||||
}
|
||||
.status-light.status-light-off {
|
||||
color: #BE0000;
|
||||
@ -243,26 +288,32 @@ section > section.public-form {
|
||||
padding: 0 6em 7em 6em;
|
||||
|
||||
}
|
||||
.form-item.row {
|
||||
.form-item {
|
||||
text-align: center;
|
||||
border-bottom: 6px inset #ccc;
|
||||
background-color: #eee;
|
||||
width: 180px;
|
||||
height: 215px;
|
||||
/*width: 180px;*/
|
||||
/*width:100%;*/
|
||||
position: relative;
|
||||
height: 0;/*215px;*/
|
||||
padding-bottom: 25%;
|
||||
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);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/*MODAL CSS */
|
||||
.form-item.row.create-new.new-form {
|
||||
.form-item.create-new.new-form {
|
||||
background-color: rgb(300,131,131);
|
||||
z-index: 11;
|
||||
}
|
||||
.form-item.row.create-new.new-form:hover {
|
||||
.form-item.create-new.new-form:hover {
|
||||
background-color: rgb(300,100,100);
|
||||
}
|
||||
|
||||
@ -272,51 +323,66 @@ section > section.public-form {
|
||||
|
||||
/*Modal overlay (for lightbox effect)*/
|
||||
.overlay {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 193%;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
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;
|
||||
background-color: #d9d9d9;
|
||||
}
|
||||
|
||||
.form-item.row.create-new:hover {
|
||||
.form-item.create-new:hover {
|
||||
/*color: #eee;*/
|
||||
background-color: rgb(81,81,81);
|
||||
}
|
||||
|
||||
.form-item.row > .title-row{
|
||||
.form-item > .title-row{
|
||||
position: relative;
|
||||
top: 15px;
|
||||
padding-top:3em;
|
||||
padding-bottom:3.65em;
|
||||
}
|
||||
.form-item.row > .title-row h4 {
|
||||
.form-item > .title-row h4 {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.form-item.row.create-new > .title-row{
|
||||
.form-item.create-new > .title-row{
|
||||
padding: 0;
|
||||
/*margin-top:1em; */
|
||||
|
||||
}
|
||||
.form-item.row.create-new > .title-row h4 {
|
||||
.form-item.create-new > .title-row h4 {
|
||||
font-size: 7em;
|
||||
}
|
||||
|
||||
.form-item.row > .details-row{
|
||||
.form-item > .details-row{
|
||||
margin-top: 3.2em;
|
||||
}
|
||||
.form-item.row > .details-row small {
|
||||
.form-item > .details-row small {
|
||||
font-size: 0.6em;
|
||||
}
|
||||
.form-item.row.create-new > .details-row small {
|
||||
.form-item.create-new > .details-row small {
|
||||
font-size: 0.95em;
|
||||
}
|
@ -54,8 +54,6 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
|
||||
|
||||
$scope.$watch(function(newValue, oldValue) {
|
||||
if($scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){
|
||||
console.log('ready to save text input');
|
||||
console.log('Saving Form');
|
||||
updateFields();
|
||||
}
|
||||
});
|
||||
|
@ -114,7 +114,9 @@ angular.module('forms')
|
||||
'required' : true,
|
||||
'disabled' : false,
|
||||
};
|
||||
|
||||
console.log('\n\n---------\nAdded field CLIENT');
|
||||
console.log(newField);
|
||||
|
||||
// put newField into fields array
|
||||
if(addOrReturn){
|
||||
$scope.myform.form_fields.push(newField);
|
||||
@ -122,7 +124,7 @@ angular.module('forms')
|
||||
return newField;
|
||||
}
|
||||
|
||||
console.log('\n\n---------\nAdded field CLIENT');
|
||||
|
||||
// console.log(Date.now());
|
||||
// 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)
|
||||
$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;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -24,7 +24,8 @@ angular.module('forms').directive('fieldIconDirective', function($http, $compile
|
||||
'scale': 'fa fa-sliders',
|
||||
'stripe': 'fa fa-credit-card',
|
||||
'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];
|
||||
},
|
||||
|
@ -8,7 +8,8 @@ var __indexOf = [].indexOf || function(item) {
|
||||
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) {
|
||||
@ -29,6 +30,7 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
|
||||
'statement',
|
||||
'rating',
|
||||
'yes_no',
|
||||
'number',
|
||||
'natural'
|
||||
];
|
||||
if (__indexOf.call(supported_fields, type) >= 0) {
|
||||
@ -38,6 +40,7 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
|
||||
|
||||
var linker = function(scope, element) {
|
||||
|
||||
scope.setActiveField = $rootScope.setActiveField;
|
||||
//Set format only if field is a date
|
||||
if(scope.field.fieldType === 'date'){
|
||||
scope.dateOptions = {
|
||||
@ -75,4 +78,4 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
|
||||
},
|
||||
link: linker
|
||||
};
|
||||
});
|
||||
}]);
|
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCounter', 'Auth', '$filter',
|
||||
function ($http, $timeout, timeCounter, Auth, $filter) {
|
||||
angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCounter', 'Auth', '$filter', '$rootScope',
|
||||
function ($http, $timeout, timeCounter, Auth, $filter, $rootScope) {
|
||||
return {
|
||||
templateUrl: './modules/forms/views/directiveViews/form/submit-form.html',
|
||||
restrict: 'E',
|
||||
@ -9,39 +9,59 @@ angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCo
|
||||
form:'='
|
||||
},
|
||||
controller: function($scope){
|
||||
console.log('rendering submitFormDirective');
|
||||
timeCounter.startClock();
|
||||
angular.element(document).ready(function() {
|
||||
|
||||
$scope.submit = function(){
|
||||
var _timeElapsed = timeCounter.stopClock();
|
||||
$scope.form.timeElapsed = _timeElapsed;
|
||||
$scope.selected = null;
|
||||
$scope.startPage = true;
|
||||
|
||||
$scope.form.percentageComplete = $filter('formValidity')($scope.form.visible_form_fields)/$scope.visible_form_fields.length;
|
||||
delete $scope.form.visible_form_fields;
|
||||
$rootScope.setActiveField = function (field_id) {
|
||||
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)
|
||||
.success(function(data, status, headers){
|
||||
console.log('form submitted successfully');
|
||||
// alert('Form submitted..');
|
||||
$scope.form.submitted = true;
|
||||
})
|
||||
.error(function(error){
|
||||
console.log(error);
|
||||
$scope.error = error.message;
|
||||
});
|
||||
};
|
||||
// console.log('percentageComplete: '+$filter('formValidity')($scope.form)/$scope.form.visible_form_fields.length*100+'%');
|
||||
$scope.form.percentageComplete = $filter('formValidity')($scope.form)/$scope.form.visible_form_fields.length*100;
|
||||
console.log($scope.form.percentageComplete);
|
||||
// delete $scope.form.visible_form_fields;
|
||||
|
||||
$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();
|
||||
};
|
||||
$scope.authentication = Auth;
|
||||
|
||||
$scope.submitPromise = $http.post('/forms/'+$scope.form._id,$scope.form)
|
||||
.success(function(data, status, headers){
|
||||
console.log('form submitted successfully');
|
||||
// alert('Form submitted..');
|
||||
$scope.form.submitted = true;
|
||||
})
|
||||
.error(function(error){
|
||||
console.log(error);
|
||||
$scope.error = error.message;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$scope.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();
|
||||
};
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
@ -55,6 +55,10 @@ angular.module('forms').service('FormFields', [
|
||||
name : 'link',
|
||||
value : 'Link'
|
||||
},
|
||||
{
|
||||
name : 'number',
|
||||
value : 'Numbers'
|
||||
},
|
||||
// {
|
||||
// name : 'scale',
|
||||
// value : 'Opinion Scale'
|
||||
@ -67,10 +71,10 @@ angular.module('forms').service('FormFields', [
|
||||
name : 'statement',
|
||||
value : 'Statement'
|
||||
},
|
||||
{
|
||||
name : 'natural',
|
||||
value : 'Natural Language Input'
|
||||
},
|
||||
// {
|
||||
// name : 'natural',
|
||||
// value : 'Natural Language Input'
|
||||
// },
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -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-input">
|
||||
<div ng-repeat="option in field.fieldOptions" class="row-fluid">
|
||||
<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>
|
||||
</label>
|
||||
</div>
|
||||
<span class="required-error" ng-show="field.required && field.fieldValue == 0">(* required)</span>
|
||||
</div>
|
||||
<div class="field row">
|
||||
<div class="field row" ng-click="setActiveField(field._id)">
|
||||
|
||||
|
@ -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>
|
||||
@ -8,7 +8,7 @@
|
||||
</div>
|
||||
<div class="col-xs-12 field-input">
|
||||
<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>
|
||||
|
@ -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-input ">
|
||||
<select ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" ng-required="field.required" ng-disabled="field.disabled">
|
||||
|
@ -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-input">
|
||||
<input type="email"
|
||||
<input ng-focus="setActiveField(field._id)"type="email"
|
||||
class="text-field-input"
|
||||
placeholder="email@example.com"
|
||||
value="{{field.fieldValue}}"
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
<h3>{{field.title}} <span class="required-error" ng-show="field.required && !field.fieldValue">*(required)</span></h3>
|
||||
<br>
|
||||
@ -7,11 +7,11 @@
|
||||
<div class="col-xs-6 field-input container">
|
||||
<div class="row-fluid">
|
||||
<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>
|
||||
</label>
|
||||
<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>
|
||||
</label>
|
||||
</div>
|
||||
|
@ -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-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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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-input">
|
||||
<input type="text"
|
||||
<input ng-focus="setActiveField(field._id)"type="text"
|
||||
class="text-field-input"
|
||||
ng-model="field.fieldValue"
|
||||
ng-model-options="{ debounce: 250 }"
|
||||
|
@ -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>
|
@ -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-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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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-input">
|
||||
<div ng-repeat="option in field.fieldOptions" class="row-fluid">
|
||||
<label class="btn btn-info col-xs-3">
|
||||
<input type="radio"
|
||||
<label class="btn col-xs-3" ng-class="{activeBtn: field.fieldValue == field.fieldOptions[$index].option_value}">
|
||||
<input ng-focus="setActiveField(field._id)"
|
||||
type="radio"
|
||||
value="{{option.option_value}}"
|
||||
ng-model="field.fieldValue"
|
||||
ng-model-options="{ debounce: 250 }"
|
||||
ng-required="field.required"
|
||||
ng-disabled="field.disabled"
|
||||
ng-init="field.fieldValue = field.fieldOptions[0].option_value"/>
|
||||
/>
|
||||
<span ng-bind="option.option_title"></span>
|
||||
</label>
|
||||
</div>
|
||||
<span class="required-error" ng-show="field.required && !field.fieldValue">* required</span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
@ -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">
|
||||
<h3>
|
||||
<span class="fa fa-angle-double-right"></span>
|
||||
@ -7,12 +7,13 @@
|
||||
</h3>
|
||||
</div>
|
||||
<div class="col-xs-12 field-input">
|
||||
<input-stars max="5"
|
||||
icon-full="fa-star" icon-base="fa fa-3x" icon-empty="fa-star-o"
|
||||
<input-stars max="5" ng-focus="setActiveField(field._id)"
|
||||
icon-full="fa-star"
|
||||
icon-base="fa fa-3x"
|
||||
icon-empty="fa-star-o"
|
||||
ng-init="field.fieldValue = 1"
|
||||
ng-model="field.fieldValue"
|
||||
ng-model-options="{ debounce: 250 }"
|
||||
value="field.fieldValue"
|
||||
ng-required="field.required"
|
||||
ng-disabled="field.disabled"
|
||||
class="angular-input-stars">
|
||||
|
@ -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">
|
||||
<i class="fa fa-quote-left fa-3 col-xs-1"></i>
|
||||
<h2 class="text-center col-xs-8 ">{{field.title}} </h2>
|
||||
|
@ -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-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>
|
||||
|
@ -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-input">
|
||||
<input type="text"
|
||||
<input ng-focus="setActiveField(field._id)"type="text"
|
||||
class="text-field-input"
|
||||
ng-model="field.fieldValue"
|
||||
ng-model-options="{ debounce: 250 }"
|
||||
|
@ -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">
|
||||
<h3 class="row">
|
||||
<span class="fa fa-angle-double-right"></span> {{field.title}}
|
||||
@ -14,12 +14,12 @@
|
||||
<div class="col-xs-12 field-input">
|
||||
<div class="row-fluid">
|
||||
<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>
|
||||
</label>
|
||||
|
||||
<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>
|
||||
</label>
|
||||
</div>
|
||||
|
@ -1,9 +1,10 @@
|
||||
<div class="config-form container">
|
||||
<div class="row">
|
||||
<div class="col-sm-6 container">
|
||||
<div class="col-md-6 col-sm-12 container">
|
||||
<div class="row">
|
||||
<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>
|
||||
|
||||
@ -13,7 +14,6 @@
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-6">
|
||||
|
||||
<label>
|
||||
<input type="radio" data-ng-value="true" ng-model="myform.hideFooter" ng-required="true" />
|
||||
<span>Yes</span>
|
||||
@ -23,8 +23,6 @@
|
||||
<input type="radio" data-ng-value="false" ng-model="myform.hideFooter" ng-required="true" />
|
||||
<span>No</span>
|
||||
</label>
|
||||
|
||||
<!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -123,23 +121,29 @@
|
||||
</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="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 class="row field">
|
||||
<div class="field-title col-sm-6">
|
||||
<div class="field-title col-sm-4">
|
||||
<h5>Form Name</h5>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6 field-input field-input">
|
||||
<div class="col-sm-8">
|
||||
<input type="text"
|
||||
ng-model="myform.title"
|
||||
value="{{myform.title}}">
|
||||
<span class="required-error" ng-show="field.required && !field.fieldValue">* required</span>
|
||||
value="{{myform.title}}"
|
||||
style="width: 100%;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -163,6 +167,26 @@
|
||||
<!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> -->
|
||||
</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;"/>
|
||||
<span>Yes</span>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input type="radio" data-ng-value="false" ng-model="myform.showStart" ng-required="true" />
|
||||
<span>No</span>
|
||||
</label>
|
||||
|
||||
<!-- <span class="required-error" ng-show="field.required && !field.fieldValue">* required</span> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="row field">
|
||||
<div class="col-xs-6 field-title">Language</div>
|
||||
<div class="col-xs-4 field-input">
|
||||
|
@ -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">
|
||||
<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 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-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>
|
||||
</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 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="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-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">
|
||||
<field-icon-directive type-name="{{field.fieldType}}"></field-icon-directive>
|
||||
</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">
|
||||
<i class="fa fa-chevron-right" ng-hide="accordion[$index].isOpen">
|
||||
</i>
|
||||
@ -46,60 +50,65 @@
|
||||
</accordion-heading>
|
||||
<div class="accordion-edit container">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="row hidden-sm hidden-xs">
|
||||
<div class="col-md-12">
|
||||
<h4>Preview Field</h4>
|
||||
</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>
|
||||
</ul>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<hr>
|
||||
<h4>Edit Field</h4>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-4">Question Title:</div>
|
||||
<div class="col-xs-8">
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">Question Title:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<input type="text" ng-model="field.title" name="title{{field._id}}" value="{{field.title}}" required></div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-4">Description:</div>
|
||||
<div class="col-xs-8"><textarea type="text" ng-model="field.description" name="description{{field._id}}"value="{{field.description}}"></textarea> </div>
|
||||
<div class="row description">
|
||||
<div class="col-md-4 col-sm-12">Description:</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 class="row" ng-show="showAddOptions(field)"><br></div>
|
||||
<div class="row" ng-show="showAddOptions(field)">
|
||||
<div class="col-xs-4">Options:</div>
|
||||
<div class="col-xs-8 container">
|
||||
<div class="row options" ng-show="showAddOptions(field)">
|
||||
<div class="col-md-4 col-xs-12">Options:</div>
|
||||
<div class="col-md-8 col-xs-12">
|
||||
<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">
|
||||
|
||||
<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>
|
||||
</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 }}
|
||||
</span>
|
||||
</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 class="row"><br></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-4 field-title">Required:</div>
|
||||
<div class="col-xs-8 field-input">
|
||||
<div class="col-md-4 col-xs-12 field-title">Required:</div>
|
||||
<div class="col-md-8 col-xs-12 field-input">
|
||||
<label class="btn col-xs-5">
|
||||
<input type="radio" ng-value="true" ng-model="field.required" name="required{{field._id}}"/>
|
||||
<span> Yes</span>
|
||||
@ -113,8 +122,8 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-4 field-input">Disabled:</div>
|
||||
<div class="col-xs-8 field-input">
|
||||
<div class="col-md-4 col-xs-12 field-input">Disabled:</div>
|
||||
<div class="col-md-8 col-xs-12 field-input">
|
||||
<label class="btn col-xs-5">
|
||||
<input type="radio" ng-value="true"
|
||||
ng-model="field.disabled" name="disabled{{field._id}}"/>
|
||||
@ -151,7 +160,7 @@
|
||||
|
||||
</accordion>
|
||||
</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 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)">
|
||||
@ -162,7 +171,7 @@
|
||||
</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 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)">
|
||||
|
@ -1,27 +1,48 @@
|
||||
<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="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>
|
||||
</div>
|
||||
</div>
|
||||
<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" >
|
||||
<field-directive field="field" ng-if="!field.deletePreserved">
|
||||
</field-directive>
|
||||
<form name="myForm" class="submission-form col-sm-offset-1 col-sm-10">
|
||||
<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="field" >
|
||||
</field-directive>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<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
|
||||
</button>
|
||||
</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="col-sm-11 col-sm-offset-1"><h1>{{ form.title }}</h1>
|
||||
@ -35,7 +56,7 @@
|
||||
<div class="row form-actions">
|
||||
<p class="text-center col-xs-4 col-xs-offset-4">
|
||||
<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>
|
||||
</p>
|
||||
<!-- <p class="text-center col-xs-2" ng-if="authentication.isAuthenticated()">
|
||||
|
@ -8,7 +8,7 @@
|
||||
</div> -->
|
||||
<br>
|
||||
<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">
|
||||
<h4 class="fa fa-plus fa-6"></h4>
|
||||
</div>
|
||||
@ -21,11 +21,11 @@
|
||||
</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 class="title-row row">
|
||||
<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 ]*$/"/>
|
||||
</div>
|
||||
</div>
|
||||
@ -50,7 +50,7 @@
|
||||
</div>
|
||||
</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">
|
||||
<i style="cursor:pointer;" class="fa fa-trash-o" ng-click="remove(form._id)"></i>
|
||||
</span>
|
||||
@ -59,15 +59,14 @@
|
||||
</a>
|
||||
<div class="col-xs-12 details-row">
|
||||
|
||||
<small class="list-group-item-text">
|
||||
<!-- <small class="list-group-item-text">
|
||||
Created on
|
||||
<span data-ng-bind="form.created | date:'mediumDate'"></span>
|
||||
<span data-ng-bind="form.created | date:'shortDate'"></span>
|
||||
by
|
||||
<span data-ng-bind="form.admin.username"></span>
|
||||
</small>
|
||||
</small> -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
@ -3,13 +3,16 @@
|
||||
<!-- Modal Delete Dialog Template -->
|
||||
<script type="text/ng-template" id="myModalContent.html">
|
||||
<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 class="modal-body">
|
||||
<div class="modal-body-alert">
|
||||
Unexpected bad things will happen if you don’t read this!
|
||||
</div>
|
||||
<p>This action <strong>CANNOT</strong> be undone. This will permanently delete the <strong>{{myform.title}}</strong> form, form submissions and remove all associated pdfs.</p>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@ -23,23 +26,36 @@
|
||||
</script>
|
||||
|
||||
<div class="page-header row" style="padding-bottom: 0px;">
|
||||
<div class="col-xs-8">
|
||||
<h1 data-ng-bind="myform.title" style="margin-bottom: 0px;"></h1>
|
||||
<div class="col-xs-10 col-sm-8">
|
||||
<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 class="col-xs-2">
|
||||
<small class=" pull-right">
|
||||
<button class="btn btn-danger" ng-click="openDeleteModal()"><i class="fa fa-trash-o"></i> Delete Form</button>
|
||||
<div class="col-xs-1 col-sm-2">
|
||||
<small class="pull-right">
|
||||
<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>
|
||||
</div>
|
||||
<div class="col-xs-2">
|
||||
<div class="col-xs-1 col-sm-2">
|
||||
<small class="pull-right">
|
||||
<a class="btn btn-default" href="/#!/forms/{{myform._id}}">
|
||||
<span ng-show="myform.isLive">
|
||||
View Live
|
||||
</span>
|
||||
<span ng-hide="myform.isLive">Preview</span> Form
|
||||
<i class="status-light status-light-on fa fa-dot-circle-o" ng-show="myform.isLive"></i>
|
||||
<i class="status-light status-light-off fa fa-dot-circle-o" ng-hide="myform.isLive"></i>
|
||||
<a class="btn btn-default view-form-btn" href="/#!/forms/{{myform._id}}">
|
||||
<span class="hidden-xs hidden-sm">
|
||||
View
|
||||
<span ng-show="myform.isLive">
|
||||
Live
|
||||
</span>
|
||||
<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>
|
||||
</small>
|
||||
</div>
|
||||
@ -70,61 +86,75 @@
|
||||
<tab-heading>
|
||||
View Submissions
|
||||
</tab-heading>
|
||||
<div class="submissions-table" ng-show="viewSubmissions">
|
||||
<div class="submissions-table row container" ng-show="viewSubmissions">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-1">
|
||||
<div class="col-xs-2">
|
||||
<button class="btn btn-danger" ng-click="deleteSelectedSubmissions()" ng-disabled="!isAtLeastOneChecked();">
|
||||
<i class="fa fa-trash-o"></i> Delete Selected
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-xs-2">
|
||||
<button class="btn btn-default" ng-click="exportSubmissions()">
|
||||
Export to XLS
|
||||
</button>
|
||||
</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">
|
||||
<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>
|
||||
Time Elapsed
|
||||
</th>
|
||||
<th>
|
||||
Date Submitted (UTC)
|
||||
</th>
|
||||
<th ng-if="myform.autofillPDFs">
|
||||
Generated PDF
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr data-ng-repeat="row in table.rows" ng-click="rowClicked(row)">
|
||||
<td>
|
||||
<input ng-model="row.selected" type="checkbox"/>
|
||||
</td>
|
||||
<th class="scope">
|
||||
{{$index+1}}
|
||||
</th>
|
||||
<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>
|
||||
<tbody>
|
||||
<tr data-ng-repeat="row in table.rows" ng-click="rowClicked($index)" ng-class="{selected: row.selected === true}">
|
||||
<td>
|
||||
<input ng-model="row.selected" type="checkbox"/>
|
||||
</td>
|
||||
<th class="scope">
|
||||
{{$index+1}}
|
||||
</th>
|
||||
<td data-ng-repeat="(key, value) in row.form_fields">
|
||||
{{value.fieldValue}}
|
||||
</td>
|
||||
<td>
|
||||
{{row.percentageComplete}}%
|
||||
</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>
|
||||
</div>
|
||||
</tab>
|
||||
</tabset>
|
||||
|
@ -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">
|
||||
|
||||
<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" >
|
||||
<nav role="navigation">
|
||||
<ul class="nav navbar-nav navbar-left" >
|
||||
<li ng-show="!form.submitted">
|
||||
<p class="lead">{{form | formValidity}} out of {{form.visible_form_fields.length}} answered</p>
|
||||
<li ng-show="!myform.submitted">
|
||||
<p class="lead">{{myform | formValidity}} out of {{myform.visible_form_fields.length}} answered</p>
|
||||
</li>
|
||||
</ul>
|
||||
<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>
|
||||
</li>
|
||||
<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 style="padding-left:5px">
|
||||
<div class="btn btn-info" id="focusDownButton" style="padding: 15px;">\/</div>
|
||||
|
@ -7,15 +7,16 @@ angular.module('users').config(['$httpProvider',
|
||||
return {
|
||||
responseError: function(response) {
|
||||
// console.log($location.path());
|
||||
if( response.config.url !== '/users/me' && $location.path() !== '/users/me' && response.config){
|
||||
|
||||
console.log('intercepted rejection of ', response.config.url, response.status);
|
||||
if (response.status === 401) {
|
||||
// save the current location so that login can redirect back
|
||||
$location.nextAfterLogin = $location.path();
|
||||
$location.path('/signin');
|
||||
}else if(response.status === 403){
|
||||
$location.path('/access_denied');
|
||||
if( $location.path() !== '/users/me' && response.config){
|
||||
if(response.config.url !== '/users/me'){
|
||||
console.log('intercepted rejection of ', response.config.url, response.status);
|
||||
if (response.status === 401) {
|
||||
// save the current location so that login can redirect back
|
||||
$location.nextAfterLogin = $location.path();
|
||||
$location.path('/signin');
|
||||
}else if(response.status === 403){
|
||||
$location.path('/access_denied');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user