Skip to content

Commit dc2a4c3

Browse files
committed
show schema config collapsed by default
This saves space on large schemas and makes it easier to focus at a certain task. We keep the new element expanded.
1 parent ba662a6 commit dc2a4c3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

jsoneditor/setup.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ jQuery(function () {
2828
this.updateEditor = function () {
2929
editor.setText($config.val());
3030
};
31+
// collapse all nodes except for the new element
32+
if(!$config.parents('.new').length) {
33+
editor.collapseAll();
34+
}
3135
});
3236

3337
/**

meta/SchemaEditor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function getEditor()
6363
$form->addHTML($this->adminColumn($col->getColref(), $col));
6464
}
6565

66-
// FIXME new one needs to be added dynamically, this is just for testing
66+
// Add one new field at the end
6767
$form->addHTML($this->adminColumn('new1', new Column($this->schema->getMaxsort() + 10, new Text()), 'new'));
6868

6969
$form->addHTML('</table>');
@@ -117,6 +117,7 @@ protected function adminColumn($column_id, Column $col, $key = 'cols')
117117
$base = 'schema[' . $key . '][' . $column_id . ']'; // base name for all fields
118118

119119
$class = $col->isEnabled() ? '' : 'disabled';
120+
if($key === 'new') $class .= ' new';
120121

121122
$html = "<tr class=\"$class\">";
122123

0 commit comments

Comments
 (0)