Files
LuHost/views/worlds/details.ejs
Nathan Schneider c1a8784cad Add essential view templates for mods and worlds functionality
- views/mods/details.ejs: Detailed mod information and management page
- views/mods/index.ejs: Main mod management interface with world selection
- views/worlds/details.ejs: World configuration and settings page
- views/worlds/new.ejs: New world creation form

These templates were previously ignored but are required for core functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-08 11:05:50 -06:00

131 lines
6.4 KiB
Plaintext

<%
const body = `
<div class="page-header">
<div class="breadcrumb">
<a href="/worlds">Worlds</a>
<span>${world.displayName}</span>
</div>
<div style="display: flex; justify-content: space-between; align-items: flex-start;">
<h2>${world.displayName}</h2>
<form method="POST" action="/worlds/${world.name}/delete"
style="display: inline;"
onsubmit="return confirmDelete('world', '${world.displayName}')">
${typeof csrfToken !== 'undefined' && csrfToken ? `<input type="hidden" name="_csrf" value="${csrfToken}">` : ''}
<button type="submit" class="btn btn-danger">Delete World</button>
</form>
</div>
${world.description ? `<p class="text-secondary">${world.description}</p>` : ''}
</div>
${typeof req !== 'undefined' && req.query && req.query.updated ? `
<div class="alert alert-success">
World settings updated successfully!
</div>
` : ''}
<div class="grid">
<div class="card">
<div class="card-header">
<h3>World Settings</h3>
</div>
<div class="card-body">
<form method="POST" action="/worlds/${world.name}/update">
${typeof csrfToken !== 'undefined' && csrfToken ? `<input type="hidden" name="_csrf" value="${csrfToken}">` : ''}
<div class="form-group">
<label>Display Name</label>
<input
type="text"
name="displayName"
class="form-control"
value="${world.displayName}"
/>
</div>
<div class="form-group">
<label>Description</label>
<textarea
name="description"
class="form-control"
rows="3"
>${world.description || ''}</textarea>
</div>
<div class="form-group">
<label>Game Settings</label>
<div style="display: grid; gap: 8px; margin-top: 8px;">
<label style="display: flex; align-items: center; gap: 8px;">
<input type="checkbox" name="creativeMode" ${world.creativeMode ? 'checked' : ''} />
<span>Enable Creative Mode</span>
</label>
<label style="display: flex; align-items: center; gap: 8px;">
<input type="checkbox" name="enableDamage" ${world.enableDamage ? 'checked' : ''} />
<span>Enable Damage</span>
</label>
<label style="display: flex; align-items: center; gap: 8px;">
<input type="checkbox" name="enablePvp" ${world.enablePvp ? 'checked' : ''} />
<span>Enable PvP</span>
</label>
<label style="display: flex; align-items: center; gap: 8px;">
<input type="checkbox" name="serverAnnounce" ${world.serverAnnounce ? 'checked' : ''} />
<span>Announce Server</span>
</label>
</div>
</div>
<div style="display: flex; gap: 12px; margin-top: 24px;">
<button type="submit" class="btn btn-primary">Update Settings</button>
<a href="/mods?world=${world.name}" class="btn btn-outline">Manage Mods</a>
</div>
</form>
<div style="margin-top: 24px; padding-top: 24px; border-top: 2px solid var(--border-color);">
<h4>World Information</h4>
<div style="display: grid; gap: 8px; margin-top: 12px;">
<div><strong>Internal Name:</strong> ${world.name}</div>
<div><strong>Game:</strong> ${world.gameid}</div>
<div><strong>World Size:</strong> ${(world.worldSize / 1024 / 1024).toFixed(2)} MB</div>
<div><strong>Created:</strong> ${new Date(world.created).toLocaleString()}</div>
<div><strong>Last Modified:</strong> ${new Date(world.lastModified).toLocaleString()}</div>
</div>
</div>
</div>
</div>
${world.enabledMods && world.enabledMods.length > 0 ? `
<div class="card">
<div class="card-header">
<h3>Enabled Mods (${world.enabledMods.length})</h3>
</div>
<div class="card-body">
<div class="mod-list">
${world.enabledMods.map(mod => `
<div class="mod-item">
<div class="mod-info">
<strong>${mod.title}</strong>
${mod.author ? `<span class="text-secondary">by ${mod.author}</span>` : ''}
</div>
${mod.description ? `<div class="mod-description">${mod.description}</div>` : ''}
<div class="mod-location">
${mod.location === 'global-enabled' ? `
<span class="badge badge-success">Global (Enabled)</span>
` : mod.location === 'world-installed' ? `
<span class="badge badge-primary">World Copy</span>
` : mod.location === 'global-missing' ? `
<span class="badge badge-danger">Missing</span>
` : `
<span class="badge badge-secondary">${mod.location}</span>
`}
</div>
</div>
`).join('')}
</div>
</div>
</div>
` : ''}
</div>
`;
%>
<%- include('../layout', { body: body, currentPage: 'worlds', title: title }) %>