2015-01-06 16:59:33 -05:00
|
|
|
export default function() {
|
2014-06-16 11:25:33 -07:00
|
|
|
// Error page
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("exception", { path: "/exception" });
|
|
|
|
this.route("exception-unknown", { path: "/404" });
|
2014-06-16 11:25:33 -07:00
|
|
|
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("about", { path: "/about", resetNamespace: true });
|
2014-08-11 16:59:00 -04:00
|
|
|
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("post", { path: "/p/:id" });
|
2018-03-24 02:44:39 +01:00
|
|
|
|
2013-02-22 15:41:12 -05:00
|
|
|
// Topic routes
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route(
|
|
|
|
"topic",
|
|
|
|
{ path: "/t/:slug/:id", resetNamespace: true },
|
|
|
|
function() {
|
|
|
|
this.route("fromParams", { path: "/" });
|
|
|
|
this.route("fromParamsNear", { path: "/:nearPost" });
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
this.route("topicBySlugOrId", { path: "/t/:slugOrId", resetNamespace: true });
|
|
|
|
|
|
|
|
this.route("discovery", { path: "/", resetNamespace: true }, function() {
|
2014-01-14 01:02:14 +01:00
|
|
|
// top
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("top");
|
|
|
|
this.route("topParentCategory", { path: "/c/:slug/l/top" });
|
|
|
|
this.route("topCategoryNone", { path: "/c/:slug/none/l/top" });
|
|
|
|
this.route("topCategory", { path: "/c/:parentSlug/:slug/l/top" });
|
2013-03-28 14:01:13 +01:00
|
|
|
|
2014-01-14 01:02:14 +01:00
|
|
|
// top by periods
|
2018-06-15 17:03:24 +02:00
|
|
|
Discourse.Site.currentProp("periods").forEach(period => {
|
|
|
|
const top = "top" + period.capitalize();
|
|
|
|
this.route(top, { path: "/top/" + period });
|
|
|
|
this.route(top + "ParentCategory", { path: "/c/:slug/l/top/" + period });
|
|
|
|
this.route(top + "CategoryNone", {
|
|
|
|
path: "/c/:slug/none/l/top/" + period
|
|
|
|
});
|
|
|
|
this.route(top + "Category", {
|
|
|
|
path: "/c/:parentSlug/:slug/l/top/" + period
|
|
|
|
});
|
2014-01-14 01:02:14 +01:00
|
|
|
});
|
2013-12-24 00:50:36 +01:00
|
|
|
|
2014-01-20 14:41:11 +01:00
|
|
|
// filters
|
2018-06-15 17:03:24 +02:00
|
|
|
Discourse.Site.currentProp("filters").forEach(filter => {
|
|
|
|
this.route(filter, { path: "/" + filter });
|
|
|
|
this.route(filter + "ParentCategory", { path: "/c/:slug/l/" + filter });
|
|
|
|
this.route(filter + "CategoryNone", {
|
|
|
|
path: "/c/:slug/none/l/" + filter
|
|
|
|
});
|
|
|
|
this.route(filter + "Category", {
|
|
|
|
path: "/c/:parentSlug/:slug/l/" + filter
|
|
|
|
});
|
2014-01-14 01:02:14 +01:00
|
|
|
});
|
|
|
|
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("categories");
|
2014-01-14 12:48:57 -05:00
|
|
|
|
2014-01-14 01:02:14 +01:00
|
|
|
// default filter for a category
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("parentCategory", { path: "/c/:slug" });
|
|
|
|
this.route("categoryNone", { path: "/c/:slug/none" });
|
|
|
|
this.route("category", { path: "/c/:parentSlug/:slug" });
|
|
|
|
this.route("categoryWithID", { path: "/c/:parentSlug/:slug/:id" });
|
2013-02-22 15:41:12 -05:00
|
|
|
});
|
|
|
|
|
2019-02-21 13:44:25 +08:00
|
|
|
this.route("groups", { resetNamespace: true, path: "/g" }, function() {
|
2018-03-27 16:45:21 +08:00
|
|
|
this.route("new", { path: "custom/new" });
|
|
|
|
});
|
2016-12-14 17:26:16 +08:00
|
|
|
|
2019-02-21 13:44:25 +08:00
|
|
|
this.route("group", { path: "/g/:name", resetNamespace: true }, function() {
|
|
|
|
this.route("members");
|
2019-03-27 13:30:59 +02:00
|
|
|
this.route("requests");
|
2018-06-15 17:03:24 +02:00
|
|
|
|
2019-02-21 13:44:25 +08:00
|
|
|
this.route("activity", function() {
|
|
|
|
this.route("posts");
|
|
|
|
this.route("topics");
|
|
|
|
this.route("mentions");
|
|
|
|
});
|
2018-06-15 17:03:24 +02:00
|
|
|
|
2019-02-21 13:44:25 +08:00
|
|
|
this.route("manage", function() {
|
|
|
|
this.route("profile");
|
|
|
|
this.route("membership");
|
|
|
|
this.route("interaction");
|
|
|
|
this.route("members");
|
|
|
|
this.route("logs");
|
|
|
|
});
|
2018-06-15 17:03:24 +02:00
|
|
|
|
2019-02-21 13:44:25 +08:00
|
|
|
this.route("messages", function() {
|
|
|
|
this.route("inbox");
|
|
|
|
this.route("archive");
|
|
|
|
});
|
|
|
|
});
|
2014-01-30 17:10:36 -05:00
|
|
|
|
2013-02-22 15:41:12 -05:00
|
|
|
// User routes
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("users", { resetNamespace: true, path: "/u" });
|
|
|
|
this.route("password-reset", { path: "/u/password-reset/:token" });
|
|
|
|
this.route("account-created", { path: "/u/account-created" }, function() {
|
|
|
|
this.route("resent");
|
|
|
|
this.route("edit-email");
|
|
|
|
});
|
|
|
|
this.route(
|
|
|
|
"user",
|
|
|
|
{ path: "/u/:username", resetNamespace: true },
|
|
|
|
function() {
|
2018-10-10 13:00:08 -04:00
|
|
|
this.route("profile-hidden");
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("summary");
|
|
|
|
this.route(
|
|
|
|
"userActivity",
|
|
|
|
{ path: "/activity", resetNamespace: true },
|
|
|
|
function() {
|
|
|
|
this.route("topics");
|
|
|
|
this.route("replies");
|
|
|
|
this.route("likesGiven", { path: "likes-given" });
|
|
|
|
this.route("bookmarks");
|
|
|
|
this.route("pending");
|
FEATURE: Drafts view in user profile
* add drafts.json endpoint, user profile tab with drafts stream
* improve drafts stream display in user profile
* truncate excerpts in drafts list, better handling for resume draft action
* improve draft stream SQL query, add rspec tests
* if composer is open, quietly close it when user opens another draft from drafts stream; load PM draft only when user is in /u/username/messages (instead of /u/username)
* cleanup
* linting fixes
* apply prettier styling to modified files
* add client tests for drafts, includes a fixture for drafts.json
* improvements to code following review
* refresh drafts route when user deletes a draft open in the composer while being in the drafts route; minor prettier scss fix
* added more spec tests, deleted an acceptance test for removing drafts that was too finicky, formatting and code style fixes, added appEvent for draft:destroyed
* prettier, eslint fixes
* use "username_lower" from users table, added error handling for rejected promises
* adds guardian spec for can_see_drafts, adds improvements following code review
* move DraftsController spec to its own file
* fix failing drafts qunit test, use getOwner instead of deprecated this.container
* limit test fixture for draft.json testing to new_topic request only
2018-08-01 02:34:54 -04:00
|
|
|
this.route("drafts");
|
2018-06-15 17:03:24 +02:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
this.route(
|
|
|
|
"userNotifications",
|
|
|
|
{ path: "/notifications", resetNamespace: true },
|
|
|
|
function() {
|
|
|
|
this.route("responses");
|
|
|
|
this.route("likesReceived", { path: "likes-received" });
|
|
|
|
this.route("mentions");
|
|
|
|
this.route("edits");
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
this.route("badges");
|
|
|
|
this.route("deletedPosts", { path: "/deleted-posts" });
|
|
|
|
|
|
|
|
this.route(
|
|
|
|
"userPrivateMessages",
|
|
|
|
{ path: "/messages", resetNamespace: true },
|
|
|
|
function() {
|
|
|
|
this.route("sent");
|
|
|
|
this.route("archive");
|
|
|
|
this.route("group", { path: "group/:name" });
|
|
|
|
this.route("groupArchive", { path: "group/:name/archive" });
|
|
|
|
this.route("tags");
|
|
|
|
this.route("tagsShow", { path: "tags/:id" });
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
this.route("preferences", { resetNamespace: true }, function() {
|
|
|
|
this.route("account");
|
|
|
|
this.route("profile");
|
|
|
|
this.route("emails");
|
|
|
|
this.route("notifications");
|
|
|
|
this.route("categories");
|
2019-03-05 14:47:51 +00:00
|
|
|
this.route("users");
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("tags");
|
|
|
|
this.route("interface");
|
|
|
|
this.route("apps");
|
|
|
|
|
|
|
|
this.route("username");
|
|
|
|
this.route("email");
|
|
|
|
this.route("second-factor");
|
2018-06-28 10:12:32 +02:00
|
|
|
this.route("second-factor-backup");
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("about", { path: "/about-me" });
|
|
|
|
});
|
|
|
|
|
|
|
|
this.route(
|
|
|
|
"userInvited",
|
|
|
|
{ path: "/invited", resetNamespace: true },
|
|
|
|
function() {
|
|
|
|
this.route("show", { path: "/:filter" });
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2019-01-03 12:03:01 -05:00
|
|
|
this.route("review", { path: "/review" }, function() {
|
|
|
|
this.route("show", { path: "/:reviewable_id" });
|
|
|
|
this.route("index", { path: "/" });
|
|
|
|
this.route("topics", { path: "/topics" });
|
|
|
|
});
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("signup", { path: "/signup" });
|
|
|
|
this.route("login", { path: "/login" });
|
|
|
|
this.route("login-preferences");
|
|
|
|
this.route("forgot-password", { path: "/password-reset" });
|
|
|
|
this.route("faq", { path: "/faq" });
|
|
|
|
this.route("tos", { path: "/tos" });
|
|
|
|
this.route("privacy", { path: "/privacy" });
|
|
|
|
this.route("guidelines", { path: "/guidelines" });
|
2018-08-28 20:40:02 -04:00
|
|
|
this.route("rules", { path: "/rules" });
|
2018-12-18 16:40:05 -05:00
|
|
|
this.route("conduct", { path: "/conduct" });
|
2018-06-15 17:03:24 +02:00
|
|
|
|
|
|
|
this.route("new-topic", { path: "/new-topic" });
|
|
|
|
this.route("new-message", { path: "/new-message" });
|
|
|
|
|
|
|
|
this.route("badges", { resetNamespace: true }, function() {
|
|
|
|
this.route("show", { path: "/:id/:slug" });
|
2017-05-02 15:57:55 -04:00
|
|
|
});
|
2015-12-17 18:06:04 +11:00
|
|
|
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("full-page-search", { path: "/search" });
|
2013-07-16 16:16:37 -04:00
|
|
|
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("tags", { resetNamespace: true }, function() {
|
|
|
|
this.route("show", { path: "/:tag_id" });
|
|
|
|
this.route("showCategory", { path: "/c/:category/:tag_id" });
|
|
|
|
this.route("showParentCategory", {
|
|
|
|
path: "/c/:parent_category/:category/:tag_id"
|
2013-02-20 13:15:50 -05:00
|
|
|
});
|
2013-07-16 16:16:37 -04:00
|
|
|
|
2018-06-15 17:03:24 +02:00
|
|
|
Discourse.Site.currentProp("filters").forEach(filter => {
|
|
|
|
this.route("show" + filter.capitalize(), {
|
|
|
|
path: "/:tag_id/l/" + filter
|
|
|
|
});
|
|
|
|
this.route("showCategory" + filter.capitalize(), {
|
|
|
|
path: "/c/:category/:tag_id/l/" + filter
|
|
|
|
});
|
|
|
|
this.route("showParentCategory" + filter.capitalize(), {
|
|
|
|
path: "/c/:parent_category/:category/:tag_id/l/" + filter
|
|
|
|
});
|
2015-07-11 17:39:12 +05:30
|
|
|
});
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("intersection", {
|
|
|
|
path: "intersection/:tag_id/*additional_tags"
|
2016-04-25 15:55:15 -04:00
|
|
|
});
|
|
|
|
});
|
2016-06-06 14:18:15 -04:00
|
|
|
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route(
|
|
|
|
"tagGroups",
|
|
|
|
{ path: "/tag_groups", resetNamespace: true },
|
|
|
|
function() {
|
|
|
|
this.route("show", { path: "/:id" });
|
|
|
|
}
|
|
|
|
);
|
2017-02-13 16:19:41 -05:00
|
|
|
|
2018-06-15 17:03:24 +02:00
|
|
|
this.route("invites", { path: "/invites", resetNamespace: true }, function() {
|
|
|
|
this.route("show", { path: "/:token" });
|
2017-02-13 16:19:41 -05:00
|
|
|
});
|
2015-01-06 16:59:33 -05:00
|
|
|
}
|