Browse Source

Added UI and functional code for starting a new project (clearing the one currently being worked on).

dev
Bryan Miller 5 years ago
parent
commit
8a3a69a9d3
4 changed files with 31 additions and 0 deletions
  1. +12
    -0
      app/js/ctrls/CTRLIO.js
  2. +6
    -0
      views/header_menu.html
  3. +2
    -0
      views/modal.html
  4. +11
    -0
      views/modals/new_project.html

+ 12
- 0
app/js/ctrls/CTRLIO.js View File

} }




function HANDLE_NewProject(){
GlobalEvents.emit("modal-close");
CTRLNameTablesStore.clear();
CTRLBanksStore.clear();
CTRLPalettesStore.clear();

CTRLPalettesStore.createPalette("Palette 1");
CTRLBanksStore.createBank("Bank 1");
}


function HANDLE_SaveProject(e){ function HANDLE_SaveProject(e){
//var a = document.createElement("a"); //var a = document.createElement("a");
var file = new Blob([JSONFromProject()], {type: "text/plain"}); var file = new Blob([JSONFromProject()], {type: "text/plain"});
GlobalEvents.listen("load-project", HANDLE_LoadProjectRequest); GlobalEvents.listen("load-project", HANDLE_LoadProjectRequest);
GlobalEvents.listen("export-pal-asm", HANDLE_ExportPalASM); GlobalEvents.listen("export-pal-asm", HANDLE_ExportPalASM);
GlobalEvents.listen("export-nametable", HANDLE_ExportNameTableASM); GlobalEvents.listen("export-nametable", HANDLE_ExportNameTableASM);
GlobalEvents.listen("new-project", HANDLE_NewProject);


var input = document.querySelectorAll("input.project-loader"); var input = document.querySelectorAll("input.project-loader");
if (input.length > 0){ if (input.length > 0){

+ 6
- 0
views/header_menu.html View File

<form> <form>
<input type="file" class="project-loader" accept="text/plain" style="display:none;"></input> <input type="file" class="project-loader" accept="text/plain" style="display:none;"></input>
</form> </form>
<li class="pure-menu-item" emit="modal-open" emit-args='{"cls":".new-project-modal"}'>
<a href="#" class="pure-menu-link">
<i class="fa fa-file-alt"></i>
New Project
</a>
</li>
<li class="pure-menu-item" emit="load-project"> <li class="pure-menu-item" emit="load-project">
<a href="#" class="pure-menu-link"> <a href="#" class="pure-menu-link">
<i class="fa fa-folder-open"></i> <i class="fa fa-folder-open"></i>

+ 2
- 0
views/modal.html View File



<%- include("modals/export_CHR.html"); %> <%- include("modals/export_CHR.html"); %>
<%- include("modals/export_NT.html"); %> <%- include("modals/export_NT.html"); %>

<%- include("modals/new_project.html"); %>

+ 11
- 0
views/modals/new_project.html View File

<div class="modal new-project-modal">
<div class="modal-content">
Clicking <b>"Yes"</b> will destroy all work in the current project.<br>
If this is <i>not</i> what you, click <b>"No"</b><br><br>
Start a new project?
<form class="pure-form new-project-form">
<button type="submit" class="pure-button" emit="new-project">Yes</button>
<button type="submit" class="pure-button" emit="modal-close">No</button>
</form>
</div>
</div>

Loading…
Cancel
Save