From 1b66876c08b46001325310791ed56a46477a09c0 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 3 Feb 2014 15:28:31 -0500 Subject: [PATCH] Show group icon in category badges if the category has restricted access --- app/assets/javascripts/discourse/lib/html.js | 12 ++++++++++-- .../templates/components/category-drop.js.handlebars | 7 ++++++- .../stylesheets/common/components/badges.css.scss | 7 +++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/html.js b/app/assets/javascripts/discourse/lib/html.js index 3a456e4dd75..5269b6234c2 100644 --- a/app/assets/javascripts/discourse/lib/html.js +++ b/app/assets/javascripts/discourse/lib/html.js @@ -47,7 +47,10 @@ Discourse.HTML = { var name = Em.get(category, 'name'), description = Em.get(category, 'description'), - html = ""; + + if (restricted) { + html += ">
" + name + "
"; + } else { + html += ">" + name + ""; + } return html; } diff --git a/app/assets/javascripts/discourse/templates/components/category-drop.js.handlebars b/app/assets/javascripts/discourse/templates/components/category-drop.js.handlebars index f934c3b8c11..edf7f361654 100644 --- a/app/assets/javascripts/discourse/templates/components/category-drop.js.handlebars +++ b/app/assets/javascripts/discourse/templates/components/category-drop.js.handlebars @@ -1,5 +1,10 @@ {{#if category}} - {{category.name}} + + {{#if category.read_restricted}} + + {{/if}} + {{category.name}} + {{else}} {{#if noSubcategories}} {{i18n categories.no_subcategory}} diff --git a/app/assets/stylesheets/common/components/badges.css.scss b/app/assets/stylesheets/common/components/badges.css.scss index d8415e6e388..efd1cca1650 100644 --- a/app/assets/stylesheets/common/components/badges.css.scss +++ b/app/assets/stylesheets/common/components/badges.css.scss @@ -28,6 +28,13 @@ &[href] { color: $white; } + &.restricted { + div { + display: inline-block; + vertical-align: top; + margin: 0; + } + } }