Merge branch 'apps' of https://github.com/urbit/urbit into apps

This commit is contained in:
Anton Dyudin 2015-08-20 12:42:45 -07:00
commit 15ad337ad3
11 changed files with 333 additions and 101 deletions

View File

@ -40,7 +40,7 @@
:_ ~
^- move
:* ost %poke
/sending/(scot %uw id)/(scot %ud version)
/sending/(scot %uv id)/(scot %ud version)
[our %talk]
%talk-command
^- command:talk
@ -48,14 +48,35 @@
|- ^- (list thought)
:_ ~
:+ (shaf %task eny)
[[[%& our (main our)] [*envelope %pending]] ~ ~]
%- mo ^- (list ,[partner envelope delivery]:talk)
%+ turn (~(tap in audience))
|=(sat=station:talk [[%& sat] [*envelope %pending]])
[now *bouquet [%tax action]]
==
==
++ claim
%_ .
eny (sham eny %direct)
moves
:_ ~
^- move
:* ost %poke
/claiming/(scot %uv id)
[our %talk]
%talk-command
^- command:talk
:- %publish
|- ^- (list thought)
:_ ~
:+ (shaf %task eny)
[[[%& owner (main owner)] [*envelope %pending]] ~ ~]
[now *bouquet [%tax %claim id]]
==
==
++ create (send `duty:work-stuff:talk`[%create `task`tax])
++ send-update |*(* (send %update id +(version) +<))
++ announce (send-update %announce ~)
++ release (cury send-update %announce)
++ release (cury send-update %release)
++ accept (send-update %accept ~)
++ delete (send-update %delete ~)
++ set-date-due (cury send-update %set-date-due)
@ -65,7 +86,6 @@
++ set-done (cury send-update %set-done)
++ add-comment (cury send-update %add-comment)
++ set-audience ~|(%not-implemented !!)
++ claim ~|(%not-implemented !!)
++ process-update
|= up=update
^+ +>
@ -96,25 +116,46 @@
++ process-duty
|= [when=@da her=ship from=(set station:talk) action=duty:work-stuff:talk]
^- [(list move) _+>.$]
=< mirror-to-web
=- =^ mof con mirror-to-web:con
[(welp mos mof) con]
^- [mos=(list move) con=_+>.$]
?- -.action
%create
=+ existing-task=(~(get by tasks) id.p.action)
%create :: XX should verify ownership
=+ existing-task=(~(get by tasks) id.tax.action)
~? ?& ?=(^ existing-task)
!=(p.action task.u.existing-task)
!=(tax.action task.u.existing-task)
==
:* %new-task-with-old-id
her=her
from=from
new-task=p.action
new-task=tax.action
existing-task=u.existing-task
==
?. |(=(her owner.tax.action) =(%released status.tax.action))
~& :* %created-with-bad-owner
her=her
from=from
new-task=tax.action
existing-task=u.existing-task
==
[~ +>.$]
=. tasks
%^ ~(put by tasks) id.p.action p.action
%^ ~(put by tasks) id.tax.action tax.action
?~ existing-task from
(~(uni in audience.u.existing-task) from)
=. sort ?~(existing-task sort [id.p.action sort])
+>.$
=. sort ?~(existing-task sort [id.action sort])
[~ +>.$]
::
%claim
=+ tax=(~(got by tasks) id.action)
?. &(=(our owner.tax) =(%announced status.tax))
~& :* %bad-claim
her=her
from=from
task=tax
==
[~ +>.$]
abet:(release:(at (~(got by tasks) id.action)) her)
::
%update
=+ tax=(~(get by tasks) id.action)
@ -124,7 +165,7 @@
from=from
action=action
==
+>.$
[~ +>.$]
?. =(version.action +(version.task.u.tax))
~& :* %update-bad-version
her
@ -132,7 +173,7 @@
action=action
tax=tax
==
+>.$
[~ +>.$]
=. tasks
%^ ~(put by tasks) id.action
?: ?& ?=(?(%announce %release %accept) -.meat.action)
@ -147,21 +188,23 @@
task.u.tax
?- -.meat.action
%announce task.u.tax(status %announced)
%release task.u.tax(owner p.meat.action, status %released)
%release task.u.tax(owner her.meat.action, status %released)
%accept task.u.tax(status %accepted)
%delete !!
%set-date-due task.u.tax(date-due p.meat.action)
%set-tags task.u.tax(tags p.meat.action)
%set-title task.u.tax(title p.meat.action)
%set-description task.u.tax(description p.meat.action)
%set-done task.u.tax(done `when)
%delete ~|(%not-implemented !!)
%set-date-due task.u.tax(date-due wen.meat.action)
%set-tags task.u.tax(tags tag.meat.action)
%set-title task.u.tax(title til.meat.action)
%set-description task.u.tax(description des.meat.action)
%set-done task.u.tax(done ?.(don.meat.action ~ `when))
%add-comment
%= task.u.tax
discussion [[when her p.meat.action] discussion.task.u.tax]
discussion [[when her com.meat.action] discussion.task.u.tax]
==
==
(~(uni in audience.u.tax) from)
+>.$
?: =([%release our] meat.action)
abet:accept:(at (~(got by tasks) id.action))
[~ +>.$]
==
::
++ mirror-to-web

