master
bel 2021-08-05 23:45:11 -06:00
parent 435ff82683
commit 568aa6a229
4 changed files with 32 additions and 10 deletions

View File

@ -265,6 +265,8 @@
<li class="mtt-menu-delimiter"></li> <li class="mtt-menu-delimiter"></li>
<li class="mtt-need-list" id="btnShowCompleted"> <li class="mtt-need-list" id="btnShowCompleted">
<div class="menu-icon"></div>Show completed tasks</li> <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> </ul>
</div> </div>

View File

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

View File

@ -7,15 +7,16 @@ import (
) )
type List struct { type List struct {
Name string `json:"name"` Name string `json:"name"`
UUID string `json:"id"` UUID string `json:"id"`
Sort int `json:"sort"` Sort int `json:"sort"`
Published int `json:"published"` Published int `json:"published"`
ShowCompl int `json:"showCompl"` ShowCompl int `json:"showCompl"`
ShowNotes int `json:"showNotes"` ShowLooping int `json:"showLooping"`
Hidden int `json:"hidden"` ShowNotes int `json:"showNotes"`
Max int `json:"max"` Hidden int `json:"hidden"`
Index int `json:"index"` Max int `json:"max"`
Index int `json:"index"`
} }
func New(r *http.Request) (*List, error) { func New(r *http.Request) (*List, error) {
@ -41,6 +42,10 @@ func (l *List) SetShowCompl(state bool) {
set(state, &l.ShowCompl) set(state, &l.ShowCompl)
} }
func (l *List) SetShowLooping(state bool) {
set(state, &l.ShowLooping)
}
func (l *List) SetShowNotes(state bool) { func (l *List) SetShowNotes(state bool) {
set(state, &l.ShowNotes) 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")) filterComplete := filterComplete(form.Get(r, "compl"))
filterTags := filterTags(form.ToStrArr(form.Get(r, "t"))) filterTags := filterTags(form.ToStrArr(form.Get(r, "t")))
filterSubstr := filterSubstr(form.Get(r, "s")) filterSubstr := filterSubstr(form.Get(r, "s"))
// TODO filter loop
tasks, err := a.storageListTasks(listID, filterComplete, filterTags, filterSubstr) tasks, err := a.storageListTasks(listID, filterComplete, filterTags, filterSubstr)
if err != nil { if err != nil {
return err return err