mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
feat(dashboard): a 3D button beside every property link
fmt.property(id, name) links a property's page and adds a small 3D button straight to its 3D view. Used everywhere a property is linked: the properties list and top slots, moderation, character pages' related properties, UGC search and the UGC page's placements, the home page, the chat log, player reports and report notes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -92,7 +92,7 @@
|
||||
document.getElementById('worldSubtitle').innerHTML = 'Zone ' + esc(world.mapID) + ' · instance ' + esc(world.instanceID) + (world.cloneID ? ' · clone ' + esc(world.cloneID) : '') +
|
||||
(world.ip ? ' · <code>' + esc(world.ip + ':' + world.port) + '</code>' : '') +
|
||||
(world.ownerId ? ' · owned by ' + fmt.character(world.ownerId, world.ownerName) : '') +
|
||||
(world.propertyId ? ' · ' + fmt.link('/properties/' + world.propertyId, 'property') : '');
|
||||
(world.propertyId ? ' · ' + fmt.property(world.propertyId, 'property') : '');
|
||||
document.getElementById('worldActions').innerHTML = can.worlds
|
||||
? '<button type="button" class="btn btn-sm btn-outline-danger" id="worldShutdown">Shut down</button>' : '';
|
||||
loadStats();
|
||||
|
||||
@@ -145,6 +145,12 @@
|
||||
},
|
||||
badge: function (text, type) { return '<span class="badge text-bg-' + type + '">' + esc(text) + '</span>'; },
|
||||
link: function (href, text) { return '<a href="' + esc(href) + '">' + esc(text) + '</a>'; },
|
||||
// A property by name, linked to its page, with a button straight to its 3D view
|
||||
property: function (id, name) {
|
||||
if (!id || id === '0') return '<span class="text-body-secondary">-</span>';
|
||||
return '<span class="text-nowrap">' + fmt.link('/properties/' + id, name || '(unnamed)') +
|
||||
' <a href="/properties/' + esc(id) + '/3d" class="btn btn-outline-secondary btn-sm py-0 px-1 ms-1 align-baseline" title="Open the 3D view">3D</a></span>';
|
||||
},
|
||||
// A character by name, linked; the ID only when the name is unknown (e.g. a deleted character)
|
||||
character: function (id, name) {
|
||||
if (!id || id === '0') return '<span class="text-body-secondary">-</span>';
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
var parts = [];
|
||||
if (r.target_character_id !== '0') parts.push(fmt.character(r.target_character_id, r.target_name));
|
||||
if (r.target_account_id) parts.push('<a class="small" href="/accounts/' + esc(r.target_account_id) + '">' + esc(r.target_account_name || ('Account ' + r.target_account_id)) + '</a>');
|
||||
if (r.property_id !== '0') parts.push('<a class="small" href="/properties/' + esc(r.property_id) + '">' + esc(r.property_name || 'Property') + '</a>');
|
||||
if (r.property_id !== '0') parts.push('<span class="small">' + fmt.property(r.property_id, r.property_name || 'Property') + '</span>');
|
||||
if (r.kind !== 'PLAYER' && r.object_lot) parts.push('<span class="small text-body-secondary">' + esc(r.object_name || ('LOT ' + r.object_lot)) + ' (' + esc(r.object_id) + ')</span>');
|
||||
return parts.join('<br>') || '<span class="text-body-secondary">Unknown</span>';
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
var SECTIONS = [
|
||||
['properties', 'Properties', function (rows) {
|
||||
return table(kind === 'account' ? ['Property', 'Owner', 'Zone', 'Models', 'Privacy', 'Status', 'Updated'] : ['Property', 'Zone', 'Models', 'Privacy', 'Status', 'Updated'], rows.map(function (p) {
|
||||
var cells = [fmt.link('/properties/' + p.id, p.name || '(unnamed)')];
|
||||
var cells = [fmt.property(p.id, p.name)];
|
||||
if (kind === 'account') cells.push(fmt.character(p.owner_id, p.owner_name));
|
||||
return cells.concat([fmt.zone(p.zone_id, p.zone_name), esc(nf.format(p.models)), esc(Labels.name('privacy', p.privacy_option) || p.privacy_option),
|
||||
p.mod_approved ? fmt.badge('Approved', 'success') : fmt.badge(p.rejection_reason ? 'Rejected' : 'Not approved yet', p.rejection_reason ? 'danger' : 'warning') +
|
||||
|
||||
@@ -526,7 +526,7 @@
|
||||
var note = '';
|
||||
if (current && current.unknown) note = 'Recorded before properties were told apart, so which property is not known.';
|
||||
else if (activity.place === 'properties' || (current && current.property && current.place.indexOf(':') < 0)) note = 'Every property together (different builds on the same ground). Pick one property to see its own data.';
|
||||
if (current && current.property_id) note += (note ? ' ' : '') + '<a href="/properties/' + esc(current.property_id) + '">Property page</a>';
|
||||
if (current && current.property_id) note += (note ? ' ' : '') + fmt.property(current.property_id, 'Property page');
|
||||
if (current && current.owner_id) note += (note ? ' · ' : '') + 'Owner ' + charLink(current.owner_id, current.owner_name);
|
||||
if (current && current.place && current.place.indexOf(':') > 0 && current.property) note += (note ? ' · ' : '') + '<a href="#" data-map-place="' + esc(current.place) + '">World map</a>';
|
||||
document.getElementById('activityPlaceNote').innerHTML = note;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
// A model the player didn't name has the client's placeholder (Objects_<lot>_name)
|
||||
var given = w.modelName && !/^Objects_\d+_name$/.test(w.modelName);
|
||||
var name = given ? ' as <span class="text-break">' + esc(w.modelName) + '</span>' : '';
|
||||
return '<div>On ' + fmt.link('/properties/' + w.propertyId, w.propertyName || 'Property ' + w.propertyId) + name +
|
||||
return '<div>On ' + fmt.property(w.propertyId, w.propertyName || 'Property ' + w.propertyId) + name +
|
||||
' <span class="small text-body-secondary">(' + fmt.character(w.ownerId, w.ownerName) + ', ' + esc(w.zoneId) + ')</span>' +
|
||||
' <a class="small" href="/properties/' + esc(w.propertyId) + '/3d#model=' + esc(w.modelId) + '">3D</a></div>';
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@
|
||||
var refs = null, refTimer = null;
|
||||
function whereText(w) {
|
||||
return (w || []).map(function (x) {
|
||||
if (x.type === 'property') return 'On <a href="/properties/' + esc(x.propertyId) + '">' + esc(x.propertyName || 'property ' + x.propertyId) + '</a>' + (x.ownerName ? ' of ' + esc(x.ownerName) : '');
|
||||
if (x.type === 'property') return 'On ' + fmt.property(x.propertyId, x.propertyName || 'property ' + x.propertyId) + (x.ownerName ? ' of ' + esc(x.ownerName) : '');
|
||||
if (x.type === 'mail') return 'In a mail to <a href="/characters/' + esc(x.characterId) + '">' + esc(x.characterName || x.characterId) + '</a>';
|
||||
return 'In the creator\'s ' + esc(x.inventory || 'inventory');
|
||||
}).join('<br>') || '<span class="text-body-secondary">Not found placed, mailed or with its creator</span>';
|
||||
|
||||
Reference in New Issue
Block a user