Merge branch 'pending' into test

This commit is contained in:
Anton Dyudin 2015-09-08 13:26:31 -07:00
commit cdc47047d7
20 changed files with 317 additions and 134 deletions

View File

@ -10,20 +10,24 @@
!: :: ::
=> |% :: external structures
++ house :: all state
$: hoc=(map bone session) :: conversations
$: %0
hoc=(map bone session) :: conversations
== ::
++ session :: per conversation
$: say=sole-share :: command-line state
syd=desk :: active desk
luc=(unit case) :: special case
poy=(unit dojo-project) :: working
[lib=(list hoof) arc=(list hoof)] :: lib/sur
var=(map term cage) :: variable state
old=(set term) :: used TLVs
buf=tape :: multiline buffer
== ::
++ dojo-command ::
$% [%flat p=path q=dojo-source] :: noun to unix atom
[%pill p=path q=dojo-source] :: noun to unix pill
:: [%tree p=path q=dojo-source] :: noun to unix tree
[%file p=beam q=dojo-source] :: save to clay
[%poke p=goal q=dojo-source] :: make and poke
[%show p=dojo-source] :: print
[%verb p=term q=dojo-source] :: store variable
@ -87,6 +91,7 @@
[%send wire [ship term] clap] ::
[%exec wire @p (unit ,[beak silk])] ::
[%deal wire sock term club] ::
[%info wire @p toro] ::
== ::
++ move (pair bone card) :: user-level move
++ sign ::
@ -104,6 +109,7 @@
|_ [[ost=bone moz=(list move)] session] ::
++ dp :: dojo parser
|%
++ dp-command-line ;~(sfix dp-command (just '\0a'))
++ dp-command :: ++dojo-command
%+ knee *dojo-command |. ~+
;~ pose
@ -149,17 +155,22 @@
::
%+ stag %verb
;~ pfix tis
;~(plug sym ;~(pfix ace dp-source))
;~((glue ace) sym dp-source)
==
::
%+ stag %file
;~ pfix tar
;~((glue ace) dp-beam dp-source)
==
::
%+ stag %flat
;~ pfix pat
;~(plug (most fas sym) ;~(pfix ace dp-source))
;~((glue ace) (most fas sym) dp-source)
==
::
%+ stag %pill
;~ pfix dot
;~(plug (most fas sym) ;~(pfix ace dp-source))
;~((glue ace) (most fas sym) dp-source)
==
::
(stag %show dp-source)
@ -186,14 +197,19 @@
(cook |=(a=term `goal`[our.hid a]) sym)
(easy [our.hid %hood])
==
++ dp-beam :: ++beam
%+ sear tome
=+ vez=(vang & dp-path)
(sear plex:vez (stag %clsg poor:vez))
::
++ dp-model-cat ;~(plug dp-server-cat dp-config) :: ++dojo-model
++ dp-model-dog ;~(plug dp-server-dog dp-config) :: ++dojo-model
++ dp-model-pig ;~(plug dp-server-pig dp-config) :: ++dojo-model
++ dp-path `path`/(scot %p our.hid)/home/(scot %da now.hid)
++ dp-path `path`/(scot %p our.hid)/[syd]/(scot %da now.hid)
++ dp-server-cat (stag 0 (stag %cat dp-device)) :: ++dojo-server
++ dp-server-dog (stag 0 (stag %dog dp-device)) :: ++dojo-server
++ dp-server-pig (stag 0 (stag %pig dp-device)) :: ++dojo-server
++ dp-twig wide:(vang & dp-path) :: ++twig
++ dp-twig tall:(vang & dp-path) :: ++twig
++ dp-device (most fas sym) :: ++dojo-device
++ dp-value :: ++dojo-source
%+ cook |=(a=dojo-source a)
@ -209,14 +225,10 @@
(star ;~(pfix ace dp-value))
%+ cook
~(gas by *(map term (unit dojo-source)))
%+ more
;~(plug com ace)
%- star
;~ plug
;~(pfix tis sym)
;~ pose
;~(pfix ace (stag ~ dp-value))
(easy ~)
==
;~(pfix com ace tis sym)
(punt ;~(pfix ace dp-value))
==
==
--
@ -225,15 +237,11 @@
|_ dojo-project ::
++ dy-abet +>(poy `+<) :: resolve
++ dy-amok +>(poy ~) :: terminate
++ dy-beak :: XX rethink
^- beak
[our.hid %home [%da now.hid]]
::
++ dy-ford :: send work to ford
|= [way=wire kas=silk]
^+ +>+>
?> ?=(~ pux)
(he-card(poy `+>+<(pux `way)) %exec way our.hid `[dy-beak kas])
(he-card(poy `+>+<(pux `way)) %exec way our.hid `[he-beak kas])
::
++ dy-stop :: stop work
^+ +>
@ -259,6 +267,7 @@
|= mad=dojo-command
^+ [mad +>]
?- -.mad
%file =^(src +>.$ (dy-init-source q.mad) [[%file p.mad src] +>.$])
%flat =^(src +>.$ (dy-init-source q.mad) [[%flat p.mad src] +>.$])
%pill =^(src +>.$ (dy-init-source q.mad) [[%pill p.mad src] +>.$])
%poke =^(src +>.$ (dy-init-source q.mad) [[%poke p.mad src] +>.$])
@ -387,6 +396,14 @@
%poke
(~(got by rez) p.q.mad)
==
::
%file
%- he-card(poy ~) :*
%info
/file
our.hid
(foal (tope p.mad) (~(got by rez) p.q.mad))
==
::
%flat
=+ out=q.q:(~(got by rez) p.q.mad)
@ -398,7 +415,18 @@
(dy-rash %sag p.mad q.q:(~(got by rez) p.q.mad))
::
%verb
dy-amok(var (~(put by var) p.mad (~(got by rez) p.q.mad)))
~& (~(run by var) mug)
=+ cay=(~(got by rez) p.q.mad)
~| bad-set/[p.mad p.q.cay]
=< dy-amok
?+ p.mad .(var (~(put by var) p.mad cay))
%now ~|(%time-is-immutable !!)
%who ~|(%self-is-immutable !!)
%law .(syd ;;(@tas q.q.cay))
%dir ~|(%cd-stub ?>(?=(~ q.q.cay) .))
%lib .(lib ;;((list hoof) q.q.cay))
%arc .(arc ;;((list hoof) q.q.cay))
==
::
%show
=+ cay=(~(got by rez) p.p.mad)
@ -454,8 +482,13 @@
(dy-silk-config cag cig)
::
++ dy-twig-head :: dynamic state
^- vase
:(slop !>(`our=@p`our.hid) !>(`now=@da`now.hid) !>(`eny=@uvI`eny.hid))
^- cage
:- %noun
!> ^- $: law=desk dir=path
[lib=(list hoof) arc=(list hoof)]
[our=@p now=@da eny=@uvI]
==
[syd / [lib arc] [our now eny]:hid]
::
++ dy-made-dial :: dialog product
|= cag=cage
@ -494,6 +527,7 @@
%dv [/hand [%core he-beak (flop p.q.u.cud)]]
%ec [/hand [%cast p.q.u.cud (dy-mare q.q.u.cud)]]
%ex [/hand (dy-mare p.q.u.cud)]
%va [/hand %$ (~(got by var) p.q.u.cud)]
%tu :- /hand
:- %$
:- %noun
@ -507,7 +541,10 @@
++ dy-mare :: build expression
|= gen=twig
^- silk
[%ride gen [[%$ %$ dy-twig-head] [%reef ~]]]
:+ %ride gen
:- [%$ dy-twig-head]
=+ sur=(turn arc |=(hoof [& +<]))
[%plan [he-beak ~] / zuse sur lib ~ ~] :: XX spur
::
++ dy-step :: advance project
|= nex=@ud
@ -520,19 +557,23 @@
::
++ he-dope :: sole user of ++dp
|= txt=tape ::
^- (each (unit dojo-command) hair) :: prefix/result
=+ vex=((full dp-command):dp [1 1] txt) ::
?. =(+((lent txt)) q.p.vex) :: fully parsed
^- (each (unit (each dojo-command tape)) hair) :: prefix/result
=+ len=+((lent txt)) :: line length
=. txt :(weld buf txt "\0a") ::
=+ vex=((full dp-command-line):dp [1 1] txt) ::
?: =(q.p.vex len) :: matched until line end
[%& ~] ::
?: =(p.p.vex +((lent (skim txt |=(a=@ =(10 a)))))) :: parsed all lines
[%& ~ ?~(q.vex [%| txt] `p.u.q.vex)] :: new buffer/complete
[%| p.p.vex (dec q.p.vex)] :: syntax error
[%& ?~(q.vex ~ `p.u.q.vex)] :: prefix/complete
::
++ he-duke :: ++he-dope variant
|= txt=tape
^- (each dojo-command ,@ud)
^- (each (unit (each dojo-command tape)) ,@ud)
=+ foy=(he-dope txt)
?- -.foy
%| [%| q.p.foy]
%& ?~(p.foy [%| (lent txt)] [%& u.p.foy])
%& [%& p.foy]
==
::
++ he-abet :: resolve
@ -632,7 +673,7 @@
|= mad=dojo-command
^+ +>
?> ?=(~ poy)
he-pine:(dy-step:~(dy-init dy mad [0 ~ ~ ~ ~ ~ ~]) 0)
he-pine:(dy-step:~(dy-init dy %*(. *dojo-project mad mad)) 0)
::
++ he-done :: parse command
|= txt=tape
@ -647,15 +688,14 @@
?- -.doy
%| (he-diff [%err p.doy])
%&
=+ old=(weld "> " (tufa buf.say))
?~ p.doy
(he-diff [%err (lent txt)])
=+ old=(weld ?~(buf "> " " ") (tufa buf.say))
=^ cal say (~(transmit sole say) [%set ~])
%. p.doy
=< he-plan
%- he-diff
:~ %mor
[%txt old]
[%nex ~]
[%det cal]
=. +>.$ (he-diff %mor txt/old nex/~ det/cal ~)
?- -.u.p.doy
%& (he-plan(buf ~) p.u.p.doy)
%| +>.$(buf p.u.p.doy)
==
==
::
@ -678,6 +718,18 @@
he-pine :: XX give mean to original keystroke
--
::
++ prep
=+ sosh==>(*session .(|4 |5(+ old)))
:: ,_`..prep
|= old=(unit ?(house (map bone ,_sosh))) ^+ [~ ..prep]
?~ old `..prep
?. ?=([@ *] u.old)
%= $
u.old
[%0 (~(run by u.old) |=(sos=_sosh sos(|4 [[~ ~] &5.sos |5.sos ""])))]
==
`..prep(+<+ u.old)
::
++ peer-sole
|= [pax=path]
^- (quip move +>)
@ -690,13 +742,7 @@
%~ he-peer he
:- [ost.hid ~]
^- session
:* *sole-share :: say=sole-share
%home :: syd=desk
~ :: luc=(unit case)
~ :: poy=(unit dojo-project)
~ :: var=(map term cage)
~ :: old=(set term)
==
%*(. *session syd %home)
::
++ poke-sole-action
|= [act=sole-action]

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:talk 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

@ -413,7 +413,7 @@
vix=(bex +((cut 0 [25 2] mag))) :: width of sender
tay=(cut 0 [27 5] mag) :: message type
==
?> =(2 vez)
?> =(3 vez)
?> =(chk (end 0 20 (mug bod)))
:+ [(end 3 wix bod) (cut 3 [wix vix] bod)]
(kins tay)
@ -433,7 +433,7 @@
=+ tay=(ksin q.kec)
%+ mix
%+ can 0
:~ [3 2]
:~ [3 3]
[20 (mug bod)]
[2 yax]
[2 qax]
@ -1018,7 +1018,7 @@
++ gnaw :: gnaw:am
|= [kay=cape ryn=lane pac=rock] :: process packet
^- [p=(list boon) q=fort]
?. =(2 (end 0 3 pac)) [~ fox]
?. =(3 (end 0 3 pac)) [~ fox]
=+ kec=(bite pac)
?: (goop p.p.kec) [~ fox]
?. (~(has by urb.ton.fox) q.p.kec)

View File

@ -333,7 +333,9 @@
::
%red :: diff ack
?> ?=([@ @ @ ~] t.pax)
?> ?=([%a %woot *] sih)
?. ?=([%a %woot *] sih)
~& [%red-went pax]
+>.$
=+ :* him=(slav %p i.t.pax)
dap=i.t.t.pax
num=(slav %ud i.t.t.t.pax)

View File

@ -11,12 +11,11 @@
::::
!:
|= $: [now=@da eny=@uvI bek=beak]
[arg=[?(sorc [syd=$|(desk beaky) sorc])] opt=(map ,%gem germ)]
[arg=[?(sorc [syd=$|(desk beaky) sorc])] gem=?(%auto germ)]
==
=* our p.bek
|^ :- %kiln-merge
^- [syd=desk her=ship sud=desk gem=?(germ %auto)]
=+ gem=(fall (~(get by opt) %gem) %auto)
^- [syd=desk her=ship sud=desk gem=?(%auto germ)]
?- arg
[@ @ ~] =+(arg [sud ?.(=(our her) her (sein her)) sud gem])
[^ ~] =+((pars bek.arg) [dez ?.(=(our who) who (sein who)) dez gem])

12
cat/hood/unsync.hoon Normal file
View File

@ -0,0 +1,12 @@
::
:::: /hoon/unsync/hood/cat
::
/? 314
::
::::
!:
|= $: [now=@da eny=@uvI bec=beak]
[arg=[syd=@tas her=@p sud=@tas ~] ~]
==
:- %kiln-unsync
[syd her sud]:arg

View File

@ -367,6 +367,8 @@
+>.$(inx 0)
(se-alas u.lag)
=. +>.$ (se-text "[unlinked from {<gyl>}]")
?: =(gyl [our %dojo]) :: undead dojo
(se-link gyl)
se-prom(liv.maz ?~(fug & liv.maz))
::
++ se-dump :: print tanks

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;
width: 16rem;
margin-left: 0.5rem;
}
.item .date {
min-width: 6rem;
}
.item .date,
.item .tags {
max-width: 6rem;
min-width: 6rem;
}
.item .description,
@ -296,7 +315,7 @@ h1.leader:after {
margin: 0.5rem 0 0.5rem 2rem;
}
.item .discussion {
max-height: 18rem;
max-height: 9rem;
overflow-x: hidden;
overflow-y: scroll;
}
@ -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 {
@ -333,6 +352,7 @@ h1.leader:after {
}
.comment .date,
.comment .ship {
max-width: 12rem;
margin-right: 1rem;
}
.comment .body {
@ -358,7 +378,6 @@ h1.leader:after {
text-decoration: underline;
}
.input {
outline: none;
padding: 0 0.6rem 0 0.3rem;
background-color: #ececec;
border: 0;
@ -461,7 +480,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
@ -199,19 +217,20 @@ 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
width 16rem
margin-left .5rem
.date
min-width 6rem
.tags
max-width 6rem
min-width 6rem
.description
@ -220,7 +239,7 @@ h1.leader:after
margin .5rem 0 .5rem 2rem
.discussion
max-height 18rem
max-height 9rem
overflow-x hidden
overflow-y scroll
@ -248,7 +267,7 @@ h1.leader:after
letter-spacing .07rem
color #fff
border 0
padding 0 .3rem
padding .6rem .3rem
margin-top .5rem
.comment
@ -256,6 +275,7 @@ h1.leader:after
.date
.ship
max-width 12rem
margin-right 1rem
.body
@ -282,7 +302,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)]