diff --git a/app/controllers/inspect.js b/app/controllers/inspect.js index d3937d6..3353693 100644 --- a/app/controllers/inspect.js +++ b/app/controllers/inspect.js @@ -24,6 +24,16 @@ export default Controller.extend({ jsonShowTree: computed.equal('jsonView', 'tree'), jsonShowSource: computed.equal('jsonView', 'source'), + publicItemURL: computed('model.documentMetaData.path', function(){ + let path = this.get('model.documentMetaData.path'); + + if (path.match(/public\//)) { + return this.get('storage.client').getItemURL(path); + } else { + return null; + } + }), + metadataHidden: false, actions: { diff --git a/app/routes/inspect.js b/app/routes/inspect.js index 95c5649..75eb3e7 100644 --- a/app/routes/inspect.js +++ b/app/routes/inspect.js @@ -32,7 +32,8 @@ export default Route.extend({ }).then(metaData => { return { documentMetaData: metaData, - currentDirPath: parentDirPath + // documentPublicURL: this.get() + currentDirPath: parentDirPath, }; }); }, diff --git a/app/styles/_buttons.scss b/app/styles/_buttons.scss index 056cc16..55b3e90 100644 --- a/app/styles/_buttons.scss +++ b/app/styles/_buttons.scss @@ -8,8 +8,10 @@ div.button-group + div.button-group { } header { - button { + button, a.button { + display: inline-block; padding: 0.4rem 0 0.3rem; + text-align: center; border: 1px solid $dark-grey-2; border-radius: 0.2em; background-color: #fff; diff --git a/app/templates/icons/browser.hbs b/app/templates/icons/browser.hbs new file mode 100644 index 0000000..8201283 --- /dev/null +++ b/app/templates/icons/browser.hbs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/templates/icons/share.hbs b/app/templates/icons/share.hbs new file mode 100644 index 0000000..9be60cf --- /dev/null +++ b/app/templates/icons/share.hbs @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/templates/inspect.hbs b/app/templates/inspect.hbs index 245972b..d61b295 100644 --- a/app/templates/inspect.hbs +++ b/app/templates/inspect.hbs @@ -1,20 +1,28 @@ {{breadcrumb-nav currentDirPath=currentDirPath}} - {{#if documentIsJSON}} - - {{#if metadataHidden}} - - {{partial "icons/arrow-from-right"}} - - {{else}} - - {{partial "icons/arrow-to-right"}} - - {{/if}} + + {{#if metadataHidden}} + + {{partial "icons/arrow-from-right"}} + + {{else}} + + {{partial "icons/arrow-to-right"}} + + {{/if}} + + {{#if publicItemURL}} + + + {{partial "icons/share"}} + + {{/if}} + {{#if documentIsJSON}} \ No newline at end of file diff --git a/public/img/icons/share.svg b/public/img/icons/share.svg new file mode 100644 index 0000000..9be60cf --- /dev/null +++ b/public/img/icons/share.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/unit/controllers/inspect-test.js b/tests/unit/controllers/inspect-test.js index 1f63510..7c6ad12 100644 --- a/tests/unit/controllers/inspect-test.js +++ b/tests/unit/controllers/inspect-test.js @@ -4,6 +4,19 @@ moduleFor('controller:inspect', 'Unit | Controller | inspect', { needs: ['controller:application', 'service:storage'] }); +test('#publicItemURL', function(assert) { + let controller = this.subject(); + + controller.set('model', {}); + + controller.set('model.documentMetaData', { + "name": "banjul-the-gambia", + "path": "/documents/notes/banjul-the-gambia", + }); + + assert.equal(controller.get('publicItemURL'), null, 'returns null when item is not in public folder'); +}); + test('#documentIsJSON', function(assert) { let controller = this.subject();