fix up messed up routes

This commit is contained in:
Sam 2013-07-02 15:21:26 +10:00
parent e4baea77be
commit c3f64f99b3
3 changed files with 8 additions and 7 deletions

View File

@ -101,7 +101,8 @@ Discourse.Category.reopenClass({
},
findBySlugOrId: function(slugOrId) {
return Discourse.ajax("/categories/" + slugOrId + ".json").then(function (result) {
// TODO: all our routing around categories need a rethink
return Discourse.ajax("/category/" + slugOrId + "/show.json").then(function (result) {
return Discourse.Category.create(result.category);
});
}

View File

@ -26,7 +26,7 @@ class ListController < ApplicationController
list = query.list_category(@category)
end
list.more_topics_url = url_for(category_path(params[:category], page: next_page, format: "json"))
list.more_topics_url = url_for(category_list_path(params[:category], page: next_page, format: "json"))
respond(list)
end

View File

@ -146,7 +146,6 @@ Discourse::Application.routes.draw do
get 'p/:post_id/:user_id' => 'posts#short_link'
resources :notifications
resources :categories
match "/auth/:provider/callback", to: "users/omniauth_callbacks#complete", via: [:get, :post]
match "/auth/failure", to: "users/omniauth_callbacks#failure", via: [:get, :post]
@ -168,11 +167,12 @@ Discourse::Application.routes.draw do
resources :user_actions
resources :education
resources :categories, :except => :show
get 'category/:id/show' => 'categories#show'
get 'category/:category.rss' => 'list#category_feed', format: :rss, as: 'category_feed'
get 'category/:category' => 'list#category'
get 'category/:category' => 'list#category'
get 'category/:category/more' => 'list#category'
get 'categories' => 'categories#index'
get 'category/:category' => 'list#category', as: 'category_list'
get 'category/:category/more' => 'list#category', as: 'category_list_more'
# We've renamed popular to latest. If people access it we want a permanent redirect.
get 'popular' => 'list#popular_redirect'