Changeset 8cb1dc7 in Klonkt for src/views/partials/topnav.ejs


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@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.