Skip to content

Commit 55dbfde

Browse files
committed
Move checkbox to front, fix tag dialog todo HTML syntax
1 parent 513199d commit 55dbfde

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

todo-desktop.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ function clearTable()
22
{
33
$("#todoTable tbody").empty();
44
}
5-
function getTodoTitleHtml(it, lineNr, tagbasename, spanCssClass, baseElem) {
5+
6+
function getTodoTitleHtml(it, lineNr, tagbasename, spanCssClass, baseElem, checkbox) {
67
var isRecurring = it.recurrenceMode != 0;
78
var hasNote = it.notes != null && it.notes != '';
89
var hasTags = it.tags != null && it.tags != '';
@@ -12,8 +13,13 @@ function getTodoTitleHtml(it, lineNr, tagbasename, spanCssClass, baseElem) {
1213
line = '<'+baseElem+' class="'+spanCssClass+'" title="'+$T('CREATED')+': '+formatDate(createDate, true)+
1314
'; '+$T('RECURRENCE')+': '+repetition+
1415
((it.completed != 0)? '; '+$T('DONE')+': '+formatDate(complDate, true):'')+
15-
'">'+
16-
'<span class="todo_lineNr">'+(lineNr+1)+'.</span> '+
16+
'">';
17+
if (checkbox)
18+
{
19+
line += '<span class="completed"><input type="checkbox" id="completed'+it.id+'" '+
20+
((it.completed==1)?'checked="true" ':'')+'/></span>';
21+
}
22+
line += '<span class="todo_lineNr">'+(lineNr+1)+'.</span> '+
1723
'<span>'+it.todo+'</span>'+
1824
(hasNote ? '<span class="note" title="'+it.notes+'"></span>':'')+
1925
(isRecurring ? '<input type="button" class="reactivateButton" id="reactivate'+it.id+'" />':'');
@@ -35,16 +41,14 @@ function renderItem(it, lineNr) {
3541
((it.deleted==1)?' todo_deleted':'')+
3642
'" id="todo'+it.id+'">';
3743
var tagbasename = 'todo_tags_';
38-
line += getTodoTitleHtml(it, lineNr, tagbasename, 'todo', 'td');
44+
line += getTodoTitleHtml(it, lineNr, tagbasename, 'todo', 'td', true);
3945
line += '<td class="start">'+((it.start == null)?'undef':formatDate(parseDate(it.start)))+'</td>'+
4046
'<td class="due">'+ dueString+
4147
((it.completed==0 && dueDate != null && (today - dueDate) > 0) ?
4248
' <span class="exclamation"></span>':'')+
4349
'</td>'+
4450
'<td class="effort">'+it.effort+'</td>'+
4551
'<td class="actions">'+
46-
'<span class="completed"><input type="checkbox" id="completed'+it.id+'" '+
47-
((it.completed==1)?'checked="true" ':'')+'/></span>'+
4852
'<span class="modify"><input type="button" alt="'+
4953
$T('EDIT')+'" id="modify'+it.id+
5054
'" class="editButton" /></span>'+
@@ -115,9 +119,7 @@ function openTagDialog(tagname)
115119
filtered.sort(ItemSort);
116120
var tagbase = 'tag_todo_tags_';
117121
for (var i=0; i<filtered.length; i++) {
118-
var line = '<div>';
119-
line += getTodoTitleHtml(filtered[i], i, tagbase, '');
120-
line += '</div>'
122+
var line = getTodoTitleHtml(filtered[i], i, tagbase, 'todo', 'div', false);
121123
$('#tag_todo_table').append(line);
122124
var elem = $('#'+tagbase+filtered[i].id); // .tagit({readOnly: true});
123125
new Tagify(elem[0], { readOnly: true } );

0 commit comments

Comments
 (0)