integrated form_modules into admin panel

This commit is contained in:
David Baldwynn 2017-09-20 15:18:19 -07:00
parent e910a02aee
commit c0cc33e223
65 changed files with 960 additions and 325 deletions

View File

@ -13,6 +13,8 @@ exports.index = function(req, res) {
};
exports.form = function(req, res) {
console.log('\n\n\nRENDERING FORM\n\n\n\n');
//Allow form to be embedded
res.set('X-Frame-Options', 'GOFORIT');

View File

@ -200,7 +200,7 @@ FormFieldSchema.pre('save', function(next) {
if(this.logicJump.jumpTo === '') delete this.logicJump.jumpTo;
}
if(!this.globalId){
this.globalId = uidgen3.generateSync()
this.globalId = uidgen3.generateSync();
}
next();
});

View File

@ -4,8 +4,7 @@
* Module dependencies.
*/
var forms = require('../../app/controllers/forms.server.controller'),
core = require('../../app/controllers/core.server.controller'),
config = require('../../config/config');
core = require('../../app/controllers/core.server.controller');
module.exports = function(app) {
// Core routing
@ -14,25 +13,5 @@ module.exports = function(app) {
app.route('/subdomain/api/')
.get(core.redoc);
if(!config.subdomainsDisabled) {
app.route('/subdomain/:userSubdomain((?!api$)[A-Za-z0-9]+)/')
.get(core.form);
app.route('/subdomain/:userSubdomain((?!api$)[A-Za-z0-9]+)/forms/:formId([a-zA-Z0-9]+)')
.post(forms.createSubmission);
app.route('/subdomain/:userSubdomain((?!api$)[A-Za-z0-9]+)/forms/:formId([a-zA-Z0-9]+)/render')
.get(forms.readForRender);
} else {
app.route('/view/')
.get(core.form);
app.route('/forms/:formId([a-zA-Z0-9]+)')
.post(forms.createSubmission);
app.route('/forms/:formId([a-zA-Z0-9]+)/render')
.get(forms.readForRender);
}
};

View File

@ -4,10 +4,29 @@
* Module dependencies.
*/
var forms = require('../../app/controllers/forms.server.controller'),
auth = require('../../config/passport_helpers');
auth = require('../../config/passport_helpers'),
config = require('../../config/config'),
core = require('../../app/controllers/core.server.controller');
module.exports = function(app) {
// Form Routes
if(!config.subdomainsDisabled) {
app.route('/subdomain/:userSubdomain((?!api$)[A-Za-z0-9]+)/')
.get(core.form);
app.route('/subdomain/:userSubdomain((?!api$)[A-Za-z0-9]+)/forms/:formId([a-zA-Z0-9]+)')
.post(forms.createSubmission);
app.route('/subdomain/:userSubdomain((?!api$)[A-Za-z0-9]+)/forms/:formId([a-zA-Z0-9]+)/render')
.get(forms.readForRender);
app.route('/forms/:formId([a-zA-Z0-9]+)/render')
.put(auth.isAuthenticatedOrApiKey, forms.hasAuthorization, forms.readForRender)
.get(auth.isAuthenticatedOrApiKey, forms.hasAuthorization, forms.readForRender);
} else {
app.route('/forms/:formId([a-zA-Z0-9]+)/render')
.get(forms.readForRender);
}
app.route('/forms')
.get(auth.isAuthenticatedOrApiKey, forms.list)
.post(auth.isAuthenticatedOrApiKey, forms.create);

View File

@ -1,143 +1,143 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{{title}} Form</title>
<head>
<title>{{title}} Form</title>
<!-- General META -->
<meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- General META -->
<meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- Semantic META -->
<meta name="keywords" content="{{keywords}}">
<meta name="description" content="{{description}}">
<!-- Semantic META -->
<meta name="keywords" content="{{keywords}}">
<meta name="description" content="{{description}}">
<!-- Facebook META -->
<meta property="og:site_name" content="{{title}}">
<meta property="og:title" content="{{title}}">
<meta property="og:description" content="{{description}}">
<meta property="og:url" content="{{url}}">
<meta property="og:image" content="/img/brand/logo.png">
<meta property="og:type" content="website">
<!-- Facebook META -->
<meta property="og:site_name" content="{{title}}">
<meta property="og:title" content="{{title}}">
<meta property="og:description" content="{{description}}">
<meta property="og:url" content="{{url}}">
<meta property="og:image" content="/img/brand/logo.png">
<meta property="og:type" content="website">
<!-- Twitter META -->
<meta name="twitter:title" content="{{title}}">
<meta name="twitter:description" content="{{description}}">
<meta name="twitter:url" content="{{url}}">
<meta name="twitter:image" content="/img/brand/logo.png">
<!-- Twitter META -->
<meta name="twitter:title" content="{{title}}">
<meta name="twitter:description" content="{{description}}">
<meta name="twitter:url" content="{{url}}">
<meta name="twitter:image" content="/img/brand/logo.png">
<style>
.loader {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 9999;
background: url('/static/dist/page-loader.gif') 50% 35% no-repeat rgb(249,249,249);
background-size: 50px 50px;
}
</style>
<style>
.loader {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 9999;
background: url('/static/dist/page-loader.gif') 50% 35% no-repeat rgb(249,249,249);
background-size: 50px 50px;
}
</style>
<script src="/static/lib/jquery/dist/jquery.slim.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(window).on("load", function() {
$(".loader").fadeOut("slow");
});
</script>
<script src="/static/lib/jquery/dist/jquery.slim.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(window).on("load", function() {
$(".loader").fadeOut("slow");
});
</script>
<!-- Fav Icon -->
<link href="/static/modules/core/img/brand/favicon.ico" rel="shortcut icon" type="image/x-icon">
<link rel="stylesheet" href="/static/lib/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/static/lib/bootstrap/dist/css/bootstrap.min.css">
<!--Bower CSS dependencies-->
{% for bowerCssFile in bowerCssFiles %}
<link rel="stylesheet" href="{{bowerCssFile}}">
{% endfor %}
<link rel="stylesheet" href="/static/lib/angular-input-stars/angular-input-stars.css">
<link rel="stylesheet" href="/static/lib/jquery-ui/themes/flick/jquery-ui.min.css"/>
<!-- Fav Icon -->
<link href="/static/modules/core/img/brand/favicon.ico" rel="shortcut icon" type="image/x-icon">
<link rel="stylesheet" href="/static/lib/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/static/lib/bootstrap/dist/css/bootstrap.min.css">
<!--Bower CSS dependencies-->
{% for bowerCssFile in bowerCssFiles %}
<link rel="stylesheet" href="{{bowerCssFile}}">
{% endfor %}
<link rel="stylesheet" href="/static/lib/angular-input-stars/angular-input-stars.css">
<link rel="stylesheet" href="/static/lib/jquery-ui/themes/flick/jquery-ui.min.css"/>
<!-- end Bower CSS dependencies-->
<!-- end Bower CSS dependencies-->
<!--Application CSS Files-->
{% for cssFile in cssFiles %}
<link rel="stylesheet" href="{{cssFile}}">
{% endfor %}
<!-- end Application CSS Files-->
<!--Application CSS Files-->
{% for cssFile in cssFiles %}
<link rel="stylesheet" href="{{cssFile}}">
{% endfor %}
<!-- end Application CSS Files-->
<!-- HTML5 Shim -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<!-- HTML5 Shim -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body ng-cloak>
<div class="loader"></div>
<body ng-cloak>
<div class="loader"></div>
<section class="content">
<section ui-view></section>
</section>
<!-- [if lt IE 9]>
<section class="browsehappy jumbotron hide">
<h1>Hello there!</h1>
<p>You are using an old browser which we unfortunately do not support.</p>
<p>Please <a href="http://browsehappy.com/">click here</a> to update your browser before using the website.</p>
<p><a href="http://browsehappy.com" class="btn btn-primary btn-lg" role="button">Yes, upgrade my browser!</a></p>
</section>
<![endif] -->
<section class="content">
<section ui-view></section>
</section>
<!--Embedding The User Object signupDisabled, socketPort and socketUrl Boolean -->
<script type="text/javascript">
var user = {{ user | json | safe }};
var signupDisabled = {{signupDisabled | safe}};
var socketPort = false;
{% if socketPort %}
socketPort = {{socketPort | safe }};
{% endif %}
var socketUrl = "{{socketUrl | safe}}";
var subdomainsDisabled = {{subdomainsDisabled | safe}};
</script>
<!-- [if lt IE 9]>
<section class="browsehappy jumbotron hide">
<h1>Hello there!</h1>
<p>You are using an old browser which we unfortunately do not support.</p>
<p>Please <a href="http://browsehappy.com/">click here</a> to update your browser before using the website.</p>
<p><a href="http://browsehappy.com" class="btn btn-primary btn-lg" role="button">Yes, upgrade my browser!</a></p>
</section>
<![endif] -->
<!--Socket.io Client Dependency-->
<script src="/static/lib/socket.io-client/dist/socket.io.min.js" async></script>
<script src="/static/lib/jquery/dist/jquery.min.js" type="text/javascript"></script>
<script src="/static/lib/jquery-ui/jquery-ui.js" type="text/javascript"></script>
<script src="/static/dist/vendor.min.js"></script>
<script src="/static/lib/angular-ui-date/src/date.js" type="text/javascript"></script>
<!--Application JavaScript Files-->
{% for jsFile in formJSFiles %}
<script type="text/javascript" src="{{jsFile}}"></script>
{% endfor %}
<!-- end Application Javascript dependencies-->
<!--Embedding The User Object signupDisabled, socketPort and socketUrl Boolean--->
<script type="text/javascript">
var user = {{ user | json | safe }};
var signupDisabled = {{signupDisabled | safe}};
var socketPort = false;
{% if socketPort %}
socketPort = {{socketPort | safe }};
{% endif %}
var socketUrl = "{{socketUrl | safe}}";
var subdomainsDisabled = {{subdomainsDisabled | safe}};
</script>
{% if process.env.NODE_ENV === 'development' %}
<!--Livereload script rendered -->
<script async type="text/javascript" src="http://{{request.hostname}}:35729/livereload.js"></script>
{% endif %}
<!--Socket.io Client Dependency-->
<script src="/static/lib/socket.io-client/dist/socket.io.min.js" async></script>
<script src="/static/lib/jquery/dist/jquery.min.js" type="text/javascript"></script>
<script src="/static/lib/jquery-ui/jquery-ui.js" type="text/javascript"></script>
<script async>
Raven.config('https://825fefd6b4ed4a4da199c1b832ca845c@sentry.tellform.com/2').install();
</script>
<script src="/static/dist/vendor.min.js"></script>
<script src="/static/lib/angular-ui-date/src/date.js" type="text/javascript"></script>
<!--Application JavaScript Files-->
{% for jsFile in formJSFiles %}
<script type="text/javascript" src="{{jsFile}}"></script>
{% endfor %}
<!-- end Application Javascript dependencies-->
<script async>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
{% if process.env.NODE_ENV === 'development' %}
<!--Livereload script rendered -->
<script async type="text/javascript" src="http://{{request.hostname}}:35729/livereload.js"></script>
{% endif %}
ga('create', '{{google_analytics_id}}', 'auto');
ga('send', 'pageview');
</script>
<script async>
Raven.config('https://825fefd6b4ed4a4da199c1b832ca845c@sentry.tellform.com/2').install();
</script>
<script async>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{google_analytics_id}}', 'auto');
ga('send', 'pageview');
</script>
</body>
</body>
</html>

