diff --git a/client/common/directives/ModelField/ModelField.js b/client/common/directives/ModelField/ModelField.js
index 4d10563e..12723b17 100644
--- a/client/common/directives/ModelField/ModelField.js
+++ b/client/common/directives/ModelField/ModelField.js
@@ -40,6 +40,19 @@ angular.module('dashboard.directives.ModelField', [
};
})
+.directive('mySpace', function () {
+ return function (scope, element, attrs) {
+ element.bind("keydown keypress", function (event) {
+ if(event.which === 32) {
+ scope.$apply(function (){
+ scope.$eval(attrs.mySpace);
+ });
+ event.preventDefault();
+ }
+ });
+ };
+})
+
.directive('modelFieldEdit', function($compile, $cookies) {
function getTemplate(type, scope) {
var template = '';
@@ -137,8 +150,8 @@ angular.module('dashboard.directives.ModelField', [
template = '\
';
@@ -278,8 +291,8 @@ angular.module('dashboard.directives.ModelField', [
scope.model.properties[scope.key.property].display = scope.key;
}
scope.key = scope.key.property;
- }
-
+ }
+
var property = { display: {type: "text"} };
if (scope.model.properties && scope.model.properties[scope.key]) property = scope.model.properties[scope.key];
if (!property) {
@@ -290,7 +303,7 @@ angular.module('dashboard.directives.ModelField', [
if (!property.display) property.display = {};
//TODO: check the property definition in the loopback model and pick a better default "type"
switch (property.type) {
- case "date":
+ case "date":
case "Date":
property.display.type = "datetime";
break;
@@ -338,7 +351,7 @@ angular.module('dashboard.directives.ModelField', [
//Make sure boolean (checkbox) values are numeric (below only gets called on init and not when state changes)
if (typeof scope.data[scope.key] === "string") scope.data[scope.key] = parseInt(scope.data[scope.key]);
}
-
+
if (property.display.type == "slider") {
if (typeof scope.data[scope.key] === 'undefined' || scope.data[scope.key] == null) {
scope.data[scope.key] = property.display.options.from + ";" + property.display.options.to;
@@ -381,9 +394,10 @@ angular.module('dashboard.directives.ModelField', [
break;
}
}
-
+
//Handle translating multi-select checks to scope.data[scope.key] output format
scope.clickMultiSelectCheckbox = function(questionKey, itemKey, itemValue, multiSelectOptions) {
+ multiSelectOptions[itemKey] = !multiSelectOptions[itemKey];
var output = property.display.output == "array" ? [] : property.display.output == "object" ? {} : "";
if (property.display.output == "object") {
//Return Key/Value Pair