added multi language support for form title

This commit is contained in:
David Baldwynn 2016-06-08 16:56:06 -07:00
commit c03c9ae33d
19 changed files with 353 additions and 367 deletions

View file

@ -72,7 +72,7 @@ var FormSchema = new Schema({
},
language: {
type: String,
enum: ['english', 'french', 'spanish'],
enum: ['english', 'french', 'spanish', 'german', 'italian'],
required: 'Form must have a language',
default: 'english'
},

View file

@ -94,7 +94,7 @@ var UserSchema = new Schema({
},
language: {
type: String,
enum: ['english', 'french', 'spanish'],
enum: ['english', 'french', 'spanish', 'italian', 'german'],
default: 'english',
required: 'User must have a language'
},

View file

@ -33,9 +33,9 @@
"angular-input-stars": "https://github.com/whitef0x0/angular-input-stars.git#master",
"raven-js": "^3.0.4",
"tableExport.jquery.plugin": "^1.5.1",
"angular-translate": "~2.11.0",
"js-yaml": "^3.6.1",
"angular-ui-select": "whitef0x0/ui-select#compiled"
"angular-ui-select": "whitef0x0/ui-select#compiled",
"angular-translate": "~2.11.0"
},
"resolutions": {
"angular-bootstrap": "^0.14.0",

8
config/env/all.js vendored
View file

@ -99,10 +99,14 @@ module.exports = {
],
unit_tests: [
'public/lib/angular-mocks/angular-mocks.js',
'public/modules/*/tests/unit/**/*.js'
'public/modules/*/tests/unit/**/*.js',
'!public/modules/**/demo/**/*.js',
'!public/modules/**/node_modules/**/*.js'
],
e2e_tests: [
'public/modules/*/tests/e2e/**.js'
'public/modules/*/tests/e2e/**.js',
'!public/modules/**/demo/**/*.js',
'!public/modules/**/node_modules/**/*.js'
]
}
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@ angular.module('core').controller('HeaderController', ['$rootScope', '$scope', '
$scope.user = $rootScope.user = Auth.ensureHasCurrentUser(User);
$scope.authentication = $rootScope.authentication = Auth;
$rootScope.languages = $scope.languages = ['english', 'french', 'spanish'];
$rootScope.languages = $scope.languages = ['english', 'french', 'spanish', 'italian', 'german'];
$scope.isCollapsed = false;
$rootScope.hideNav = false;

View file

@ -1,81 +0,0 @@
<section data-ng-controller="HomeController" class="hero-section" style="overflow:hidden;">
<div class="opacity-background">
</div>
<div class="image-background">
</div>
<div class="jumbotron text-center">
<div class="container" data-ng-if="!authentication.isAuthenticated()">
<div class="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">
<span>Tell<span style="text-decoration: underline; color: #FA787E;">Form</span></span>
</h2>
</div>
<div class="row" style="margin-top:0px">
<h1 class="lead col-md-10 col-md-offset-1 hidden-xs hidden-sm" style="font-size:3.8em;">
Craft beautiful forms in seconds.
</h1>
<h2 class="lead col-sm-12 text-center hidden-md hidden-lg" style="font-size:2.8em;">
Craft beautiful forms.
</h2>
<p class="lead hidden-xs hidden-sm col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2" style="font-size:1.5em; color:rgba(255,255,255,.75)">
<i>TellForm is an opensource <b>alternative to TypeForm </b> that can create stunning forms from PDFs or from scratch</i>
</p>
<p class="lead col-xs-12 hidden-md hidden-lg" style="font-size:1.5em; color:rgba(255,255,255,.75)">
<i>TellForm is an opensource <b>alternative to TypeForm </b> that can create stunning forms from PDFs or from scratch</i>
</h1>
</div>
</div>
</div>
<div class="jumbotron text-center">
<div class="container" data-ng-if="!authentication.isAuthenticated()">
<div class="row" style="margin-top:0px">
<h1 class="lead col-md-10 col-md-offset-1 hidden-xs hidden-sm" style="font-size:3.8em;">
Create your next ______.
</h1>
<h1 class="lead col-md-10 col-md-offset-1 hidden-xs hidden-sm" style="font-size:2.5em;">
Tell a story with a form.
</h1>
</div>
<div class="row" style="margin-top:7%;">
<a class="col-xs-4 col-xs-offset-4 btn btn-info signup-btn" href="/#!/signup" style="background-color:#FA787E; border: none; font-size: 2em; padding: 0.3em 0.9em; color: white;">
sign me up!
</a>
</div>
</div>
</div>
</section>
<footer class="footer-basic-centered">
<p class="footer-company-motto">The company motto.</p>
<p class="footer-links">
<a href="/#!/">Home</a>
·
<a href="/#!/blog">Blog</a>
·
<a href="https://github.com/whitef0x0/tellform">Github Source</a>
·
<a href="/#!/about">About</a>
.
<a href="/#!/terms">Privacy & Terms</a>
·
<a href="https://status.tellform.com">System Status</a>
·
<a href="mailto:polydaic@gmail.com">Contact</a>
</p>
<p class="footer-company-name">TellForm © 2016</p>
</footer>

View file

@ -3,11 +3,20 @@
// Forms controller
angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http',
function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http) {
$scope = $rootScope;
$scope.forms = {};
$scope.showCreateModal = false;
$scope.languageRegExp = $scope.myPt = {
regExp: /[@!#$%^&*()\-+={}\[\]|\\/'";:`.,~№?<>]+/i,
test: function(val) {
console.log(val);
return !this.regExp.test(val);
}
};
// Return all user's Forms
$scope.findAll = function() {
Forms.query(function(_forms){
@ -37,15 +46,15 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
$scope.duplicateForm = function(form_index){
var form = _.cloneDeep($scope.myforms[form_index]);
delete form._id;
$http.post('/forms', {form: form})
.success(function(data, status, headers){
$scope.myforms.splice(form_index+1, 0, data);
}).error(function(errorResponse){
console.error(errorResponse);
if(errorResponse === null){
$scope.error = errorResponse.data.message;
}
$scope.error = errorResponse.data.message;
}
});
};
@ -61,7 +70,7 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
$http.post('/forms', {form: form})
.success(function(data, status, headers){
console.log('new form created');
// Redirect after save
// Redirect after save
$scope.goToWithId('viewForm.create', data._id+'');
}).error(function(errorResponse){
console.error(errorResponse);
@ -85,4 +94,4 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
});
};
}
]);
]);

View file

@ -20,7 +20,7 @@
<div class="title-row row">
<div class="col-xs-5 field-title text-left"> Name </div>
<div class="col-xs-12 field-input">
<input type="text" name="title" required ng-model="formTitle" ng-pattern="/^[a-zA-Z0-9 \-.]*$/" ng-minlength="4"/>
<input type="text" name="title" required ng-model="formTitle" ng-pattern="languageRegExp" ng-minlength="4" style="color:black;"/>
</div>
</div>
<div class="details-row row">

View file

@ -33,6 +33,8 @@
"resolutions": {
"angular-bootstrap": "^0.14.0",
"angular": "1.4.x"
"restangular": "~1.5.2",
"angular-ui-select": "whitef0x0/ui-select#compiled",
},
"overrides": {
"BOWER-PACKAGE": {

View file

@ -0,0 +1,35 @@
'use strict';
angular.module('forms').config(['$translateProvider', function ($translateProvider) {
$translateProvider.translations('german', {
FORM_SUCCESS: 'Ihre Angaben wurden gespeichert.',
REVIEW: 'Unvollständig',
BACK_TO_FORM: 'Zurück zum Formular',
EDIT_FORM: '',
CREATE_FORM: '',
ADVANCEMENT: '{{done}} von {{total}} beantwortet',
CONTINUE_FORM: 'Zum Formular',
REQUIRED: 'verpflichtend',
COMPLETING_NEEDED: 'Es fehlen/fehtl noch {{answers_not_completed}} Antwort(en)',
OPTIONAL: 'fakultativ',
ERROR_EMAIL_INVALID: 'Bitte gültige Mailadresse eingeben',
ERROR_NOT_A_NUMBER: 'Bitte nur Zahlen eingeben',
ERROR_URL_INVALID: 'Bitte eine gültige URL eingeben',
OK: 'Okay',
ENTER: 'Eingabetaste drücken',
YES: 'Ja',
NO: 'Nein',
NEWLINE: 'Für eine neue Zeile SHIFT+ENTER drücken',
CONTINUE: 'Weiter',
LEGAL_ACCEPT: 'I accept',
LEGAL_NO_ACCEPT: 'I dont accept',
DELETE: 'Entfernen',
CANCEL: 'Canceln',
SUBMIT: 'Speichern',
UPLOAD_FILE: 'Datei versenden',
Y: 'J',
N: 'N',
});
}]);

View file

@ -0,0 +1,35 @@
'use strict';
angular.module('forms').config(['$translateProvider', function ($translateProvider) {
$translateProvider.translations('italian', {
FORM_SUCCESS: 'Il formulario è stato inviato con successo!',
REVIEW: 'Incompleto',
BACK_TO_FORM: 'Ritorna al formulario',
EDIT_FORM: '',
CREATE_FORM: '',
ADVANCEMENT: '{{done}} su {{total}} completate',
CONTINUE_FORM: 'Vai al formulario',
REQUIRED: 'obbligatorio',
COMPLETING_NEEDED: '{{answers_not_completed}} risposta/e deve/ono essere completata/e',
OPTIONAL: 'opzionale',
ERROR_EMAIL_INVALID: 'Si prega di inserire un indirizzo email valido',
ERROR_NOT_A_NUMBER: 'Si prega di inserire solo numeri',
ERROR_URL_INVALID: 'Grazie per inserire un URL valido',
OK: 'OK',
ENTER: 'premere INVIO',
YES: 'Sì',
NO: 'No',
NEWLINE: 'premere SHIFT+INVIO per creare una nuova linea',
CONTINUE: 'Continua',
LEGAL_ACCEPT: 'I accept',
LEGAL_NO_ACCEPT: 'I dont accept',
DELETE: 'Cancella',
CANCEL: 'Reset',
SUBMIT: 'Registra',
UPLOAD_FILE: 'Invia un file',
Y: 'S',
N: 'N',
});
}]);

View file

@ -0,0 +1,35 @@
'use strict';
angular.module('forms').config(['$translateProvider', function ($translateProvider) {
$translateProvider.translations('spanish', {
FORM_SUCCESS: '¡El formulario ha sido enviado con éxito!',
REVIEW: 'Revisar',
BACK_TO_FORM: 'Regresar al formulario',
EDIT_FORM: '',
CREATE_FORM: '',
ADVANCEMENT: '{{done}} de {{total}} contestadas',
CONTINUE_FORM: 'Continuar al formulario',
REQUIRED: 'Información requerida',
COMPLETING_NEEDED: '{{answers_not_completed}} respuesta(s) necesita(n) ser completada(s)',
OPTIONAL: 'Opcional',
ERROR_EMAIL_INVALID: 'Favor de proporcionar un correo electrónico válido',
ERROR_NOT_A_NUMBER: 'Por favor, introduzca sólo números válidos',
ERROR_URL_INVALID: 'Favor de proporcionar un url válido',
OK: 'OK',
ENTER: 'pulse INTRO',
YES: 'Si',
NO: 'No',
NEWLINE: 'presione SHIFT+INTRO para crear una nueva línea',
CONTINUE: 'Continuar',
LEGAL_ACCEPT: 'I accept',
LEGAL_NO_ACCEPT: 'I dont accept',
DELETE: 'Eliminar',
CANCEL: 'Cancelar',
SUBMIT: 'Registrar',
UPLOAD_FILE: 'Cargar el archivo',
Y: 'S',
N: 'N'
});
}]);

View file

@ -49,6 +49,9 @@ angular.module('forms').factory('myForm', ['Forms', function(Forms) {
}]);
angular.module('forms').constant('FORM_URL', '/form/:formId');
angular.module('forms').value('SendVisitorData', {
send: function(){}
});
angular.element(document).ready(function() {
//Then init the app

View file

@ -29,12 +29,13 @@ angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$root
'number',
'natural'
];
if (__indexOf.call(supported_fields, type) >= 0) {
var templateUrl = 'modules/forms/base/views/directiveViews/field/';
var templateUrl = 'modules/forms/base/views/directiveViews/field/';
if (__indexOf.call(supportedFields, type) >= 0) {
templateUrl = templateUrl+type+'.html';
return $templateCache.get(templateUrl);
}
return null;
}
return $templateCache.get(templateUrl);
};
return {

View file

@ -8,7 +8,6 @@
</small>
{{field.title}}
<span class="required-error" ng-show="!field.required">{{ 'OPTIONAL' | translate }}</span>
</h3>
<p class="col-xs-12">
<small>{{field.description}}</small>

View file

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

View file

@ -27,8 +27,8 @@
style="opacity: 0; margin-left: 0px;"
ng-model="field.fieldValue"
ng-focus="setActiveField(field._id, index, true)"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-change="$root.nextField()"
ng-disabled="field.disabled" />
<div class="letter">
@ -46,8 +46,8 @@
<input type="radio" value="false"
style="opacity:0; margin-left:0px;"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-change="$root.nextField()"
ng-disabled="field.disabled"/>