Add buttons for switching JSON preview style
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import Controller from '@ember/controller';
|
||||
import { inject as controller } from '@ember/controller';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { computed } from '@ember/object';
|
||||
import { alias } from '@ember/object/computed';
|
||||
import { isEmpty } from '@ember/utils';
|
||||
|
||||
export default Controller.extend({
|
||||
|
||||
@@ -12,8 +14,26 @@ export default Controller.extend({
|
||||
|
||||
queryParams: ['path'],
|
||||
|
||||
documentIsJSON: computed('model.documentMetaData.type', function(){
|
||||
if (isEmpty(this.get('model.documentMetaData'))) { return false; }
|
||||
|
||||
return !!this.get('model.documentMetaData.type').match(/application\/json/i);
|
||||
}),
|
||||
|
||||
jsonView: 'source',
|
||||
jsonShowTree: computed.equal('jsonView', 'tree'),
|
||||
jsonShowSource: computed.equal('jsonView', 'source'),
|
||||
|
||||
actions: {
|
||||
|
||||
showJsonTree () {
|
||||
this.set('jsonView', 'tree');
|
||||
},
|
||||
|
||||
showJsonSource () {
|
||||
this.set('jsonView', 'source');
|
||||
},
|
||||
|
||||
deleteItem () {
|
||||
if (window.confirm('Sure?')) {
|
||||
this.get('storage.client')
|
||||
|
||||
Reference in New Issue
Block a user