WIP edit records
This commit is contained in:
parent
4612f2cbad
commit
2aa57739ed
|
@ -245,28 +245,28 @@
|
|||
});
|
||||
|
||||
$on('button.js-record-edit', 'click', function (ev) {
|
||||
console.log(ev.target);
|
||||
var id = ev.target.parentElement.querySelector('.js-record-id').value;
|
||||
console.log(id);
|
||||
var record = cache.recordsMap[id];
|
||||
console.log(record);
|
||||
var formTpl;
|
||||
|
||||
formTpl = tpls.formsMap[record.type.toLowerCase()];
|
||||
var formTpl = tpls.formsMap[record.type.toLowerCase()];
|
||||
if (!formTpl) {
|
||||
record.typex = 'typex';
|
||||
formTpl = tpls.formsMap.typex;
|
||||
}
|
||||
|
||||
console.log(ev.target);
|
||||
console.log(id);
|
||||
console.log(record);
|
||||
|
||||
formTpl = tpls.formsMap[record.typex || record.type.toLowerCase()];
|
||||
$qs('select.js-record-form-type').value = record.typex || record.type;
|
||||
$qs('select.js-record-form-type').value = record.typex || record.type.toLowerCase();
|
||||
$qs('select.js-record-form-type').dispatchEvent(new Event('change', { bubbles: true }));
|
||||
$qs('.js-record-form-tpl').innerHTML = formTpl || '';
|
||||
|
||||
record.host = record.name.replace(new RegExp('\\.?' + record.zone.replace(/\./g, '\\.') + '$'), '');
|
||||
record.host = record.name.replace(new RegExp('\\.?' + (record.zone || record.name).replace(/\./g, '\\.') + '$'), '');
|
||||
|
||||
console.log('record.type:');
|
||||
console.log(record.type.toLowerCase());
|
||||
|
||||
Object.keys(record).forEach(function (key) {
|
||||
var $el = $qs('.js-record-' + key, $qs('.js-record-form-tpl'));
|
||||
if (!$el) {
|
||||
|
@ -274,9 +274,8 @@
|
|||
}
|
||||
$el.value = record[key];
|
||||
});
|
||||
if (!record.host) {
|
||||
$qs('.js-record-host').placeholder = '@';
|
||||
}
|
||||
if (!record.host) { $qs('.js-record-host').placeholder = '@'; }
|
||||
$qs('.js-record-type', $qs('.js-record-form-tpl')).innerHTML = record.type;
|
||||
});
|
||||
|
||||
$qs('select.js-record-form-type').value = '';
|
||||
|
|
Loading…
Reference in New Issue