diff --git a/public/index.html b/public/index.html index 879bbd4..4de8b28 100755 --- a/public/index.html +++ b/public/index.html @@ -265,6 +265,8 @@
  • Show completed tasks
  • +
  • + Show looping tasks
  • diff --git a/public/mytinytodo.js b/public/mytinytodo.js index 6ec18f5..8f6f08d 100755 --- a/public/mytinytodo.js +++ b/public/mytinytodo.js @@ -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; diff --git a/server/ajax/list/list.go b/server/ajax/list/list.go index 265cc14..5c5d8fa 100755 --- a/server/ajax/list/list.go +++ b/server/ajax/list/list.go @@ -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) } diff --git a/server/ajax/task.go b/server/ajax/task.go index 211be7e..517e033 100755 --- a/server/ajax/task.go +++ b/server/ajax/task.go @@ -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