Skip to content

Commit

Permalink
Use the categories' css classes in the views.
Browse files Browse the repository at this point in the history
  • Loading branch information
tburry committed Oct 8, 2012
1 parent 8948981 commit ec7561d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Expand Up @@ -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))));
Expand Down
5 changes: 3 additions & 2 deletions applications/vanilla/views/discussions/helper_functions.php
Expand Up @@ -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';
Expand Down Expand Up @@ -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');
?>
Expand Down
7 changes: 4 additions & 3 deletions applications/vanilla/views/modules/categories.php
Expand Up @@ -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>';
Expand Down

0 comments on commit ec7561d

Please sign in to comment.