fixed form preview issues

This commit is contained in:
David Baldwynn 2017-04-10 17:36:24 -07:00
parent 18cde5213d
commit 3f20bcf712
No known key found for this signature in database
GPG key ID: 15D1C13202224A9B
8 changed files with 47 additions and 36 deletions

View file

@ -174,7 +174,7 @@ exports.uploadTemp = function(req, res) {
*/
exports.readForRender = function(req, res) {
var newForm = req.form.toJSON();
console.log(req.user);
if (!newForm.isLive && !req.user) {
return res.status(404).send({
message: 'Form Does Not Exist'

5
config/env/all.js vendored
View file

@ -28,6 +28,7 @@ module.exports = {
reCAPTCHA_Key: process.env.reCAPTCHA_KEY || '',
signupDisabled: (process.env.SIGNUP_DISABLED === "TRUE"),
disableClusterMode: (process.env.DISABLE_CLUSTER_MODE === "TRUE"),
baseUrl: '',
tempUserCollection: 'temporary_users',
@ -57,10 +58,10 @@ module.exports = {
secure: false,
// Only set the maxAge to null if the cookie shouldn't be expired
// at all. The cookie will expunge when the browser is closed.
maxAge: null
maxAge: 24 * 60 * 60 * 1000, // 24 hours
// To set the cookie in a specific domain uncomment the following
// setting:
// domain: 'tellform.com'
//domain: process.env.COOKIE_SESSION_URL || process.env.BASE_URL || '.tellform.com'
},
/*

View file

@ -19,9 +19,7 @@ module.exports = {
// stream: 'access.log'
}
},
sessionCookie: {
//domain: process.env.BASE_URL || 'http://localhost:3000'
},
facebook: {
clientID: process.env.FACEBOOK_ID || 'APP_ID',
clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',

View file

@ -18,7 +18,9 @@ module.exports = {
}
},
sessionCookie: {
//domain: process.env.BASE_URL || 'tellform.com'
secure: false,
maxAge: 24 * 60 * 60 * 1000, // 24 hours
domain: process.env.BASE_URL || '.tellform.com'
},
assets: {
bower_js: 'public/dist/vendor.min.js',

View file

@ -16,7 +16,7 @@ module.exports = function (app, db) {
io = socketio(config.socketPort, { transports: ['websocket', 'polling'] });
}
if(process.env.DISABLE_CLUSTER_MODE !== "TRUE"){
if(config.disableClusterMode){
var redis = require('socket.io-redis');
io.adapter(redis( process.env.REDIS_URL || { host: process.env.REDIS_DB_PORT_6379_TCP_ADDR || '127.0.0.1' , port: process.env.REDIS_DB_PORT_6379_TCP_PORT || 6379 }));
}

View file

@ -2231,7 +2231,7 @@ angular.module('core').config(['$translateProvider', function ($translateProvide
angular.module('forms').controller('AdminFormController', ['$rootScope', '$window', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal', 'myForm', '$filter', '$sce',
function($rootScope, $window, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal, myForm, $filter, $sce) {
$scope.trustSrc = function(src) {
$scope.trustSrc = function (src) {
return $sce.trustAsResourceUrl(src);
};
@ -2239,29 +2239,34 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
$scope.activePill = 0;
$scope.copied = false;
$scope.onCopySuccess = function(e) {
$scope.onCopySuccess = function (e) {
$scope.copied = true;
};
$scope = $rootScope;
$scope.animationsEnabled = true;
$scope.myform = myForm;
$rootScope.saveInProgress = false;
$scope = $rootScope;
$scope.animationsEnabled = true;
$scope.myform = myForm;
$rootScope.saveInProgress = false;
CurrentForm.setForm($scope.myform);
CurrentForm.setForm($scope.myform);
$scope.formURL = "/#!/forms/" + $scope.myform._id;
if($window.subdomainsDisabled == true){
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + '/view' + $scope.formURL;
} else {
if(window.location.host.split('.').length < 3){
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host + $scope.formURL;
if ($scope.myform.isLive) {
if ($window.subdomainsDisabled == true) {
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + '/view' + $scope.formURL;
} else {
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host.split('.').slice(1,3).join('.') + $scope.formURL;
if (window.location.host.split('.').length < 3) {
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host + $scope.formURL;
} else {
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host.split('.').slice(1, 3).join('.') + $scope.formURL;
}
}
} else {
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + $scope.formURL;
}
var refreshFrame = $scope.refreshFrame = function(){
if(document.getElementById('iframe')) {
document.getElementById('iframe').contentWindow.location.reload();

File diff suppressed because one or more lines are too long

View file

@ -4,7 +4,7 @@
angular.module('forms').controller('AdminFormController', ['$rootScope', '$window', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal', 'myForm', '$filter', '$sce',
function($rootScope, $window, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal, myForm, $filter, $sce) {
$scope.trustSrc = function(src) {
$scope.trustSrc = function (src) {
return $sce.trustAsResourceUrl(src);
};
@ -12,29 +12,34 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
$scope.activePill = 0;
$scope.copied = false;
$scope.onCopySuccess = function(e) {
$scope.onCopySuccess = function (e) {
$scope.copied = true;
};
$scope = $rootScope;
$scope.animationsEnabled = true;
$scope.myform = myForm;
$rootScope.saveInProgress = false;
$scope = $rootScope;
$scope.animationsEnabled = true;
$scope.myform = myForm;
$rootScope.saveInProgress = false;
CurrentForm.setForm($scope.myform);
CurrentForm.setForm($scope.myform);
$scope.formURL = "/#!/forms/" + $scope.myform._id;
if($window.subdomainsDisabled == true){
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + '/view' + $scope.formURL;
} else {
if(window.location.host.split('.').length < 3){
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host + $scope.formURL;
if ($scope.myform.isLive) {
if ($window.subdomainsDisabled == true) {
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + '/view' + $scope.formURL;
} else {
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host.split('.').slice(1,3).join('.') + $scope.formURL;
if (window.location.host.split('.').length < 3) {
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host + $scope.formURL;
} else {
$scope.actualFormURL = window.location.protocol + '//' + $scope.myform.admin.username + '.' + window.location.host.split('.').slice(1, 3).join('.') + $scope.formURL;
}
}
} else {
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + $scope.formURL;
}
var refreshFrame = $scope.refreshFrame = function(){
if(document.getElementById('iframe')) {
document.getElementById('iframe').contentWindow.location.reload();