Commit 9d27117f authored by Pascal Hartig's avatar Pascal Hartig

sapui5: code style fixes

parent e7fbe334
......@@ -10,7 +10,7 @@
this.name = aName;
};
todo.TodoPersistency.prototype = function () {
todo.TodoPersistency.prototype = (function () {
var storage = window.localStorage;
return {
......@@ -29,5 +29,5 @@
return !(this.get());
}
};
}();
}());
})();
......@@ -10,55 +10,55 @@
jQuery.sap.declare('todo.formatters');
todo.formatters = {
// Returns whether all todos are completed
allCompletedTodosFormatter: function (aTodos) {
return !(aTodos.some(function (element, index, array) {
return element.done === false;
}));
},
// Returns whether all todos are completed
allCompletedTodosFormatter: function (aTodos) {
return !(aTodos.some(function (element, index, array) {
return element.done === false;
}));
},
// Converts booleans to strings
booleanToStringFormatter: function (value) {
if (value === true) {
return 'true';
}
return 'false';
},
// Converts booleans to strings
booleanToStringFormatter: function (value) {
if (value === true) {
return 'true';
}
return 'false';
},
// Counts the number of closed todos
completedTodoCountFormatter: function (aTodos) {
var numberOfCompletedItems = 0;
aTodos.forEach(function (todo) {
if (todo.done === true) {
numberOfCompletedItems++;
}
});
// Counts the number of closed todos
completedTodoCountFormatter: function (aTodos) {
var numberOfCompletedItems = 0;
aTodos.forEach(function (todo) {
if (todo.done === true) {
numberOfCompletedItems++;
}
});
return 'Clear completed (' + numberOfCompletedItems + ')';
},
return 'Clear completed (' + numberOfCompletedItems + ')';
},
// Returns whether a completed todo is available
hasCompletedTodosFormatter: function (aTodos) {
return aTodos.some(function (element, index, array) {
return element.done === true;
});
},
// Returns whether a completed todo is available
hasCompletedTodosFormatter: function (aTodos) {
return aTodos.some(function (element, index, array) {
return element.done === true;
});
},
// Returns whether a an array has elements
isArrayNonEmptyFormatter: function (aTodos) {
return aTodos.length > 0;
},
// Returns whether a an array has elements
isArrayNonEmptyFormatter: function (aTodos) {
return aTodos.length > 0;
},
// Counts the number of open todos
openTodoCountFormatter: function (aTodos) {
var numberOfOpenItems = 0;
aTodos.forEach(function (todo) {
if (todo.done === false) {
numberOfOpenItems++;
}
});
// Counts the number of open todos
openTodoCountFormatter: function (aTodos) {
var numberOfOpenItems = 0;
aTodos.forEach(function (todo) {
if (todo.done === false) {
numberOfOpenItems++;
}
});
return numberOfOpenItems === 1 ? '1 item left' : numberOfOpenItems + ' items left';
}
return numberOfOpenItems === 1 ? '1 item left' : numberOfOpenItems + ' items left';
}
};
})();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment