aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/static/editor.js
diff options
context:
space:
mode:
Diffstat (limited to 'internal/admin/static/editor.js')
-rw-r--r--internal/admin/static/editor.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/admin/static/editor.js b/internal/admin/static/editor.js
index 1ed0653..37bc797 100644
--- a/internal/admin/static/editor.js
+++ b/internal/admin/static/editor.js
@@ -59,7 +59,7 @@ function renderDirGroup(name, ids, filter) {
displayIds = ids.filter(function(id) { return String(id).toLowerCase().indexOf(filter) >= 0; });
if (displayIds.length === 0) return '';
}
- var expanded = isFiltering ? true : (collapsedDirs[name] === false || (!name && collapsedDirs[''] === undefined));
+ var expanded = isFiltering ? true : (collapsedDirs[name] === true);
var displayName = name || editorType.charAt(0).toUpperCase() + editorType.slice(1);
var h = '<div class="dir-group">';
if (name) {
@@ -79,7 +79,7 @@ function renderDirGroup(name, ids, filter) {
}
function toggleDir(name) {
- collapsedDirs[name] = collapsedDirs[name] === false ? true : false;
+ collapsedDirs[name] = collapsedDirs[name] !== true;
renderList('');
}
@@ -206,6 +206,13 @@ function switchTab(e, tab) {
tabs.forEach(function(t) { t.style.display = 'none'; });
var target = document.getElementById('tab' + tab.charAt(0).toUpperCase() + tab.slice(1));
if (target) target.style.display = 'block';
+
+ if (tab === 'yaml' && currentID) {
+ API.get('/api/' + editorType + '/' + encodeURIComponent(currentID)).then(function(data) {
+ var pre = document.querySelector('#tabYaml pre');
+ if (pre) pre.textContent = data._raw || JSON.stringify(data, null, 2);
+ });
+ }
}
function getNested(obj, path) {