mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Setup categories section in sidebar for future work (#16733)
This commit is contained in:
parent
ab9433569a
commit
2cc9f0e7d9
@ -0,0 +1,3 @@
|
|||||||
|
import GlimmerComponent from "discourse/components/glimmer";
|
||||||
|
|
||||||
|
export default class SidebarCategoriesSection extends GlimmerComponent {}
|
@ -2,6 +2,7 @@
|
|||||||
<div class="sidebar-wrapper">
|
<div class="sidebar-wrapper">
|
||||||
<div class="sidebar-container">
|
<div class="sidebar-container">
|
||||||
<Sidebar::TopicsSection />
|
<Sidebar::TopicsSection />
|
||||||
|
<Sidebar::CategoriesSection />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
<Sidebar::Section
|
||||||
|
@sectionName="categories"
|
||||||
|
@headerRoute="discovery.categories"
|
||||||
|
@headerLinkText={{i18n "sidebar.sections.categories.header_link_text"}}
|
||||||
|
@headerLinkTitle={{i18n "sidebar.sections.categories.header_link_title"}} >
|
||||||
|
|
||||||
|
</Sidebar::Section>
|
@ -0,0 +1,26 @@
|
|||||||
|
import { click, currentURL, visit } from "@ember/test-helpers";
|
||||||
|
|
||||||
|
import {
|
||||||
|
acceptance,
|
||||||
|
conditionalTest,
|
||||||
|
} from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
import { isLegacyEmber } from "discourse-common/config/environment";
|
||||||
|
|
||||||
|
acceptance("Sidebar - Categories Section", function (needs) {
|
||||||
|
needs.user({ experimental_sidebar_enabled: true });
|
||||||
|
|
||||||
|
conditionalTest(
|
||||||
|
"clicking on section header link",
|
||||||
|
!isLegacyEmber(),
|
||||||
|
async function (assert) {
|
||||||
|
await visit("/t/280");
|
||||||
|
await click(".sidebar-section-categories .sidebar-section-header-link");
|
||||||
|
|
||||||
|
assert.strictEqual(
|
||||||
|
currentURL(),
|
||||||
|
"/categories",
|
||||||
|
"it should transition to the categories page"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
@ -64,15 +64,24 @@ acceptance("Sidebar - Topics Section", function (needs) {
|
|||||||
async function (assert) {
|
async function (assert) {
|
||||||
await visit("/");
|
await visit("/");
|
||||||
|
|
||||||
assert.ok(exists(".sidebar-section-content"), "shows content section");
|
assert.ok(
|
||||||
|
exists(".sidebar-section-topics .sidebar-section-content"),
|
||||||
|
"shows content section"
|
||||||
|
);
|
||||||
|
|
||||||
await click(".sidebar-section-topics .sidebar-section-header-caret");
|
await click(".sidebar-section-topics .sidebar-section-header-caret");
|
||||||
|
|
||||||
assert.ok(!exists(".sidebar-section-content"), "hides content section");
|
assert.ok(
|
||||||
|
!exists(".sidebar-section-topics .sidebar-section-content"),
|
||||||
|
"hides content section"
|
||||||
|
);
|
||||||
|
|
||||||
await click(".sidebar-section-topics .sidebar-section-header-caret");
|
await click(".sidebar-section-topics .sidebar-section-header-caret");
|
||||||
|
|
||||||
assert.ok(exists(".sidebar-section-content"), "shows content section");
|
assert.ok(
|
||||||
|
exists(".sidebar-section-topics .sidebar-section-content"),
|
||||||
|
"shows content section"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -40,6 +40,10 @@
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebar-section-wrapper {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
.sidebar-section-header {
|
.sidebar-section-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
@ -4035,6 +4035,9 @@ en:
|
|||||||
unread_count: "%{count} unread"
|
unread_count: "%{count} unread"
|
||||||
new_count: "%{count} new"
|
new_count: "%{count} new"
|
||||||
sections:
|
sections:
|
||||||
|
categories:
|
||||||
|
header_link_title: "all categories"
|
||||||
|
header_link_text: "Categories"
|
||||||
topics:
|
topics:
|
||||||
header_link_title: "home"
|
header_link_title: "home"
|
||||||
header_link_text: "Topics"
|
header_link_text: "Topics"
|
||||||
|
Loading…
Reference in New Issue
Block a user