diff --git a/index.html b/index.html index 63b4c11..318f3d2 100644 --- a/index.html +++ b/index.html @@ -97,8 +97,8 @@
{{title}}

{{description}}

-

{{remote_url}}

-

{{assigned_to}}

+

{{#checkForBlank remote_url}}{{/checkForBlank}}

+

{{#checkForBlank assigned_to}}{{/checkForBlank}}

{{/each}} @@ -107,6 +107,7 @@ + diff --git a/src/scripts/app.js b/src/scripts/app.js index 6ec24f3..d3c2cb7 100644 --- a/src/scripts/app.js +++ b/src/scripts/app.js @@ -52,6 +52,11 @@ var App = function() { obj[keyVal[0]] = unescape(keyVal[1]); } + // TODO: Add validations + if(obj.description === '' || obj.title === '') { + return; + } + var iid = LocalStorage.get('taskCounter'); obj.id = ++iid; obj.status = 'pending'; @@ -63,6 +68,9 @@ var App = function() { draggable(); $('.close-modal').trigger('click'); + + //Clear form fields after submit + $(this).find('input[type=text], textarea').val(''); }); }); diff --git a/src/scripts/helper.js b/src/scripts/helper.js new file mode 100644 index 0000000..6211a00 --- /dev/null +++ b/src/scripts/helper.js @@ -0,0 +1,3 @@ +Handlebars.registerHelper('checkForBlank', function(val, options) { + return (val !== '') ? val : '-'; +}); \ No newline at end of file