Browse Source

Finished up the first part of UI for NameTables. They can now be added, removed, and saved in project files. No editing as of yet.

dev
Bryan Miller 5 years ago
parent
commit
553cf3ad7b
2 changed files with 10 additions and 3 deletions
  1. +8
    -2
      app/js/ctrls/CTRLIO.js
  2. +2
    -1
      views/modal.html

+ 8
- 2
app/js/ctrls/CTRLIO.js View File

import NESPalette from "/app/js/models/NESPalette.js"; import NESPalette from "/app/js/models/NESPalette.js";
import CTRLPalettesStore from "/app/js/ctrls/CTRLPalettesStore.js"; import CTRLPalettesStore from "/app/js/ctrls/CTRLPalettesStore.js";
import CTRLBanksStore from "/app/js/ctrls/CTRLBanksStore.js"; import CTRLBanksStore from "/app/js/ctrls/CTRLBanksStore.js";
import CTRLNameTablesStore from "/app/js/ctrls/CTRLNameTablesStore.js";




const SUPPORTED_PROJECT_VERSIONS=[ const SUPPORTED_PROJECT_VERSIONS=[
"pattern":"^[0-9]{1,}\.[0-9]{1,}$" "pattern":"^[0-9]{1,}\.[0-9]{1,}$"
}, },
"paletteStore":{"$ref":"http://nespaint/PalettesStoreSchema.json"}, "paletteStore":{"$ref":"http://nespaint/PalettesStoreSchema.json"},
"bankStore":{"$ref":"http://nespaint/BanksStoreSchema.json"}
"bankStore":{"$ref":"http://nespaint/BanksStoreSchema.json"},
"nametableStore":{"$ref":"http://nespaint/NametableStoreSchema.json"}
}, },
"required":["id","version","paletteStore","bankStore"] "required":["id","version","paletteStore","bankStore"]
}); });
paletteStore:CTRLPalettesStore.obj, paletteStore:CTRLPalettesStore.obj,
bankStore:CTRLBanksStore.obj bankStore:CTRLBanksStore.obj
}; };
if (CTRLNameTablesStore.keys.length > 0)
proj.nametableStore = CTRLNameTablesStore.obj;
return JSON.stringify(proj); return JSON.stringify(proj);
} }


// TODO: Validate 'id' and 'version' properties. // TODO: Validate 'id' and 'version' properties.
CTRLPalettesStore.obj = o.paletteStore; CTRLPalettesStore.obj = o.paletteStore;
CTRLBanksStore.obj = o.bankStore; CTRLBanksStore.obj = o.bankStore;
if ("nametableStore" in o)
CTRLNametablesStore.obj = o.nametableStore;
} }
if (this.parentNode.nodeName.toLowerCase() === "form"){ if (this.parentNode.nodeName.toLowerCase() === "form"){
this.parentNode.reset(); this.parentNode.reset();


CTRLPalettesStore.initialize(); CTRLPalettesStore.initialize();
CTRLBanksStore.initialize(); CTRLBanksStore.initialize();
CTRLNameTablesStore.initialize();
} }
} }



+ 2
- 1
views/modal.html View File



<%- include("modals/storeadd.html", {stores:[ <%- include("modals/storeadd.html", {stores:[
{"modalclass":"palettes-store-add", "title":"New Palette Name", "addevent":"palstore-add"}, {"modalclass":"palettes-store-add", "title":"New Palette Name", "addevent":"palstore-add"},
{"modalclass":"banks-store-add", "title":"New Bank Name", "addevent":"bankstore-add"}
{"modalclass":"banks-store-add", "title":"New Bank Name", "addevent":"bankstore-add"},
{"modalclass":"nt-store-add", "title":"New Nametable Name", "addevent":"ntstore-add"}
]}); %> ]}); %>


<div id="LoadProject" class="modal"> <div id="LoadProject" class="modal">

Loading…
Cancel
Save