diff --git a/app/controllers/inspect.js b/app/controllers/inspect.js index 3353693..d48a774 100644 --- a/app/controllers/inspect.js +++ b/app/controllers/inspect.js @@ -14,6 +14,11 @@ export default Controller.extend({ queryParams: ['path'], + documentIsEditable: computed.not('model.documentMetaData.isBinary'), + + documentShowEditor: false, + documentHideEditor: computed.not('documentShowEditor'), + documentIsJSON: computed('model.documentMetaData.type', function(){ if (isEmpty(this.get('model.documentMetaData'))) { return false; } @@ -46,6 +51,16 @@ export default Controller.extend({ this.set('jsonView', 'source'); }, + showEditor () { + this.set('documentShowEditor', true); + // TODO init editing + }, + + cancelEditor () { + this.set('documentShowEditor', false); + // TODO remove changes from tree/source + }, + toggleMetadata () { this.toggleProperty('metadataHidden'); }, diff --git a/app/templates/icons/edit.hbs b/app/templates/icons/edit.hbs new file mode 100644 index 0000000..0bd7bae --- /dev/null +++ b/app/templates/icons/edit.hbs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/templates/icons/eye.hbs b/app/templates/icons/eye.hbs new file mode 100644 index 0000000..c803ae4 --- /dev/null +++ b/app/templates/icons/eye.hbs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/templates/inspect.hbs b/app/templates/inspect.hbs index d61b295..1e91cc1 100644 --- a/app/templates/inspect.hbs +++ b/app/templates/inspect.hbs @@ -38,6 +38,21 @@ {{/if}} + {{#if documentIsEditable}} +
+ + +
+ {{/if}} diff --git a/tests/unit/controllers/inspect-test.js b/tests/unit/controllers/inspect-test.js index 7c6ad12..37c0e65 100644 --- a/tests/unit/controllers/inspect-test.js +++ b/tests/unit/controllers/inspect-test.js @@ -47,7 +47,7 @@ test('#documentIsJSON', function(assert) { assert.notOk(controller.get('documentIsJSON'), 'is false when content type is not JSON'); }); -test('jsonView actions/methods', function(assert) { +test('jsonView - switch between source and tree view', function(assert) { let controller = this.subject(); controller.set('jsonView', null);