From 8db259d147e31e1faced0721a916856063b8f8f7 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Thu, 25 Jan 2018 16:52:56 +0000 Subject: [PATCH] Add button for opening public docs in a new tab --- app/controllers/inspect.js | 10 ++++++++ app/routes/inspect.js | 3 ++- app/styles/_buttons.scss | 4 ++- app/templates/icons/browser.hbs | 1 + app/templates/icons/share.hbs | 1 + app/templates/inspect.hbs | 34 ++++++++++++++++---------- public/img/icons/browser.svg | 1 + public/img/icons/share.svg | 1 + tests/unit/controllers/inspect-test.js | 13 ++++++++++ 9 files changed, 53 insertions(+), 15 deletions(-) create mode 100644 app/templates/icons/browser.hbs create mode 100644 app/templates/icons/share.hbs create mode 100644 public/img/icons/browser.svg create mode 100644 public/img/icons/share.svg 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}}