-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: include tag sidebars, migrate to objects setting (#22)
- Loading branch information
1 parent
41ab679
commit e63c903
Showing
9 changed files
with
272 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require("@discourse/lint-configs/eslint-theme"); | ||
module.exports = require("@discourse/lint-configs/eslint-theme"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "discourse-category-sidebars", | ||
"license_url": "https://github.com/awesomerobot/discourse-category-sidebars/blob/master/LICENSE", | ||
"about_url": "https://github.com/awesomerobot/discourse-category-sidebars/blob/master/README.md", | ||
"name": "Discourse Topic List Sidebars", | ||
"license_url": "https://github.com/discourse/discourse-category-sidebars/blob/master/LICENSE", | ||
"about_url": "https://github.com/discourse/discourse-category-sidebars/blob/master/README.md", | ||
"component": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...fore-topic-list-body/category-sidebar.hbs → ...re-topic-list-body/topic-list-sidebar.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{{#unless site.mobileView}} | ||
<CategorySidebar /> | ||
<TopicListSidebar /> | ||
{{/unless}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
export default function migrate(settings, helpers) { | ||
const oldSetup = settings.get("setup"); | ||
|
||
if (oldSetup) { | ||
const newSidebars = oldSetup | ||
.split("|") | ||
.map((sidebar) => { | ||
const [categorySlug, topicId] = sidebar | ||
.split(",") | ||
.map((value) => value.trim()); | ||
const sanitizedCategorySlug = | ||
categorySlug.replace(/-/g, " ") || "sidebar"; | ||
const parsedTopicId = parseInt(topicId, 10) || 0; | ||
|
||
let categoryId = helpers.getCategoryIdByName(sanitizedCategorySlug); | ||
|
||
return { | ||
name: | ||
sanitizedCategorySlug.toLowerCase() === "all" | ||
? "all" | ||
: sanitizedCategorySlug, | ||
category: categoryId ? [categoryId] : [], | ||
tag: [], | ||
topic_id: parsedTopicId, | ||
}; | ||
}) | ||
.filter((item) => item !== null); | ||
|
||
settings.set("sidebars", newSidebars); | ||
settings.delete("setup"); | ||
} | ||
|
||
return settings; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.