Changeset edc462d in Klonkt


Ignore:
Timestamp:
06/17/2026 01:14:00 AM (3 months ago)
Author:
roboburr <roboburr@โ€ฆ>
Branches:
main
Children:
ca253750
Parents:
3068cc0
Message:

Post-editor: default status Published (new posts) + friendlier pin control

  • Status: new posts default to Published (was Draft); labels in English (Published/Draft/Archived).
  • Pinned rank: raw number + cryptic legend replaced by a "๐Ÿ“Œ Pin to top" checkbox + โ–ฒโ–ผ-stepper with readable position ("top", "2nd from top"). Underlying value (pinned, 0 = not pinned) remains the same.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@โ€ฆ>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/post-edit.ejs

    r3068cc0 redc462d  
    156156        <label class="pe-field">
    157157          <span>Status</span>
     158          <% var _st = isNew ? 'published' : (post.status || 'draft'); %>
    158159          <select name="status">
    159             <option value="draft"     <%= post.status === 'draft'     ? 'selected' : '' %>>Draft</option>
    160             <option value="published" <%= post.status === 'published' ? 'selected' : '' %>>Published</option>
    161             <option value="archived"  <%= post.status === 'archived'  ? 'selected' : '' %>>Archived</option>
     160            <option value="published" <%= _st === 'published' ? 'selected' : '' %>>Gepubliceerd</option>
     161            <option value="draft"     <%= _st === 'draft'     ? 'selected' : '' %>>Concept</option>
     162            <option value="archived"  <%= _st === 'archived'  ? 'selected' : '' %>>Gearchiveerd</option>
    162163          </select>
    163164        </label>
     
    174175      </div>
    175176      <div class="pe-checkboxes">
    176         <label class="pe-pinned-rank">
    177           <span>๐Ÿ“Œ Pinned rank</span>
    178           <input type="number" name="pinned" min="0" step="1"
    179                  inputmode="numeric" pattern="[0-9]*"
    180                  value="<%= post.pinned || 0 %>"
    181                  title="0 = niet pinned. 1 = bovenaan, 2 = daaronder, etc.">
    182           <small>0 = niet pinned ยท 1 = bovenaan ยท 2 daaronder ยท โ€ฆ</small>
    183         </label>
     177        <div class="pe-pin">
     178          <label class="pe-checkbox">
     179            <input type="checkbox" id="pin-toggle" <%= (Number(post.pinned) > 0) ? 'checked' : '' %>>
     180            <span>๐Ÿ“Œ Vastpinnen bovenaan</span>
     181          </label>
     182          <input type="hidden" name="pinned" id="pin-rank" value="<%= post.pinned || 0 %>">
     183          <div class="pe-pin-pos" id="pin-pos" <%= (Number(post.pinned) > 0) ? '' : 'hidden' %>>
     184            <span class="pe-pin-steps">
     185              <button type="button" class="pe-pin-btn" id="pin-up" aria-label="Hoger zetten">โ–ฒ</button>
     186              <button type="button" class="pe-pin-btn" id="pin-down" aria-label="Lager zetten">โ–ผ</button>
     187            </span>
     188            <span class="pe-pin-label" id="pin-label"></span>
     189          </div>
     190        </div>
    184191        <label class="pe-checkbox">
    185192          <input type="checkbox" name="noindex" value="1" <%= post.noindex ? 'checked' : '' %>>
     
    786793}
    787794
    788 /* Pinned rank: replaces the old boolean checkbox with a number input.
    789    Stack the label / input / hint vertically โ€” small footprint. */
    790 .pe-pinned-rank {
    791   display: flex; flex-direction: column; gap: 0.25rem;
    792   font-size: 0.95rem;
    793   color: var(--ink);
    794 }
    795 .pe-pinned-rank input[type="number"] {
    796   width: 80px;
    797   padding: 0.4rem 0.6rem; min-height: 36px;
    798   border: 1px solid var(--rule); border-radius: 6px;
    799   background: var(--paper-2); color: var(--ink);
    800   font-family: var(--font-ui, system-ui), sans-serif;
    801   font-size: 0.95rem;
    802   font-variant-numeric: tabular-nums;
    803   -webkit-appearance: none; appearance: textfield;
    804 }
    805 .pe-pinned-rank input[type="number"]:focus {
    806   outline: 2px solid var(--accent); outline-offset: -1px;
    807   border-color: var(--accent);
    808 }
    809 .pe-pinned-rank small {
    810   font-size: 0.78rem;
    811   color: var(--ink-muted, var(--ink-soft));
    812 }
     795/* Vastpinnen: checkbox + โ–ฒโ–ผ-stepper met beschrijving (i.p.v. een ruw rang-getal). */
     796.pe-pin { display: flex; flex-direction: column; gap: 0.45rem; }
     797.pe-pin-pos { display: flex; align-items: center; gap: 0.55rem; padding-left: 1.65rem; }
     798.pe-pin-pos[hidden] { display: none; }
     799.pe-pin-steps { display: inline-flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
     800.pe-pin-btn {
     801  width: 30px; height: 28px; padding: 0;
     802  border: none; background: var(--paper-2); color: var(--ink);
     803  cursor: pointer; font-size: 0.68rem; line-height: 1;
     804  display: inline-flex; align-items: center; justify-content: center;
     805}
     806.pe-pin-btn + .pe-pin-btn { border-left: 1px solid var(--rule); }
     807.pe-pin-btn:hover { background: color-mix(in srgb, var(--accent) 14%, var(--paper-2)); color: var(--accent); }
     808.pe-pin-btn:disabled { opacity: 0.35; cursor: default; }
     809.pe-pin-label { font-size: 0.85rem; color: var(--accent); font-weight: 600; }
    813810
    814811/* โ”€โ”€โ”€ Sticky action footer โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ */
     
    13801377  <%- include('../partials/playlist-editor', { csrfToken: (typeof csrfToken !== 'undefined' ? csrfToken : '') }) %>
    13811378<% } %>
     1379
     1380<script>
     1381(function () {
     1382  // Vastpinnen: checkbox toggelt het verborgen rang-veld (0 = niet gepind),
     1383  // โ–ฒโ–ผ verschuift de plek, met een leesbare beschrijving i.p.v. een ruw getal.
     1384  var toggle = document.getElementById('pin-toggle');
     1385  var rank   = document.getElementById('pin-rank');
     1386  var pos    = document.getElementById('pin-pos');
     1387  var label  = document.getElementById('pin-label');
     1388  var up     = document.getElementById('pin-up');    // hoger = lager getal (richting 1/bovenaan)
     1389  var down   = document.getElementById('pin-down');
     1390  if (!toggle || !rank || !pos) return;
     1391
     1392  function descr(n) {
     1393    n = Number(n) || 0;
     1394    if (n <= 1) return 'bovenaan';
     1395    return n + 'e van boven';
     1396  }
     1397  function render() {
     1398    var on = toggle.checked;
     1399    pos.hidden = !on;
     1400    if (on && Number(rank.value) < 1) rank.value = 1;
     1401    if (!on) rank.value = 0;
     1402    if (label) label.textContent = on ? descr(rank.value) : '';
     1403    if (up) up.disabled = Number(rank.value) <= 1;
     1404  }
     1405  toggle.addEventListener('change', render);
     1406  if (up)   up.addEventListener('click', function () { rank.value = Math.max(1, (Number(rank.value) || 1) - 1); render(); });
     1407  if (down) down.addEventListener('click', function () { rank.value = (Number(rank.value) || 0) + 1; render(); });
     1408  render();
     1409})();
     1410</script>
Note: See TracChangeset for help on using the changeset viewer.