mirror of
https://github.com/urbit/shrub.git
synced 2025-01-05 19:46:50 +03:00
hide archived tasks
This commit is contained in:
parent
d78846c14e
commit
42fd9146f6
@ -21,6 +21,7 @@
|
||||
title/[%s title]
|
||||
status/[%s status]
|
||||
version/(jone version)
|
||||
archived/[%b archived]
|
||||
claiming/[%b claiming]
|
||||
=< audience/[%a (turn (~(tap in audience)) .)]
|
||||
|=(a=station:talk [%s (crip "{<p.a>}/{(trip q.a)}")])
|
||||
|
@ -34,8 +34,10 @@ module.exports =
|
||||
version += 1
|
||||
Persistence.put old:{id,version,dif:own:o}
|
||||
|
||||
setAudience: ({id},val) ->
|
||||
Persistence.put audience:{id,to:val}
|
||||
removeItem: ({id,version},index) -> @setAudience {id},[]
|
||||
setAudience: ({id},to) ->
|
||||
Persistence.put audience:{id,to}
|
||||
Dispatcher.handleViewAction {type:'setAudienece',id,to}
|
||||
|
||||
addComment: ({id,version},val) ->
|
||||
version += 1
|
||||
@ -50,11 +52,7 @@ module.exports =
|
||||
Dispatcher.handleViewAction {list:sort,to,from,type:'moveItems'}
|
||||
|
||||
addItem: (index,item) ->
|
||||
Dispatcher.handleViewAction {type:'addItem',index,item}
|
||||
|
||||
removeItem: ({id,version},index) ->
|
||||
Persistence.put old:{id,version,dif:set:done:true}
|
||||
Dispatcher.handleViewAction {type:'removeItem',index}
|
||||
Dispatcher.handleViewAction {type:'addItem',index,item}
|
||||
|
||||
|
||||
listenList: (type)->
|
||||
|
@ -27,7 +27,7 @@ module.exports = recl
|
||||
@$el = $ @getDOMNode()
|
||||
@$items = @$el.find('.items').children()
|
||||
|
||||
_focus: (e,i) -> @setState {selected:Number(i.props.index)}
|
||||
_focus: (e,i) -> @setState {selected:i.props.index}
|
||||
|
||||
_dragStart: (e,i) -> @dragged = i.dragged
|
||||
|
||||
@ -54,7 +54,7 @@ module.exports = recl
|
||||
@drop = 'after'
|
||||
@placeholder.insertAfter $t
|
||||
|
||||
title_keyDown: (e) ->
|
||||
title_keyDown: (e,i) ->
|
||||
kc = e.keyCode
|
||||
|
||||
switch kc
|
||||
@ -72,7 +72,7 @@ module.exports = recl
|
||||
e.target.innerText.length is 0
|
||||
if @state.selected isnt 0
|
||||
@setState {selected:@state.selected-1,select:"end"}
|
||||
WorkActions.removeItem @state.list[@state.selected], @state.selected
|
||||
WorkActions.removeItem i.props.item
|
||||
e.preventDefault()
|
||||
# up
|
||||
when 38
|
||||
@ -143,6 +143,7 @@ module.exports = recl
|
||||
(div {className:'item-wrap',key:item.id,'data-index':index},
|
||||
rece(ItemComponent,{
|
||||
item
|
||||
index
|
||||
@_focus
|
||||
@title_keyDown
|
||||
draggable:@state.canSort
|
||||
|
@ -68,15 +68,27 @@ module.exports = {
|
||||
}
|
||||
});
|
||||
},
|
||||
setAudience: function(arg, val) {
|
||||
removeItem: function(arg, index) {
|
||||
var id, version;
|
||||
id = arg.id, version = arg.version;
|
||||
return this.setAudience({
|
||||
id: id
|
||||
}, []);
|
||||
},
|
||||
setAudience: function(arg, to) {
|
||||
var id;
|
||||
id = arg.id;
|
||||
return Persistence.put({
|
||||
Persistence.put({
|
||||
audience: {
|
||||
id: id,
|
||||
to: val
|
||||
to: to
|
||||
}
|
||||
});
|
||||
return Dispatcher.handleViewAction({
|
||||
type: 'setAudienece',
|
||||
id: id,
|
||||
to: to
|
||||
});
|
||||
},
|
||||
addComment: function(arg, val) {
|
||||
var id, version;
|
||||
@ -129,25 +141,6 @@ module.exports = {
|
||||
item: item
|
||||
});
|
||||
},
|
||||
removeItem: function(arg, index) {
|
||||
var id, version;
|
||||
id = arg.id, version = arg.version;
|
||||
Persistence.put({
|
||||
old: {
|
||||
id: id,
|
||||
version: version,
|
||||
dif: {
|
||||
set: {
|
||||
done: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return Dispatcher.handleViewAction({
|
||||
type: 'removeItem',
|
||||
index: index
|
||||
});
|
||||
},
|
||||
listenList: function(type) {
|
||||
return Persistence.subscribe(type, function(err, d) {
|
||||
var ref, sort, tasks;
|
||||
@ -696,7 +689,7 @@ module.exports = recl({
|
||||
},
|
||||
_focus: function(e, i) {
|
||||
return this.setState({
|
||||
selected: Number(i.props.index)
|
||||
selected: i.props.index
|
||||
});
|
||||
},
|
||||
_dragStart: function(e, i) {
|
||||
@ -747,7 +740,7 @@ module.exports = recl({
|
||||
return this.placeholder.insertAfter($t);
|
||||
}
|
||||
},
|
||||
title_keyDown: function(e) {
|
||||
title_keyDown: function(e, i) {
|
||||
var ins, kc, last, next;
|
||||
kc = e.keyCode;
|
||||
switch (kc) {
|
||||
@ -771,7 +764,7 @@ module.exports = recl({
|
||||
select: "end"
|
||||
});
|
||||
}
|
||||
WorkActions.removeItem(this.state.list[this.state.selected], this.state.selected);
|
||||
WorkActions.removeItem(i.props.item);
|
||||
e.preventDefault();
|
||||
}
|
||||
break;
|
||||
@ -865,6 +858,7 @@ module.exports = recl({
|
||||
'data-index': index
|
||||
}, rece(ItemComponent, {
|
||||
item: item,
|
||||
index: index,
|
||||
_focus: _this._focus,
|
||||
title_keyDown: _this.title_keyDown,
|
||||
draggable: _this.state.canSort,
|
||||
@ -1514,6 +1508,9 @@ WorkStore = assign({}, EventEmitter.prototype, {
|
||||
for (i = 0, len = _list.length; i < len; i++) {
|
||||
id = _list[i];
|
||||
task = _tasks[id];
|
||||
if (task.archived) {
|
||||
continue;
|
||||
}
|
||||
add = true;
|
||||
for (_k in _filters) {
|
||||
_v = _filters[_k];
|
||||
@ -1521,32 +1518,23 @@ WorkStore = assign({}, EventEmitter.prototype, {
|
||||
continue;
|
||||
}
|
||||
c = task[_k];
|
||||
switch (_k) {
|
||||
case 'tags' || 'audience':
|
||||
if (_.intersection(c, _v).length === 0) {
|
||||
add = false;
|
||||
}
|
||||
break;
|
||||
case 'owner':
|
||||
if (c !== _v.replace(/\~/g, "")) {
|
||||
add = false;
|
||||
}
|
||||
break;
|
||||
case 'done':
|
||||
if (_v === true && !c) {
|
||||
add = false;
|
||||
}
|
||||
if (_v === false && c) {
|
||||
add = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (c !== _v) {
|
||||
add = false;
|
||||
}
|
||||
add = (function() {
|
||||
switch (_k) {
|
||||
case 'tags' || 'audience':
|
||||
return _.intersection(c, _v).length !== 0;
|
||||
case 'owner':
|
||||
return c === _v.replace(/\~/g, "");
|
||||
case 'done':
|
||||
return !!c === _v;
|
||||
default:
|
||||
return c === _v;
|
||||
}
|
||||
})();
|
||||
if (!add) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (add === true) {
|
||||
if (add) {
|
||||
list.push(task);
|
||||
}
|
||||
}
|
||||
@ -1632,10 +1620,10 @@ WorkStore = assign({}, EventEmitter.prototype, {
|
||||
_tasks[_list[from]].sort = _tasks[_list[to]].sort;
|
||||
return _list = list;
|
||||
},
|
||||
removeItem: function(arg) {
|
||||
var index;
|
||||
index = arg.index;
|
||||
return _list.splice(index, 1);
|
||||
setAudience: function(arg) {
|
||||
var id, to;
|
||||
id = arg.id, to = arg.to;
|
||||
return _tasks[id].audience = to;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -84,21 +84,22 @@ WorkStore = assign {},EventEmitter.prototype,{
|
||||
list = []
|
||||
for id in _list
|
||||
task = _tasks[id]
|
||||
if task.archived
|
||||
continue
|
||||
add = true
|
||||
for _k,_v of _filters
|
||||
if _v is null then continue
|
||||
c = task[_k]
|
||||
switch _k
|
||||
add = switch _k
|
||||
when 'tags' or 'audience'
|
||||
if _.intersection(c,_v).length is 0 then add = false
|
||||
_.intersection(c,_v).length isnt 0
|
||||
when 'owner'
|
||||
if c isnt _v.replace(/\~/g, "") then add = false
|
||||
c is _v.replace(/\~/g, "")
|
||||
when 'done'
|
||||
if _v is true and not c then add = false
|
||||
if _v is false and c then add = false
|
||||
else
|
||||
if c isnt _v then add = false
|
||||
if add is true
|
||||
!!c is _v
|
||||
else c is _v
|
||||
break unless add
|
||||
if add
|
||||
list.push task
|
||||
if _.uniq(_.values(_sorts)).length > 0
|
||||
for k,v of _sorts
|
||||
@ -138,7 +139,7 @@ WorkStore = assign {},EventEmitter.prototype,{
|
||||
moveItems: ({list,to,from}) ->
|
||||
_tasks[_list[from]].sort = _tasks[_list[to]].sort
|
||||
_list = list
|
||||
removeItem: ({index}) -> _list.splice index,1
|
||||
setAudience: ({id,to})-> _tasks[id].audience = to
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user