summaryrefslogtreecommitdiff
path: root/desk/web/calendar/notes.hoon
blob: 6190e84b5f21553e5d09e2e644de80ba7d590b2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/-  tp=trill-post
/+  ui=trill-ui
/+  kaji
|_  [notes=(list post:tp) =bowl:gall]

++  css  ^~  %-  trip
'''
*{
  box-sizing: border-box;
}
#list{
  width: 20%;
  border-right: 1px solid black;
  & .entry{
    padding: 1rem;
    cursor: pointer;
  }
}
#composer{
  width: 80%;
  & form{
    height: 100%;
    padding: 2rem;
    #inputs{
      height: 100%;
      & input,textarea{
        display: block;
        width: 100%;
        outline: none;
      }
      #top{
        display: flex;
        input[type=text]{
          font-size: 2rem;
          font-weight: 700;
          height: 2rem;
          border: none;
          margin-bottom: 1rem;
          flex-grow: 1;
        }
        input[type=submit]{
          height: 2rem;
          width: fit-content;
        }
      }
      & textarea{
        height: 90%;
        resize: none;
        border: none;
      }
    }
  }
}
'''
++  $
;div
  ;style: {css}
  ;div#list.scroll
    =kaji  "scry"
    =targ  "#inputs"
    ;*  %+  turn  notes  note-preview
  ==
  ;div#composer
    ;form
      =kaji  "poke"
      =action  "save-note"
      ;div#inputs
        ;div#top
          ;input(type "text", value "Title");
          ;input(type "submit", value "Save");
        ==
        ;textarea(name "text")
         ; This is a Markdown note
        ==
      ==
    ==
  ==
==
++  note-preview
|=  n=post:tp
=/  id  (enc:kaji [author.n id.n])
;div.entry
  =path  "/cal/f/note/{id}"
 ; {(trip title.n)}
==
++  note
|=  n=post:tp  ^-  manx
=/  pid-string  (enc:kaji [author.n id.n])
=/  post-text   (content-to-md:ui contents.n)
;div
  ;div#top
    ;input(type "hidden", name "pid", value pid-string);
    ;input(type "text", value (trip title.n));
    ;input(type "submit", value "Save");
  ==
  ;textarea(name "text")
   ; {post-text}
  ==
==
--