mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 15:12:45 +08:00
FIX: Some more non-english category errors
This commit is contained in:
parent
ee6b97754a
commit
69503345c4
|
@ -135,19 +135,18 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
|
|||
this.set('saving', true);
|
||||
model.set('parentCategory', parentCategory);
|
||||
|
||||
self.set('saving', false);
|
||||
this.get('model').save().then(function(result) {
|
||||
// success
|
||||
self.send('closeModal');
|
||||
model.set('slug', result.category.slug);
|
||||
model.setProperties({slug: result.category.slug, id: result.category.id });
|
||||
Discourse.URL.redirectTo("/category/" + Discourse.Category.slugFor(model));
|
||||
}).fail(function(error) {
|
||||
|
||||
}).fail(function(error) {
|
||||
if (error && error.responseText) {
|
||||
self.flash($.parseJSON(error.responseText).errors[0]);
|
||||
} else {
|
||||
self.flash(I18n.t('generic_error'));
|
||||
}
|
||||
|
||||
self.set('saving', false);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -13,12 +13,11 @@ Discourse.ListController = Discourse.Controller.extend({
|
|||
needs: ["composer", "modal", "listTopics"],
|
||||
|
||||
availableNavItems: function() {
|
||||
var loggedOn = !!Discourse.User.current();
|
||||
var category = this.get("category");
|
||||
|
||||
return Discourse.SiteSettings.top_menu.split("|").map(function(i) {
|
||||
return Discourse.NavItem.fromText(i, {
|
||||
loggedOn: loggedOn,
|
||||
loggedOn: !!Discourse.User.current(),
|
||||
category: category
|
||||
});
|
||||
}).filter(function(i) {
|
||||
|
|
|
@ -37,17 +37,16 @@ Discourse.NavItem = Discourse.Model.extend({
|
|||
// href from this item
|
||||
filterMode: function() {
|
||||
var name = this.get('name');
|
||||
|
||||
if( name.split('/')[0] === 'category' ) {
|
||||
return 'category/' + this.get('categorySlug');
|
||||
return 'category/' + this.get('categorySlug')
|
||||
} else {
|
||||
var mode = "";
|
||||
var category = this.get("category");
|
||||
var mode = "",
|
||||
category = this.get("category");
|
||||
|
||||
if(category){
|
||||
mode += "category/";
|
||||
|
||||
var parentSlug = category.get('parentCategory.slug');
|
||||
if (parentSlug) { mode += parentSlug + "/"; }
|
||||
mode += category.get("slug") + "/l/";
|
||||
mode += Discourse.Category.slugFor(this.get('category')) + "/l/";
|
||||
}
|
||||
return mode + name.replace(' ', '-');
|
||||
}
|
||||
|
|
|
@ -17,9 +17,10 @@ Discourse.NavItemView = Discourse.View.extend({
|
|||
active: Discourse.computed.propertyEqual('content.filterMode', 'controller.filterMode'),
|
||||
|
||||
title: function() {
|
||||
var categoryName, extra, name;
|
||||
name = this.get('content.name');
|
||||
categoryName = this.get('content.categoryName');
|
||||
var categoryName = this.get('content.categoryName'),
|
||||
name = this.get('content.name'),
|
||||
extra;
|
||||
|
||||
if (categoryName) {
|
||||
extra = { categoryName: categoryName };
|
||||
name = "category";
|
||||
|
@ -29,12 +30,12 @@ Discourse.NavItemView = Discourse.View.extend({
|
|||
|
||||
|
||||
name: function() {
|
||||
var categoryName, extra, name;
|
||||
name = this.get('content.name');
|
||||
categoryName = this.get('content.categoryName');
|
||||
extra = {
|
||||
count: this.get('content.count') || 0
|
||||
};
|
||||
var categoryName = this.get('content.categoryName'),
|
||||
name = this.get('content.name'),
|
||||
extra = {
|
||||
count: this.get('content.count') || 0
|
||||
};
|
||||
|
||||
if (categoryName) {
|
||||
name = 'category';
|
||||
extra.categoryName = Discourse.Formatter.toTitleCase(categoryName);
|
||||
|
|
Loading…
Reference in New Issue
Block a user