made landing page pretty
This commit is contained in:
parent
ce8e244653
commit
78b08af8c7
|
@ -160,8 +160,11 @@ exports.listSubmissions = function(req, res) {
|
|||
* Create a new form
|
||||
*/
|
||||
exports.create = function(req, res) {
|
||||
var form = new Form(req.body);
|
||||
var form = new Form(req.body.form);
|
||||
|
||||
form.admin = req.user;
|
||||
console.log(form);
|
||||
console.log(req.user);
|
||||
|
||||
form.save(function(err) {
|
||||
if (err) {
|
||||
|
|
|
@ -29,11 +29,15 @@ var FormSchema = new Schema({
|
|||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
trim: true,
|
||||
unique: true,
|
||||
required: 'Title cannot be blank'
|
||||
},
|
||||
language: {
|
||||
type: String,
|
||||
enum: ['english', 'french', 'spanish'],
|
||||
required: 'Form must have a language'
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
default: '',
|
||||
|
@ -64,7 +68,7 @@ var FormSchema = new Schema({
|
|||
},
|
||||
hideFooter: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
default: false,
|
||||
},
|
||||
isGenerated: {
|
||||
type: Boolean,
|
||||
|
@ -72,7 +76,7 @@ var FormSchema = new Schema({
|
|||
},
|
||||
isLive: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
default: false,
|
||||
},
|
||||
autofillPDFs: {
|
||||
type: Boolean,
|
||||
|
@ -91,24 +95,6 @@ FormSchema.pre('remove', function (next) {
|
|||
}
|
||||
});
|
||||
|
||||
//Create folder for user's pdfs
|
||||
FormSchema.pre('save', function (next) {
|
||||
var newDestination = path.join(config.pdfUploadPath, this.admin.username.replace(/ /g,'')),
|
||||
stat = null;
|
||||
|
||||
try {
|
||||
stat = fs.statSync(newDestination);
|
||||
} catch (err) {
|
||||
fs.mkdirSync(newDestination);
|
||||
}
|
||||
if (stat && !stat.isDirectory()) {
|
||||
// console.log('Directory cannot be created');
|
||||
next( new Error('Directory cannot be created because an inode of a different type exists at "' + newDestination + '"') );
|
||||
}else{
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
//Update lastModified and created everytime we save
|
||||
FormSchema.pre('save', function (next) {
|
||||
var now = new Date();
|
||||
|
|
|
@ -59,9 +59,9 @@ var FormFieldSchema = new Schema({
|
|||
type: String,
|
||||
default: '',
|
||||
},
|
||||
options: [{
|
||||
fieldOptions: [{
|
||||
type: String
|
||||
}]
|
||||
}],
|
||||
required: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
*/
|
||||
var mongoose = require('mongoose'),
|
||||
Schema = mongoose.Schema,
|
||||
crypto = require('crypto');
|
||||
crypto = require('crypto'),
|
||||
config = require('../../config/config'),
|
||||
fs = require('fs-extra'),
|
||||
path = require('path');
|
||||
|
||||
/**
|
||||
* A Validation function for local strategy properties
|
||||
|
@ -75,6 +78,12 @@ var UserSchema = new Schema({
|
|||
}],
|
||||
default: ['user']
|
||||
},
|
||||
language: {
|
||||
type: String,
|
||||
enum: ['english', 'french', 'spanish'],
|
||||
default: 'english',
|
||||
required: 'User must have a language'
|
||||
},
|
||||
updated: {
|
||||
type: Date
|
||||
},
|
||||
|
@ -92,6 +101,24 @@ var UserSchema = new Schema({
|
|||
token: String
|
||||
});
|
||||
|
||||
//Create folder for user's pdfs
|
||||
UserSchema.pre('save', function (next) {
|
||||
var newDestination = path.join(config.pdfUploadPath, this.username.replace(/ /g,'')),
|
||||
stat = null;
|
||||
|
||||
try {
|
||||
stat = fs.statSync(newDestination);
|
||||
} catch (err) {
|
||||
fs.mkdirSync(newDestination);
|
||||
}
|
||||
if (stat && !stat.isDirectory()) {
|
||||
// console.log('Directory cannot be created');
|
||||
next( new Error('Directory cannot be created because an inode of a different type exists at "' + newDestination + '"') );
|
||||
}else{
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Hook a pre save method to hash the password
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{% extends 'layout.server.view.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
<section ui-view></section>
|
||||
{% endblock %}
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
<header data-ng-include="'/modules/core/views/header.client.view.html'"></header>
|
||||
<section class="content">
|
||||
<!-- <section class="container"> -->
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
<!-- </section> -->
|
||||
</section>
|
||||
|
|
|
@ -4,7 +4,7 @@ angular.module('core').controller('HeaderController', ['$rootScope','$scope','Me
|
|||
function ($rootScope, $scope, Menus, $state, Auth, User) {
|
||||
$scope.user = $rootScope.user = Auth.ensureHasCurrentUser(User);
|
||||
$scope.authentication = $rootScope.authentication = Auth;
|
||||
|
||||
$rootScope.languages = $scope.languages = ['english', 'french', 'spanish'];
|
||||
// console.log('isAuthenticated(): '+$scope.authentication.isAuthenticated());
|
||||
|
||||
$scope.isCollapsed = false;
|
||||
|
|
|
@ -5,7 +5,6 @@ angular.module('core').controller('HomeController', ['$rootScope', '$scope', 'Us
|
|||
function($rootScope, $scope, User, Auth, $state) {
|
||||
$scope = $rootScope;
|
||||
|
||||
console.log($rootScope.user);
|
||||
$scope.user = Auth.ensureHasCurrentUser(User);
|
||||
$scope.authentication = Auth;
|
||||
|
||||
|
|
|
@ -4,15 +4,25 @@
|
|||
border: 0;
|
||||
}
|
||||
.navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:hover {
|
||||
background-color:#ddd;
|
||||
/*background-color:#ddd;*/
|
||||
}
|
||||
.navbar .navbar-brand {
|
||||
font-size: 1.6em;
|
||||
font-weight: 900;
|
||||
/*color: #FA787E;*/
|
||||
color: rgb(300,131,131);
|
||||
}
|
||||
.navbar .navbar-brand:hover, .navbar .navbar-brand:visited {
|
||||
color: #FA787E;
|
||||
}
|
||||
.navbar .navbar-brand:hover {
|
||||
color: #000;
|
||||
.navbar li.dropdown a.dropdown-toggle:hover > *{
|
||||
color: black;
|
||||
}
|
||||
.navbar li.dropdown a.dropdown-toggle > *{
|
||||
color: #d9d9d9;
|
||||
}
|
||||
.navbar li.dropdown.open a.dropdown-toggle:hover > *{
|
||||
color: white;
|
||||
}
|
||||
.navbar .navbar-brand span {
|
||||
text-decoration: underline;
|
||||
|
@ -44,21 +54,31 @@ body.ng-cloak
|
|||
|
||||
/*Hero Section CSS (for /home)*/
|
||||
section.hero-section {
|
||||
/*padding-top:30px;*/
|
||||
width: 100%;
|
||||
}
|
||||
section.hero-section > .jumbotron {
|
||||
background-image: url(http://yourplaceandmine.ie/wp-content/uploads/2014/09/Daingean-meeting-048_13-1080x675.jpg);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 50%;
|
||||
/*background-position-top: 0px;*/
|
||||
background-size: cover;
|
||||
section.hero-section .jumbotron {
|
||||
background-color: transparent;
|
||||
color:#fff;
|
||||
}
|
||||
.image-background {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 110%;
|
||||
width: 100%;
|
||||
z-index: -98;
|
||||
background-image: url(http://yourplaceandmine.ie/wp-content/uploads/2014/09/Daingean-meeting-048_13-1080x675.jpg);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 50%;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
section > .jumbotron > .opacity-background {
|
||||
background-color: rgba(71,61,61,0.5);
|
||||
color: white;
|
||||
padding: inherit;
|
||||
height: inherit;
|
||||
width: inherit;
|
||||
.opacity-background {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 110%;
|
||||
width: 100%;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
z-index: -97;
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
</button>
|
||||
<a href="/#!/" class="navbar-brand">
|
||||
<!-- <i class="fa fa-5 fa-heartbeat"></i> -->
|
||||
Med<span>Form</span>
|
||||
Med<span>Forms</span>
|
||||
</a>
|
||||
</div>
|
||||
<nav class="collapse navbar-collapse" collapse="!isCollapsed" role="navigation">
|
||||
|
|
|
@ -1,26 +1,40 @@
|
|||
<section data-ng-controller="HomeController" class="hero-section">
|
||||
|
||||
<div class="opacity-background">
|
||||
</div>
|
||||
<div class="image-background">
|
||||
</div>
|
||||
<div class="jumbotron text-center">
|
||||
<div class="opacity-background">
|
||||
<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()">
|
||||
<p class="lead">
|
||||
Make beautiful forms in a snap.
|
||||
</p>
|
||||
<br><br> <br><br>
|
||||
<a class="btn btn-info" href="/#!/signup">
|
||||
Signup now
|
||||
</a>
|
||||
|
||||
|
||||
<!-- <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>
|
||||
</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">
|
||||
<i class="fa fa-archive fa-3x"></i>
|
||||
</h3>
|
||||
<h2 class="col-xs-12" style="margin-top:0px">
|
||||
Med<span style="color: #FA787E">Forms</span>
|
||||
</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;">
|
||||
Craft beautiful forms in seconds.
|
||||
</h1>
|
||||
<p class="lead col-xs-12" 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>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12" style="margin-top:7%;">
|
||||
<a class="btn btn-info" href="/#!/signup" style="background-color:#FA787E; border: none; font-size: 2em; padding: 0.3em 0.9em; color: white;">
|
||||
sign me up!
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<br>Enjoy & Keep Us Updated,
|
||||
<br>The MedForms Team.
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
angular.module('forms').run(['Menus',
|
||||
function(Menus) {
|
||||
// Set top bar menu items
|
||||
Menus.addMenuItem('topbar', 'Forms', 'forms', 'dropdown', '/forms(/create)?');
|
||||
Menus.addSubMenuItem('topbar', 'forms', 'List Forms', 'forms');
|
||||
Menus.addSubMenuItem('topbar', 'forms', 'Create Form', 'forms/create');
|
||||
Menus.addMenuItem('topbar', 'My Forms', 'forms', '', '/forms', false);
|
||||
}
|
||||
]).filter('formValidity',
|
||||
function(){
|
||||
|
|
|
@ -91,8 +91,8 @@ angular.module('forms').controller('EditFormController', ['$scope', '$state', '$
|
|||
// Redirect after save
|
||||
$scope.goToWithId('viewForm', $scope.form._id);
|
||||
}).error(function(errorResponse){
|
||||
console.log(errorResponse.data.message);
|
||||
$scope.error = errorResponse.data.message;
|
||||
console.log(errorResponse);
|
||||
$scope.error = errorResponse;
|
||||
});
|
||||
} else{
|
||||
$scope.update();
|
||||
|
|
|
@ -4,15 +4,55 @@
|
|||
angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm','$http',
|
||||
function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http) {
|
||||
|
||||
// view form submissions
|
||||
$scope.form = CurrentForm.getForm();
|
||||
$scope.myform = CurrentForm.getForm();
|
||||
$scope.submissions = undefined;
|
||||
$scope.viewSubmissions = false;
|
||||
$scope.showCreateModal = false;
|
||||
$scope.table = {
|
||||
masterChecker: true,
|
||||
rows: []
|
||||
};
|
||||
|
||||
$scope.setForm = function (form) {
|
||||
$scope.myForm = form;
|
||||
};
|
||||
|
||||
$scope.openCreateModal = function(){
|
||||
if(!$scope.showCreateModal){
|
||||
$scope.showCreateModal = true;
|
||||
}
|
||||
};
|
||||
$scope.closeCreateModal = function(){
|
||||
if($scope.showCreateModal){
|
||||
$scope.showCreateModal = false;
|
||||
}
|
||||
};
|
||||
|
||||
//Create new form
|
||||
$scope.createNew = function(){
|
||||
var form = {};
|
||||
form.title = $scope.myForm.name.$modelValue;
|
||||
form.language = $scope.myForm.language.$modelValue;
|
||||
console.log(form);
|
||||
$scope.showCreateModal = true;
|
||||
|
||||
console.log($scope.myForm);
|
||||
if($scope.myForm.$valid && $scope.myForm.$dirty){
|
||||
$http.post('/forms', {form: form})
|
||||
.success(function(data, status, headers){
|
||||
console.log('form created');
|
||||
|
||||
// Clear form fields
|
||||
$scope.myForm = {};
|
||||
// Redirect after save
|
||||
$scope.goToWithId('viewForm', $scope.myform._id);
|
||||
}).error(function(errorResponse){
|
||||
console.log(errorResponse);
|
||||
// $scope.error = errorResponse.data.message;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.saveInProgress = false;
|
||||
$scope.update = function() {
|
||||
if(!$scope.saveInProgress){
|
||||
|
@ -20,31 +60,31 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
|||
|
||||
console.log('start update()');
|
||||
|
||||
$http.put('/forms/'+$scope.form._id, {form: $scope.form})
|
||||
$http.put('/forms/'+$scope.myform._id, {form: $scope.myform})
|
||||
.then(function(response){
|
||||
console.log('form updated successfully');
|
||||
console.log('$scope.saveInProgress: '+$scope.saveInProgress);
|
||||
// $rootScope.goToWithId('viewForm', $scope.form._id);
|
||||
// $rootScope.goToWithId('viewForm', $scope.myform._id);
|
||||
}).catch(function(response){
|
||||
console.log('Error occured during form UPDATE.\n');
|
||||
console.log(response.data);
|
||||
}).finally(function() {
|
||||
$scope.saveInProgress = false;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//Table Functions
|
||||
$scope.toggleAllCheckers = function(){
|
||||
console.log('toggleAllCheckers');
|
||||
for(var i=0; i<$scope.table.rows.length; i++){
|
||||
table.rows[i].selected = $scope.table.masterChecker;
|
||||
$scope.table.rows[i].selected = $scope.table.masterChecker;
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.toggleObjSelection = function($event, description) {
|
||||
$event.stopPropagation();
|
||||
console.log('checkbox clicked');
|
||||
}
|
||||
};
|
||||
|
||||
$scope.rowClicked = function(obj) {
|
||||
console.log('row clicked');
|
||||
|
@ -55,7 +95,7 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
|||
$scope.showSubmissions = function(){
|
||||
$scope.viewSubmissions = true;
|
||||
if(!$scope.table.rows.length){
|
||||
$http.get('/forms/'+$scope.form._id+'/submissions')
|
||||
$http.get('/forms/'+$scope.myform._id+'/submissions')
|
||||
.success(function(data, status, headers){
|
||||
console.log(data);
|
||||
$scope.submissions = data;
|
||||
|
@ -66,7 +106,7 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
|||
console.log('Could not fetch form submissions.\nError: '+err);
|
||||
});
|
||||
} else if(!$scope.submissions.length){
|
||||
$http.get('/forms/'+$scope.form._id+'/submissions')
|
||||
$http.get('/forms/'+$scope.myform._id+'/submissions')
|
||||
.success(function(data, status, headers){
|
||||
$scope.submissions = data;
|
||||
$scope.table.rows = data;
|
||||
|
@ -87,29 +127,42 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
|||
|
||||
// Return all user's Forms
|
||||
$scope.findAll = function() {
|
||||
$scope.forms = Forms.query();
|
||||
console.log($scope.forms);
|
||||
$scope.myforms = Forms.query();
|
||||
};
|
||||
|
||||
// Find a specific Form
|
||||
$scope.findOne = function() {
|
||||
$scope.form = Forms.get({
|
||||
$scope.myform = Forms.get({
|
||||
formId: $stateParams.formId
|
||||
});
|
||||
CurrentForm.setForm($scope.form);
|
||||
CurrentForm.setForm($scope.myform);
|
||||
};
|
||||
|
||||
// Remove existing Form
|
||||
$scope.remove = function() {
|
||||
$scope.remove = function(form_id) {
|
||||
var form = {};
|
||||
if(!form_id){
|
||||
form = CurrentForm.getForm();
|
||||
if(!form) form = $scope.myform;
|
||||
}else {
|
||||
form._id = form_id;
|
||||
}
|
||||
|
||||
var form = CurrentForm.getForm();
|
||||
if(!form) form = $scope.form;
|
||||
|
||||
|
||||
$http.delete('/forms/'+$scope.form._id)
|
||||
$http.delete('/forms/'+form._id)
|
||||
.success(function(data, status, headers){
|
||||
console.log('form deleted successfully');
|
||||
alert('Form deleted..');
|
||||
$state.go('listForms');
|
||||
|
||||
if(!form_id){
|
||||
$state.go('listForms');
|
||||
}
|
||||
if($scope.myforms.length > 0){
|
||||
$scope.myforms = _.filter($scope.myforms, function(myform){
|
||||
return myform._id !== form._id;
|
||||
});
|
||||
}
|
||||
|
||||
}).error(function(error){
|
||||
console.log('ERROR: Form could not be deleted.');
|
||||
console.error(error);
|
||||
|
@ -124,16 +177,16 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
|||
$rootScope.createOrUpdate = function() {
|
||||
if($scope.isNewForm){
|
||||
// Create new Form object
|
||||
var form = new Forms($scope.form);
|
||||
var form = new Forms($scope.myform);
|
||||
|
||||
$http.post('/forms', {form: $scope.form})
|
||||
$http.post('/forms', {form: $scope.myform})
|
||||
.success(function(data, status, headers){
|
||||
console.log('form created');
|
||||
|
||||
// Clear form fields
|
||||
$scope.form = {};
|
||||
$scope.myform = {};
|
||||
// Redirect after save
|
||||
$scope.goToWithId('viewForm', $scope.form._id);
|
||||
$scope.goToWithId('viewForm', $scope.myform._id);
|
||||
}).error(function(errorResponse){
|
||||
console.log(errorResponse.data.message);
|
||||
$scope.error = errorResponse.data.message;
|
||||
|
@ -156,7 +209,7 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
|||
$rootScope.saveInProgress = true;
|
||||
console.log('update form');
|
||||
|
||||
$http.put('/forms/'+$scope.form._id, {form: $scope.form})
|
||||
$http.put('/forms/'+$scope.myform._id, {form: $scope.myform})
|
||||
.then(function(response){
|
||||
console.log('form updated successfully');
|
||||
}).catch(function(response){
|
||||
|
@ -169,10 +222,10 @@ angular.module('forms').controller('ViewFormController', ['$rootScope', '$scope'
|
|||
};
|
||||
|
||||
$rootScope.resetForm = function(){
|
||||
$scope.form = Forms.get({
|
||||
$scope.myform = Forms.get({
|
||||
formId: $stateParams.formId
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
]);
|
|
@ -150,6 +150,31 @@ section > section.ng-scope {
|
|||
color: white;
|
||||
}
|
||||
|
||||
/*MODAL CSS */
|
||||
.form-item.row.create-new.new-form {
|
||||
background-color: rgb(300,131,131);
|
||||
z-index: 11;
|
||||
}
|
||||
.form-item.row.create-new.new-form:hover {
|
||||
background-color: rgb(300,100,100);
|
||||
}
|
||||
|
||||
.form-item.new-form a.btn {
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
/*Modal overlay (for lightbox effect)*/
|
||||
.overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 193%;
|
||||
width: inherit;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
|
||||
.form-item.row:hover, .form-item.row.create-new:hover {
|
||||
border-bottom: 8px inset #ccc;
|
||||
background-color: #d9d9d9;
|
||||
|
@ -183,7 +208,7 @@ section > section.ng-scope {
|
|||
margin-top: 3.2em;
|
||||
}
|
||||
.form-item.row > .details-row small {
|
||||
font-size: 0.65em;
|
||||
font-size: 0.6em;
|
||||
}
|
||||
.form-item.row.create-new > .details-row small {
|
||||
font-size: 0.95em;
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
<section data-ng-controller="ViewFormController" data-ng-init="findAll()" class="container">
|
||||
<section data-ng-controller="ViewFormController as ctrl" data-ng-init="findAll()" class="container">
|
||||
<section class="overlay" ng-if="showCreateModal" ng-click="closeCreateModal()"></section>
|
||||
|
||||
<div class="row">
|
||||
<div class="page-header col-xs-10 col-xs-offset-1">
|
||||
<h1>My MedForms</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<a data-ng-href="#!/forms/create" class="col-xs-2 col-xs-offset-1 form-item row create-new">
|
||||
<div ng-click="openCreateModal()" class="col-xs-2 col-xs-offset-1 form-item row create-new">
|
||||
<div class="title-row col-xs-12">
|
||||
<h4 class=" fa fa-plus fa-6"></h4>
|
||||
<h4 class="fa fa-plus fa-6"></h4>
|
||||
</div>
|
||||
<div class="col-xs-12 details-row">
|
||||
|
||||
|
@ -15,13 +17,46 @@
|
|||
Create a new form
|
||||
</small>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form name="createForm" class="col-xs-2 col-xs-offset-1 form-item row 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">
|
||||
<input type="text" name="name" ng-model="name" required style="color:black;" ng-pattern="/^[a-zA-Z0-9 ]*$/"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</a>
|
||||
<a data-ng-repeat="form in forms" data-ng-href="#!/forms/{{form._id}}/admin" class="col-xs-2 col-xs-offset-1 form-item row">
|
||||
<div class="title-row col-xs-12">
|
||||
<div class="details-row row">
|
||||
<div class="col-xs-5 field-title text-left">
|
||||
Language
|
||||
</div>
|
||||
<div class="col-xs-5 field-input">
|
||||
<select style="color:black;" name="language" required ng-model="formLanguage">
|
||||
<option ng-repeat="language in languages"
|
||||
value="{{language}}" ng-selected="language == formLanguage">
|
||||
{{language}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="details-row row">
|
||||
<div class="col-xs-12 field-title text-center">
|
||||
<button class="btn btn-primary" ng-disabled="myForm.$invalid" ng-click="createNew()">
|
||||
Create Form
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div data-ng-repeat="form in myforms" class="col-xs-2 col-xs-offset-1 form-item row">
|
||||
<span class="pull-right">
|
||||
<i style="cursor:pointer;" class="fa fa-trash-o" ng-click="remove(form._id);"></i>
|
||||
</span>
|
||||
<a data-ng-href="#!/forms/{{form._id}}/admin" class="title-row col-xs-12">
|
||||
<h4 class="list-group-item-heading" data-ng-bind="form.title"></h4>
|
||||
</div>
|
||||
</a>
|
||||
<div class="col-xs-12 details-row">
|
||||
|
||||
<small class="list-group-item-text">
|
||||
|
@ -33,7 +68,7 @@
|
|||
|
||||
</div>
|
||||
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="alert alert-warning text-center" data-ng-if="forms.$resolved && !forms.length">
|
||||
No forms yet, why don't you <a href="/#!/forms/create">create one</a>?
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
<section data-ng-controller="ViewFormController" data-ng-init="findOne()" class="container admin-form">
|
||||
<div class="page-header row" style="padding-bottom: 0px;">
|
||||
<div class="col-xs-9">
|
||||
<div class="col-xs-6">
|
||||
<h1 data-ng-bind="form.title" style="margin-bottom: 0px;"></h1>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<small class=" pull-right">
|
||||
<a class="btn btn-default" href="/#!/forms/{{form._id}}">
|
||||
<span ng-show="form.isLive">View Live</span> <span ng-hide="form.isLive">Preview</span> Form
|
||||
<i class="status-light status-light-on fa fa-dot-circle-o" ng-show="form.isLive"></i>
|
||||
<i class="status-light status-light-off fa fa-dot-circle-o" ng-hide="form.isLive"></i>
|
||||
<span ng-click="remove()">Delete Form</span>
|
||||
<!-- <i class="fa fa-sign-out"></i> -->
|
||||
</a>
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<small class=" pull-right">
|
||||
<a class="btn btn-default" href="/#!/forms/{{form._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>
|
||||
<!-- <i class="fa fa-sign-out"></i> -->
|
||||
</a>
|
||||
</small>
|
||||
|
@ -22,19 +30,19 @@
|
|||
<tab-heading>
|
||||
Edit Form Fields
|
||||
</tab-heading>
|
||||
<edit-form-directive form="form" user="user"></edit-form-directive>
|
||||
<edit-form-directive form="myform" user="user"></edit-form-directive>
|
||||
</tab>
|
||||
<tab disabled="true">
|
||||
<tab-heading >
|
||||
Edit Design
|
||||
</tab-heading>
|
||||
<edit-form-directive form="form" user="user"></edit-form-directive>
|
||||
<edit-form-directive form="myform" user="user"></edit-form-directive>
|
||||
</tab>
|
||||
<tab>
|
||||
<tab-heading>
|
||||
Configure
|
||||
</tab-heading>
|
||||
<configure-form-directive form="form" user="user"></configure-form-directive>
|
||||
<configure-form-directive form="myform" user="user"></configure-form-directive>
|
||||
</tab>
|
||||
<tab data-ng-click="showSubmissions()">
|
||||
<tab-heading>
|
||||
|
@ -57,7 +65,7 @@
|
|||
<th>
|
||||
Date Submitted (UTC)
|
||||
</th>
|
||||
<th ng-if="form.autofillPDFs">
|
||||
<th ng-if="myform.autofillPDFs">
|
||||
Generated PDF
|
||||
</th>
|
||||
</tr>
|
||||
|
|
|
@ -6,7 +6,7 @@ angular.module('users').config(['$httpProvider',
|
|||
$httpProvider.interceptors.push(function($q, $location) {
|
||||
return {
|
||||
responseError: function(response) {
|
||||
if( $location.path() !== '/users/me' ){
|
||||
if( $location.path() !== '/users/me' && $location.path() !== '/'){
|
||||
|
||||
console.log('intercepted rejection of ', response.config.url, response.status);
|
||||
if (response.status === 401) {
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
angular.module('users').config(['$stateProvider',
|
||||
function($stateProvider) {
|
||||
|
||||
var checkLoggedin = function($q, $timeout, $location, User, Auth) {
|
||||
var checkLoggedin = function($q, $timeout, $state, User, Auth) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
console.log(Auth.getUserState);
|
||||
// console.log(Auth.ensureHasCurrentUser(User));
|
||||
|
||||
if (Auth.currentUser && Auth.currentUser.email) {
|
||||
$timeout(deferred.resolve);
|
||||
|
@ -15,12 +15,12 @@ angular.module('users').config(['$stateProvider',
|
|||
else {
|
||||
Auth.currentUser = User.getCurrent(function() {
|
||||
Auth.login();
|
||||
$timeout(deferred.resolve);
|
||||
$timeout(deferred.resolve());
|
||||
},
|
||||
function() {
|
||||
Auth.logout();
|
||||
$timeout(deferred.reject);
|
||||
$location.path('/login');
|
||||
$timeout(deferred.reject());
|
||||
$state.go('sigin', {reload: true});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('users').controller('SettingsController', ['$scope', '$http', '$state', 'Users',
|
||||
function($scope, $http, $state, Users) {
|
||||
|
||||
// Principal.identity().then(function(user){
|
||||
// $scope.user = user;
|
||||
// }).then(function(){
|
||||
// $scope.user = Principal.identity();
|
||||
|
||||
angular.module('users').controller('SettingsController', ['$scope', '$rootScope', '$http', '$state', 'Users',
|
||||
function($scope, $rootScope, $http, $state, Users) {
|
||||
$scope.user = $rootScope.user;
|
||||
console.log($scope.user);
|
||||
// If user is not signed in then redirect back home
|
||||
if (!$scope.user) $state.go('home');
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<section class="row auth" data-ng-controller="SettingsController">
|
||||
<section class="row auth" data-ng-controller="SettingsController" >
|
||||
<h3 class="col-md-12 text-center">Edit your profile</h3>
|
||||
<div class="col-xs-offset-2 col-xs-8 col-md-offset-3 col-md-6">
|
||||
<form name="userForm" data-ng-submit="updateUserProfile(userForm.$valid)" class="signin form-horizontal" autocomplete="off">
|
||||
|
@ -7,7 +7,7 @@
|
|||
<strong>Profile Saved Successfully</strong>
|
||||
</div>
|
||||
<div data-ng-show="error" class="text-center text-danger">
|
||||
Couldn't Save your Profile.<br>
|
||||
Couldn't Save Your Profile.<br>
|
||||
Error: <strong data-ng-bind="error"></strong>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -19,9 +19,17 @@
|
|||
<input type="text" id="lastName" name="lastName" class="form-control" data-ng-model="user.lastName" placeholder="Last Name">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="lastName">Last Name</label>
|
||||
<input type="text" id="lastName" name="lastName" class="form-control" data-ng-model="user.lastName" placeholder="Last Name">
|
||||
<div class="field row form-group">
|
||||
<div class="col-xs-7 field-title">Language </div>
|
||||
<div class="col-xs-5 field-input">
|
||||
<select ng-model="user.language" required>
|
||||
<option ng-repeat="language in languages"
|
||||
ng-selected="language == user.language"
|
||||
value="{{language}}">
|
||||
{{language}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email">Email (also your username)</label>
|
||||
|
|
Loading…
Reference in a new issue