618
base_bak/css/form.css Normal file
View File

@ -0,0 +1,618 @@
/* Custom Tab CSS */
.nav.nav-pills.nav-stacked {
width: 16.66666667%;
float: left;
position: relative;
min-height: 1px;
padding-right: 15px;
}
div.tab-content {
width: 83.33333333%;
position: relative;
min-height: 1px;
float:left;
padding-top: 0!important;
}
.panel-default.startPage {
border-style: dashed;
border-color: #a9a9a9;
border-width:3px;
}
.busy-updating-wrapper {
text-align: center;
font-size: 20px;
position: fixed;
bottom: 0;
right: 55px;
z-index: 1;
}
.busy-submitting-wrapper {
position: fixed;
top: 50%;
left: 0;
right: 0;
bottom: 0;
}
.dropzone h4.panel-title {
height: 17px;
overflow: hidden;
}
.container.admin-form {
margin-top: 70px;
}
.public-form.preview {
border: none;
box-shadow: 0px 0px 10px 0px grey;
overflow-y: scroll;
overflow-x: hidden;
height: 400px;
width: 90%;
position: absolute;
}
.public-form input, .public-form textarea {
background-color: #000000;
background-color: rgba(0,0,0,0);
border: 2px dashed #ddd!important;
}
.public-form input:focus, .public-form textarea:focus {
border: 2px dashed #ddd!important;
outline: 0;
}
/*.public-form input.no-border.ng-invalid, .public-form textarea.no-border {
border-color: none;
}*/
.public-form input.ng-valid, .public-form textarea.ng-valid {
border-color: #20FF20!important;
border-style: solid!important;
border-width: 3px!important;
}
.public-form input.ng-invalid.ng-dirty, .public-form textarea.ng-invalid.ng-dirty {
border-color: #FA787E!important;
border-style: solid!important;
border-width: 3px!important;
}
section.content p.breakwords {
word-break: break-all;
}
.public-form .btn {
border: 1px solid #c6c6c6;
}
.public-form .btn[type='submit'] {
font-size: 1.5em;
padding: 0.35em 1.2em 0.35em 1.2em;
}
section.content > section > section.container {
margin-top: 70px;
}
/*
** Modal CSS Styles
*/
.modal-header {
padding: 15px;
border-bottom: 1px solid #e5e5e5;
font-size: 18px;
font-weight: normal;
}
.public-form .input-block {
display: block;
width: 100%;
}
.modal-footer input[type='text'] {
min-height: 34px;
padding: 7px 8px;
font-size: 13px;
color: #333;
vertical-align: middle;
background-color: #fff;
background-repeat: no-repeat;
background-position: right 8px center;
border: 1px solid #ccc;
border-radius: 3px;
box-shadow: inset 0 1px 2px rgba(0,0,0,0.075);
}
.modal-body > .modal-body-alert {
color: #796620;
background-color: #f8eec7;
border-color: #f2e09a;
margin: -16px -15px 15px;
padding: 10px 15px;
border-style: solid;
border-width: 1px 0;
}
div.form-fields {
position: relative;
padding-top: 10%;
}
.public-form .letter {
position: relative;
display: -moz-inline-stack;
display: inline-block;
vertical-align: top;
zoom: 1;
width: 16px;
padding: 0;
height: 17px;
font-size: 12px;
line-height: 19px;
border: 1px solid #000;
border: 1px solid rgba(0,0,0,.2);
margin-right: 7px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
text-align: center;
font-weight: 700;
}
div.form-submitted > .field.row {
padding-bottom: 2%;
margin-top: 10%;
}
div.form-submitted > .field.row > div {
font-size: 1.7em;
}
/* Styles for accordion */
form .accordion-edit {
width: inherit;
}
/*Styles for ui-datepicker*/
.ui-datepicker.ui-widget {
z-index: 99!important;
}
form .row.field .field-number {
margin-right: 0.5em;
}
/* Styles for form submission view (/forms/:formID) */
form .row.field {
padding: 1em 0 0 0;
width: inherit;
}
form .row.field > .field-title {
margin-top:0.5em;
font-size:1.2em;
padding-bottom: 1.8em;
width: inherit;
}
form .row.field > .field-input {
font-size: 1.4em;
color: #777;
}
form.submission-form .row.field.statement > .field-title {
font-size:1.7em;
}
form.submission-form .row.field.statement > .field-input {
font-size:1em;
color:#ddd;
}
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: #000!important;
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;
}
form.submission-form .select > .field-input .btn > span {
font-size: 1.10em;
}
/*form.submission-form .field-input > input:focus {
font-size:1em;
}*/
form .field-input > textarea{
padding: 0.45em 0.9em;
width: 100%;
line-height: 160%;
}
form .field-input > input.hasDatepicker{
padding: 0.45em 0.9em;
width: 50%;
line-height: 160%;
}
form .field-input > input.text-field-input{
padding: 0.45em 0.9em;
width: 100%;
line-height: 160%;
}
form .required-error{
color: #ddd;
font-size:0.8em;
}
form .row.field.dropdown > .field-input input {
min-height: 34px;
border-width: 0 0 2px 0;
border-radius: 5px;
}
form .row.field.dropdown > .field-input input:focus {
border: none;
}
form .dropdown > .field-input .ui-select-choices-row-inner {
border-radius: 3px;
margin: 5px;
padding: 10px;
background-color: #000000;
background-color: rgba(0,0,0,0.05);
}
form .dropdown > .field-input .ui-select-choices-row-inner.active, form .dropdown > .field-input .ui-select-choices-row-inner.active:focus {
background-color: #000000;
background-color: rgba(0,0,0,0.1);
}
.config-form {
max-width: 100%;
}
.config-form > .row {
padding: 19px;
margin-bottom: 20px;
background-color: #f5f5f5;
border: 1px solid #e3e3e3;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
}
div.config-form .row.field {
padding-top:1.5em;
}
div.config-form > .row > .container:nth-of-type(odd){
border-right: 1px #ddd solid;
}
div.config-form.design > .row > .container:nth-of-type(odd){
border-right: none;
}
div.config-form .row > .field-input {
padding-left:0.1em;
}
div.config-form .row > .field-input label {
padding-left:1.3em;
display: block;
}
/* Styles for form admin view (/forms/:formID/admin) */
.admin-form > .page-header {
padding-bottom: 0;
margin-bottom: 40px;
}
.admin-form > .page-header h1 {
margin-bottom: 0;
margin-top: 0;
}
.admin-form > .page-header > .col-xs-3 {
padding-top: 1.4em;
}
.admin-form .form-controls .row {
padding: 5px;
}
.admin-form .page-header {
border: none;
margin-top: none;
margin-bottom: none;
}
/*Styles for admin view tabs */
.admin-form .tab-content {
padding-top: 3em;
}
.admin-form .panel-heading {
background-color: #f1f1f1;
position: relative!important;
}
.admin-form .panel-heading:hover {
background-color: #fff;
cursor: pointer;
}
.admin-form .panel-heading a:hover {
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%;
}
/*Override Select2 UI*/
.ui-select-choices.ui-select-dropdown {
top:2.5em!important;
}
.ui-select-toggle {
box-shadow:none!important;
border:none!important;
}
.current-fields .tool-panel > .panel-default:hover {
border-color: #9d9d9d;
cursor: pointer;
}
.current-fields .tool-panel > .panel-default .panel-heading {
background-color: #fff;
color: #9d9d9d!important;
}
.current-fields .tool-panel > .panel-default .panel-heading:hover {
background-color: #eee;
color: #000!important;
cursor: pointer;
}
.current-fields .tool-panel > .panel-default .panel-heading a {
color: inherit;
}
.current-fields .tool-panel > .panel-default .panel-heading a:hover{
text-decoration: none;
}
/*Styles for submission table*/
.submissions-table .table-outer.row {
margin: 1.5em 0 2em 0!important;
}
.submissions-table .table-outer .col-xs-12 {
padding-left: 0!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 {
background-color: #ddd;
padding: 0 2% 0 2%;
border-radius: 3px;
}
.admin-form .add-field .col-xs-6 {
padding: 0.25em 0.4em;
}
.admin-form .add-field .col-xs-6 .panel-heading {
border-width: 1px;
border-style: solid;
border-color: #bbb;
border-radius: 4px;
}
.admin-form .oscar-field-select {
margin: 10px 0 10px;
}
.view-form-btn.span {
padding-right:0.6em;
}
.status-light.status-light-off {
color: #BE0000;
}
.status-light.status-light-on {
color: #33CC00;
}
/* Styles for form list view (/forms) */
section.public-form {
padding: 0 10% 0 10%;
}
section.public-form .form-submitted {
height: 100%;
}
section.public-form .btn {
border: 1px solid;
}
.form-item {
border-radius: 5px;
text-align: center;
background-color: #eee;
width: 180px;
position: relative;
height: 215px;
margin-bottom: 45px;
}
.form-item.paused {
background-color: red;
color: white;
}
.form-item.paused:hover {
background-color: darkred;
color: white;
}
.form-item.create-new input[type='text']{
width: inherit;
color:black;
border:none;
}
.form-item.create-new {
background-color: #3FA2F7;
color: white;
}
.form-item.create-new:hover {
background-color: #276496;
}
/*CREATE-NEW FORM MODAL*/
.form-item.create-new.new-form {
background-color: #832383;
background-color: rgb(300,131,131);
z-index: 11;
}
.form-item.create-new.new-form:hover {
background-color: #3079b5;
}
.form-item.new-form input[type='text'] {
margin-top:0.2em;
width: inherit;
color:black;
border:none;
padding: 0.3em 0.6em 0.3em 0.6em;
}
.form-item.new-form .custom-select {
margin-top: 0.2em
}
.form-item.new-form .custom-select select {
background-color: white;
}
.form-item.new-form .details-row {
margin-top: 1em;
}
.form-item.new-form .details-row.submit {
margin-top: 1.7em;
}
.form-item.new-form .details-row.submit .btn {
font-size: 0.95em;
}
.form-item.new-form .title-row {
margin-top: 1em;
top:0;
}
/*Modal overlay (for lightbox effect)*/
.overlay {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #000;
background-color: rgba(0,0,0,0.5);
z-index: 10;
}
.overlay.submitform {
background-color: #fff;
background-color: rgba(256,256,256,0.8);
}
/*Modal overlay for live preview in Design Tab of Admin Form page*/
.overlay.previewform {
position: absolute;
}
.field-directive {
z-index: 9;
padding: 10% 10% 10% 0;
border: 25px transparent solid;
position: relative;
}
.activeField {
z-index: 11;
position: relative;
background-color: transparent;
}
.activeField.field-directive {
display: inline-block;
border-radius: 7px;
width: 100%;
border: 25px transparent solid;
}
.activeField input {
background-color: transparent;
}
h3.forms-list-title {
color: #3FA2F7;
font-weight: 600;
margin-bottom: 3em;
}
.form-item {
color: #71AADD;
background-color: #E4F1FD;
}
.form-item:hover {
background-color: #3FA2F7;
color: #23527C;
}
.form-item.create-new:hover {
background-color: #d9d9d9;
color: white;
}
.form-item.create-new:hover {
background-color: #515151;
background-color: rgb(81,81,81);
}
.form-item > .row.footer {
position: absolute;
bottom: 0;
left: 30%;
}
.form-item .title-row {
position: relative;
top: 15px;
padding-top:3em;
padding-bottom:1em;
}
.form-item .title-row h4 {
font-size: 1.3em;
}
.form-item.create-new .title-row{
padding: 0;
}
.form-item.create-new .title-row h4 {
font-size: 7em;
}
.form-item .details-row{
margin-top: 3.2em;
}
.form-item .details-row small {
font-size: 0.6em;
}
.form-item.create-new .details-row small {
font-size: 0.95em;
}

View File

@ -4,16 +4,21 @@
angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter', '$filter', '$rootScope', 'Auth', 'SendVisitorData',
function ($http, TimeCounter, $filter, $rootScope, Auth, SendVisitorData) {
return {
templateUrl: 'modules/forms/base/views/directiveViews/form/submit-form.client.view.html',
templateUrl: '/static/modules/forms/base/views/directiveViews/form/submit-form.client.view.html',
restrict: 'E',
scope: {
myform:'='
myform:'=',
ispreview: '='
},
controller: function($document, $window, $scope){
$scope.authentication = $rootScope.authentication;
$scope.noscroll = false;
$scope.forms = {};
//Don't start timer if we are looking at a design preview
if($scope.ispreview){
TimeCounter.restartClock();
}
var form_fields_count = $scope.myform.visible_form_fields.filter(function(field){
if(field.fieldType === 'statement' || field.fieldType === 'rating'){
return false;
@ -45,9 +50,10 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
};
$scope.setActiveField($scope.myform.visible_form_fields[0]._id, 0, false);
//console.log($scope.selected);
//Reset Timer
TimeCounter.restartClock();
if(!$scope.ispreview){
TimeCounter.restartClock();
}
};
//Fire event when window is scrolled
@ -155,8 +161,6 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
}
});
}
};
$rootScope.nextField = $scope.nextField = function(){
@ -200,6 +204,16 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
$rootScope.submitForm = $scope.submitForm = function(cb) {
//Don't submit anything if we are looking at a design preview
if ($scope.ispreview) {
$scope.myform.submitted = true;
$scope.loading = false;
//Reload our form
$scope.reloadForm();
return;
}
var _timeElapsed = TimeCounter.stopClock();
$scope.loading = true;

View File

@ -22,7 +22,7 @@
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
placeholder="MM/DD/YYYY"
ng-focus="setActiveField(field._id, index, true)"
on-tab-key="nextField()"

View File

@ -20,7 +20,7 @@
search-by="option_value"
set-search-to-answer="true"
ng-required="field.required"
ng-disabled="field.disabled"
on-tab-and-shift-key="prevField()"
on-tab-key="nextField()"
ng-change="$root.nextField()">

View File

@ -1 +1 @@
<input ng-focus="setActiveField(field._id, index, true)" ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}" type="hidden" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" value="{{field.fieldValue}}" ng-disabled="field.disabled">
<input ng-focus="setActiveField(field._id, index, true)" ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}" type="hidden" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" value="{{field.fieldValue}}" >

