Merge branch 'apps' into pending

This commit is contained in:
Philip C Monk 2015-09-02 16:40:37 -04:00
commit 2db1e82240
14 changed files with 197 additions and 77 deletions

View File

@ -72,6 +72,8 @@
::
++ send-create (send %create tax)
++ send-change |* *
?: =(our creator.tax)
(send-update +(version.tax) our +<)
%+ send-audience
[[creator.tax (main creator.tax)] ~ ~]
[%change id.tax +<]
@ -228,6 +230,9 @@
action=action
tax=tax
==
?: (lte version.action version.tax.u.tax)
~& %really-bad-version
[~ +>.$]
:- ~
%_ +>.$
unordered
@ -306,6 +311,9 @@
::
:: XX maybe need to check that we haven't received this message before
:: by keeping a counter of last message received
:: XX definitely do this!
:: XX handle and test the disconnection case
::
++ diff-talk-report
|= [way=wire rep=report:talk]
^- [(list move) _+>.$]

View File

@ -101,6 +101,12 @@ button {
h1 {
font-weight: 500;
}
input,
button,
.input {
outline: none;
border: 0;
}
h1.leader:after {
content: "—";
margin-left: 0.6rem;
@ -139,7 +145,6 @@ h1.leader:after {
vertical-align: middle;
}
.ctrl .sort {
outline: none;
border: 0;
cursor: pointer;
background-color: #000;
@ -184,6 +189,7 @@ h1.leader:after {
}
.item {
display: block;
min-height: 3rem;
max-height: 3rem;
margin-bottom: 1.5rem;
width: 36rem;
@ -193,7 +199,8 @@ h1.leader:after {
}
.item .description,
.item .discussion {
display: none;
transition: visibility 0s linear 200ms;
visibility: hidden;
}
.item.expand {
max-height: 24rem;
@ -201,7 +208,8 @@ h1.leader:after {
}
.item.expand .description,
.item.expand .discussion {
display: inherit;
transition: visibility 0s;
visibility: visible;
}
.item .expand {
margin-left: 2rem;
@ -240,7 +248,17 @@ h1.leader:after {
font-size: 0.7rem;
}
.item .sort {
color: #ccc;
opacity: 0;
width: 1rem;
height: 0.2rem;
background-color: #e0e0e0;
border-top: 0.2rem solid #ccc;
border-bottom: 0.2rem solid #ccc;
margin: 0 0.5rem;
margin-top: -0.6rem;
}
.item:hover .sort {
opacity: 1;
}
.item .done {
margin-top: 0.5rem;
@ -275,19 +293,20 @@ h1.leader:after {
.item .audience .input {
background-color: transparent;
}
.item .sort {
font-size: 0.6rem;
width: 2rem;
text-align: center;
.item .title,
.item .date,
.item .tags {
overflow: hidden;
white-space: nowrap;
height: 2rem;
}
.item .title {
min-width: 16rem;
margin-left: 0.5rem;
}
.item .date {
min-width: 6rem;
}
.item .date,
.item .tags {
max-width: 6rem;
min-width: 6rem;
}
.item .description,
@ -325,7 +344,7 @@ h1.leader:after {
letter-spacing: 0.07rem;
color: #fff;
border: 0;
padding: 0 0.3rem;
padding: 0.6rem 0.3rem;
margin-top: 0.5rem;
}
.comment {
@ -358,7 +377,6 @@ h1.leader:after {
text-decoration: underline;
}
.input {
outline: none;
padding: 0 0.6rem 0 0.3rem;
background-color: #ececec;
border: 0;
@ -461,7 +479,6 @@ textarea:focus,
max-width: 6rem;
overflow: hidden;
margin-left: 0.3rem;
height: 2rem;
}
.item .expand {
float: right;

View File

@ -23,6 +23,12 @@ button
h1
font-weight 500
input
button
.input
outline none
border 0
h1.leader:after
content ""
margin-left .6rem
@ -61,7 +67,6 @@ h1.leader:after
vertical-align middle
.sort
outline none
border 0
cursor pointer
background-color #000
@ -108,6 +113,7 @@ h1.leader:after
.item
display block
min-height 3rem
max-height 3rem
margin-bottom 1.5rem
width 36rem
@ -117,7 +123,8 @@ h1.leader:after
.description
.discussion
display none
transition visibility 0s linear 200ms
visibility hidden
&.expand
max-height 24rem
@ -125,7 +132,8 @@ h1.leader:after
.description
.discussion
display inherit
transition visibility 0s
visibility visible
.expand
margin-left 2rem
@ -164,7 +172,17 @@ h1.leader:after
font-size .7rem
.sort
color #ccc
opacity 0
width 1rem
height .2rem
background-color #e0e0e0
border-top .2rem solid #ccc
border-bottom .2rem solid #ccc
margin 0 .5rem
margin-top -.6rem
&:hover .sort
opacity 1
.done
margin-top .5rem
@ -198,20 +216,21 @@ h1.leader:after
.audience .input
background-color transparent
.sort
font-size .6rem
width 2rem
text-align center
.title
.date
.tags
overflow hidden
white-space nowrap
height 2rem
.title
min-width 16rem
margin-left .5rem
.date
min-width 6rem
.tags
max-width 6rem
min-width 6rem
.description
@ -248,7 +267,7 @@ h1.leader:after
letter-spacing .07rem
color #fff
border 0
padding 0 .3rem
padding .6rem .3rem
margin-top .5rem
.comment
@ -282,7 +301,6 @@ h1.leader:after
text-decoration underline
.input
outline none
padding 0 .6rem 0 .3rem
background-color #ececec
border 0

View File

@ -65,7 +65,6 @@
max-width 6rem
overflow hidden
margin-left .3rem
height 2rem
.item .expand
float right

View File

@ -48,12 +48,29 @@ module.exports =
version += 1
Persistence.put old:{id,version,dif:add:comment:val}
setFilter: (key,val) -> Dispatcher.handleViewAction {type:'setFilter', key,val}
setSort: (key,val) -> Dispatcher.handleViewAction {type:'setSort',key,val}
setFilter: (key,val,filters) ->
Dispatcher.handleViewAction {type:'setFilter', key,val}
filters[key] = val
Persistence.setLocal 'filters',filters
setSort: (key,val,sorts) ->
Dispatcher.handleViewAction {type:'setSort',key,val}
sorts[key] = val
Persistence.setLocal 'sorts',sorts
moveItem: (list,to,from) ->
Persistence.put {sort:list}
Dispatcher.handleViewAction {type:'moveItems',list,to,from}
getLocal: (key)->
Persistence.getLocal key,(e,r) ->
new Error(e) if e
return if r is null
obj =
type:"load#{key[0].toUpperCase()+key.slice(1)}"
obj[key] = r
Dispatcher.handleServerAction obj
listenList: (type)->
Persistence.subscribe type, (err,d)->
if d?

View File

@ -16,8 +16,8 @@ module.exports = recl
if e.keyCode is 13
e.stopPropagation()
e.preventDefault()
onKeyUp: (e) -> @change(e)
onBlur: (e) -> @change(e)
onKeyUp: (e) -> @change e
onBlur: (e) -> @change e
change: (e) ->
$t = $(e.target).closest('.filter')
txt = $t.find('.input').text().trim()
@ -38,6 +38,9 @@ module.exports = recl
render: ->
(div {className:'filters'}, @fields.map ({filter,key,title})=>
txt = @props.filters[key]
txt = txt?.replace(/\~/g,"") if key is 'creator'
(div {key, 'data-key':key, className:"#{filter} filter ib"},
(label {}, title)
switch filter
@ -53,5 +56,5 @@ module.exports = recl
@onKeyDown
@onKeyUp
@onBlur
},@props.filters[filter])
},txt)
))

View File

@ -126,7 +126,7 @@ module.exports = recl
)
(@renderField 'audience', {}, @formatAudience)
)
(div {className:'sort ib top'}, @props.item.sort)
(div {className:'sort ib'}, '')
(button {className:'done ib done-'+(@props.item.done is true), onClick:@_markDone}, '')
(@renderTopField 'title', {@onFocus,@onKeyDown})
(@renderTopField 'date_due', {className:'date'}, @formatDate)

View File

@ -17,7 +17,6 @@ module.exports = recl
noNew:WorkStore.noNew()
canSort:WorkStore.canSort()
fulllist:WorkStore.getFullList()
listening:WorkStore.getListening()
sorts:WorkStore.getSorts()
filters:WorkStore.getFilters()
expand:false
@ -107,14 +106,16 @@ module.exports = recl
_changeListening: ->
_changeFilter: (key,val) -> WorkActions.setFilter key,val
_changeFilter: (key,val) -> WorkActions.setFilter key,val,@state.filters
_changeSort: (key,val) -> WorkActions.setSort key,val
_changeSort: (key,val) -> WorkActions.setSort key,val,@state.sorts
componentDidMount: ->
@placeholder = $ "<div class='item placeholder'><div class='sort'>x</div></div>"
WorkStore.addChangeListener @_onChangeStore
WorkActions.listenList @props.list
WorkActions.getLocal 'filters'
WorkActions.getLocal 'sorts'
@alias()
componentDidUpdate: (_props,_state)->

View File

@ -11,6 +11,7 @@ module.exports = recl
else if sor is 1 then sor = -1
else if sor is -1 then sor = 0
@props.onChange key,sor
render: ->
(div {className:'sorts'}, _.map @props.sorts,(state,key) =>
(button {

View File

@ -43,14 +43,14 @@ module.exports = {
});
},
setItem: function(arg, key, val) {
var id, obj, set, version;
var id, obj1, set, version;
id = arg.id, version = arg.version;
version += 1;
key = key.split('_').join('-');
set = (
obj = {},
obj["" + key] = val,
obj
obj1 = {},
obj1["" + key] = val,
obj1
);
Persistence.put({
old: {
@ -69,7 +69,7 @@ module.exports = {
});
},
ownItem: function(arg, act) {
var id, obj, version;
var id, obj1, version;
id = arg.id, version = arg.version;
version += 1;
return Persistence.put({
@ -78,9 +78,9 @@ module.exports = {
version: version,
dif: {
doer: (
obj = {},
obj["" + act] = null,
obj
obj1 = {},
obj1["" + act] = null,
obj1
)
}
}
@ -141,19 +141,23 @@ module.exports = {
}
});
},
setFilter: function(key, val) {
return Dispatcher.handleViewAction({
setFilter: function(key, val, filters) {
Dispatcher.handleViewAction({
type: 'setFilter',
key: key,
val: val
});
filters[key] = val;
return Persistence.setLocal('filters', filters);
},
setSort: function(key, val) {
return Dispatcher.handleViewAction({
setSort: function(key, val, sorts) {
Dispatcher.handleViewAction({
type: 'setSort',
key: key,
val: val
});
sorts[key] = val;
return Persistence.setLocal('sorts', sorts);
},
moveItem: function(list, to, from) {
Persistence.put({
@ -166,6 +170,22 @@ module.exports = {
from: from
});
},
getLocal: function(key) {
return Persistence.getLocal(key, function(e, r) {
var obj;
if (e) {
new Error(e);
}
if (r === null) {
return;
}
obj = {
type: "load" + (key[0].toUpperCase() + key.slice(1))
};
obj[key] = r;
return Dispatcher.handleServerAction(obj);
});
},
listenList: function(type) {
return Persistence.subscribe(type, function(err, d) {
var ref, sort, tasks;
@ -182,7 +202,6 @@ module.exports = {
};
},{"../dispatcher/Dispatcher.coffee":9,"../persistence/Persistence.coffee":15,"../util.coffee":17}],2:[function(require,module,exports){
var WorkActions, div, rece, recl, ref, textarea,
slice = [].slice;
@ -347,7 +366,6 @@ module.exports = recl({
});
},{"../actions/WorkActions.coffee":1}],3:[function(require,module,exports){
var button, div, h1, label, rece, recl, ref;
@ -433,8 +451,12 @@ module.exports = recl({
className: 'filters'
}, this.fields.map((function(_this) {
return function(arg) {
var filter, key, title;
var filter, key, title, txt;
filter = arg.filter, key = arg.key, title = arg.title;
txt = _this.props.filters[key];
if (key === 'creator') {
txt = txt != null ? txt.replace(/\~/g, "") : void 0;
}
return div({
key: key,
'data-key': key,
@ -453,7 +475,7 @@ module.exports = recl({
onKeyDown: this.onKeyDown,
onKeyUp: this.onKeyUp,
onBlur: this.onBlur
}, this.props.filters[filter]);
}, txt);
}
}).call(_this));
};
@ -462,7 +484,6 @@ module.exports = recl({
});
},{}],4:[function(require,module,exports){
var Field, WorkActions, button, div, rece, recl, ref, textarea;
@ -647,8 +668,8 @@ module.exports = recl({
}, status), div({
className: 'action a'
}, action)), this.renderField('audience', {}, this.formatAudience)), div({
className: 'sort ib top'
}, this.props.item.sort), button({
className: 'sort ib'
}, ''), button({
className: 'done ib done-' + (this.props.item.done === true),
onClick: this._markDone
}, ''), this.renderTopField('title', {
@ -714,7 +735,6 @@ module.exports = recl({
});
},{"../actions/WorkActions.coffee":1,"./FieldComponent.coffee":2}],5:[function(require,module,exports){
var FilterComponent, ItemComponent, ListeningComponent, SortComponent, WorkActions, WorkStore, div, h1, input, rece, recl, ref, textarea;
@ -745,7 +765,6 @@ module.exports = recl({
noNew: WorkStore.noNew(),
canSort: WorkStore.canSort(),
fulllist: WorkStore.getFullList(),
listening: WorkStore.getListening(),
sorts: WorkStore.getSorts(),
filters: WorkStore.getFilters(),
expand: false,
@ -892,15 +911,17 @@ module.exports = recl({
},
_changeListening: function() {},
_changeFilter: function(key, val) {
return WorkActions.setFilter(key, val);
return WorkActions.setFilter(key, val, this.state.filters);
},
_changeSort: function(key, val) {
return WorkActions.setSort(key, val);
return WorkActions.setSort(key, val, this.state.sorts);
},
componentDidMount: function() {
this.placeholder = $("<div class='item placeholder'><div class='sort'>x</div></div>");
WorkStore.addChangeListener(this._onChangeStore);
WorkActions.listenList(this.props.list);
WorkActions.getLocal('filters');
WorkActions.getLocal('sorts');
return this.alias();
},
componentDidUpdate: function(_props, _state) {
@ -970,7 +991,6 @@ module.exports = recl({
});
},{"../actions/WorkActions.coffee":1,"../stores/WorkStore.coffee":16,"./FilterComponent.coffee":3,"./ItemComponent.coffee":4,"./ListeningComponent.coffee":6,"./SortComponent.coffee":7}],6:[function(require,module,exports){
var div, h1, input, rece, recl, ref, textarea;
@ -989,7 +1009,6 @@ module.exports = recl({
});
},{}],7:[function(require,module,exports){
var button, div, h1, label, rece, recl, ref;
@ -1034,7 +1053,6 @@ module.exports = recl({
});
},{}],8:[function(require,module,exports){
var ListComponent, div, h1, rece, recl, ref;
@ -1057,7 +1075,6 @@ module.exports = recl({
});
},{"./ListComponent.coffee":5}],9:[function(require,module,exports){
var Dispatcher;
@ -1079,7 +1096,6 @@ module.exports = _.merge(new Dispatcher(), {
});
},{"flux":11}],10:[function(require,module,exports){
var WorkComponent;
@ -1092,7 +1108,6 @@ $(function() {
});
},{"./components/WorkComponent.coffee":8,"./util.coffee":17}],11:[function(require,module,exports){
/**
* Copyright (c) 2014-2015, Facebook, Inc.
@ -1486,11 +1501,23 @@ module.exports = {
if (cache != null) {
return cb(null, cache);
}
},
setLocal: function(key, val) {
return window.localStorage.setItem(key, JSON.stringify(val));
},
getLocal: function(key, cb) {
var e, out;
try {
out = JSON.parse(window.localStorage.getItem(key));
return cb(null, out);
} catch (_error) {
e = _error;
return cb(e);
}
}
};
},{}],16:[function(require,module,exports){
var Dispatcher, EventEmitter, WorkStore, _filters, _ghost, _list, _listening, _sorts, _tasks, _updated, assign, uuid32;
@ -1654,8 +1681,12 @@ WorkStore = assign({}, EventEmitter.prototype, {
}
return _tasks[item.id] = this.itemFromData(item, index);
},
getListening: function() {
return _listening;
loadFilters: function(arg) {
var filters;
filters = arg.filters;
console.log('filters');
console.log(filters);
return _filters = filters;
},
getFilters: function() {
return _filters;
@ -1665,6 +1696,13 @@ WorkStore = assign({}, EventEmitter.prototype, {
key = arg.key, val = arg.val;
return _filters[key] = val;
},
loadSorts: function(arg) {
var sorts;
sorts = arg.sorts;
console.log('load sorts');
console.log(sorts);
return _sorts = sorts;
},
getSorts: function() {
return _sorts;
},
@ -1759,7 +1797,6 @@ WorkStore.dispatchToken = Dispatcher.register(function(p) {
module.exports = WorkStore;
},{"../dispatcher/Dispatcher.coffee":9,"../util.coffee":17,"events":18,"object-assign":14}],17:[function(require,module,exports){
module.exports = {
uuid32: function() {
@ -1818,7 +1855,6 @@ module.exports = {
};
},{}],18:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//

View File

@ -12,3 +12,10 @@ module.exports =
subscribe: (key,cb) ->
listeners[key] = cb
(cb null,cache) if cache?
setLocal: (key,val) -> window.localStorage.setItem key,JSON.stringify val
getLocal: (key,cb) ->
try
out = JSON.parse window.localStorage.getItem key
cb null,out
catch e
cb e

View File

@ -90,10 +90,18 @@ WorkStore = assign {},EventEmitter.prototype,{
throw new Error "Collision: already have #{item.id}"
_tasks[item.id] = @itemFromData item, index
getListening: -> _listening
loadFilters: ({filters}) ->
console.log 'filters'
console.log filters
_filters = filters
getFilters: -> _filters
setFilter: ({key,val}) ->
_filters[key] = val
loadSorts: ({sorts}) ->
console.log 'load sorts'
console.log sorts
_sorts = sorts
getSorts: -> _sorts
setSort: ({key,val}) ->
for k,v of _sorts

View File

@ -91,9 +91,9 @@
[%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-description des=@t] :: XX (list ,@t) :: set description
[%set-done don=?] :: set done
[%add-comment com=@t] :: add comment
[%add-comment com=@t] :: XX (list ,@t) :: add comment
== ::
++ task ::
$: id=@uvH ::

View File

@ -1,3 +1,8 @@
::
:::: /hoon/work/sur
::
:: A block comment might go here!
::
/- talk
|%
++ client
@ -20,20 +25,20 @@
date-due=(unit ,@da)
done=(unit ,@da)
title=@t
description=@t
description=@t :: XX (list ,@t)
discussion=(list comment)
==
++ comment
$: date=@da
ship=@p
body=@t
body=@t :: XX (list ,@t)
==
++ command
$% [%new audience=(set station:talk) task]
[%old id=@uvH dif=update]
[%sort p=(list ,@uvH)]
==
++ update
++ update :: XX rename, web-edit?
$% $: %set
$% [%audience to=(set station:talk)]
[%date-due p=(unit ,@da)]