FEATURE: Add users and groups links to community section in sidebar (#17609)
This commit is contained in:
parent
b4b339b059
commit
49d4f7c066
|
@ -6,6 +6,8 @@ import { customSectionLinks } from "discourse/lib/sidebar/custom-community-secti
|
|||
import EverythingSectionLink from "discourse/lib/sidebar/community-section/everything-section-link";
|
||||
import TrackedSectionLink from "discourse/lib/sidebar/community-section/tracked-section-link";
|
||||
import MyPostsSectionLink from "discourse/lib/sidebar/community-section/my-posts-section-link";
|
||||
import GroupsSectionLink from "discourse/lib/sidebar/community-section/groups-section-link";
|
||||
import UsersSectionLink from "discourse/lib/sidebar/community-section/users-section-link";
|
||||
|
||||
import { action } from "@ember/object";
|
||||
import { next } from "@ember/runloop";
|
||||
|
@ -13,6 +15,8 @@ import { next } from "@ember/runloop";
|
|||
const DEFAULT_SECTION_LINKS = [
|
||||
EverythingSectionLink,
|
||||
TrackedSectionLink,
|
||||
GroupsSectionLink,
|
||||
UsersSectionLink,
|
||||
MyPostsSectionLink,
|
||||
];
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
import I18n from "I18n";
|
||||
|
||||
import BaseSectionLink from "discourse/lib/sidebar/community-section/base-section-link";
|
||||
|
||||
export default class GroupsSectionLink extends BaseSectionLink {
|
||||
get name() {
|
||||
return "groups";
|
||||
}
|
||||
|
||||
get route() {
|
||||
return "groups";
|
||||
}
|
||||
|
||||
get title() {
|
||||
return I18n.t("sidebar.sections.community.links.groups.title");
|
||||
}
|
||||
|
||||
get text() {
|
||||
return I18n.t("sidebar.sections.community.links.groups.content");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
import I18n from "I18n";
|
||||
|
||||
import BaseSectionLink from "discourse/lib/sidebar/community-section/base-section-link";
|
||||
|
||||
export default class UsersSectionLink extends BaseSectionLink {
|
||||
get name() {
|
||||
return "users";
|
||||
}
|
||||
|
||||
get route() {
|
||||
return "users";
|
||||
}
|
||||
|
||||
get title() {
|
||||
return I18n.t("sidebar.sections.community.links.users.title");
|
||||
}
|
||||
|
||||
get text() {
|
||||
return I18n.t("sidebar.sections.community.links.users.content");
|
||||
}
|
||||
}
|
|
@ -158,6 +158,50 @@ acceptance("Sidebar - Community Section", function (needs) {
|
|||
);
|
||||
});
|
||||
|
||||
test("clicking on users link", async function (assert) {
|
||||
await visit("/t/280");
|
||||
await click(".sidebar-section-community .sidebar-section-link-users");
|
||||
|
||||
assert.strictEqual(
|
||||
currentURL(),
|
||||
"/u?order=likes_received",
|
||||
"it should transition to the users url"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
count(".sidebar-section-community .sidebar-section-link.active"),
|
||||
1,
|
||||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-section-community .sidebar-section-link-users.active"),
|
||||
"the users link is marked as active"
|
||||
);
|
||||
});
|
||||
|
||||
test("clicking on groups link", async function (assert) {
|
||||
await visit("/t/280");
|
||||
await click(".sidebar-section-community .sidebar-section-link-groups");
|
||||
|
||||
assert.strictEqual(
|
||||
currentURL(),
|
||||
"/g",
|
||||
"it should transition to the groups url"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
count(".sidebar-section-community .sidebar-section-link.active"),
|
||||
1,
|
||||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(".sidebar-section-community .sidebar-section-link-groups.active"),
|
||||
"the groups link is marked as active"
|
||||
);
|
||||
});
|
||||
|
||||
test("clicking on my posts link", async function (assert) {
|
||||
await visit("/t/280");
|
||||
await click(".sidebar-section-community .sidebar-section-link-my-posts");
|
||||
|
|
|
@ -4107,6 +4107,12 @@ en:
|
|||
tracked:
|
||||
content: "Tracked"
|
||||
title: "All tracked topics"
|
||||
groups:
|
||||
content: "Groups"
|
||||
title: "All groups"
|
||||
users:
|
||||
content: "Users"
|
||||
title: "All users"
|
||||
my_posts:
|
||||
content: "My Posts"
|
||||
title: "My posts"
|
||||
|
|
Loading…
Reference in New Issue