View File

@ -83,7 +83,10 @@
font-style: normal;
}
html,
body {
body,
input,
label,
button {
font-family: "bau";
font-size: 18px;
}
@ -98,11 +101,38 @@ body {
h1 {
font-weight: 500;
}
.ctrl {
margin-top: 2rem;
}
.ctrl h1 {
font-size: 1rem;
}
.ctrl .sort label,
.ctrl .filter label {
text-transform: uppercase;
font-size: 0.7rem;
line-height: 2rem;
letter-spacing: 0.07rem;
}
.ctrl .filter {
line-height: 2rem;
margin-right: 1rem;
}
.ctrl .sort {
border: 3px solid transparent;
background-color: transparent;
outline: none;
}
.ctrl .sort.s-1,
.ctrl .sort.s--1 {
border: 3px solid #ccc;
}
.ctrl .sort.s-1 label,
.ctrl .sort.s--1 label {
margin-right: 1rem;
}
.items {
margin-top: 4rem;
margin-top: 2rem;
}
.item {
display: block;
@ -257,6 +287,20 @@ h1 {
border-bottom: 6px solid transparent;
margin-top: 0.4rem;
}
.s-1 .caret,
.caret.down {
border-left: 6px solid transparent;
border-top: 6px solid #000;
border-right: 6px solid transparent;
border-bottom: 6px solid transparent;
}
.s--1 .caret,
.caret.up {
border-left: 6px solid transparent;
border-top: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #000;
}
.hr1 {
height: 0.2rem;
width: 6rem;

View File

@ -6,6 +6,9 @@
html
body
input
label
button
font-family "bau"
font-size 18px
@ -21,11 +24,38 @@ h1
font-weight 500
.ctrl
margin-top 2rem
h1
font-size 1rem
.sort label
.filter label
text-transform uppercase
font-size .7rem
line-height 2rem
letter-spacing .07rem
.filter
line-height 2rem
margin-right 1rem
.sort
border 3px solid transparent
background-color transparent
outline none
.sort.s-1
.sort.s--1
border 3px solid #ccc
label
margin-right 1rem
.items
margin-top 4rem
margin-top 2rem
.item
display block
@ -180,6 +210,20 @@ h1
border-bottom 6px solid transparent
margin-top .4rem
.s-1 .caret
.caret.down
border-left 6px solid transparent
border-top 6px solid #000
border-right 6px solid transparent
border-bottom 6px solid transparent
.s--1 .caret
.caret.up
border-left 6px solid transparent
border-top 6px solid transparent
border-right 6px solid transparent
border-bottom 6px solid #000
.hr1
height .2rem
width 6rem

View File

@ -12,13 +12,15 @@ module.exports = recl
change: (e) ->
$t = $(e.target).closest('.filter')
txt = $t.find('.input').text().trim()
key = $t.attr('data-key')
if txt.length is 0 then txt = null
@props.onChange $t.attr('data-key'),txt
if key is 'audience' then txt = txt.split " "
if key is 'tags' then txt = [txt]
@props.onChange key,txt
render: ->
(div {className:'filters'}, [
(h1 {}, 'Filters:')
(div {className:'owned filter','data-key':'owned'}, [
(label {}, 'Owened by:')
(div {className:'owned filter ib','data-key':'owner'}, [
(label {}, 'Owned by:')
(div {
contentEditable:true
className:'input ib'
@ -26,25 +28,31 @@ module.exports = recl
onBlur:@_onBlur
},@props.filters.owned)
])
(div {className:'tag filter','data-key':'tag'}, [
(div {className:'tag filter ib','data-key':'tags'}, [
(label {}, 'Tag:')
(div {
contentEditable:true
className:'input ib'
onKeyDown:@_onKeyDown
onBlur:@_onBlur
},@props.filters.tag)
])
(div {className:'channel filter','data-key':'channel'}, [
(label {}, 'Channel:')
(div {className:'channel filter ib','data-key':'audience'}, [
(label {}, 'Audience:')
(div {
contentEditable:true
className:'input ib'
onKeyDown:@_onKeyDown
onBlur:@_onBlur
},@props.filters.channel)
])
(div {className:'status filter','data-key':'status'}, [
(div {className:'status filter ib','data-key':'status'}, [
(label {}, 'Status:')
(div {
contentEditable:true
className:'input ib'
onKeyDown:@_onKeyDown
onBlur:@_onBlur
},@props.filters.status)
])
])

View File

@ -51,7 +51,7 @@ module.exports = recl
'data-index':@props.index
}, [
(div {className:'audience'},@props.item.audience.join(" "))
(div {className:'sort ib top'},@props.index)
(div {className:'sort ib top'},@props.item.sort)
(div {className:'done ib'},'')
(div {className:'title ib top'},[
(div {

View File

@ -93,7 +93,7 @@ module.exports = recl
_changeFilter: (key,val) -> WorkActions.setFilter key,val
_changeSorts: ->
_changeSort: (key,val) -> WorkActions.setSort key,val
componentDidMount: ->
@placeholder = $ "<div class='item placeholder'><div class='sort'>x</div></div>"
@ -130,7 +130,7 @@ module.exports = recl
})
rece(SortComponent, {
sorts:@state.sorts
onChange:@_changeSorts
onChange:@_changeSort
})
]),
])

View File

@ -4,6 +4,4 @@ rece = React.createElement
module.exports = recl
render: ->
(div {className:'listening'}, [
(h1 {}, 'Listening:')
])
(div {className:'listening'}, "")

View File

@ -1,13 +1,25 @@
recl = React.createClass
rece = React.createElement
[div,h1,button] = [React.DOM.div,React.DOM.h1,React.DOM.button]
[div,h1,button,label] = [React.DOM.div,React.DOM.h1,React.DOM.button,React.DOM.label]
module.exports = recl
_onClick: (e) ->
$t = $(e.target).closest '.sort'
key = $t.attr('data-key')
sor = Number $t.attr 'data-state'
if sor is 0 then sor = 1
else if sor is 1 then sor = -1
else if sor is -1 then sor = 0
@props.onChange key,sor
render: ->
(div {className:'sorts'}, [
(h1 {}, 'Sorts:')
(button {}, 'Name')
(button {}, 'Owner')
(button {}, 'Date')
(button {}, 'Priority')
])
(div {className:'sorts'}, _.map @props.sorts,(s,k) =>
(button {
'data-key':k
'data-state':s
className:"sort s-#{s}"
onClick:@_onClick
}, [
(label {}, k)
(div {className:'caret ib'}, '')
])
)

View File

@ -105,51 +105,64 @@ module.exports = recl({
return this.change(e);
},
change: function(e) {
var $t, txt;
var $t, key, txt;
$t = $(e.target).closest('.filter');
txt = $t.find('.input').text().trim();
key = $t.attr('data-key');
if (txt.length === 0) {
txt = null;
}
return this.props.onChange($t.attr('data-key'), txt);
if (key === 'audience') {
txt = txt.split(" ");
}
if (key === 'tags') {
txt = [txt];
}
return this.props.onChange(key, txt);
},
render: function() {
return div({
className: 'filters'
}, [
h1({}, 'Filters:'), div({
className: 'owned filter',
'data-key': 'owned'
div({
className: 'owned filter ib',
'data-key': 'owner'
}, [
label({}, 'Owened by:'), div({
label({}, 'Owned by:'), div({
contentEditable: true,
className: 'input ib',
onKeyDown: this._onKeyDown,
onBlur: this._onBlur
}, this.props.filters.owned)
]), div({
className: 'tag filter',
'data-key': 'tag'
className: 'tag filter ib',
'data-key': 'tags'
}, [
label({}, 'Tag:'), div({
contentEditable: true,
className: 'input ib'
className: 'input ib',
onKeyDown: this._onKeyDown,
onBlur: this._onBlur
}, this.props.filters.tag)
]), div({
className: 'channel filter',
'data-key': 'channel'
className: 'channel filter ib',
'data-key': 'audience'
}, [
label({}, 'Channel:'), div({
label({}, 'Audience:'), div({
contentEditable: true,
className: 'input ib'
className: 'input ib',
onKeyDown: this._onKeyDown,
onBlur: this._onBlur
}, this.props.filters.channel)
]), div({
className: 'status filter',
className: 'status filter ib',
'data-key': 'status'
}, [
label({}, 'Status:'), div({
contentEditable: true,
className: 'input ib'
className: 'input ib',
onKeyDown: this._onKeyDown,
onBlur: this._onBlur
}, this.props.filters.status)
])
]);
@ -229,7 +242,7 @@ module.exports = recl({
className: 'audience'
}, this.props.item.audience.join(" ")), div({
className: 'sort ib top'
}, this.props.index), div({
}, this.props.item.sort), div({
className: 'done ib'
}, ''), div({
className: 'title ib top'
@ -460,7 +473,9 @@ module.exports = recl({
_changeFilter: function(key, val) {
return WorkActions.setFilter(key, val);
},
_changeSorts: function() {},
_changeSort: function(key, val) {
return WorkActions.setSort(key, val);
},
componentDidMount: function() {
this.placeholder = $("<div class='item placeholder'><div class='sort'>x</div></div>");
WorkStore.addChangeListener(this._onChangeStore);
@ -505,7 +520,7 @@ module.exports = recl({
onChange: this._changeFilter
}), rece(SortComponent, {
sorts: this.state.sorts,
onChange: this._changeSorts
onChange: this._changeSort
})
])
]), div({
@ -544,26 +559,53 @@ module.exports = recl({
render: function() {
return div({
className: 'listening'
}, [h1({}, 'Listening:')]);
}, "");
}
});
},{}],6:[function(require,module,exports){
var button, div, h1, rece, recl, ref;
var button, div, h1, label, rece, recl, ref;
recl = React.createClass;
rece = React.createElement;
ref = [React.DOM.div, React.DOM.h1, React.DOM.button], div = ref[0], h1 = ref[1], button = ref[2];
ref = [React.DOM.div, React.DOM.h1, React.DOM.button, React.DOM.label], div = ref[0], h1 = ref[1], button = ref[2], label = ref[3];
module.exports = recl({
_onClick: function(e) {
var $t, key, sor;
$t = $(e.target).closest('.sort');
key = $t.attr('data-key');
sor = Number($t.attr('data-state'));
if (sor === 0) {
sor = 1;
} else if (sor === 1) {
sor = -1;
} else if (sor === -1) {
sor = 0;
}
return this.props.onChange(key, sor);
},
render: function() {
return div({
className: 'sorts'
}, [h1({}, 'Sorts:'), button({}, 'Name'), button({}, 'Owner'), button({}, 'Date'), button({}, 'Priority')]);
}, _.map(this.props.sorts, (function(_this) {
return function(s, k) {
return button({
'data-key': k,
'data-state': s,
className: "sort s-" + s,
onClick: _this._onClick
}, [
label({}, k), div({
className: 'caret ib'
}, '')
]);
};
})(this)));
}
});
@ -1068,17 +1110,17 @@ _list = [
_listening = [];
_filters = {
owned: null,
tag: null,
channel: null,
owner: null,
tags: null,
audience: null,
status: null
};
_sorts = {
name: null,
owner: null,
date: null,
priority: null
title: 0,
owner: 0,
date: 0,
sort: 0
};
WorkStore = assign({}, EventEmitter.prototype, {
@ -1092,20 +1134,43 @@ WorkStore = assign({}, EventEmitter.prototype, {
return this.removeListener("change", cb);
},
getList: function(key) {
var add, k, list, v;
var _k, _v, add, c, k, list, v;
list = [];
for (k in _list) {
v = _list[k];
add = true;
if (_filters.owned !== null) {
if (v.owner !== _filters.owned) {
add = false;
for (_k in _filters) {
_v = _filters[_k];
if (_v === null) {
continue;
}
c = v[_k];
if (typeof c === 'object') {
if (_.intersection(c, _v).length === 0) {
add = false;
}
} else {
if (c !== _v) {
add = false;
}
}
}
if (add === true) {
list.push(v);
}
}
if (_.uniq(_.values(_sorts)).length > 0) {
for (k in _sorts) {
v = _sorts[k];
if (v !== 0) {
break;
}
}
list = _.sortBy(list, k, k);
if (v === -1) {
list.reverse();
}
}
return list;
},
getListening: function() {
@ -1123,8 +1188,12 @@ WorkStore = assign({}, EventEmitter.prototype, {
return _sorts;
},
setSort: function(arg) {
var key, val;
var k, key, v, val;
key = arg.key, val = arg.val;
for (k in _sorts) {
v = _sorts[k];
_sorts[k] = 0;
}
return _sorts[key] = val;
},
newItem: function(arg) {

View File

@ -50,15 +50,15 @@ _list = [
]
_listening = []
_filters =
owned:null
tag:null
channel:null
owner:null
tags:null
audience:null
status:null
_sorts =
name:null
owner:null
date:null
priority:null
title:0
owner:0
date:0
sort:0
WorkStore = assign {},EventEmitter.prototype,{
emitChange: -> @emit 'change'
@ -69,11 +69,21 @@ WorkStore = assign {},EventEmitter.prototype,{
list = []
for k,v of _list
add = true
if _filters.owned isnt null
if v.owner isnt _filters.owned
add = false
for _k,_v of _filters
if _v is null then continue
c = v[_k]
if typeof(c) is 'object'
if _.intersection(c,_v).length is 0 then add = false
else
if c isnt _v then add = false
if add is true
list.push v
if _.uniq(_.values(_sorts)).length > 0
for k,v of _sorts
if v isnt 0
break
list = _.sortBy list,k,k
if v is -1 then list.reverse()
list
getListening: -> _listening
@ -84,7 +94,10 @@ WorkStore = assign {},EventEmitter.prototype,{
getSorts: -> _sorts
setSort: ({key,val}) -> _sorts[key] = val
setSort: ({key,val}) ->
for k,v of _sorts
_sorts[k] = 0
_sorts[key] = val
newItem: ({index,item}) ->
_item = _.extend {sort:index,audience:[]}, item

View File

@ -81,21 +81,22 @@
++ work-stuff ::
|% ::
++ duty ::
$% [%create p=task] :: create new task
$% [%create tax=task] :: create new task
[%claim id=@uvH] :: claim task
$: %update :: operate on task
id=@uvH :: which task
version=@u :: version
$= meat ::
$% [%announce ~] :: make available
[%release p=ship] :: pass to new owner
[%release her=ship] :: pass to new owner
[%accept ~] :: accept pass
[%delete ~] :: delete task
[%set-date-due p=(unit ,@da)] :: set due date
[%set-tags p=(set ,@t)] :: set tags
[%set-title p=@t] :: set title
[%set-description p=@t] :: set description
[%set-done p=?] :: set done
[%add-comment p=@t] :: add comment
[%set-date-due wen=(unit ,@da)] :: set due date
[%set-tags tag=(set ,@t)] :: set tags
[%set-title til=@t] :: set title
[%set-description des=@t] :: set description
[%set-done don=?] :: set done
[%add-comment com=@t] :: add comment
== ::
== ::
== ::