View File

@ -26,7 +26,7 @@
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
ng-change="$root.nextField()"/>
<div class="letter" style="float:left">
Y
@ -41,7 +41,7 @@
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
ng-change="$root.nextField()"/>
<div class="letter" style="float:left">
N

View File

@ -32,7 +32,7 @@
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
ng-change="$root.nextField()"/>
<span ng-bind="option.option_value" style="white-space: normal;"></span>

View File

@ -23,7 +23,7 @@
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
ng-focus="setActiveField(field._id, index, true)"

View File

@ -21,7 +21,7 @@
ng-class="{ 'no-border': !!field.fieldValue }"
value="{{field.fieldValue}}"
ng-required="field.required"
ng-disabled="field.disabled"
ng-focus="setActiveField(field._id, index, true)"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
@ -31,7 +31,7 @@
</div>
<div>
<div class="btn btn-lg btn-default hidden-xs"
<div class="btn btn-lg btn-default"
style="padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)">
<button ng-disabled="!field.fieldValue || forms.myForm.{{field.fieldType}}{{$index}}.$invalid"
ng-style="{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"

View File

@ -33,7 +33,7 @@
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
ng-required="field.required"
ng-disabled="field.disabled"
aria-describedby="inputError2Status">
</div>
<div class="col-xs-12">
@ -47,7 +47,7 @@
</div>
</div>
<div>
<div class="btn btn-lg btn-default col-xs-12 col-sm-4 hidden-xs"
<div class="btn btn-lg btn-default"
style="padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)">
<button ng-disabled="!field.fieldValue || forms.myForm.{{field.fieldType}}{{$index}}.$invalid"
ng-style="{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"

