in the middle of adding conditional buttons to Form's StartPage
This commit is contained in:
parent
bbd3baaf1d
commit
9c22020214
|
@ -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 }
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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(){
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<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 is-open="accordion[$index].isOpen" on-finish-render="editFormFields" ng-if="form.startPage.showStart">
|
||||
<accordion-group is-open="accordion[$index].isOpen" ng-if="myform.startPage.showStart">
|
||||
|
||||
<accordion-heading>
|
||||
|
||||
|
@ -48,6 +48,37 @@
|
|||
</accordion-heading>
|
||||
<div class="accordion-edit container">
|
||||
|
||||
<div class="row hidden-sm hidden-xs">
|
||||
<div class="col-md-12">
|
||||
<h4>Preview Field</h4>
|
||||
</div>
|
||||
<ul class="col-md-12 container" style="list-style:none;border:2px lightgray solid;">
|
||||
<div class="field row text-center">
|
||||
<div class="col-xs-12 text-center">
|
||||
<h1>Welcome to {{myform.title}}</h1>
|
||||
</div>
|
||||
<div class="col-xs-10 col-xs-offset-1 text-center">
|
||||
<p>{{form.startPage.introText}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-actions">
|
||||
<p ng-repeat="button in form.startPage.buttons" class="col-xs-6 col-xs-offset-3 text-center">
|
||||
<button class="btn btn-info" type="button" ng-style="{background-color:button.backgroundColor; color:button.color;}">
|
||||
<a href="{{button.url}}" style="font-size: 1.6em; text-decoration: none;"> {{button.buttonText}}</a>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="row form-actions">
|
||||
<p class="col-xs-6 col-xs-offset-3 text-center">
|
||||
<button class="btn btn-info" type="button">
|
||||
<a ng-click="exitStartPage()" style="color:white; font-size: 1.6em; text-decoration: none;">Continue to Form</a>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
</ul>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<h4>Edit StartPage</h4>
|
||||
|
@ -58,26 +89,53 @@
|
|||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">Intro Text:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<input type="text" ng-model="form.startPage.introText" name="titleStartPage" value="{{form.startPage.introText}}" required></div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row description">
|
||||
<div class="col-md-4 col-sm-12">Intro Description:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<textarea type="text" ng-model="form.startPage.introDescription" name="descriptionStartPage" value="{{form.startPage.introDescription}}"></textarea>
|
||||
<input type="text"
|
||||
ng-model="myform.startPage.introText"
|
||||
name="introTextStartPage"
|
||||
value="{{myform.startPage.introText}}" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<<div class="row"><br></div>
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row description">
|
||||
<div class="row options">
|
||||
<div class="col-md-4 col-xs-12">Buttons:</div>
|
||||
<div class="col-md-8 col-xs-12">
|
||||
<div ng-repeat="button in myform.startPage.buttons" class="row">
|
||||
|
||||
<input type="text"
|
||||
name="{{button.buttonText}}_buttonText_StartPage"
|
||||
ng-model="button.buttonText"
|
||||
value="{{button.buttonText}}"
|
||||
placeholder="My Button"
|
||||
class="col-xs-4">
|
||||
|
||||
<input type="text"
|
||||
name="{{button.url}}_url_StartPage"
|
||||
ng-model="button.url"
|
||||
value="{{button.url}}"
|
||||
placeholder="http://aeouaou.com/aoeuoa"
|
||||
class="col-xs-6">
|
||||
|
||||
<a class="btn btn-danger btn-mini right" type="button" ng-click="deleteButton(button)" class="col-xs-2">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<button class="btn btn-primary btn-small ol-md-12 col-sm-6 col-sm-offset-6 col-xs-6 col-xs-offset-6" type="button" ng-click="addButton(field)">
|
||||
<i class="icon-plus icon-white"></i> Add Button
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="row description">
|
||||
<div class="col-md-4 col-sm-12">Button Text:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<textarea type="text" ng-model="form.startPage.buttonText" name="buttonStartPage" value="{{form.startPage.buttonText}}"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</accordion-group>
|
||||
|
||||
|
|
|
@ -1,26 +1,33 @@
|
|||
<div cg-busy="{promise:submitPromise,message:'Submitting form...',backdrop:true}"></div>
|
||||
|
||||
<section class="overlay" ng-if="selected" ng-click="hideOverlay()"></section>
|
||||
<section class="overlay submitform" ng-if="selected" ng-click="hideOverlay()"></section>
|
||||
|
||||
<div ng-show="!form.submitted && startPage && form.showStart" class="form-submitted">
|
||||
<div ng-show="!form.submitted && form.startPage.showStart" class="form-submitted">
|
||||
<div class="field row text-center">
|
||||
<div class="col-xs-12 text-center">
|
||||
<h1>Welcome to {{form.title}}</h1>
|
||||
</div>
|
||||
<!-- <div class="col-xs-10 col-xs-offset-1 text-center">
|
||||
<div class="col-xs-10 col-xs-offset-1 text-center">
|
||||
<p>{{form.startPage.introText}}</p>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-actions">
|
||||
<p ng-repeat="button in form.startPage.buttons" class="col-xs-6 col-xs-offset-3 text-center">
|
||||
<button class="btn btn-info" type="button">
|
||||
<a href="{{button.url}}" style="font-size: 1.6em; text-decoration: none;">{{button.buttonText}}</a>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="row form-actions">
|
||||
<p class="text-center col-xs-4 col-xs-offset-4">
|
||||
<p class="col-xs-6 col-xs-offset-3 text-center">
|
||||
<button class="btn btn-info" type="button">
|
||||
<a ng-click="exitStartPage()" style="color:white; font-size: 1.6em; text-decoration: none;">Continue to Form</a>
|
||||
<a ng-click="exitStartPage()" style="font-size: 1.6em; text-decoration: none;">Continue to Form</a>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="!form.submitted && !(startPage && form.showStart)" data-ng-init="initFocus()">
|
||||
<div ng-show="!form.submitted && !form.startPage.showStart" data-ng-init="initFocus()">
|
||||
<div class="field row" style="padding-bottom:5em;">
|
||||
<div class="col-sm-10 col-sm-offset-1">
|
||||
<h1>{{ form.title }} <span style="font-size:0.8em; color: #bbb;" ng-if="!form.isLive">(private preview)</span></h1>
|
||||
|
@ -28,7 +35,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<form name="myForm" class="submission-form col-sm-offset-1 col-sm-10">
|
||||
<form name="myForm" class="submission-form col-sm-12 col-md-offset-1 col-md-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>
|
||||
|
|
24
scripts/git-remove-history.sh
Normal file
24
scripts/git-remove-history.sh
Normal file
|
@ -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
|
Loading…
Reference in a new issue