add event delegation to update after task, descriptive tip, other fixes related to empty fields

This commit is contained in:
i-break-codes 2016-11-21 22:37:36 +05:30
parent 640355c696
commit 5c53b11a26
5 changed files with 103 additions and 9 deletions

View File

@ -1,3 +1,14 @@
<!--
/**
* logerr
*
* @category scrum-board
* @author Vaibhav Mehta <vaibhav@decodingweb.com>
* @copyright Copyright (c) 2016 Vaibhav Mehta <https://github.com/i-break-codes>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0 Beta
*/
-->
<!DOCTYPE html>
<html lang="en">
<head>
@ -87,7 +98,7 @@
</div>
<div class="hide" id="tips">
Double click on the task text to edit it
Double click on the task text to edit it <br> <span>(Task titles are not editable for now)</span>
</div>
<script id="task-card-template" type="text/x-handlebars-template">
@ -97,8 +108,12 @@
<h5>{{title}}</h5>
<div class="card-details">
<p data-field="description">{{description}}</p>
<p data-field="remote_url"><a href="{{#checkForBlank remote_url}}{{/checkForBlank}}" target="_blank">{{#checkForBlank remote_url}}{{/checkForBlank}}</a></p>
<p data-field="assigned_to">{{#checkForBlank assigned_to}}{{/checkForBlank}}</p>
<p data-field="remote_url">
{{#checkIfEmptyRemoteURL remote_url}}{{/checkIfEmptyRemoteURL}}
</p>
<p data-field="assigned_to">
{{#checkIfEmptyAssigned assigned_to}}{{/checkIfEmptyAssigned}}
</p>
</div>
</div>
{{/each}}

View File

@ -1,3 +1,13 @@
/**
* logerr
*
* @category scrum-board
* @author Vaibhav Mehta <vaibhav@decodingweb.com>
* @copyright Copyright (c) 2016 Vaibhav Mehta <https://github.com/i-break-codes>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0 Beta
*/
var App = function() {
function init() {
tips();
@ -82,7 +92,7 @@ var App = function() {
$(this).attr('contenteditable','true').parents('.card').addClass('edit-mode');
});
$('.card').find('p').on('input', function() {
$(document).on('input', '.card p', function() {
var taskId = $(this).parents('.card').data('task-id');
var fieldToEdit = $(this).data('field');
var getTaskData = JSON.parse(LocalStorage.get('task-' + taskId));

View File

@ -1,3 +1,45 @@
Handlebars.registerHelper('checkForBlank', function(val, options) {
return (val !== '') ? val : '-';
/**
* logerr
*
* @category scrum-board
* @author Vaibhav Mehta <vaibhav@decodingweb.com>
* @copyright Copyright (c) 2016 Vaibhav Mehta <https://github.com/i-break-codes>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0 Beta
*/
// TODO: Clearup this mess later and find a better way to handle blank fields
var Helper = function() {
function init() {
checkIfEmptyRemoteURL();
checkForEmptyAssign();
}
function checkIfEmptyRemoteURL() {
Handlebars.registerHelper('checkIfEmptyRemoteURL', function(val, options) {
if(val) {
return '<a href="' + val + '" target="_blank">' + val + '</a>';
} else {
return '-';
}
});
}
function checkForEmptyAssign() {
Handlebars.registerHelper('checkIfEmptyAssigned', function(val, options) {
if(val) {
return val;
} else {
return '-';
}
});
}
return {
init: init
}
}();
Helper.init();

View File

@ -1,3 +1,14 @@
/**
* logerr
*
* @category scrum-board
* @author Vaibhav Mehta <vaibhav@decodingweb.com>
* @copyright Copyright (c) 2016 Vaibhav Mehta <https://github.com/i-break-codes>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0 Beta
*/
var LocalStorage = function() {
function set(key, val) {
localStorage.setItem(key, val);

View File

@ -1,3 +1,14 @@
/**
* logerr
*
* @category scrum-board
* @author Vaibhav Mehta <vaibhav@decodingweb.com>
* @copyright Copyright (c) 2016 Vaibhav Mehta <https://github.com/i-break-codes>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0 Beta
*/
@import 'https://fonts.googleapis.com/css?family=Hind+Vadodara:300,400';
//Colors
@ -565,10 +576,15 @@ footer {
cursor: pointer;
background: {
image: url('../images/info.svg');
position: 4px center;
position: 4px 12px;
size: 16px;
repeat: no-repeat;
}
span {
font-size: 10px;
font-style: italic;
}
}
@keyframes showTips {