export supportedFields in injector

This commit is contained in:
Sam 2016-05-05 13:00:24 +03:00
parent 013a560da6
commit df10d8e3fe
4 changed files with 23 additions and 18 deletions

View file

@ -127,6 +127,7 @@ module.exports = function(db) {
app.use(cookieParser());
// Express MongoDB session storage
app.use(session({
saveUninitialized: true,
resave: true,

View file

@ -7,12 +7,14 @@ services:
build: .
volumes:
- .:/usr/src/app
command: node server.js
ports:
- "3000:3000"
- "35729:35729"
environment:
DB_1_PORT_27017_TCP_ADDR: db
PORT: 3000
BASE_URL: http://192.168.99.100:3000/
links:
- db
volumes:

View file

@ -27,3 +27,19 @@ function(){
return 0;
};
});
angular.module('forms').value('supportedFields', [
'textfield',
'textarea',
'date',
'dropdown',
'hidden',
'password',
'radio',
'legal',
'statement',
'rating',
'yes_no',
'number',
'natural'
]);

View file

@ -8,28 +8,14 @@ var __indexOf = [].indexOf || function(item) {
return -1;
};
angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$rootScope', '$templateCache',
function($http, $compile, $rootScope, $templateCache) {
angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$rootScope', '$templateCache', 'supportedFields',
function($http, $compile, $rootScope, $templateCache, supportedFields) {
var getTemplateUrl = function(fieldType) {
var type = fieldType;
var templateUrl = 'modules/forms/base/views/directiveViews/field/';
var supported_fields = [
'textfield',
'textarea',
'date',
'dropdown',
'hidden',
'password',
'radio',
'legal',
'statement',
'rating',
'yes_no',
'number',
'natural'
];
if (__indexOf.call(supported_fields, type) >= 0) {
if (__indexOf.call(supportedFields, type) >= 0) {
templateUrl = templateUrl+type+'.html';
}
return $templateCache.get('../public/'+templateUrl);