Skip to main content

max / makenotwork

2.7 KB · 66 lines History Blame Raw
1 {% extends "base.html" %}
2
3 {% block title %}Custom page: {{ heading }} - Makenotwork{% endblock %}
4
5 {% block content %}
6 <div class="cp-editor">
7 <header class="cp-editor-head">
8 <h1>Custom page: {{ heading }}</h1>
9 <nav class="cp-editor-actions">
10 <a href="{{ live_url }}" target="_blank" rel="noopener">View live</a>
11 <a href="/docs/custom-pages" target="_blank" rel="noopener">Guide</a>
12 </nav>
13 </header>
14 <p class="cp-intro">
15 Write your own HTML and CSS. No JavaScript, and every link must point to
16 makenot.work. Anything off-platform is listed below and stripped on save.
17 </p>
18
19 {% if locked %}
20 <div class="cp-locked-banner">
21 Your custom pages are locked by moderation. Editing is disabled and your
22 pages currently show the platform default. Contact info@makenot.work.
23 </div>
24 {% endif %}
25
26 <div class="cp-editor-grid">
27 <form class="cp-editor-form" hx-post="{{ base_path }}" hx-target="#cp-status" hx-swap="innerHTML">
28 {% if let Some(token) = csrf_token %}<input type="hidden" name="_csrf" value="{{ token }}">{% endif %}
29
30 <label for="cp-html">HTML</label>
31 <textarea id="cp-html" name="custom_html" class="cp-code" spellcheck="false"
32 {% if locked %}disabled{% endif %}
33 hx-post="{{ base_path }}/draft" hx-trigger="keyup changed delay:1s"
34 hx-include="closest form" hx-target="#cp-blocked" hx-swap="outerHTML">{{ html_value }}</textarea>
35
36 <label for="cp-css">CSS</label>
37 <textarea id="cp-css" name="custom_css" class="cp-code" spellcheck="false"
38 {% if locked %}disabled{% endif %}
39 hx-post="{{ base_path }}/draft" hx-trigger="keyup changed delay:1s"
40 hx-include="closest form" hx-target="#cp-blocked" hx-swap="outerHTML">{{ css_value }}</textarea>
41
42 <div class="cp-editor-buttons">
43 <button type="submit" class="btn-primary"{% if locked %} disabled{% endif %}>Save and publish</button>
44 <span id="cp-status" class="cp-status"></span>
45 </div>
46 </form>
47
48 <div class="cp-preview-pane">
49 <div class="cp-preview-bar">Preview (updates as you type)</div>
50 <iframe id="cp-preview" class="cp-preview" title="Live preview" src="{{ preview_url }}"></iframe>
51 </div>
52 </div>
53
54 <section class="cp-blocked-section">
55 <h2 class="subsection-title">Blocked references</h2>
56 {% include "partials/custom_page_blocked.html" %}
57 </section>
58
59 <form class="cp-reset" method="post" action="{{ base_path }}/reset"
60 data-submit="confirmResetPage">
61 {% if let Some(token) = csrf_token %}<input type="hidden" name="_csrf" value="{{ token }}">{% endif %}
62 <button type="submit" class="btn-danger">Reset to default</button>
63 </form>
64 </div>
65 {% endblock %}
66