GlobalEvents.listen("change_surface", HANDLE_ChangeSurface); | GlobalEvents.listen("change_surface", HANDLE_ChangeSurface); | ||||
GlobalEvents.listen("bankstore-add", (function(e){ | |||||
if (e.hasOwnProperty("bankname")){ | |||||
GlobalEvents.listen("bankstore-add", (function(ev){ | |||||
/*if (e.hasOwnProperty("bankname")){ | |||||
this.createBank(e.bankname); | this.createBank(e.bankname); | ||||
this.activateBank(e.bankname); | this.activateBank(e.bankname); | ||||
}*/ | |||||
GlobalEvents.emit("modal-close"); | |||||
var e = document.querySelector(".banks-store-add"); | |||||
if (e){ | |||||
var eform = e.querySelector("form"); | |||||
var einput = e.querySelector('input[name="storeitemname"]'); | |||||
if (eform && einput){ | |||||
var name = einput.value; | |||||
eform.reset(); | |||||
this.createBank(name); | |||||
this.activateBank(name); | |||||
} | |||||
} | } | ||||
}).bind(this)); | }).bind(this)); | ||||
class CTRLPalettesStore{ | class CTRLPalettesStore{ | ||||
constructor(){ | constructor(){ | ||||
GlobalEvents.listen("palstore-add", (function(e){ | |||||
if (e.hasOwnProperty("palname")){ | |||||
this.createPalette(e.palname); | |||||
this.activatePalette(e.palname); | |||||
GlobalEvents.listen("palstore-add", (function(ev){ | |||||
GlobalEvents.emit("modal-close"); | |||||
var e = document.querySelector(".palettes-store-add"); | |||||
if (e){ | |||||
var eform = e.querySelector("form"); | |||||
var einput = e.querySelector('input[name="storeitemname"]'); | |||||
if (eform && einput){ | |||||
var name = einput.value; | |||||
eform.reset(); | |||||
this.createPalette(name); | |||||
this.activatePalette(name); | |||||
} | |||||
} | } | ||||
}).bind(this)); | }).bind(this)); | ||||
function handle_emitter(event){ | function handle_emitter(event){ | ||||
if (this.hasAttribute("emit")){ | if (this.hasAttribute("emit")){ | ||||
event.preventDefault(); | |||||
var args = [this.getAttribute("emit"), this]; | var args = [this.getAttribute("emit"), this]; | ||||
if (this.hasAttribute("emit-args")){ | if (this.hasAttribute("emit-args")){ | ||||
try { | try { |
<div class="tabnav"> | |||||
<ul tabs="<%= tabsetname %>"> | |||||
<% tabs.forEach(function(item){ %> | |||||
<li tabid="<%= item.id %>"><a href="#"><%= item.name %></a></li> | |||||
<% }); %> | |||||
</ul> | |||||
<% tabs.forEach(function(item){ %> | |||||
<div class="tab-content" fortabs="<%= tabsetname %>" tabid="<%= item.id %>"> | |||||
<div class="simple-padding"> | |||||
<% if (item.hasOwnProperty("addevent")){ %> | |||||
<button class="pure-button" emit="modal-open" emit-args='{"id":"<%= item.addevent %>"}'> | |||||
<i class="fa fa-plus-circle"></i> | |||||
</button> | |||||
<% } %> | |||||
<% if (item.hasOwnProperty("remevent")){ %> | |||||
<button class="pure-button" emit="<%= item.remevent %>"> | |||||
<i class="fa fa-trash-alt"></i> | |||||
</button> | |||||
<% } %> | |||||
</div> | |||||
<div class="list-container"> | |||||
<% if(item.hasOwnProperty("tmpl")){ %> | |||||
<%- include(item.tmpl) %> | |||||
<% } %> | |||||
</div> | |||||
</div> | |||||
<% }); %> | |||||
</div> | |||||
<div class="tabnav"> | |||||
<ul tabs="<%= tabsetname %>"> | |||||
<% tabs.forEach(function(item){ %> | |||||
<li tabid="<%= item.id %>"><a href="#"><%= item.name %></a></li> | |||||
<% }); %> | |||||
</ul> | |||||
<% tabs.forEach(function(item){ %> | |||||
<div class="tab-content" fortabs="<%= tabsetname %>" tabid="<%= item.id %>"> | |||||
<div class="simple-padding"> | |||||
<% if (item.hasOwnProperty("addevent")){ %> | |||||
<button class="pure-button" emit="modal-open" emit-args='{"cls":"<%= item.addevent %>"}'> | |||||
<i class="fa fa-plus-circle"></i> | |||||
</button> | |||||
<% } %> | |||||
<% if (item.hasOwnProperty("remevent")){ %> | |||||
<button class="pure-button" emit="<%= item.remevent %>"> | |||||
<i class="fa fa-trash-alt"></i> | |||||
</button> | |||||
<% } %> | |||||
</div> | |||||
<div class="list-container"> | |||||
<% if(item.hasOwnProperty("tmpl")){ %> | |||||
<%- include(item.tmpl) %> | |||||
<% } %> | |||||
</div> | |||||
</div> | |||||
<% }); %> | |||||
</div> |
<%- include('docks.html', { | <%- include('docks.html', { | ||||
tabsetname:"assetlists", | tabsetname:"assetlists", | ||||
tabs:[ | tabs:[ | ||||
{name:"Palettes", id:"palettes", tmpl:"paletteListItem.html", addevent:"PaletteAdd", remevent:"palstore-remove", selected:true}, | |||||
{name:"Banks", id:"banks", tmpl:"bankListItem.html", addevent:"BankAdd", remevent:"bankstore-remove", selected:false}, | |||||
{name:"Palettes", id:"palettes", tmpl:"paletteListItem.html", addevent:"palettes-store-add", remevent:"palstore-remove", selected:true}, | |||||
{name:"Banks", id:"banks", tmpl:"bankListItem.html", addevent:"banks-store-add", remevent:"bankstore-remove", selected:false}, | |||||
{name:"Attrib. Tables", id:"attrtbls", selected:false} | {name:"Attrib. Tables", id:"attrtbls", selected:false} | ||||
] | ] | ||||
}); %> | }); %> |
</div> | </div> | ||||
</div> | </div> | ||||
<div id="PaletteAdd" class="modal"> | |||||
<div class="modal-content"> | |||||
<label for="palname"> | |||||
New Palette Name: | |||||
</label> | |||||
<input type="text" name="palname" /> | |||||
<button class="pure-button" emit="modal-submit" emit-args='{"subevent":"palstore-add", "ids":"palname", "closeoncomplete":true}'>Submit</button> | |||||
</div> | |||||
</div> | |||||
<div id="BankAdd" class="modal"> | |||||
<div class="modal-content"> | |||||
<label for="bankname"> | |||||
New Bank Name: | |||||
</label> | |||||
<input type="text" name="bankname" /> | |||||
<button class="pure-button" emit="modal-submit" emit-args='{"subevent":"bankstore-add", "ids":"bankname", "closeoncomplete":true}'>Submit</button> | |||||
</div> | |||||
</div> | |||||
<%- include("modals/storeadd.html", {stores:[ | |||||
{"modalclass":"palettes-store-add", "title":"New Palette Name", "addevent":"palstore-add"}, | |||||
{"modalclass":"banks-store-add", "title":"New Bank Name", "addevent":"bankstore-add"} | |||||
]}); %> | |||||
<div id="LoadProject" class="modal"> | <div id="LoadProject" class="modal"> | ||||
<div class="modal-content"> | <div class="modal-content"> |
<% stores.forEach(function(item){ %> | |||||
<div class="modal <%= item.modalclass %>"> | |||||
<div class="modal-content"> | |||||
<form class="store-add-form"> | |||||
<label for="storeitemname"> | |||||
<%= item.title %>: | |||||
</label> | |||||
<input type="text" name="storeitemname" /> | |||||
<button class="pure-button" emit="<%= item.addevent %>">Submit</button> | |||||
</form> | |||||
</div> | |||||
</div> | |||||
<% }); %> |