mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Changed breadcrumb dropdowns
This commit is contained in:
parent
70ce07ae49
commit
8c882fd392
9 changed files with 34 additions and 20 deletions
|
@ -7,16 +7,20 @@ Discourse.DiscourseBreadcrumbsComponent = Ember.Component.extend({
|
|||
return !c.get('parentCategory');
|
||||
}),
|
||||
|
||||
targetCategory: function() {
|
||||
// Note we can't use Em.computed.or here because it returns a boolean not the object
|
||||
firstCategory: function() {
|
||||
return this.get('parentCategory') || this.get('category');
|
||||
}.property('parentCategory', 'category'),
|
||||
|
||||
secondCategory: function() {
|
||||
if (this.get('parentCategory')) return this.get('category');
|
||||
return null;
|
||||
}.property('category', 'parentCategory'),
|
||||
|
||||
childCategories: function() {
|
||||
var self = this;
|
||||
return this.get('categories').filter(function (c) {
|
||||
return c.get('parentCategory') === self.get('targetCategory');
|
||||
return c.get('parentCategory') === self.get('firstCategory');
|
||||
});
|
||||
}.property('targetCategory')
|
||||
}.property('firstCategory')
|
||||
|
||||
});
|
||||
|
|
|
@ -7,6 +7,17 @@ Discourse.DiscourseCategorydropComponent = Ember.Component.extend({
|
|||
return "icon icon-caret-right";
|
||||
}.property('expanded'),
|
||||
|
||||
allCategoriesUrl: function() {
|
||||
return this.get('category.parentCategory.url') || "/";
|
||||
}.property('category'),
|
||||
|
||||
allCategoriesLabel: function() {
|
||||
if (this.get('subCategory')) {
|
||||
return I18n.t('categories.all_subcategories');
|
||||
}
|
||||
return I18n.t('categories.all');
|
||||
}.property('category'),
|
||||
|
||||
badgeStyle: function() {
|
||||
var category = this.get('category');
|
||||
if (category) {
|
||||
|
|
|
@ -31,7 +31,7 @@ Discourse.Category = Discourse.Model.extend({
|
|||
}.property('id'),
|
||||
|
||||
url: function() {
|
||||
return Discourse.getURL("/category/") + (this.get('slug'));
|
||||
return Discourse.getURL("/category/") + Discourse.Category.slugFor(this);
|
||||
}.property('name'),
|
||||
|
||||
unreadUrl: function() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
<li>
|
||||
{{discourse-categorydrop parentCategory=category categories=parentCategories}}
|
||||
{{discourse-categorydrop category=firstCategory categories=parentCategories}}
|
||||
</li>
|
||||
<li>
|
||||
{{discourse-categorydrop parentCategory=category category=targetCategory categories=childCategories}}
|
||||
</li>
|
||||
{{#if parentCategory}}
|
||||
|
||||
{{#if childCategories}}
|
||||
<li>
|
||||
{{boundCategoryLink category}}
|
||||
{{discourse-categorydrop category=secondCategory categories=childCategories subCategory="true"}}
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
{{#if category}}
|
||||
{{boundCategoryLink category allowUncategorized=true}}
|
||||
<a href="#" {{action expand}} class="badge-category" {{bindAttr style="badgeStyle"}}>{{category.name}}</a>
|
||||
{{else}}
|
||||
<a href='/' class='badge-category home' {{bindAttr style="badgeStyle"}}><i class='icon icon-home'></i></a>
|
||||
<a href='#' {{action expand}} class='badge-category home' {{bindAttr style="badgeStyle"}}>{{allCategoriesLabel}}</i></a>
|
||||
{{/if}}
|
||||
|
||||
{{#if categories}}
|
||||
<a href='#' {{action expand}} class='badge-category category-dropdown-button' {{bindAttr style="badgeStyle"}}><i {{bindAttr class="iconClass"}}></i></a>
|
||||
<section {{bindAttr class="expanded::hidden :category-dropdown-menu"}} class='chooser'>
|
||||
<div class='cat'><a {{bindAttr href=allCategoriesUrl}} class='badge-category home'>{{allCategoriesLabel}}</a></div>
|
||||
{{#each categories}}<div class='cat'>{{categoryLink this allowUncategorized=true}}</div>{{/each}}
|
||||
</section>
|
||||
{{/if}}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<div class='list-controls'>
|
||||
<div class="container">
|
||||
|
||||
{{#if category}}
|
||||
{{discourse-breadcrumbs category=category categories=categories}}
|
||||
{{/if}}
|
||||
{{discourse-breadcrumbs category=category categories=categories}}
|
||||
|
||||
<ul class="nav nav-pills" id='category-filter'>
|
||||
{{each availableNavItems itemViewClass="Discourse.NavItemView"}}
|
||||
|
|
|
@ -351,8 +351,8 @@
|
|||
|
||||
.list-controls {
|
||||
.home {
|
||||
font-size: 20px;
|
||||
font-weight: normal;
|
||||
background-color: #eee;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.badge-category {
|
||||
|
|
|
@ -241,8 +241,8 @@
|
|||
|
||||
.list-controls {
|
||||
.home {
|
||||
font-size: 20px;
|
||||
font-weight: normal;
|
||||
color: #333;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.badge-category {
|
||||
|
|
|
@ -184,6 +184,8 @@ en:
|
|||
"13": "Inbox"
|
||||
|
||||
categories:
|
||||
all: "all categories"
|
||||
all_subcategories: "all subcategories"
|
||||
category: "Category"
|
||||
posts: "Posts"
|
||||
topics: "Topics"
|
||||
|
|
Loading…
Reference in a new issue