Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/KleeGroup/focus
Browse files Browse the repository at this point in the history
  • Loading branch information
obtl committed Feb 18, 2015
2 parents aa74c8a + c330acf commit 5324268
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
11 changes: 6 additions & 5 deletions lib/helpers/form_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,13 @@ var _formInputModelBinder = function formInputModelBinder(inputs, model, options
}

if (input.multiple) {
// Init field values array.
if (modelContainer[this.getAttribute('data-name')] === undefined) {
modelContainer[this.getAttribute('data-name')] = [];
}
/* Add value if checked. */
if (input.checked) {
if (modelContainer[this.getAttribute('data-name')] === undefined) {
modelContainer[this.getAttribute('data-name')] = [currentvalue];
} else {
modelContainer[this.getAttribute('data-name')].push(currentvalue);
}
modelContainer[this.getAttribute('data-name')].push(currentvalue);
}
} else {
modelContainer[this.getAttribute('data-name')] = currentvalue;
Expand Down
10 changes: 5 additions & 5 deletions lib/helpers/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ function stringLength(stringToTest, options) {
}
//Function to validate that an input is a number.
function numberValidation(numberToValidate, options) {
options = options || {};
if (!numberToValidate) {
options = options || {};
if (_.isUndefined(numberToValidate) || _.isNull(numberToValidate)) {
return true;
}
if (isNaN(numberToValidate)) {
}
if (_.isNaN(numberToValidate)) {
return false;
}
}
numberToValidate = +numberToValidate; //Cast it into a number.
var isMin = options.min !== undefined ? numberToValidate >= options.min : true;
var isMax = options.max !== undefined ? numberToValidate <= options.max : true;
Expand Down
2 changes: 1 addition & 1 deletion lib/views/notifications-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
//In order to call the templat only if needed.
function printMessageIfExists(messageContainerName, context) {
if (messages[messageContainerName].length > 0) {
context.$el.append(template(messageToPrint[messageContainerName]));
context.$el.append(context.template(messageToPrint[messageContainerName]));
}
}
printMessageIfExists('errorMessages', this); //The this is put into a closure in order to not lose it.
Expand Down

0 comments on commit 5324268

Please sign in to comment.