diff --git a/assets/javascripts/discourse/components/knowledge-explorer-category.js.es6 b/assets/javascripts/discourse/components/knowledge-explorer-category.js.es6
index 3267555..815bb90 100644
--- a/assets/javascripts/discourse/components/knowledge-explorer-category.js.es6
+++ b/assets/javascripts/discourse/components/knowledge-explorer-category.js.es6
@@ -1,12 +1,15 @@
import { default as computed } from "ember-addons/ember-computed-decorators";
export default Ember.Component.extend({
+ tagName: "",
@computed("category")
categoryName(category) {
return this.site.categories.findBy("id", category.id).name;
},
- click() {
- this.selectCategory(this.category);
- return false;
+ actions: {
+ selectCategory() {
+ this.selectCategory(this.category);
+ return false;
+ }
}
});
diff --git a/assets/javascripts/discourse/components/knowledge-explorer-tag.js.es6 b/assets/javascripts/discourse/components/knowledge-explorer-tag.js.es6
index e741d64..9c38f14 100644
--- a/assets/javascripts/discourse/components/knowledge-explorer-tag.js.es6
+++ b/assets/javascripts/discourse/components/knowledge-explorer-tag.js.es6
@@ -1,6 +1,9 @@
export default Ember.Component.extend({
- click() {
- this.selectTag(this.tag);
- return false;
+ tagName: "",
+ actions: {
+ selectTag() {
+ this.selectTag(this.tag);
+ return false;
+ }
}
});
diff --git a/assets/javascripts/discourse/templates/components/knowledge-explorer-category.hbs b/assets/javascripts/discourse/templates/components/knowledge-explorer-category.hbs
index 1f3185f..1e3fa1d 100644
--- a/assets/javascripts/discourse/templates/components/knowledge-explorer-category.hbs
+++ b/assets/javascripts/discourse/templates/components/knowledge-explorer-category.hbs
@@ -1,10 +1,10 @@
-
-
-
{{i18n 'knowledge_explorer.categories'}}
- {{#each categories as |category|}}
- {{knowledge-explorer-category
- category=category
- selectCategory=(action "updateSelectedCategories")
- }}
- {{/each}}
-
-
-
{{i18n 'knowledge_explorer.tags'}}
- {{#each tags as |tag|}}
- {{knowledge-explorer-tag
- tag=tag
- selectTag=(action "updateSelectedTags")
- }}
- {{/each}}
-
+ {{#if categories}}
+
+
{{i18n 'knowledge_explorer.categories'}}
+ {{#each categories as |category|}}
+ {{knowledge-explorer-category
+ category=category
+ selectCategory=(action "updateSelectedCategories"
+ tagName="")
+ }}
+ {{/each}}
+
+ {{/if}}
+ {{#if tags}}
+
+
{{i18n 'knowledge_explorer.tags'}}
+ {{#each tags as |tag|}}
+ {{knowledge-explorer-tag
+ tag=tag
+ selectTag=(action "updateSelectedTags")
+ }}
+ {{/each}}
+
+ {{/if}}
{{#if selectedTopic}}
{{#conditional-loading-spinner condition=isTopicLoading}}
diff --git a/assets/stylesheets/common/knowledge-explorer.scss b/assets/stylesheets/common/knowledge-explorer.scss
index bfd80f4..064ed3f 100644
--- a/assets/stylesheets/common/knowledge-explorer.scss
+++ b/assets/stylesheets/common/knowledge-explorer.scss
@@ -1,86 +1,132 @@
-.knowledge-explorer {
+.knowledge-base-search-wrapper {
+ position: relative;
+ width: 500px;
+ .d-icon {
+ position: absolute;
+ right: 0.75em;
+ top: 25%;
+ font-size: 1.5em;
+ color: $primary-low-mid;
+ pointer-events: none;
+ @media screen and (max-width: 400px) {
+ // Just decoration, remove on small screens
+ display: none;
+ }
}
- .knowledge-explorer-search {
+}
+
+.knowledge-explorer-search {
align-items: center;
background-color: $primary-very-low;
display: flex;
justify-content: center;
padding: 1.5em 1em;
- .knowledge-explorer-search-bar {
- height: 50px;
- margin-bottom: 0px;
- width: 500px;
+ @include breakpoint(mobile-extra-large, min-width) {
+ // More breathing room on larger screens
+ margin-bottom: 2em;
}
- }
- .knowledge-explorer-browse {
- display: flex;
- .loading-container {
- display: flex;
- flex-basis: 100%;
- padding: 10px 0 10px 10px;
- }
- .knowledge-explorer-results {
- display: flex;
- flex-direction: column;
- flex-basis: 100%;
- .result-count {
- padding-top: 15px;
- padding-left: 10px;
- }
- }
- .knowledge-explorer-filters {
- flex-basis: 25%;
- }
- .knowledge-explorer-tags, .knowledge-explorer-categories {
- padding: 10px 10px 10px 0;
- a {
- color: $primary;
+ .knowledge-explorer-search-bar {
+ height: 50px;
+ margin-bottom: 0px;
+ width: 100%;
+ }
+}
+.knowledge-explorer-browse {
+ display: flex;
+ .loading-container {
+ display: flex;
+ flex-basis: 100%;
+ padding: 0.625em 0 0.625em 0.625em;
+ }
+ .knowledge-explorer-results {
+ display: flex;
+ flex-direction: column;
+ flex-basis: 100%;
+ .result-count {
+ padding-top: 15px;
+ padding-left: 0.625em;
+ }
+ }
+ .knowledge-explorer-filters {
+ margin-top: 0.15em;
+ flex: 0 1 20%;
+ @include breakpoint(tablet, min-width) {
+ padding-right: 2em;
+ }
+ // min-width on flex allows container to
+ // be more narrow than content if needed
+ min-width: 175px;
+ }
+ .knowledge-explorer-items {
+ padding: 0.57em 1em 1em 0;
+
+ a {
+ color: $primary;
+ white-space: nowrap;
+ }
+
+ h3 {
+ padding-left: 0.35em;
+ font-size: $font-up-1;
+ }
+
+ .knowledge-explorer-item-count {
+ margin-left: auto;
+ color: $primary-high;
+ font-size: $font-down-1;
+ }
+
+ .knowledge-explorer-item {
+ display: flex;
+ align-items: center;
+ cursor: pointer;
+ padding: 0.25em 0.5em;
+
+ .d-icon {
+ height: 1em;
+ padding-bottom: 0.15em;
+ margin-right: 0.25em;
+ color: $primary-high;
+ &.d-icon-plus {
+ height: 0.75em;
+ margin-right: 0.25em;
+ }
}
- .knowledge-explorer-tag, .knowledge-explorer-category {
- display: flex;
- align-items: center;
- cursor: pointer;
- height: 30px;
- padding-left: 10px;
+ &:hover {
+ background: $highlight-medium;
+ }
+ &.selected:hover {
+ background: $danger-low;
.d-icon {
- height: 1em;
- &.d-icon-plus {
- height: 0.75em;
- margin-right: 0.25em;
- }
- &.d-icon-times-circle {
- margin-left: 0.25em;
- }
- }
- &:hover {
- background: $highlight-medium;
- }
- &.selected:hover {
- background: $danger-low;
-
- .d-icon {
- color: $danger;
- }
- }
- .tag-id, .category-id {
- margin-right: 3px;
+ color: $danger;
}
}
-
- .selected {
- font-weight: bold;
+ .tag-id,
+ .category-id {
+ margin-right: 3px;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
}
- .knowledge-explorer-topic-list {
- flex-basis: 100%;
- .knowledge-explorer-topic-link {
- color: $tertiary;
- cursor: pointer;
- }
- .discourse-tag {
- padding-right: 5px;
- }
+ .selected {
+ font-weight: bold;
}
+ }
+ .knowledge-explorer-topic-list {
+ flex-basis: 100%;
+
+ .badge-wrapper .badge-category .category-name {
+ // extra protection for ultra-long category names
+ max-width: 30vw;
+ }
+
+ .knowledge-explorer-topic-link {
+ color: $tertiary;
+ }
+ .discourse-tag {
+ padding-right: 5px;
+ }
+ }
.knowledge-explorer-topic {
display: flex;
flex-direction: column;
@@ -94,17 +140,15 @@
}
}
&.more {
- margin-left: auto;
font-size: $font-up-1;
padding: 10px 0;
- &::after {
- content: "ยป";
- margin-left: 5px;
- }
}
}
.topic-content {
+ h1 {
+ line-height: $line-height-medium;
+ }
padding-top: 10px;
}
- }
+ }
}
diff --git a/assets/stylesheets/mobile/knowledge-explorer.scss b/assets/stylesheets/mobile/knowledge-explorer.scss
index e3278ab..2c8f72a 100644
--- a/assets/stylesheets/mobile/knowledge-explorer.scss
+++ b/assets/stylesheets/mobile/knowledge-explorer.scss
@@ -1,25 +1,24 @@
.mobile-view {
.knowledge-explorer {
.knowledge-explorer-topic {
- width: calc(100vw - .75em);
- margin: 10px 0;
+ width: calc(100vw - 0.75em);
+ margin: 0.625em 0;
}
.knowledge-explorer-search {
font-size: $font-up-2;
- padding: .5em 0;
+ padding: 0.5em 0;
.knowledge-explorer-search-bar {
width: calc(100vw - 2em);
}
}
.knowledge-explorer-browse {
+ .knowledge-explorer-items {
+ padding-right: 0;
+ }
flex-direction: column;
.knowledge-explorer-results .result-count {
- padding-left: 0px;
- }
- .knowledge-explorer-tags {
- flex-basis: 100%;
- padding: 1em 0;
+ padding-left: 0;
}
.knowledge-explorer-topic-list {
flex-basis: 100%;
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index c3ced8b..d07fb18 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -5,9 +5,10 @@ en:
categories: "Categories"
tags: "Tags"
search:
- results:
+ results:
one: "%{count} result found"
other: "%{count} results found"
+ placeholder: "Search for topics"
topic:
back: "Go back"
navigate_to_topic: "View the discussion on this topic"