master
bel 2021-08-05 23:45:11 -06:00
parent 2763b68bc4
commit fc088ec240
4 changed files with 32 additions and 10 deletions

View File

@ -265,6 +265,8 @@
<li class="mtt-menu-delimiter"></li>
<li class="mtt-need-list" id="btnShowCompleted">
<div class="menu-icon"></div>Show completed tasks</li>
<li class="mtt-need-list" id="btnShowLooping">
<div class="menu-icon"></div>Show looping tasks</li>
</ul>
</div>

View File

@ -50,7 +50,7 @@ function getGetParamValue(url, paramName) {
this._lists = {};
this._length = 0;
this._order = [];
this._alltasks = {id: -1, showCompl: 0, sort: 3};
this._alltasks = {id: -1, showCompl: 0, showLooping: 0, sort: 3};
},
length: function () {
return this._length;
@ -851,6 +851,7 @@ function getGetParamValue(url, paramName) {
_mtt.db.request('loadTasks', {
list: curList.id,
compl: curList.showCompl,
looping: curList.showLooping,
sort: curList.sort,
search: filter.search,
tag: _mtt.filter.getTags(true),
@ -1233,6 +1234,9 @@ function getGetParamValue(url, paramName) {
case 'btnRssFeed':
feedCurList();
break;
case 'btnShowLooping':
showLoopingToggle();
break;
case 'btnShowCompleted':
showCompletedToggle();
break;
@ -1892,6 +1896,8 @@ function getGetParamValue(url, paramName) {
}
if (list.showCompl) $('#btnShowCompleted').addClass('mtt-item-checked');
else $('#btnShowCompleted').removeClass('mtt-item-checked');
if (list.showLooping) $('#btnShowLooping').addClass('mtt-item-checked');
else $('#btnShowLooping').removeClass('mtt-item-checked');
}
function listOrderChanged(event, ui) {
@ -1905,6 +1911,14 @@ function getGetParamValue(url, paramName) {
_mtt.doAction('listOrderChanged', {order: order});
}
function showLoopingToggle() { // todo
var act = curList.showLooping ? 0 : 1;
curList.showLooping = tabLists.get(curList.id).showLooping = act;
if (act) $('#btnShowLooping').addClass('mtt-item-checked');
else $('#btnShowLooping').removeClass('mtt-item-checked');
loadTasks({setLooping: 1});
}
function showCompletedToggle() {
var act = curList.showCompl ? 0 : 1;
curList.showCompl = tabLists.get(curList.id).showCompl = act;

View File

@ -7,15 +7,16 @@ import (
)
type List struct {
Name string `json:"name"`
UUID string `json:"id"`
Sort int `json:"sort"`
Published int `json:"published"`
ShowCompl int `json:"showCompl"`
ShowNotes int `json:"showNotes"`
Hidden int `json:"hidden"`
Max int `json:"max"`
Index int `json:"index"`
Name string `json:"name"`
UUID string `json:"id"`
Sort int `json:"sort"`
Published int `json:"published"`
ShowCompl int `json:"showCompl"`
ShowLooping int `json:"showLooping"`
ShowNotes int `json:"showNotes"`
Hidden int `json:"hidden"`
Max int `json:"max"`
Index int `json:"index"`
}
func New(r *http.Request) (*List, error) {
@ -41,6 +42,10 @@ func (l *List) SetShowCompl(state bool) {
set(state, &l.ShowCompl)
}
func (l *List) SetShowLooping(state bool) {
set(state, &l.ShowLooping)
}
func (l *List) SetShowNotes(state bool) {
set(state, &l.ShowNotes)
}

View File

@ -22,6 +22,7 @@ func (a *Ajax) loadTasks(w http.ResponseWriter, r *http.Request) error {
filterComplete := filterComplete(form.Get(r, "compl"))
filterTags := filterTags(form.ToStrArr(form.Get(r, "t")))
filterSubstr := filterSubstr(form.Get(r, "s"))
// TODO filter loop
tasks, err := a.storageListTasks(listID, filterComplete, filterTags, filterSubstr)
if err != nil {
return err