mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
DEV: Use category ids in URLs preferentially
This commit is contained in:
parent
9251065768
commit
374534f00e
|
@ -23,13 +23,13 @@ export default Controller.extend({
|
|||
showMoreUrl(period) {
|
||||
let url = "",
|
||||
category = this.category;
|
||||
|
||||
if (category) {
|
||||
url =
|
||||
"/c/" +
|
||||
Category.slugFor(category) +
|
||||
(this.noSubcategories ? "/none" : "") +
|
||||
"/l";
|
||||
url = `/c/${Category.slugFor(category)}/${category.id}${
|
||||
this.noSubcategories ? "/none" : ""
|
||||
}/l`;
|
||||
}
|
||||
|
||||
url += "/top/" + period;
|
||||
return url;
|
||||
},
|
||||
|
|
|
@ -120,7 +120,7 @@ NavItem.reopenClass({
|
|||
|
||||
if (context.category) {
|
||||
includesCategoryContext = true;
|
||||
path += `/c/${Category.slugFor(context.category)}`;
|
||||
path += `/c/${Category.slugFor(context.category)}/${context.category.id}`;
|
||||
|
||||
if (context.noSubcategories) {
|
||||
path += "/none";
|
||||
|
|
|
@ -102,9 +102,9 @@ export default (filterArg, params) => {
|
|||
},
|
||||
|
||||
_retrieveTopicList(category, transition) {
|
||||
const listFilter = `c/${Category.slugFor(category)}/l/${this.filter(
|
||||
category
|
||||
)}`,
|
||||
const listFilter = `c/${Category.slugFor(category)}/${
|
||||
category.id
|
||||
}/l/${this.filter(category)}`,
|
||||
findOpts = filterQueryParams(transition.to.queryParams, params),
|
||||
extras = { cached: this.isPoppedState(transition) };
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ export default DiscourseRoute.extend(FilterModeMixin, {
|
|||
if (category) {
|
||||
category.setupGroupsAndPermissions();
|
||||
this.set("category", category);
|
||||
filter = `tags/c/${Category.slugFor(category)}`;
|
||||
filter = `tags/c/${Category.slugFor(category)}/${category.id}`;
|
||||
|
||||
if (this.noSubcategories) {
|
||||
filter += "/none";
|
||||
|
|
|
@ -144,7 +144,7 @@ export default ComboBoxComponent.extend({
|
|||
} else {
|
||||
const category = Category.findById(parseInt(categoryId, 10));
|
||||
const slug = Category.slugFor(category);
|
||||
categoryURL = Discourse.getURL("/c/") + slug;
|
||||
categoryURL = Discourse.getURL(`/c/${slug}/${categoryId}`);
|
||||
}
|
||||
|
||||
DiscourseURL.routeTo(categoryURL);
|
||||
|
|
|
@ -84,7 +84,7 @@ export default ComboBoxComponent.extend(TagsMixin, {
|
|||
let url = "/tags";
|
||||
|
||||
if (currentCategory) {
|
||||
url += `/c/${Category.slugFor(currentCategory)}`;
|
||||
url += `/c/${Category.slugFor(currentCategory)}/${currentCategory.id}`;
|
||||
}
|
||||
|
||||
return Discourse.getURL(`${url}/none`);
|
||||
|
@ -162,7 +162,9 @@ export default ComboBoxComponent.extend(TagsMixin, {
|
|||
url = "/tags";
|
||||
|
||||
if (this.currentCategory) {
|
||||
url += `/c/${Category.slugFor(this.currentCategory)}`;
|
||||
url += `/c/${Category.slugFor(this.currentCategory)}/${
|
||||
this.currentCategory.id
|
||||
}`;
|
||||
}
|
||||
|
||||
url = Discourse.getURL(`${url}/${tagId.toLowerCase()}`);
|
||||
|
|
|
@ -2683,7 +2683,7 @@ export default {
|
|||
]
|
||||
}
|
||||
},
|
||||
"/c/bug/l/latest.json": {
|
||||
"/c/bug/1/l/latest.json": {
|
||||
users: [
|
||||
{ id: 1, username: "sam", avatar_template: "/images/avatar.png" },
|
||||
{
|
||||
|
@ -3863,7 +3863,7 @@ export default {
|
|||
]
|
||||
}
|
||||
},
|
||||
"/c/feature/l/latest.json": {
|
||||
"/c/feature/2/l/latest.json": {
|
||||
users: [
|
||||
{ id: 1, username: "sam", avatar_template: "/images/avatar.png" },
|
||||
{
|
||||
|
@ -4935,7 +4935,7 @@ export default {
|
|||
]
|
||||
}
|
||||
},
|
||||
"/c/dev/l/latest.json": {
|
||||
"/c/dev/7/l/latest.json": {
|
||||
users: [
|
||||
{ id: 1, username: "sam", avatar_template: "/images/avatar.png" },
|
||||
{
|
||||
|
|
|
@ -64,8 +64,8 @@ export default function() {
|
|||
return response(json);
|
||||
});
|
||||
|
||||
this.get("/c/bug/l/latest.json", () => {
|
||||
const json = fixturesByUrl["/c/bug/l/latest.json"];
|
||||
this.get("/c/bug/1/l/latest.json", () => {
|
||||
const json = fixturesByUrl["/c/bug/1/l/latest.json"];
|
||||
|
||||
if (loggedIn()) {
|
||||
// Stuff to let us post
|
||||
|
|
Loading…
Reference in New Issue
Block a user