Robin S Posted May 30, 2017 Share Posted May 30, 2017 Note: this functionality is now built into AdminOnSteroids. I'd hate to know how much accumulated time I have spent and how much eye-strain I have experienced over the last couple of years, hunting through the 675 icons in the "all icons" view for the one I want. Today I finally got around to doing something about it. IconsFilter Allows the "all icons" view in InputfieldIcon to be filtered by name. Usage Install the IconsFilter module. When viewing "all icons" in InputfieldIcon (Advanced tab of field/template settings) you can filter the icons by name using the filter input at top right. https://github.com/Toutouwai/IconsFilter @tpr, something that could be merged into AdminOnSteroids? 10 Link to comment Share on other sites More sharing options...
tpr Posted May 30, 2017 Share Posted May 30, 2017 Sure, but I would take a different approach, namely Choices, see the "Single select input" example. Link to comment Share on other sites More sharing options...
Robin S Posted May 30, 2017 Author Share Posted May 30, 2017 1 hour ago, tpr said: Sure, but I would take a different approach, namely Choices, see the "Single select input" example. But the idea is to filter the icons preview, not the select options. Link to comment Share on other sites More sharing options...
tpr Posted May 30, 2017 Share Posted May 30, 2017 Yepp I noticed that after posting. Somehow mixing the two would be the best, having an autocomplete and preview too. Choices could use a callback to filter the icons too but it would overlap the icons. Using Choices with custom template that shows the icons in multiple columns could work though (just tried it in devtools). Link to comment Share on other sites More sharing options...
elabx Posted May 30, 2017 Share Posted May 30, 2017 +1000 to put this in core 6 Link to comment Share on other sites More sharing options...
szabesz Posted May 30, 2017 Share Posted May 30, 2017 This is great, thanks! May I have a suggestion too? Searching by name is one thing, but what if we could search by "tags"? I mean lots of icons can be used in different contexts, and most of the time I cannot even guess the name. For example I use "Car" for the article excerpt/ledes (in a "leading the way" sense). More examples I use: Trophy => bagde, Fire => effects, Compass => sku, etc... These associations could be (hard?) wired into the module, so that you can make search possible this way too. I would be happy to contribute, or even better, you could somehow make it possible for everyone to contribute. 2 Link to comment Share on other sites More sharing options...
Pixrael Posted May 30, 2017 Share Posted May 30, 2017 http://fontawesome.io/icons/ have this using the Argolia search engine.. maybe we can have something similar using this https://jets.js.org/ .. is very easy to use with html/data tags and really fast 3 Link to comment Share on other sites More sharing options...
tpr Posted May 30, 2017 Share Posted May 30, 2017 jets looks great! The icon selector's markup seems a bit overkill to me. The spans are unnecessary and the JS hover events could be replaced with a few lines of CSS. The markup for the .InputfieldIconAll div is 100+ kbytes which could be easily cut by half. I know it's not a big deal but still. Perhaps a facelift PR could be put together containing a filter update? 1 Link to comment Share on other sites More sharing options...
tpr Posted May 30, 2017 Share Posted May 30, 2017 I played a bit with InputfieldIcon.js and CSS and a few improvements could be made: use :active state to zoom the icons + show its name using CSS attr() deselect an icon by clicking on it (instead of selecting the first option in the select box) do not re-initialize the icons after re-open (click events are currently fired multiple times if so) plus do not add those 675 spans 3 Link to comment Share on other sites More sharing options...
Macrura Posted May 31, 2017 Share Posted May 31, 2017 i've been using the enhanced icon select in my selectize template and field tags module, which has served well for the past year; http://modules.processwire.com/modules/selectize-template-field-tags/ but your module looks like possible improvement..thanks! 3 Link to comment Share on other sites More sharing options...
Robin S Posted May 31, 2017 Author Share Posted May 31, 2017 6 hours ago, Macrura said: i've been using the enhanced icon select in my selectize template and field tags module, which has served well for the past year Somehow I missed the enhanced icon select part of the module - damn, wish I found that earlier. 10 hours ago, tpr said: do not re-initialize the icons after re-open (click events are currently fired multiple times if so) plus do not add those 675 spans I take you mean to propose changes for that in the core, because it isn't possible to do in a module. Link to comment Share on other sites More sharing options...
tpr Posted May 31, 2017 Share Posted May 31, 2017 1 hour ago, Robin S said: I take you mean to propose changes for that in the core, because it isn't possible to do in a module. Sure, and a filter part in AOS if Ryan wouldn't like it to be in the core. Link to comment Share on other sites More sharing options...
tpr Posted June 10, 2017 Share Posted June 10, 2017 I've added Robin's code to AOS (unreleased yet) with some tweaks (use placeholder search character instead ::before pseudo, on enter select first match and do not submit the form, focus on expanding the icons and position the filter next to the Show all button instead floating. I've also posted a PR to the core InputfieldIcon. 6 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now