diff --git a/app/models/form.server.model.js b/app/models/form.server.model.js index 55bd2dd7..ba4237fc 100644 --- a/app/models/form.server.model.js +++ b/app/models/form.server.model.js @@ -76,9 +76,26 @@ var FormSchema = new Schema({ introText:{ type: String, }, - buttonText:{ - type: String - } + buttons:[{ + url: { + type: String, + match: [/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/], + }, + action: String, + buttonText: String, + backgroundColor: { + type: String, + match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/], + default: '#5bc0de' + }, + color: { + type: String, + match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/], + default: '#ffffff' + } + + + }] }, hideFooter: { type: Boolean, @@ -99,10 +116,22 @@ var FormSchema = new Schema({ design: { colors:{ - backgroundColor: String, - questionColor: String, - answerColor: String, - buttonColor: String, + backgroundColor: { + type: String, + match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/] + }, + questionColor: { + type: String, + match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/] + }, + answerColor: { + type: String, + match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/] + }, + buttonColor: { + type: String, + match: [/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/] + }, }, font: String, backgroundImage: { type: Schema.Types.Mixed } diff --git a/public/modules/forms/controllers/list-forms.client.controller.js b/public/modules/forms/controllers/list-forms.client.controller.js index 970b7969..6e782007 100644 --- a/public/modules/forms/controllers/list-forms.client.controller.js +++ b/public/modules/forms/controllers/list-forms.client.controller.js @@ -60,8 +60,6 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope .success(function(data, status, headers){ console.log('form created'); - // Clear form fields - $scope.myform = {}; // Redirect after save $scope.goToWithId('viewForm', data._id+''); }).error(function(errorResponse){ diff --git a/public/modules/forms/css/form.css b/public/modules/forms/css/form.css index 7491e5d2..d702c050 100644 --- a/public/modules/forms/css/form.css +++ b/public/modules/forms/css/form.css @@ -113,7 +113,12 @@ form .row.field { border: 2px dashed #ddd; } - + form .field-input > input.hasDatepicker{ + padding: 0.45em 0.9em; + width: 50%; + line-height: 160%; + border: 2px dashed #ddd; + } form .field-input > input.text-field-input{ padding: 0.45em 0.9em; width: 100%; @@ -140,6 +145,7 @@ form .row.field { border: 1px solid #ccc; height: 34px; } + .config-form { max-width: 100%; } @@ -325,15 +331,6 @@ section > section.public-form { } /*Modal overlay (for lightbox effect)*/ -.overlay { - position: fixed; - top: 0; - left: 0; - height: 100%; - width: 100%; - background-color: rgba(256,256,256,0.8); - z-index: 10; -} .overlay { position: fixed; top: 0; @@ -343,9 +340,12 @@ section > section.public-form { background-color: rgba(0,0,0,0.5); z-index: 10; } +.overlay.submitform { + background-color: rgba(256,256,256,0.8); +} .field-directive { z-index: 9; - padding:25px; + padding: 10% 10% 10% 0; border: 25px transparent solid; position: relative; } diff --git a/public/modules/forms/directives/edit-form.client.directive.js b/public/modules/forms/directives/edit-form.client.directive.js index 38db801a..f809a381 100644 --- a/public/modules/forms/directives/edit-form.client.directive.js +++ b/public/modules/forms/directives/edit-form.client.directive.js @@ -153,6 +153,33 @@ angular.module('forms') // } }; + + /* + ** StartPage Button Methods + */ + + // add new Button to the field + $scope.addButton = function (Button){ + + var lastButtonID = 0; + + if($scope.myform.StartPage.buttons[$scope.myform.StartPage.buttons.length-1]) + lastButtonID = $scope.myform.StartPage.buttons[$scope.myform.StartPage.buttons.length-1].button_id; + + // put new option into fieldOptions array + Button.backgroundColor = '#5bc0de'; + Button.button_id = lastButtonID; + Button.color = '#ffffff'; + + + $scope.myform.StartPage.buttons.push(Button); + }; + + // delete particular option + $scope.deleteButton = function (button_index){ + $scope.myform.StartPage.buttons.splice(button_index, 1); + }; + /* ** Field Option Methods */ diff --git a/public/modules/forms/directives/submit-form.client.directive.js b/public/modules/forms/directives/submit-form.client.directive.js index 2725b420..12833e82 100644 --- a/public/modules/forms/directives/submit-form.client.directive.js +++ b/public/modules/forms/directives/submit-form.client.directive.js @@ -12,8 +12,7 @@ angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCo angular.element(document).ready(function() { $scope.selected = null; - $scope.startPage = true; - timeCounter.startClock() + timeCounter.startClock() $rootScope.setActiveField = function (field_id) { console.log('form field clicked: '+field_id); @@ -50,7 +49,7 @@ angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCo $scope.exitStartPage = function () { - $scope.startPage = false; + $scope.form.startPage.showStart = false; }; $scope.reloadForm = function(){ diff --git a/public/modules/forms/views/directiveViews/form/edit-form.html b/public/modules/forms/views/directiveViews/form/edit-form.html index d2da2c83..460d424c 100644 --- a/public/modules/forms/views/directiveViews/form/edit-form.html +++ b/public/modules/forms/views/directiveViews/form/edit-form.html @@ -28,7 +28,7 @@
- + @@ -48,6 +48,37 @@
+ +

Edit StartPage

@@ -58,26 +89,53 @@
Intro Text:
-
-
- -

- -
-
Intro Description:
-
- +
- <

+

-
+
+
Buttons:
+
+
+ + + + + + + + + +
+
+ +
+
+
+ +
diff --git a/public/modules/forms/views/directiveViews/form/submit-form.html b/public/modules/forms/views/directiveViews/form/submit-form.html index 1b7e8dcc..b4e1b872 100755 --- a/public/modules/forms/views/directiveViews/form/submit-form.html +++ b/public/modules/forms/views/directiveViews/form/submit-form.html @@ -1,26 +1,33 @@
-
+
- -
+

{{ form.title }} (private preview)

@@ -28,7 +35,7 @@
-
+
diff --git a/scripts/git-remove-history.sh b/scripts/git-remove-history.sh new file mode 100644 index 00000000..25b28faa --- /dev/null +++ b/scripts/git-remove-history.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -o errexit + +# Author: David Underhill +# Script to permanently delete files/folders from your git repository. To use +# it, cd to your repository's root and then run the script with a list of paths +# you want to delete, e.g., git-delete-history path1 path2 + +if [ $# -eq 0 ]; then + exit 0 +fi + +# make sure we're at the root of git repo +if [ ! -d .git ]; then + echo "Error: must run this script from the root of a git repository" + exit 1 +fi + +# remove all paths passed as arguments from the history of the repo +files=$@ +git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD + +# remove the temporary history git-filter-branch otherwise leaves behind for a long time +rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune