Changeset 8cb1dc7 in Klonkt for src/views


Ignore:
Timestamp:
06/14/2026 04:17:14 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
640b39c
Parents:
ccbd6a6
Message:

hub: artist self-management — owner manages their own subsite (posts/appearance/comments)

A site owner (member) now gets a "My PrutFolio" dashboard and can manage their
OWN site; cross-site access is restricted.

  • auth.js: requireSiteManager (owner of res.locals.site or god) + requireSiteManagerBySlug (owner of :slug or god).
  • admin.js: /admin role-aware -> god=hub management, owner=my-site dashboard, member without site=403.
  • admin-sites.js: /:slug/edit + /save owner-or-god (was god-only); upload-photo requireAuth. list/new/create/delete remain god-only.
  • admin-comments.js: requireSiteManager + redirects/form actions via siteUrlBase so the artist context (/user/<slug>/admin/comments) is correct.
  • render.js: userOwnsSite flag; topnav + overview show "Admin" for owners; topnav "New post" uses siteUrlBase.
  • pages/my-site.ejs: artist dashboard.

Co-Authored-By: Claude <noreply@…>

Location:
src/views
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/admin-comments.ejs

    rccbd6a6 r8cb1dc7  
    2626            <strong><%= c.author_username %></strong>
    2727            <% if (c.parent_comment_id) { %><span class="muted">(reply)</span><% } %>
    28             on <a href="/<%= c.post_slug %>"><%= c.post_title || c.post_slug %></a>
     28            on <a href="<%= siteUrlBase %>/<%= c.post_slug %>"><%= c.post_title || c.post_slug %></a>
    2929            <span class="muted">&middot; <%= formatDateTime(c.created_at) %></span>
    3030          </div>
    3131          <blockquote class="moderation-content"><%= c.content %></blockquote>
    3232          <div class="moderation-actions">
    33             <form method="post" action="/admin/comments/<%= c.id %>/approve" style="display:inline">
     33            <form method="post" action="<%= siteUrlBase %>/admin/comments/<%= c.id %>/approve" style="display:inline">
    3434              <button type="submit" class="btn btn-primary">Approve</button>
    3535            </form>
    36             <form method="post" action="/admin/comments/<%= c.id %>/reject" style="display:inline">
     36            <form method="post" action="<%= siteUrlBase %>/admin/comments/<%= c.id %>/reject" style="display:inline">
    3737              <button type="submit" class="btn btn-danger">Reject</button>
    3838            </form>
     
    5555          <tr class="status-<%= c.status %>">
    5656            <td><%= c.author_username %></td>
    57             <td><a href="/<%= c.post_slug %>"><%= c.post_title || c.post_slug %></a></td>
     57            <td><a href="<%= siteUrlBase %>/<%= c.post_slug %>"><%= c.post_title || c.post_slug %></a></td>
    5858            <td>
    5959              <span class="status-pill status-pill--<%= c.status %>"><%= c.status %></span>
  • src/views/pages/hub-home.ejs

    rccbd6a6 r8cb1dc7  
    55    <div class="hub-nav-inner container">
    66      <% if (user) { %>
    7         <% if (user.role === 'god' || user.role === 'admin') { %>
     7        <% if (user.role === 'god' || user.role === 'admin' || (typeof userOwnsSite !== 'undefined' && userOwnsSite)) { %>
    88          <a class="hub-nav-link" href="/admin">Beheer</a>
    99        <% } %>
  • src/views/partials/topnav.ejs

    rccbd6a6 r8cb1dc7  
    109109                <span>Account</span>
    110110              </a>
    111               <% if (user.role === 'god' || user.role === 'admin') { %>
     111              <% if (user.role === 'god' || user.role === 'admin' || (typeof userOwnsSite !== 'undefined' && userOwnsSite)) { %>
    112112                <a href="/admin" role="menuitem" class="udi">
    113113                  <svg class="udi-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3h7v7H3z"/><path d="M14 3h7v7h-7z"/><path d="M14 14h7v7h-7z"/><path d="M3 14h7v7H3z"/></svg>
     
    116116              <% } %>
    117117              <% if (_canPost) { %>
    118                 <a href="/posts/new" role="menuitem" class="udi"
    119                    hx-get="/posts/new?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
    120                    hx-push-url="/posts/new" hx-indicator="#pcms-loading">
     118                <a href="<%= _siteUrlBase %>/posts/new" role="menuitem" class="udi"
     119                   hx-get="<%= _siteUrlBase %>/posts/new?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
     120                   hx-push-url="<%= _siteUrlBase %>/posts/new" hx-indicator="#pcms-loading">
    121121                  <svg class="udi-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"/></svg>
    122122                  <span>Nieuwe post</span>
Note: See TracChangeset for help on using the changeset viewer.