better organization, 'new' button

This commit is contained in:
AJ ONeal 2018-01-26 03:23:12 -07:00
parent 77b69d59a1
commit 92056f6d55
2 changed files with 16 additions and 1 deletions

View File

@ -27,10 +27,13 @@
<li class="js-peer-name">peer-name</li> <li class="js-peer-name">peer-name</li>
</ul> </ul>
<h3>Zones:</h3>
<button type="button" class="js-zone-new">new</button>
<ul class="js-zone-tpl"> <ul class="js-zone-tpl">
<li><button type="button" class="js-zone-name">zone-name</button></li> <li><button type="button" class="js-zone-name">zone-name</button></li>
</ul> </ul>
<h3>Records:</h3>
<ul class="js-record-tpl"> <ul class="js-record-tpl">
<li class="js-record-soa"> <li class="js-record-soa">
<input type="hidden" class="js-record-id" /> <input type="hidden" class="js-record-id" />
@ -117,7 +120,7 @@
<label>Select Type:</label> <label>Select Type:</label>
<select class="js-record-form-type"> <select class="js-record-form-type">
<option value="" selected disabled>Record Type</option> <option value="" selected disabled>Record Type</option>
<option value="SOA">SOA</option> <option value="SOA" disabled>SOA</option>
<option value="NS">NS</option> <option value="NS">NS</option>
<option value="A">A</option> <option value="A">A</option>
<option value="AAAA">AAAA</option> <option value="AAAA">AAAA</option>
@ -130,6 +133,7 @@
<option value="TXT">TXT</option> <option value="TXT">TXT</option>
<option value="typeX">typeX</option> <option value="typeX">typeX</option>
</select> </select>
<button type="button" class="js-record-form-new">new</button>
<div class="js-record-form-tpl"> <div class="js-record-form-tpl">
<form class="js-record-form-soa"> <form class="js-record-form-soa">

View File

@ -225,6 +225,10 @@
return fetchRecords(zone);/*.then(function () { return fetchRecords(zone);/*.then(function () {
});*/ });*/
}); });
$on('button.js-zone-new', 'click', function (/*ev*/) {
$qs('select.js-record-form-type').value = 'SOA';
$qs('select.js-record-form-type').dispatchEvent(new Event('change', { bubbles: true }));
});
$on('select.js-record-form-type', 'change', function (ev) { $on('select.js-record-form-type', 'change', function (ev) {
var type = ev.target.value; var type = ev.target.value;
@ -250,6 +254,13 @@
$qs('.js-record-type', $tpl).innerText = type; $qs('.js-record-type', $tpl).innerText = type;
$qs('.js-record-zone', $tpl).innerText = myZone; $qs('.js-record-zone', $tpl).innerText = myZone;
}); });
$on('button.js-record-form-new', 'click', function (/*ev*/) {
var type = $qs('select.js-record-form-type').value;
if (!type) {
$qs('select.js-record-form-type').value = 'A';
}
$qs('select.js-record-form-type').dispatchEvent(new Event('change', { bubbles: true }));
});
$on('button.js-record-edit', 'click', function (ev) { $on('button.js-record-edit', 'click', function (ev) {
var id = ev.target.parentElement.querySelector('.js-record-id').value; var id = ev.target.parentElement.querySelector('.js-record-id').value;