From 2b4c056fe5e1747ef8a5f5b05998e699f335810d Mon Sep 17 00:00:00 2001 From: Rishabh Nambiar <5862206+rishabhnambiar@users.noreply.github.com> Date: Fri, 17 Aug 2018 15:59:48 +0530 Subject: [PATCH] FEATURE: Hide unnecessary create/import bar when visiting a query --- .../discourse/controllers/admin-plugins-explorer.js.es6 | 6 +++++- .../discourse/templates/admin/plugins-explorer.hbs | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 index 66aad96..8fc8f93 100644 --- a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 @@ -19,6 +19,7 @@ export default Ember.Controller.extend({ results: Em.computed.alias('selectedItem.results'), editing: false, + showNavbar: true, everEditing: false, showRecentQueries: true, sortBy: ['id:desc'], @@ -90,13 +91,16 @@ export default Ember.Controller.extend({ window.open(this.get('selectedItem.downloadUrl'), "_blank"); }, - scrollTop() { + visitQuery() { window.scrollTo(0,0); this.set('editing', false); + this.set('showCreate', false); + this.set('showNavbar', false); this.set('everEditing', false); }, goHome() { + this.set('showNavbar', true); this.set('selectedQueryId', null); this.transitionToRoute('adminPlugins.explorer'); }, diff --git a/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs b/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs index 4a5149a..1ddd0ea 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs @@ -3,11 +3,13 @@ {{#if disallow}}

{{i18n "explorer.admins_only"}}

{{else}} + {{#if showNavbar}}
{{combo-box valueAttribute="id" value=selectedQueryId nameProperty="listName" none="explorer.menu_none" content=content castInteger="true" nameChanges="true"}} {{d-button action="showCreate" icon="plus" class="no-text"}} {{d-button action="importQuery" label="explorer.import.label" icon="upload"}}
+ {{/if}} {{#if showCreate}}
@@ -23,7 +25,9 @@
{{/if}} -
+ {{#if showNavbar}} +
+ {{/if}} {{#if content.length}} {{#if selectedItem.fake}} @@ -151,7 +155,7 @@ {{#each sortedQueries as |query|}} - + {{query.name}}
{{query.description}}