mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 10:29:35 +08:00
DEV: addTopicsSectionLink
-> addCommunitySectionLink
plugin api (#17740)
This commit is contained in:
parent
af912b4b0e
commit
ad6b5825bf
|
@ -1627,12 +1627,12 @@ class PluginApi {
|
|||
|
||||
/**
|
||||
* EXPERIMENTAL. Do not use.
|
||||
* Support for adding a link under Sidebar topics section by returning a class which extends from the BaseSectionLink
|
||||
* Support for adding a navigation link to Sidebar Community section by returning a class which extends from the BaseSectionLink
|
||||
* class interface. See `lib/sidebar/community-section/base-section-link.js` for documentation on the BaseSectionLink class
|
||||
* interface.
|
||||
*
|
||||
* ```
|
||||
* api.addTopicsSectionLink((baseSectionLink) => {
|
||||
* api.addCommunitySectionLink((baseSectionLink) => {
|
||||
* return class CustomSectionLink extends baseSectionLink {
|
||||
* get name() {
|
||||
* return "bookmarked";
|
||||
|
@ -1660,7 +1660,7 @@ class PluginApi {
|
|||
* or
|
||||
*
|
||||
* ```
|
||||
* api.addTopicsSectionLink({
|
||||
* api.addCommunitySectionLink({
|
||||
* name: "unread",
|
||||
* route: "discovery.unread",
|
||||
* title: I18n.t("some.unread.title"),
|
||||
|
@ -1668,17 +1668,17 @@ class PluginApi {
|
|||
* })
|
||||
* ```
|
||||
*
|
||||
* @callback addTopicsSectionLinkCallback
|
||||
* @callback addCommunitySectionLinkCallback
|
||||
* @param {BaseSectionLink} baseSectionLink - Factory class to inherit from.
|
||||
* @returns {BaseSectionLink} - A class that extends BaseSectionLink.
|
||||
*
|
||||
* @param {(addTopicsSectionLinkCallback|Object)} arg - A callback function or an Object.
|
||||
* @param {(addCommunitySectionLinkCallback|Object)} arg - A callback function or an Object.
|
||||
* @param {string} arg.name - The name of the link. Needs to be dasherized and lowercase.
|
||||
* @param {string} arg.route - The Ember route of the link.
|
||||
* @param {string} arg.title - The title attribute for the link.
|
||||
* @param {string} arg.text - The text to display for the link.
|
||||
*/
|
||||
addTopicsSectionLink(arg) {
|
||||
addCommunitySectionLink(arg) {
|
||||
addSectionLink(arg);
|
||||
}
|
||||
|
||||
|
|
|
@ -758,7 +758,7 @@ acceptance("Sidebar - Community Section", function (needs) {
|
|||
|
||||
test("adding section link via plugin API with Object", async function (assert) {
|
||||
withPluginApi("1.2.0", (api) => {
|
||||
api.addTopicsSectionLink({
|
||||
api.addCommunitySectionLink({
|
||||
name: "unread",
|
||||
route: "discovery.unread",
|
||||
text: "unread topics",
|
||||
|
@ -791,7 +791,7 @@ acceptance("Sidebar - Community Section", function (needs) {
|
|||
|
||||
test("adding section link via plugin API with callback function", async function (assert) {
|
||||
withPluginApi("1.2.0", (api) => {
|
||||
api.addTopicsSectionLink((baseSectionLink) => {
|
||||
api.addCommunitySectionLink((baseSectionLink) => {
|
||||
return class CustomSectionLink extends baseSectionLink {
|
||||
get name() {
|
||||
return "user-summary";
|
||||
|
|
Loading…
Reference in New Issue
Block a user