Jump to content

Icons Filter


Robin S
 Share

Recommended Posts

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.

 

2017-05-30_210009.png.d2aaa88ed277f359aa5049a98e77ea58.png

 

https://github.com/Toutouwai/IconsFilter

 

@tpr, something that could be merged into AdminOnSteroids?

  • Like 10
Link to comment
Share on other sites

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

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.

  • Like 2
Link to comment
Share on other sites

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?

  • Like 1
Link to comment
Share on other sites

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 :) 

 

icon-selector.gif

  • Like 3
Link to comment
Share on other sites

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

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

  • 2 weeks later...

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.

  • Like 6
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...