Permalink
Browse files

Use the categories' css classes in the views.

  • Loading branch information...
tburry committed Oct 8, 2012
1 parent 8948981 commit ec7561d1e12fc2d009d1f8985ef8a8043a9e612f
@@ -120,6 +120,7 @@ public function Index($CategoryIdentifier = '', $Page = '0') {
throw NotFoundException();
}
$Category = (object)$Category;
+ Gdn_Theme::Section($Category->CssClass);
// Load the breadcrumbs.
$this->SetData('Breadcrumbs', array_merge(array(array('Name' => T('Categories'), 'Url' => '/categories')), CategoryModel::GetAncestors(GetValue('CategoryID', $Category))));
@@ -83,6 +83,7 @@ function CategoryLink($Discussion, $Prefix = ' ') {
function WriteDiscussion($Discussion, &$Sender, &$Session) {
$CssClass = CssClass($Discussion);
$DiscussionUrl = $Discussion->Url;
+ $Category = CategoryModel::Categories($Discussion->CategoryID);
if ($Session->UserID)
$DiscussionUrl .= '#latest';
@@ -175,8 +176,8 @@ function WriteDiscussion($Discussion, &$Sender, &$Session) {
echo '</span> ';
}
- if (C('Vanilla.Categories.Use') && $Discussion->CategoryUrlCode != '')
- echo Wrap(Anchor($Discussion->Category, CategoryUrl($Discussion->CategoryUrlCode)), 'span', array('class' => 'MItem Category'));
+ if (C('Vanilla.Categories.Use') && $Category)
+ echo Wrap(Anchor($Discussion->Category, CategoryUrl($Discussion->CategoryUrlCode)), 'span', array('class' => 'MItem Category '.$Category['CssClass']));
$Sender->FireEvent('DiscussionMeta');
?>
@@ -22,14 +22,15 @@
continue;
if ($DoHeadings && $Category->Depth == 1)
- $CssClass = 'Heading';
+ $CssClass = 'Heading '.$Category->CssClass;
else
- $CssClass = 'Depth'.$Category->Depth.($CategoryID == $Category->CategoryID ? ' Active' : '');
+ $CssClass = 'Depth'.$Category->Depth.($CategoryID == $Category->CategoryID ? ' Active' : '').' '.$Category->CssClass;
echo '<li class="ClearFix '.$CssClass.'">';
if ($DoHeadings && $Category->Depth == 1) {
- echo Gdn_Format::Text($Category->Name);
+ echo Gdn_Format::Text($Category->Name)
+ .' <span class="Aside"><span class="Count Hidden">'.BigPlural($Category->CountAllDiscussions, '%s discussion').'</span></span>';
} else {
echo Wrap(Anchor(Gdn_Format::Text($Category->Name), CategoryUrl($Category)), 'strong')
.' <span class="Aside"><span class="Count">'.BigPlural($Category->CountAllDiscussions, '%s discussion').'</span></span>';

0 comments on commit ec7561d

Please sign in to comment.