From 6e806cc1dfaa035c1f7ed502e0b4ac9b20e3c5f8 Mon Sep 17 00:00:00 2001 From: Rishabh Nambiar <5862206+rishabhnambiar@users.noreply.github.com> Date: Mon, 13 Aug 2018 17:04:01 +0530 Subject: [PATCH] Added clickable rows, default query sorting by id and clickable usernames --- .../controllers/admin-plugins-explorer.js.es6 | 11 +++-------- .../templates/admin/plugins-explorer.hbs | 14 +++++++++----- assets/stylesheets/explorer.scss | 12 +++++------- plugin.rb | 15 ++++++++------- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 index a281235..236de82 100644 --- a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 @@ -21,6 +21,8 @@ export default Ember.Controller.extend({ editing: false, everEditing: false, showRecentQueries: true, + sortBy: ['id:desc'], + sortedQueries: Em.computed.sort('model', 'sortBy'), createDisabled: function() { return (this.get('newQueryName') || "").trim().length === 0; @@ -29,9 +31,7 @@ export default Ember.Controller.extend({ selectedItem: function() { const id = parseInt(this.get('selectedQueryId')); const item = this.get('content').find(q => q.get('id') === id); - if (!isNaN(id)) { - this.set('showRecentQueries', false); - } + !isNaN(id) ? this.set('showRecentQueries', false) : this.set('showRecentQueries', true); return item || NoQuery; }.property('selectedQueryId'), @@ -80,11 +80,6 @@ export default Ember.Controller.extend({ showCreate() { this.set('showCreate', true); - this.set('showRecentQueries', false); - }, - - showRecentQueries() { - this.set('showRecentQueries', true); }, editName() { diff --git a/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs b/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs index 24d229c..f04f685 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs @@ -134,7 +134,7 @@ {{/unless}} {{#if showRecentQueries}} - {{#if model.length}} + {{#if sortedQueries.length}}
{{i18n 'explorer.query_name'}} | @@ -142,18 +142,22 @@{{i18n 'explorer.query_time'}} | |||
---|---|---|---|---|
-
+
{{query.name}}
|
-
+
+ |
+