While groups are nice to have some simple grouping in select lists, that's not really sufficient yet. It would be nice to filter Rules by the elements used in there, e.g. so you can say show me all Rules related to "commerce payment", "e-mail", or "twitter".

I've been thinking whether we could simply tag the rule configurations with groups, but for one we have the translation problem (groups are only provided in the current translation), and the problem of mixing auto-generated stuff with user-controlled stuff.

So instead, the idea is to add a new "category" system, which basically replaces the previous groups - (or moves them a level down). So for the start, we can keep the UI as it is now, make sure existing groups and categories live well side-by-side and support filtering rules by what is already a category.

Thus, filtering options would become "Categories + Tags (+ optionally others, e.g. events).

In a next step, we could leverage it to do: #2052311: Improve action/condition/event selection screens
Also, in addition to having translation in-dependent category strings for search, we can start to allow modules to add (color-neutral) icons to a category (+ generating default icons for others). Then, fluxkraft and other UIs can start leveraging them, while Rules itself would not make use of it for now. If the icons work out well in other UIs, we could start using them in Rules itself as well.

So, this could work out like that:
- Add new category system for rules, which basically replaces the current "groups". Shows as "Category" in the UI and you can filter by Category + Tags - see #2052321: Improve filtering/searching for Rules.
- Categories are searchable, optionally have icons only
- For keeping BC, we support mapping groups to categories (creates 1:1 relationship). So contribs can keep using "group" for now and just assign the group to a category.
- Categories would be "fluxtwitter", "commerce", "commerce payment", "rules_mail", ... - and would have to be module prefixed (at least the machine name).
- Rules could probably need a list of useful pre-defined categories (mail, ... )
- Then, we could continue to support grouping inside categories: e.g. commerce payment could have groups like "paypal", "paymill", .. or "facebook" could have groups like "posts", "messages", .. (Would be only possible if used without group-cateogry-BC-mode").

Comments

fago’s picture

Status: Active » Needs review
StatusFileSize
new13.7 KB

Patch attached adds in the possibility to define categories + weight them.

todo: We need a docu page on how to create icons. http://fortawesome.github.io/Font-Awesome/cheatsheet/ was suggested, but it seems we cannot commit icons generated out of it in the repos as they won't be gpl?

fago’s picture

Some gpl icons I found: http://genericons.com/

fago’s picture

So we could allow people to provide either files (d.o.: gplv2), or a reference to a font-aweseome icon as fallback. So it would be up to the providing ui (e.g. fluxkraft) to apply font-awesome icons (or not).

Status: Needs review » Needs work

The last submitted patch, d7_rules_category.patch, failed testing.

fago’s picture

criz’s picture

If we want to support a webfont icon library as fallback (yeah!) it would be best to restrict the icons to be SVGs. Otherwise we would loose all the great webfont advantages, because we have to stick to png resolution/dimensions.

Creating SVG Icons using Inkscape should be easy, we can provide a short howto or/and a template.

But for IE8 we might have to use a polyfill: http://caniuse.com/svg

fago’s picture

Status: Needs work » Needs review
StatusFileSize
new14.36 KB
new14.5 KB

Makes sense. So I updated the patch to refer to SVG and included an option icon font class referring to font awesome class names as they have good number of icons and class names for them. Themes can decide to go with font awesome or just another icon font with matching class names.

fago’s picture

sry, turns out the interdiff is rather useless :-(

socialnicheguru’s picture

latest rules dev

patch -p1 < d7_rules_category.patch
patching file modules/data.rules.inc
patching file modules/entity.rules.inc
patching file modules/node.eval.inc
Hunk #1 FAILED at 18.
1 out of 1 hunk FAILED -- saving rejects to file modules/node.eval.inc.rej
patching file modules/node.rules.inc
Hunk #4 succeeded at 153 (offset 45 lines).
patching file modules/rules_core.rules.inc
patching file rules.api.php
Hunk #1 succeeded at 152 (offset -4 lines).
patching file rules.rules.inc
patching file ui/ui.core.inc
aegir@devmac:~/p/7/m/all/rules$ more modules/node.eval.inc.rej
--- modules/node.eval.inc
+++ modules/node.eval.inc
@@ -18,7 +18,7 @@
'parameter' => array(
'node' => array('type' => 'node', 'label' => t('Content')),
),
- 'group' => t('Node'),
+ 'category' => 'node',
'access callback' => 'rules_node_integration_access',
);
}

fago’s picture

Status: Needs review » Fixed

I updated the patch to take over latest icon-rules improvements from fluxservices, added a docu page and committed it.

Docu page: https://drupal.org/node/2090265

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.