almost fixed the regression of not allowing top level filters

This commit is contained in:
Sam 2013-05-23 16:38:29 +10:00
parent 84fd366322
commit fc3c93d237
3 changed files with 7 additions and 5 deletions

View File

@ -18,7 +18,7 @@ Discourse.NavItem = Discourse.Model.extend({
// href from this item
href: function() {
var name = this.get('name'),
href = Discourse.getURL("/") + name;
href = Discourse.getURL("/") + name.replace(' ', '-');
if (name === 'category') href += "/" + this.get('categoryName');
return href;
}.property('name')

View File

@ -25,7 +25,7 @@ Discourse.NavItemView = Discourse.View.extend({
}).property("content.filter"),
isActive: (function() {
if (this.get("content.name") === this.get("controller.filterMode")) return "active";
if (this.get("content.name").replace(' ','-') === this.get("controller.filterMode")) return "active";
return "";
}).property("content.name", "controller.filterMode"),
@ -42,7 +42,7 @@ Discourse.NavItemView = Discourse.View.extend({
};
if (categoryName) {
name = 'category';
extra.categoryName = categoryName.capitalize();
extra.categoryName = categoryName.titleize();
}
return I18n.t("js.filters." + name + ".title", extra);
}).property('count'),

View File

@ -216,11 +216,13 @@ class SiteSetting < ActiveRecord::Base
end
def self.homepage
top_menu.split('|')[0]
# TODO objectify this
x = top_menu.split('|')[0].split(',')[0]
end
def self.anonymous_homepage
top_menu.split('|').select{ |f| ['latest', 'hot', 'categories', 'category'].include? f }[0]
# TODO objectify this
top_menu.split('|').map{|f| f.split(',')[0] }.select{ |f| ['latest', 'hot', 'categories', 'category'].include? f}[0]
end
end