Show group icon in category badges if the category has restricted access
This commit is contained in:
parent
bf951689e8
commit
1b66876c08
|
@ -47,7 +47,10 @@ Discourse.HTML = {
|
||||||
|
|
||||||
var name = Em.get(category, 'name'),
|
var name = Em.get(category, 'name'),
|
||||||
description = Em.get(category, 'description'),
|
description = Em.get(category, 'description'),
|
||||||
html = "<a href=\"" + Discourse.getURL("/category/") + Discourse.Category.slugFor(category) + "\" class=\"badge-category\" ";
|
restricted = Em.get(category, 'read_restricted'),
|
||||||
|
html = "<a href=\"" + Discourse.getURL("/category/") + Discourse.Category.slugFor(category) + "\" ";
|
||||||
|
|
||||||
|
html += "class=\"badge-category" + (restricted ? ' restricted' : '' ) + "\" ";
|
||||||
|
|
||||||
// Add description if we have it
|
// Add description if we have it
|
||||||
if (description) html += "title=\"" + Handlebars.Utils.escapeExpression(description) + "\" ";
|
if (description) html += "title=\"" + Handlebars.Utils.escapeExpression(description) + "\" ";
|
||||||
|
@ -56,7 +59,12 @@ Discourse.HTML = {
|
||||||
if (categoryStyle) {
|
if (categoryStyle) {
|
||||||
html += "style=\"" + categoryStyle + "\" ";
|
html += "style=\"" + categoryStyle + "\" ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (restricted) {
|
||||||
|
html += "><div><i class='fa fa-group'></i> " + name + "</div></a>";
|
||||||
|
} else {
|
||||||
html += ">" + name + "</a>";
|
html += ">" + name + "</a>";
|
||||||
|
}
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
{{#if category}}
|
{{#if category}}
|
||||||
<a href="#" {{action expand}} class="badge-category" {{bind-attr style="badgeStyle"}}>{{category.name}}</a>
|
<a href="#" {{action expand}} class="badge-category" {{bind-attr style="badgeStyle"}}>
|
||||||
|
{{#if category.read_restricted}}
|
||||||
|
<i class='fa fa-group'></i>
|
||||||
|
{{/if}}
|
||||||
|
{{category.name}}
|
||||||
|
</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if noSubcategories}}
|
{{#if noSubcategories}}
|
||||||
<a href='#' {{action expand}} class='badge-category home' {{bind-attr style="badgeStyle"}}>{{i18n categories.no_subcategory}}</i></a>
|
<a href='#' {{action expand}} class='badge-category home' {{bind-attr style="badgeStyle"}}>{{i18n categories.no_subcategory}}</i></a>
|
||||||
|
|
|
@ -28,6 +28,13 @@
|
||||||
&[href] {
|
&[href] {
|
||||||
color: $white;
|
color: $white;
|
||||||
}
|
}
|
||||||
|
&.restricted {
|
||||||
|
div {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: top;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue