Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Adding "Options Gear" after Category in "Mixed" Category view
DoyceT
✭✭✭
Vanilla 2.1, Default Theme.
In both the Table and Modern category views, the user is shown an 'options' gear when they mouse over a given category. (Typically, the menu this gear displays includes 'Mark Read', and either 'Hide' or "Unhide'.)
The code for this "Options Gear" seems to be found in /applications/vanilla/views/categories/helper_functions.php, lines 57 to 97.
In the Mixed category view, this options gear is not available, and I'd like to fix that.
My problem: I can't figure out how/where that code is being called in the Table and Modern views, and thus I can't replicate it for the Mixed view.
Tagged:
0
Comments
I see the cog in the mixed view. Could it be a theme issue?
Try adding this to the custom.css temporarily to make it visible all the time. Maybe it is hiding behind something else
You need to also set the permissions in the dashboard for members to be able to edit but this permission may be to edit everything not just their posts.
I think there may be a bug here. Because the cog won't show in mixed view if permissions to edit are not set.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
See the attached image.
Basically, adding that bit of css shows me the options gear after individual discussions, but not for the Category itself.
I'm attaching a screen cap from firebug.
In it, I'm examining the category and first discussion from the screen capture above.
It seems that there is no "options" being written for the Category at all - it's not hidden behind something, it's just not there.
The discussion immediately below that one has the span class "Options" with all the requisite code included.
.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
yes I can see that too. The options are not showing in the selected category. Not to edit or anything and does not appear in the source.
I think this is a permissions thing but I could not find the root of it .
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
What I'm looking for is basically this:
Functional Goal: I want to be able to easily hide and unhide categories while using the Mixed category view. As it stands, the only way to do that is to switch category view to one of the other views, make the hide-unhide changes, then switch back. Annoying for me, and over-complex for some of my users.
I can't verify if it works correctly, you would have to experiment, but here is a possible start.
it may work but you have to test with a variety of permissions.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
That one might either be a resource for possibilities or a solution: http://vanillaforums.org/addon/categoriesmoduleplus-plugin
ok I added that function to my categories drop down plugin, it now shows the cog but only by the category , not each category in the category list. Is that what it is supposed to do? or also add it by each cat ?
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
You need to add a call to the
GetOptions()
function in your categories/discussions view.Copy the file from
/applications/vanilla/views/categories/discussions.php
to/themes/yourTheme/views/categories/discussions.php
.Add the following code on line 2 of the new file:
Then you need to add
echo GetOptions($Category);
right after the line that looks likeGdn::Controller()->FireEvent('AfterCategoryTitle');
You should now have a static gear icon that has the category options available. If you want it to only show on hover, you need to bust out your CSS skills, or ask the guru (@vrijvlinder).
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
so is it better to replace the view or just add a plugin in case the view changes
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
I cross-posted... AGAIN.
Honestly, I would hook into the view via a plugin and load up the categories' helper_functions view. Then use the
GetOptions()
function.This will ensure changing the GetOptions function (or overriding it elsewhere) will be reflected in your plugin.
Probably the cleanest solution.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
ok I tried that
Same result for member role than the code from peregrine that I added to my plugin, however the cog also shows if logged out....
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Here is the plugin based code:
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
I am not seeing that on my test install of 2.1. The
GetOptions()
function checks for a valid session before spitting out any markup as well.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
No, when I added it to categories drop down it shows even if logged out. Because the plugin does not check for session.
But both result in no cog for individual discussions in the category list
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
didn't see your cross-posted code again or I'll take the blame. I cross-posted.
so I removed mine.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Hmm. I'm definitely not getting that.
All three solutions seem to give the same end result - I'm currently using the Plugin that calls helper_functions, as it seemed the best of both worlds.
This gives an always-visible gear after all categories while in mixed view, and 'hidden until moused over' gears for individual discussion.
Only remaining challenge, as hg mentioned, is figuring out the css that allows the category-level gear to hide until moused over, without also hiding the Bookmark sprite. :pensive:
Oh... and one other issue: when you switch to any of the other category views, you get two identical gears on mouseover, since the other two views are already calling helper_functions in some fashion.
On the forums I used people find the hiding of stuff very hard to use. surprising that you want to hide it.
it is just a tiny cogwheel.
half the time people can't find how to do something because it is hidden. e.g. reactions is another one.
Just my soapbox rant I hate the hiding of stuff and make it all visible, unless it is a total distractions.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.