NathanK
November 18, 2021, 3:50am
1
I’ve recently changed the icon for locks on my forum to unlock-alt
using https://github.com/discourse/discourse-category-icons.git
Naturally, they don’t apply to this widget. How would I go about changing the icon that is used?
Also, are you going to be sharing the nice Category List Widget that you are using here in thepavilion.io ? It is very nice!
keegan
November 18, 2021, 7:40pm
2
Hey @Nathan ,
I’m not sure how that theme component is doing it, but if you add this to your head tag:
<script type="text/discourse-plugin" version="0.8">
api.replaceIcon('lock', 'unlock-alt');
</script>
It replaces the icon site wide, allowing it to be changed for the category list widget as well.
Yes, actually, its already available for you to enjoy. To achieve this look:
In your Layouts Settings:
Set layouts sidebar left position
to full
.
In your Category List Widget Settings:
Check collapsible sidebar
setting to true
Check auto generate category logos
to true
Set collapsible sidebar desktop toggle
to top
NathanK
November 18, 2021, 9:59pm
3
<script type="text/discourse-plugin" version="0.8">
api.replaceIcon('lock', 'unlock-alt');
</script>
It replaces the icon site wide, allowing it to be changed for the category list widget as well.
Thank you - however, I only want it changed for categories and not topics. That will be a degree harder, eh?
keegan
November 19, 2021, 6:37pm
4
Yeah that would be a little bit harder. You could probably use the api method:
api.reopenWidget("layouts-category-link", {});
and copy all the original content, but you’d only be replacing one line:
contents.push(iconNode("lock"));
contents.push(iconNode("unlock-alt"));
however, this won’t be great for maintainability of the component.
NathanK
November 23, 2021, 4:22am
5
Well, I’ve had a crack at the Widget TC and it is now working for me with some lovely unlock icons:
Please see my PR:
https://github.com/paviliondev/layouts-category-list-widget/pull/9
Yes, actually, its already available for you to enjoy. To achieve this look:
In your Layouts Settings:
Set layouts sidebar left position
to full
.
In your Category List Widget Settings:
Check collapsible sidebar
setting to true
Check auto generate category logos
to true
Set collapsible sidebar desktop toggle
to top
And btw, is it intentional that setting layouts sidebar left position
to full
also hide the right sidebar ?
keegan
November 25, 2021, 10:43pm
7
@Benjamin_D yeah, the full
sidebar style is intended to be used as a full width/height left sidebar only. Currently, the right sidebar is not supported when the left sidebar is in the full format.