Commit b18a535
refactor(cohort): vendor and inline Tom Select instead of CDN
Per the Doist service-production-readiness standard, the cohort form
should not make third-party network calls at runtime. Vendor Tom Select
2.3.1 into bitmapist/cohort/tmpl/vendor/ (verified against the published
sha384 hashes) and inline the CSS/JS into the rendered fragment.
The assets are inlined rather than referenced by URL because the library
has no static-serving mechanism of its own -- consumers just embed the
string returned by render_html_form(), so there is no path they could
mount. Inlining makes the fragment fully self-contained and CSP/offline
safe. render_html_form() reads the vendored files once (module cache) and
passes them to the template; the wheel already ships everything under
bitmapist/, so the assets are packaged automatically.
The library <script> is emitted after the form markup so the browser can
render the form before executing ~50KB of JS, and the initializer no-ops
with a console warning if TomSelect is somehow unavailable.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 6d45ad6 commit b18a535
4 files changed
Lines changed: 491 additions & 15 deletions
File tree
- bitmapist/cohort
- tmpl
- vendor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
84 | 102 | | |
85 | 103 | | |
86 | 104 | | |
| |||
141 | 159 | | |
142 | 160 | | |
143 | 161 | | |
| 162 | + | |
| 163 | + | |
144 | 164 | | |
145 | 165 | | |
146 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
99 | 107 | | |
100 | 108 | | |
101 | 109 | | |
102 | 110 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
113 | 127 | | |
114 | | - | |
| 128 | + | |
115 | 129 | | |
116 | 130 | | |
117 | 131 | | |
| |||
0 commit comments