nathank
(Nathan Kershaw)
December 15, 2021, 2:53am
1
I’ve used Category Icons to change the category locks icon to unlock-alt
, which is great.
They are applied to all categories and subcategories appropriately except the category-box-heading
. You’ll note that the subcategory titles have the replacement icon with no problem:
.
When inspecting the boxes, I note that the text for the category-box-heading is not wrapped in `category name here , and the icon assigned to it is the default one (not the one it has been changed to).
Apologies if this is actually related to the Theme Component, but I’m pretty sure it is something in core.
1 Like
Johani
(Joe)
December 15, 2021, 6:39am
2
Some of this is in core, and some of it is in the component. These two PRs should fix the issue when merged
discourse:main
← hnb-ku:category-boxes-lock-icons
opened 06:27AM - 15 Dec 21 UTC
Context: https://meta.discourse.org/t/unable-to-alter-the-lock-icon-in-category-… boxes/212133
Instead of hardcoding the category lock icon, set it as a property that themes can override. This means that themes can avoid full template overrides.
The category title link already does that here.
https://github.com/discourse/discourse/blob/1472e47aae5bfdfb6fd9abfe89beb186c751f514/app/assets/javascripts/discourse/app/components/category-title-link.js#L5
https://github.com/discourse/discourse/blob/70eca1dc4e04e94eb326482b51ea2617656fa8a8/app/assets/javascripts/discourse/app/templates/components/category-title-link.hbs#L5
This PR makes it so the `categories-boxes` and `categories-boxes-with-topics` also do the same.
discourse:main
← hnb-ku:category-boxes-lock-icons-fix
opened 06:30AM - 15 Dec 21 UTC
context: https://meta.discourse.org/t/unable-to-alter-the-lock-icon-in-category-… boxes/212133
I sent a PR to fix the core side of this here
https://github.com/discourse/discourse/pull/15309
This PR makes the same adjustment here
https://github.com/discourse/discourse-category-icons/blob/main/javascripts/discourse/initializers/category-icons.js#L21-L23
to the `categories-boxes` and `categories-boxes-with-topics` components.
4 Likes
nathank
(Nathan Kershaw)
December 15, 2021, 10:47pm
3
Thanks Joe - I’ve updated both discourse and the component, but the behaviour hasn’t changed. This example is for subcategories but it is the same for boxes on the /c
page.
When I inspect it, I can see the additional wrapping - that is in there nicely, but still the wrong lock icon:
<svg class="fa d-icon d-icon-lock svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use href="#lock"></use></svg>
Johani
(Joe)
December 15, 2021, 11:12pm
4
What commit is the site you’re seeing this issue on?
Right-click > view page source > Look for the Meta Generator tag.
It looks like this
<meta name="generator" content="Discourse 2.8.0.beta9 - https://github.com/discourse/discourse version 5e534e58973730ad43026455821966a352e8477a">
Can you share that here?
nathank
(Nathan Kershaw)
December 15, 2021, 11:33pm
5
In betterstreets.nz , but you won’t see any locked icons unless you join (which you are welcome to do).
Here 'tis:
<meta name="generator" content="Discourse 2.8.0.beta9 - https://github.com/discourse/discourse version 1c9a0fe18e19831277fd1c1be6d28559b3bad108">
1 Like
Johani
(Joe)
December 15, 2021, 11:45pm
6
The theme component is not updated on your site. I’m seeing this.
Summary
let lockIcon = settings.category_lock_icon || "lock";
categoryTitleLink.default.reopen({
lockIcon: lockIcon
});
when it should be
Summary
let lockIcon = settings.category_lock_icon || "lock";
categoryTitleLink.reopen({
lockIcon: lockIcon,
});
categoriesBoxes.reopen({
lockIcon: lockIcon,
});
categoriesBoxesWithTopics.reopen({
lockIcon: lockIcon,
});
Like it is here
discourse-category-icons/category-icons.js at main · discourse/discourse-category-icons · GitHub
Head to the component page on your site and make sure that the source
link is pointing to the correct repository
https://github.com/discourse/discourse-category-icons
Also, double check if you have multiple copies of the component installed. Check if the one that’s active is up to date.
nathank
(Nathan Kershaw)
December 15, 2021, 11:57pm
7
Hmmm, all looks good at my end. Only one component, correct repository, activated.
Source is:
Johani
(Joe)
December 16, 2021, 12:15am
8
Not really sure at this point. Looking through the settings, I see you’re only using this for the lock icon, right? Can you try deleting the component and installing it again?
3 Likes
nathank
(Nathan Kershaw)
December 16, 2021, 12:20am
9
Well, that worked!!!
Thanks for your above and beyond the call of duty persistent support for me on this Joe!
I’ll now apply it to our other sites, deleting and re-installing the component each time. I’m unsure what that triggered but hey, it works.
3 Likes