Support category names with spaces

This commit is contained in:
Robin Ward
2013-02-12 17:39:31 -05:00
parent 8235d47bdd
commit 69c7b5aeed
3 changed files with 10 additions and 7 deletions

View File

@@ -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)