iz
Clone
https://git.tahinli.com/Tahinli/iz.git
0 watching0 forksRustAGPL-3.0567.3 KiB3950aceTahinli27 days ago34 commits
| 1 | //! Shared page chrome: the HTML shell and the small components every page is built from. |
| 2 | //! |
| 3 | //! `view!` escapes text and attribute values, so user data is safe in it by default. Nothing here |
| 4 | //! emits an inline script, style or event handler; see `security.rs`. |
| 5 | |
| 6 | use Result; |
| 7 | use ; |
| 8 | use ; |
| 9 | use ; |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | use crate; |
| 18 | use crateService; |
| 19 | use crateLang; |
| 20 | use crate; |
| 21 | use crateAppState; |
| 22 | |
| 23 | /// The family key of this app. The switcher marks the service with this key as the current one. |
| 24 | const APP_KEY: &str = "iz"; |
| 25 | |
| 26 | /// What the shell shows about the signed-in person: the name in the user menu, the administrator |
| 27 | /// badge, and the CSRF token of the sign-out form in that menu. |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | /// The HTML document around a page. `title` is the page's own title; the document title adds the |
| 38 | /// app name. `child` is the page, placed in `<main>`. `page_script` is the one script of this page |
| 39 | /// (for example `board.js`), or `None`; it is loaded with `defer` and only on the page that needs it. |
| 40 | /// |
| 41 | /// The topbar has the wordmark on the left, the service switcher in the middle and the viewer's name |
| 42 | /// on the right. The switcher lists the family services from the cache in `AppState`; it is left out |
| 43 | /// when the list is empty. `nav.js` reads the restart text from `<body data-restart-text>`. |
| 44 | |
| 45 | pub async |
| 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 | |
| 101 | |
| 102 | |
| 103 | /// Whether `service` is the app that renders the page, which the switcher marks with `aria-current`. |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | /// The body of a message page: a title, one sentence, an optional detail (escaped, in a code |
| 109 | /// element) and a way back to the start. |
| 110 | |
| 111 | pub async |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | /// An error message for a failed action. Forms show it above their fields. |
| 130 | |
| 131 | pub async |
| 132 | |
| 133 | |
| 134 | |
| 135 | /// A plain message that is not an error, such as a confirmation or a hint. |
| 136 | |
| 137 | pub async |
| 138 | |
| 139 | |
| 140 | |
| 141 | /// A section with nothing in it yet: a title, then what to do next. |
| 142 | |
| 143 | pub async |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | /// Turns a rendered view into the response of a handler. For a handler that answers with a view on one |
| 153 | /// path and with a redirect or JSON on another. |
| 154 | pub async |
| 155 | |
| 156 | |
| 157 |