View File

@ -30,7 +30,7 @@
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-change="$root.nextField()"
ng-disabled="field.disabled" />
/>
<div class="letter">
{{ 'Y' | translate }}
</div>
@ -49,7 +49,7 @@
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-change="$root.nextField()"
ng-disabled="field.disabled"/>
/>
<div class="letter">
{{ 'N' | translate }}

View File

@ -1,4 +1,5 @@
<section class="overlay submitform" ng-if="loading || (!myform.submitted && !myform.startPage.showStart)"></section>
<section class="overlay submitform" ng-if="!ispreview && (loading || (!myform.submitted && !myform.startPage.showStart))"></section>
<section class="overlay previewform submitform" ng-if="ispreview && (loading || (!myform.submitted && !myform.startPage.showStart))"></section>
<!-- Start Page View -->
<div ng-show="!myform.submitted && myform.startPage.showStart"

View File

@ -1,5 +1,3 @@
<section class="public-form" ng-style="{ 'background-color': myform.design.colors.backgroundColor }">
<submit-form-directive myform="myform"></submit-form-directive>
</section>

18
config/env/all.js vendored
View File

@ -100,14 +100,13 @@ module.exports = {
'public/config.js',
'public/application.js',
'public/dist/populate_template_cache.js',
'public/form_modules/forms/*.js',
'public/form_modules/forms/base/**/*.js',
'!public/modules/forms/base/**/*.js',
'public/modules/*/*.js',
'public/modules/*/*/*/*/*.js',
'public/modules/*/*/*.js',
'public/modules/*/*/*/*.js',
'!public/modules/**/gruntfile.js',
'!public/modules/**/demo/**/*.js',
'!public/modules/**/dist/**/*.js',
'!public/modules/**/node_modules/**/*.js',
'public/modules/*/*/*/*/*.js',
'!public/modules/**/tests/**/*.js'
],
form_js: [
@ -115,16 +114,17 @@ module.exports = {
'public/form-application.js',
'public/dist/form_populate_template_cache.js',
'public/form_modules/forms/*.js',
'public/form_modules/forms/*/*/*/*.js',
'public/form_modules/forms/*/*.js',
'public/form_modules/forms/*/*/*.js',
'public/form_modules/forms/**.js'
'public/form_modules/forms/*/*/*/*.js',
'public/form_modules/forms/**.js',
'!public/form_modules/**/tests/**/*.js'
],
views: [
'public/modules/**/*.html',
'!public/modules/**/demo/**/*.html',
'public/form_modules/forms/base/**/*.html',
'!public/modules/forms/base/**/*.html',
'!public/modules/**/dist/**/*.html',
'!public/modules/**/node_modules/**/*.html',
'!public/modules/**/tests/**/*.html'
],
unit_tests: [

View File

@ -59,7 +59,7 @@ module.exports = function(db) {
if(config.socketPort && process.env.NODE_ENV !== 'production'){
app.locals.socketPort = config.socketPort;
} else {
app.locals.socketPort = "";
app.locals.socketPort = '';
}
if(config.socketUrl){
@ -80,7 +80,7 @@ module.exports = function(db) {
var User = mongoose.model('User');
var subdomainPath = '/subdomain/';
var subdomains = req.subdomains;
if (subdomains.slice(0, 4).join('.') + '' === '1.0.0.127') {
subdomains = subdomains.slice(4);
}

View File

@ -26,7 +26,7 @@ module.exports = function(grunt) {
serverViews: ['app/views/**/*.*'],
serverJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js', '!app/tests/'],
clientViews: ['public/modules/**/views/**.html'],
clientViews: ['public/modules/**/*.html', 'public/form_modules/forms/base/**/*.html', '!public/modules/forms/base/**/*.html',],
clientJS: ['public/js/*.js', 'public/form_modules/**/*.js', 'public/modules/**/*.js'],
clientCSS: ['public/modules/**/*.css', 'public/form_modules/**/*.css', '!public/modules/**/demo/**/*.css', '!public/modules/**/dist/**/*.css'],
@ -311,7 +311,7 @@ module.exports = function(grunt) {
options: {
module: 'TellForm.templates'
},
src: ['public/modules/**/views/**.html', 'public/modules/**/views/**/*.html'],
src: ['public/modules/**/views/**.html', 'public/modules/**/views/**/*.html', 'public/form_modules/forms/base/**/*.html', '!public/modules/forms/base/**/*.html'],
dest: 'public/dist/populate_template_cache.js'
}
},

View File

@ -3,8 +3,8 @@
// Init the application configuration module for AngularJS application
var ApplicationConfiguration = (function() {
// Init module configuration options
var applicationModuleName = 'NodeForm';
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'ngSanitize', 'vButton', 'ngResource', 'TellForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate'];
var applicationModuleName = 'TellForm';
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'ngSanitize', 'vButton', 'ngResource', 'TellForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate', 'view-form'];
// Add a new vertical module
var registerModule = function(moduleName, dependencies) {

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@ var __indexOf = [].indexOf || function(item) {
angular.module('view-form').directive('fieldDirective', ['$http', '$compile', '$rootScope', '$templateCache', 'supportedFields',
function($http, $compile, $rootScope, $templateCache, supportedFields) {
var getTemplateUrl = function(fieldType) {
var getTemplateHtml = function(fieldType) {
var type = fieldType;
var supported_fields = [
@ -101,7 +101,7 @@ angular.module('view-form').directive('fieldDirective', ['$http', '$compile', '$
fieldType = 'textfield';
}
var template = getTemplateUrl(fieldType);
var template = getTemplateHtml(fieldType);
element.html(template).show();
var output = $compile(element.contents())(scope);
}

View File

@ -12,29 +12,34 @@ jsep.addBinaryOp('!ends', 10);
angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCounter', '$filter', '$rootScope', 'SendVisitorData',
function ($http, TimeCounter, $filter, $rootScope, SendVisitorData) {
return {
templateUrl: 'form_modules/forms/base/views/directiveViews/form/submit-form.client.view.html',
templateUrl: '/static/form_modules/forms/base/views/directiveViews/form/submit-form.client.view.html',
restrict: 'E',
scope: {
myform:'='
myform:'=',
ispreview: '='
},
controller: function($document, $window, $scope){
$scope.noscroll = false;
$scope.forms = {};
TimeCounter.restartClock();
//Don't start timer if we are looking at a design preview
if($scope.ispreview){
TimeCounter.restartClock();
}
var form_fields_count = $scope.myform.visible_form_fields.filter(function(field){
if(field.fieldType === 'statement'){
return false;
}
return true;
}).length;
var form_fields_count = $scope.myform.visible_form_fields.filter(function(field){
if(field.fieldType === 'statement'){
return false;
}
return true;
}).length;
var nb_valid = $filter('formValidity')($scope.myform);
$scope.translateAdvancementData = {
done: nb_valid,
total: form_fields_count,
answers_not_completed: form_fields_count - nb_valid
};
var nb_valid = $filter('formValidity')($scope.myform);
$scope.translateAdvancementData = {
done: nb_valid,
total: form_fields_count,
answers_not_completed: form_fields_count - nb_valid
};
$scope.reloadForm = function(){
//Reset Form
@ -330,7 +335,6 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
var geoData = getIpAndGeo();
form.ipAddr = geoData.ipAddr;
form.geoLocation = geoData.geoLocation;
console.log(geoData);
form.timeElapsed = _timeElapsed;
form.percentageComplete = $filter('formValidity')($scope.myform) / $scope.myform.visible_form_fields.length * 100;
@ -358,7 +362,7 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
};
//Reload our form
$scope.reloadForm();
$scope.reloadForm();
}
};
}

View File

@ -22,11 +22,10 @@
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
placeholder="MM/DD/YYYY"
on-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
ng-change="$root.nextField()">
ng-change="nextField()">
</div>
</div>
</div>

View File

@ -20,10 +20,9 @@
search-by="option_value"
set-search-to-answer="true"
ng-required="field.required"
ng-disabled="field.disabled"
on-tab-and-shift-key="prevField()"
on-tab-key="nextField()"
ng-change="$root.nextField()">
ng-change="nextField()">
<ui-select-match placeholder="Type or select an option">
</ui-select-match>
<ui-select-choices repeat="option in field.fieldOptions | filter: $select.search"

View File

@ -1 +1 @@
<input ng-focus="setActiveField(field._id, index, true)" ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}" type="hidden" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" value="{{field.fieldValue}}" ng-disabled="field.disabled">
<input type="hidden"></input>

View File

@ -1,7 +1,10 @@
<div class="field row radio legal"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
key-to-truthy key-char-truthy="y" key-char-falsey="n" field="field" on-valid-key="nextField()">
key-to-truthy key-char-truthy="y"
key-char-falsey="n"
field="field"
on-valid-key="nextField()">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3>
<small class="field-number">
@ -24,7 +27,6 @@
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
ng-change="nextField()"/>
<div class="letter" style="float:left">
Y
@ -39,7 +41,6 @@
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
ng-change="nextField()"/>
<div class="letter" style="float:left">
N

View File

@ -1,5 +1,6 @@
<div class="field row radio"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
key-to-option field="field"
ng-if="field.fieldOptions.length > 0">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
@ -30,7 +31,6 @@
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
ng-change="$root.nextField()"/>
<span ng-bind="option.option_value"></span>

View File

@ -1,5 +1,4 @@
<div class="textfield field row"
on-enter-or-tab-key="nextField()">
<div class="textfield field row">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3>
<small class="field-number">
@ -25,7 +24,6 @@
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-disabled="field.disabled"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
class="angular-input-stars focusOn">

View File

@ -21,7 +21,6 @@
ng-class="{ 'no-border': !!field.fieldValue }"
value="{{field.fieldValue}}"
ng-required="field.required"
ng-disabled="field.disabled"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
style="border: none; border-left: lightgrey dashed 2px;">
@ -30,7 +29,7 @@
</div>
<div>
<div class="btn btn-lg btn-default col-xs-12 col-sm-4 hidden-xs"
<div class="btn btn-lg btn-default"
style="padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)">
<button ng-disabled="!field.fieldValue || forms.myForm.{{field.fieldType}}{{$index}}.$invalid"
ng-style="{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"

View File

@ -32,7 +32,6 @@
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
ng-required="field.required"
ng-disabled="field.disabled"
aria-describedby="inputError2Status" />
</div>
<div class="col-xs-12">
@ -46,7 +45,7 @@
</div>
</div>
<div>
<div class="btn btn-lg btn-default col-xs-12 col-sm-4 hidden-xs"
<div class="btn btn-lg btn-default"
style="padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)">
<button ng-disabled="!field.fieldValue || field.$invalid"
ng-style="{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"

View File

@ -1,9 +1,10 @@
<div class="field row radio"
ng-click="setActiveField(field._id, index, true)"
on-tab-and-shift-key="prevField()"
key-to-truthy key-char-truthy="y" key-char-falsey="n" field="field"
on-valid-key="nextField()"
ng-show="!field.disabled">
key-to-truthy key-char-truthy="y" key-char-falsey="n"
field="field"
on-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
on-valid-key="nextField()">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3 class="row">
<small class="field-number">

View File

@ -1,4 +1,5 @@
<section class="overlay submitform" ng-if="loading || (!myform.submitted && !myform.startPage.showStart)"></section>
<section class="overlay submitform" ng-if="!ispreview && (loading || (!myform.submitted && !myform.startPage.showStart))"></section>
<section class="overlay previewform submitform" ng-if="ispreview && (loading || (!myform.submitted && !myform.startPage.showStart))"></section>
<!-- Start Page View -->
<div ng-show="!myform.submitted && myform.startPage.showStart"

View File

@ -1,5 +1,3 @@
<section class="public-form" ng-style="{ 'background-color': myform.design.colors.backgroundColor }">
<submit-form-directive myform="myform"></submit-form-directive>
</section>

View File

@ -1,12 +1,8 @@
'use strict';
// Forms controller
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) {
return $sce.trustAsResourceUrl(src);
};
angular.module('forms').controller('AdminFormController', ['$rootScope', '$window', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal', 'myForm', '$filter',
function($rootScope, $window, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal, myForm, $filter) {
//Set active tab to Create
$scope.activePill = 0;
@ -22,6 +18,9 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
$rootScope.saveInProgress = false;
CurrentForm.setForm($scope.myform);
console.log("$scope.myform");
console.log($scope.myform);
$scope.formURL = '/#!/forms/' + $scope.myform._id;

View File

@ -1,8 +1,8 @@
'use strict';
// Forms controller
angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal',
function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal) {
angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope', '$stateParams', '$state', 'GetForms', 'CurrentForm', '$http', '$uibModal',
function($rootScope, $scope, $stateParams, $state, GetForms, CurrentForm, $http, $uibModal) {
$scope = $rootScope;
$scope.forms = {};
@ -51,7 +51,7 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
// Return all user's Forms
$scope.findAll = function() {
Forms.query(function(_forms){
GetForms.query(function(_forms){
$scope.myforms = _forms;
});
};

View File

@ -63,7 +63,7 @@
<edit-form-directive myform="myform"></edit-form-directive>
</uib-tab>
<uib-tab ng-repeat="tab in tabData" index="{{$index+1}}" heading="{{tab.heading}}">
<div class='row' data-ng-include="'/static/modules/forms/admin/views/adminTabs/'+tab.templateName+'.html'" onload="form_url = trustSrc(formURL)"></div>
<div class='row' data-ng-include="'/static/modules/forms/admin/views/adminTabs/'+tab.templateName+'.html'"></div>
</uib-tab>
<uib-tab index="2" heading="{{ 'ANALYZE_TAB' | translate }}">
<edit-submissions-form-directive myform="myform" user="myform.admin"></edit-submissions-form-directive>
@ -117,7 +117,7 @@
<uib-tab ng-if="tabData && myform.form_fields.length" heading="{{ 'DESIGN_TAB' | translate }}" index="{{tabData.length}}+1">
<div class="config-form design container">
<div class="row">
<div class="col-md-4 col-sm-12">
<div class="col-sm-4 col-xs-12">
<div class="row field">
<div class="field-title col-sm-5">
<h5>{{ 'BACKGROUND_COLOR' | translate }}</h5>
@ -170,8 +170,10 @@
</div>
</div>
</div>
<div class="col-md-8 hide-md hide-lg">
<iframe id="iframe" ng-if="!!formURL" src="{{trustSrc(formURL)}}" style="border: none; box-shadow: 0px 0px 10px 0px grey; overflow: hidden; height: 400px; width: 90%; position: absolute;"></iframe>
<div class="col-sm-8 hidden-xs">
<div class="public-form preview" ng-style="{ 'background-color': myform.design.colors.backgroundColor }">
<submit-form-directive myform="myform" ispreview="true"></submit-form-directive>
</div>
</div>
</div>
@ -185,55 +187,6 @@
</div>
</div>
</uib-tab>
<uib-tab ng-if="tabData" heading="{{ 'ANALYZE_TAB' | translate }}" index="{{tabData.length+2}}">
<edit-submissions-form-directive myform="myform" user="myform.admin"></edit-submissions-form-directive>
</uib-tab>
<uib-tab ng-if="tabData" heading="{{ 'SHARE_TAB' | translate }}" index="{{tabData.length+3}}">
<div class="config-form">
<div class="row">
<div class="col-sm-12">
<uib-tabset active="activePill" vertical="true" type="pills">
<uib-tab index="0" heading="{{ 'SHARE_YOUR_FORM' | translate }}">
<div class="row">
<div class="col-sm-12">
{{ 'TELLFORM_URL' | translate }}
</div>
<div class="col-sm-8 form-input">
<span ngclipboard data-clipboard-target="#copyURL"> <input id="copyURL" ng-value="actualFormURL" class="form-control ng-pristine ng-untouched ng-valid"> </span>
</div>
<div class="col-sm-4">
<button class="btn btn btn-secondary view-form-btn" ngclipboard data-clipboard-target="#copyURL">
{{ 'COPY' | translate }} <i class="fa fa-clipboard" aria-hidden="true"></i>
</button>
</div>
</div>
</uib-tab>
<uib-tab index="1" heading="{{ 'EMBED_YOUR_FORM' | translate }}">
<div class="row">
<div class="col-sm-12">
{{ 'COPY_AND_PASTE' | translate }}
</div>
<div class="col-sm-8 form-input">
<span ngclipboard data-clipboard-target="#copyEmbedded">
<textarea id="copyEmbedded" class="form-control ng-pristine ng-untouched ng-valid" style="min-height:200px; width:100%; background-color: #FFFFCC; color: #30313F;">
&lt;!-- {{ 'CHANGE_WIDTH_AND_HEIGHT' | translate }} --&gt;
<iframe id="iframe" src="{{actualFormURL}}" style="width:100%;height:500px;"></iframe>
<div style="font-family: Sans-Serif;font-size: 12px;color: #999;opacity: 0.5; padding-top: 5px;">{{ 'POWERED_BY' | translate }} <a href="https://www.tellform.com" style="color: #999" target="_blank">TellForm</a></div>
</textarea>
</span>
</div>
<div class="col-sm-4">
<button class="btn btn btn-secondary view-form-btn" ngclipboard data-clipboard-target="#copyEmbedded">
{{ 'COPY' | translate }} <i class="fa fa-clipboard" aria-hidden="true"></i>
</button>
</div>
</div>
</uib-tab>
</uib-tabset>
</div>
</div>
</div>
</uib-tab>
</uib-tabset>
</div>
</div>

View File

@ -379,20 +379,6 @@
</div>
</div>
<div class="row">
<div class="col-md-4 col-xs-12 field-input">{{ 'DISABLED' | translate }}</div>
<div class="col-md-8 col-xs-12 field-input">
<label class="switch-light switch-holo">
<input type="checkbox" ng-model="field.disabled">
<span>
<span> {{ 'OFF' | translate }}</span>
<span> {{ 'ON' | translate }}</span>
<a></a>
</span>
</label>
</div>
</div>
<div class="row">
<div class="col-md-4 col-xs-12 field-input">{{ 'LOGIC_JUMP' | translate }}</div>
<div class="col-md-8 col-xs-12 field-input">
@ -558,7 +544,7 @@
<div class="panel-group dropzone" ui-sortable="sortableOptions" ng-model="myform.form_fields">
<div class="panel panel-default" ng-repeat="field in myform.form_fields"
<div class="panel panel-default" ng-repeat="field in myform.form_fields track by $index"
ng-if="!field.deletePreserved"
ng-click="openEditModal(field)">
<div class="panel-heading">

View File

@ -269,7 +269,7 @@
<input ng-model="table.masterChecker" ng-change="toggleAllCheckers()" type="checkbox"/>
</th>
<th>#</th>
<th data-ng-repeat="(key, value) in myform.form_fields">
<th data-ng-repeat="(key, value) in myform.form_fields track by $index">
{{value.title}}
</th>
<th>

View File

@ -46,6 +46,16 @@ div.tab-content {
margin-top: 70px;
}
.public-form.preview {
border: none;
box-shadow: 0px 0px 10px 0px grey;
overflow-y: scroll;
overflow-x: hidden;
height: 400px;
width: 90%;
position: absolute;
}
.public-form input, .public-form textarea {
background-color: #000000;
background-color: rgba(0,0,0,0);
@ -127,7 +137,7 @@ section.content > section > section.container {
div.form-fields {
position: relative;
padding-top: 35vh;
padding-top: 10%;
}
.public-form .letter {
position: relative;
@ -152,7 +162,7 @@ div.form-fields {
div.form-submitted > .field.row {
padding-bottom: 2%;
margin-top: 35vh;
margin-top: 10%;
}
div.form-submitted > .field.row > div {
font-size: 1.7em;
@ -426,7 +436,7 @@ section.public-form {
padding: 0 10% 0 10%;
}
section.public-form .form-submitted {
height: 100vh;
height: 100%;
}
section.public-form .btn {
@ -524,6 +534,12 @@ section.public-form .btn {
background-color: #fff;
background-color: rgba(256,256,256,0.8);
}
/*Modal overlay for live preview in Design Tab of Admin Form page*/
.overlay.previewform {
position: absolute;
}
.field-directive {
z-index: 9;
padding: 10% 10% 10% 0;

View File

@ -10,8 +10,7 @@ angular.module('forms').run(['Menus',
return function(seconds) {
return new Date(1970, 0, 1).setSeconds(seconds);
};
}]).filter('formValidity',
function(){
}]).filter('formValidity', [function(){
return function(formObj){
if(formObj && formObj.form_fields && formObj.visible_form_fields){
@ -37,7 +36,12 @@ angular.module('forms').run(['Menus',
}
return 0;
};
}).config(['$provide', function ($provide){
}]).filter('trustSrc', ['$sce', function($sce){
return function(formUrl){
console.log(' $sce.trustAsResourceUrl(formUrl): '+ $sce.trustAsResourceUrl(formUrl));
return $sce.trustAsResourceUrl(formUrl);
};
}]).config(['$provide', function ($provide){
$provide.decorator('accordionDirective', function($delegate) {
var directive = $delegate[0];
directive.replace = true;

View File

@ -16,10 +16,15 @@ angular.module('forms').config(['$stateProvider',
hideNav: true
},
resolve: {
Forms: 'Forms',
myForm: function (Forms, $stateParams) {
return Forms.get({formId: $stateParams.formId}).$promise;
}
Forms: 'GetForms',
myForm: function (GetForms, $stateParams, $q) {
var deferred = $q.defer();
GetForms.get({formId: $stateParams.formId}, function(resolvedForm){
deferred.resolve(resolvedForm);
});
return deferred.promise;
}
},
controller: 'SubmitFormController',
controllerAs: 'ctrl'
@ -30,9 +35,14 @@ angular.module('forms').config(['$stateProvider',
permissions: [ 'editForm' ]
},
resolve: {
Forms: 'Forms',
myForm: function (Forms, $stateParams) {
return Forms.get({formId: $stateParams.formId}).$promise;
Forms: 'GetForms',
myForm: function (GetForms, $stateParams, $q) {
var deferred = $q.defer();
GetForms.get({formId: $stateParams.formId}, function(resolvedForm){
deferred.resolve(resolvedForm);
});
return deferred.promise;
}
},
controller: 'AdminFormController'

View File

@ -0,0 +1,32 @@
'use strict';
//Forms service used for communicating with the forms REST endpoints
angular.module('forms').factory('GetForms', ['$resource', 'FORM_URL',
function($resource, FORM_URL) {
return $resource(FORM_URL, {
formId: '@_id'
}, {
'query' : {
method: 'GET',
isArray: true
},
'get' : {
method: 'GET',
transformResponse: function(data, header) {
var form = angular.fromJson(data);
form.visible_form_fields = _.filter(form.form_fields, function(field){
return (field.deletePreserved === false);
});
return form;
}
},
'update': {
method: 'PUT'
},
'save': {
method: 'POST'
}
});
}
]);

View File

@ -30,6 +30,11 @@ angular.module('users').controller('AuthenticationController', ['$scope', '$loca
};
$scope.signup = function() {
if($scope.credentials === 'admin'){
$scope.error = 'Username cannot be \'admin\'. Please pick another username.'
return;
}
User.signup($scope.credentials).then(
function(response) {
$state.go('signup-success');

View File

@ -7,8 +7,8 @@ exports.run = function(app, db, cb) {
var User = mongoose.model('User');
var email = config.ADMIN_EMAIL || 'admin@admin.com';
var username = config.ADMIN_USERNAME || 'admin';
var password = config.ADMIN_PASSWORD || 'admin';
var username = config.ADMIN_USERNAME || 'root';
var password = config.ADMIN_PASSWORD || 'root';
var newUser = new User({
firstName: 'Admin',