mirror of
https://github.com/RoY7x/worldbuilding.git
synced 2025-04-30 02:31:41 -04:00
Ensure worldbuilding changes are working on legacy worldbuilding world and adjust attribute form styling
This commit is contained in:
parent
977fb4b76b
commit
8a2ba78203
4 changed files with 47 additions and 37 deletions
|
@ -36,17 +36,16 @@ export class SimpleActorSheet extends ActorSheet {
|
||||||
data.data.ungroupedAttributes = {};
|
data.data.ungroupedAttributes = {};
|
||||||
|
|
||||||
// Build an array of sorted group keys.
|
// Build an array of sorted group keys.
|
||||||
let groupKeys = Object.keys(data.data.groups).sort((a, b) => {
|
const groups = data.data.groups || {};
|
||||||
// Attempt to sort by the label, but fall back to the key.
|
let groupKeys = Object.keys(groups).sort((a, b) => {
|
||||||
let aSort = data.data.groups[a].label ? data.data.groups[a].label : a;
|
let aSort = groups[a].label ?? a;
|
||||||
let bSort = data.data.groups[b].label ? data.data.groups[b].label : b;
|
let bSort = groups[b].label ?? b;
|
||||||
return aSort.localeCompare(bSort);
|
return aSort.localeCompare(bSort);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Iterate over the sorted groups to add their attributes..
|
// Iterate over the sorted groups to add their attributes.
|
||||||
groupKeys.forEach(key => {
|
for ( let key of groupKeys ) {
|
||||||
// Retrieve the group.
|
let group = data.data.attributes[key] || {};
|
||||||
let group = data.data.attributes[key];
|
|
||||||
|
|
||||||
// Initialize the attributes container for this group.
|
// Initialize the attributes container for this group.
|
||||||
if ( !data.data.groups[key]['attributes'] ) data.data.groups[key]['attributes'] = {};
|
if ( !data.data.groups[key]['attributes'] ) data.data.groups[key]['attributes'] = {};
|
||||||
|
@ -58,7 +57,7 @@ export class SimpleActorSheet extends ActorSheet {
|
||||||
group[attr]['isResource'] = group[attr]['dtype'] === 'Resource';
|
group[attr]['isResource'] = group[attr]['dtype'] === 'Resource';
|
||||||
data.data.groups[key]['attributes'][attr] = group[attr];
|
data.data.groups[key]['attributes'][attr] = group[attr];
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
// Sort the remaining attributes attributes.
|
// Sort the remaining attributes attributes.
|
||||||
Object.keys(data.data.attributes).filter(a => !groupKeys.includes(a)).sort((a, b) => a.localeCompare(b)).forEach(key => {
|
Object.keys(data.data.attributes).filter(a => !groupKeys.includes(a)).sort((a, b) => a.localeCompare(b)).forEach(key => {
|
||||||
|
|
|
@ -4,6 +4,15 @@
|
||||||
*/
|
*/
|
||||||
export class SimpleActor extends Actor {
|
export class SimpleActor extends Actor {
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
prepareData() {
|
||||||
|
super.prepareData();
|
||||||
|
this.data.data.groups = this.data.data.groups || {};
|
||||||
|
this.data.data.attributes = this.data.data.attributes || {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
getRollData() {
|
getRollData() {
|
||||||
const data = super.getRollData();
|
const data = super.getRollData();
|
||||||
|
|
|
@ -150,21 +150,15 @@
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
align-items: center;
|
||||||
padding: 5px;
|
padding: 0 5px;
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
background: #cfcdc2;
|
background: #cfcdc2;
|
||||||
border: 1px solid #AAA;
|
border: 1px solid #AAA;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
text-align: center;
|
text-align: left;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.worldbuilding .attributes-header .attribute-label {
|
|
||||||
flex: 1.5;
|
|
||||||
}
|
|
||||||
.worldbuilding .attributes-header .attribute-control {
|
|
||||||
flex: 0 0 20px;
|
|
||||||
}
|
|
||||||
.worldbuilding .attributes-list {
|
.worldbuilding .attributes-list {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -199,20 +193,24 @@
|
||||||
.worldbuilding .group-header input[type="text"]:focus::placeholder {
|
.worldbuilding .group-header input[type="text"]:focus::placeholder {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
.worldbuilding .group-controls {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
.worldbuilding .groups-list {
|
.worldbuilding .groups-list {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
.worldbuilding .group {
|
.worldbuilding .group {
|
||||||
margin: 20px 0;
|
margin: 5px 0 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
.worldbuilding .group-header {
|
.worldbuilding .group-header {
|
||||||
|
align-items: center;
|
||||||
background: rgba(0, 0, 0, 0.05);
|
background: rgba(0, 0, 0, 0.05);
|
||||||
border: 1px solid #AAA;
|
border: 1px solid #AAA;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
padding: 5px;
|
padding: 2px 5px;
|
||||||
}
|
}
|
||||||
.worldbuilding .group-key,
|
.worldbuilding .group-key,
|
||||||
.worldbuilding .group-label {
|
.worldbuilding .group-label {
|
||||||
|
@ -224,12 +222,15 @@
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
}
|
}
|
||||||
.worldbuilding .group-key {
|
.worldbuilding .group-key {
|
||||||
flex: 0 0 126px;
|
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
}
|
}
|
||||||
|
.worldbuilding .group-label {
|
||||||
|
flex: 2;
|
||||||
|
}
|
||||||
.worldbuilding .group-dtype {
|
.worldbuilding .group-dtype {
|
||||||
|
height: 24px;
|
||||||
|
flex: 0 0 116px;
|
||||||
margin: 0 5px;
|
margin: 0 5px;
|
||||||
flex: 0;
|
|
||||||
}
|
}
|
||||||
.worldbuilding.sheet.actor {
|
.worldbuilding.sheet.actor {
|
||||||
min-width: 560px;
|
min-width: 560px;
|
||||||
|
|
|
@ -172,22 +172,14 @@
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
align-items: center;
|
||||||
padding: 5px;
|
padding: 0 5px;
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
background: #cfcdc2;
|
background: #cfcdc2;
|
||||||
border: 1px solid #AAA;
|
border: 1px solid #AAA;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
text-align: center;
|
text-align: left;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
.attribute-label {
|
|
||||||
flex: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.attribute-control {
|
|
||||||
flex: 0 0 20px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.attributes-list {
|
.attributes-list {
|
||||||
|
@ -235,6 +227,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.group-controls {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.groups-list {
|
.groups-list {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -242,15 +238,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.group {
|
.group {
|
||||||
margin: 20px 0;
|
margin: 5px 0 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-header {
|
.group-header {
|
||||||
|
align-items: center;
|
||||||
background: rgba(0, 0, 0, 0.05);
|
background: rgba(0, 0, 0, 0.05);
|
||||||
border: 1px solid #AAA;
|
border: 1px solid #AAA;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
padding: 5px;
|
padding: 2px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-key,
|
.group-key,
|
||||||
|
@ -264,13 +261,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-key {
|
.group-key {
|
||||||
flex: 0 0 126px;
|
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.group-label {
|
||||||
|
flex: 2;
|
||||||
|
}
|
||||||
|
|
||||||
.group-dtype {
|
.group-dtype {
|
||||||
|
height: 24px;
|
||||||
|
flex: 0 0 116px;
|
||||||
margin: 0 5px;
|
margin: 0 5px;
|
||||||
flex: 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue