Support category names with spaces
This commit is contained in:
parent
8235d47bdd
commit
69c7b5aeed
|
@ -1,10 +1,13 @@
|
|||
window.Discourse.ListCategoryRoute = Discourse.FilteredListRoute.extend
|
||||
serialize: (params) -> slug: params.get('slug')
|
||||
|
||||
setupController: (controller, model) ->
|
||||
|
||||
slug = Em.get(model, 'slug')
|
||||
category = Discourse.get('site.categories').findProperty('slug', slug)
|
||||
category ||= Discourse.Category.create(name: slug, slug: slug)
|
||||
|
||||
listController = @controllerFor('list')
|
||||
listController.set('filterMode', "category/#{model.slug}")
|
||||
listController.load("category/#{model.slug}").then (topicList) =>
|
||||
listController.set('filterMode', "category/#{category.get('slug')}")
|
||||
listController.load("category/#{category.get('slug')}").then (topicList) =>
|
||||
listController.set('canCreateTopic', topicList.get('can_create_topic'))
|
||||
listController.set('category', Discourse.Category.create(name: model.slug))
|
||||
listController.set('category',category)
|
||||
@controllerFor('listTopics').set('content', topicList)
|
||||
|
|
|
@ -35,7 +35,7 @@ class ListController < ApplicationController
|
|||
list = nil
|
||||
|
||||
# If they choose uncategorized, return topics NOT in a category
|
||||
if params[:category] == SiteSetting.uncategorized_name
|
||||
if params[:category] == Slug.for(SiteSetting.uncategorized_name) or params[:category] == SiteSetting.uncategorized_name
|
||||
list = query.list_uncategorized
|
||||
else
|
||||
category = Category.where(slug: params[:category]).includes(:featured_users).first
|
||||
|
|
|
@ -30,7 +30,7 @@ class CategoryList
|
|||
|
||||
|
||||
uncategorized = Category.new({name: SiteSetting.uncategorized_name,
|
||||
slug: SiteSetting.uncategorized_name,
|
||||
slug: Slug.for(SiteSetting.uncategorized_name),
|
||||
featured_topics: uncategorized_topics}.merge(totals))
|
||||
|
||||
# Find the appropriate place to insert it:
|
||||
|
|
Loading…
Reference in New Issue