diff options
Diffstat (limited to 'desk/web/calendar/router.hoon')
-rw-r--r-- | desk/web/calendar/router.hoon | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/desk/web/calendar/router.hoon b/desk/web/calendar/router.hoon new file mode 100644 index 0000000..793f946 --- /dev/null +++ b/desk/web/calendar/router.hoon @@ -0,0 +1,66 @@ +/- boke, tp=trill-post, cnt=contact +/+ kaji, fetch-lib=fetch, plib=trill-utils, const=constants, sr=sortug, lib=boke, ui=trill-ui +/= index /web/index +/= main /web/calendar/main +/= notes /web/calendar/notes +/= todo /web/calendar/todo +/= cal /web/calendar/cal/month + +|_ [rl=req-line:kaji s=state:boke =bowl:gall] ++* fetch ~(. fetch-lib [s bowl]) +++ eyre-bail (error-response:kaji 404) +++ manx-bail (error-page:kaji 404) +:: +++ $ ^- eyre-res:kaji + ~& >> routing-cal=rl + =/ p pat.rl ::?. mob.rl pat.rl [%m pat.rl] + ?+ p eyre-bail + ~ root + [%f rest=*] :- %html (fragment rest.p) + == +++ root + :- %page (main s bowl) + +++ fragment +|= p=(pole knot) +=/ st s + ?+ p manx-bail + [%notes ~] (notes note-list bowl) + [%todo ~] (todo st bowl) + [%cal ~] (~(html cal bowl) now.bowl) + :: + [%note uid=@t ~] (note uid.p) + [%todo uid=@t ~] manx-bail + [%cal %day uid=@t ~] manx-bail + [%cal %week uid=@t ~] manx-bail + [%cal %month uid=@t ~] manx-bail + [%cal %event uid=@t ~] manx-bail + == +++ note |= uid=@t ^- manx + =/ upid (dec:kaji uid pid:tp) + ?~ upid manx-bail + =/ =post:tp (make-note 'rofl') + (note:notes post) + +++ note-list ^- (list post:tp) + %+ turn ~['Note 1' 'Lol' 'Hoon' 'Blog ideas' 'lmao'] + make-note +++ make-note + |= t=@t ^- post:tp + =/ tokens (tokenize:ui t) + =/ tags (silt ~[t 'note']) + =/ p (build-post:lib tokens tags [our.bowl now.bowl]) + p(title t) ++$ task + $: title=@t + desc=paragraph:tp + priority=@ud + status=$?(%todo %wip %done) + created=@da + due=((mop @da @da) gth) + creator=@p + subtasks=$~(~ (list task)) + workers=(map @p @t) :: who's doing what + tags=(set @t) + == +-- |