-
-
Notifications
You must be signed in to change notification settings - Fork 827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev/core#785 Differentiate smart group from regular group using icon in select2 field #13958
Conversation
(Standard links)
|
@monishdeb +1 on concept. I see there are some change relating to how select2 is added to the form in this PR. I think it might be easier to extract and merge those changes first (separately) to the new icon "feature". |
Thanks for your feedback. Will move out the select2 element type changes to addField(...) in a separate PR. |
test fail relates |
3a93b06
to
a5ca0fa
Compare
test this please |
test fail relates @colemanw are you +1 on concept / general code approach? |
14c448c
to
c8184c8
Compare
Jenkins test this please |
@colemanw there is still a related test fail here but can you confirm that you have no concerns on this pr |
Yes I approve this concept, actually the lightbulb was my bright idea, just got lost in some other thread when we were discussing this proposal. @civicrm-builder retest this please |
oh the test is failing |
That looks to me like an unrelated issue with the test, not a problem with this PR. |
Ignore that last comment. It's an issue with the test included with this PR and should be fixed. |
lol - I thought that when I first saw your comment - so you were snapped |
Jenkins test this please. |
@eileenmcnaughton @colemanw the test build passed. Can we merge this PR? |
@monishdeb this looks good. Edit form/groups issue is fixed. |
@@ -1119,11 +1120,12 @@ private static function buildGroupHierarchy(&$hierarchy, $group, $tree, $titleOn | |||
$hierarchy[$group['id']] = $spaces . $group['title']; | |||
} | |||
else { | |||
$hierarchy[$group['id']] = [ | |||
'title' => $spaces . $group['title'], | |||
$hierarchy[] = array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monishdeb is there a reason why we are changing the array key here? also shouldn't this use the short array syntax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seamuslee001 the answer lies in here where we are now relying on select2 widget, which expects the array keys to be sequential and not hardcoded group ID. And better coverage for tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update for the short array syntax?
@monishdeb can you check the review comment from Seamus above? Also I would +1 the suggestion from BGM that we move the asterisk to after the group name as
|
-1 to move the asterisk after the group name. For long group names the asterisk would either be lost at the end of the line or it would simply disappear. Maybe adding a CSS solution, padding-left and aligning all elements and putting an "asterisk" only on smart groups might be the best solution. |
I don't think there's a perfect solution for the asterisk location. I'd lean toward the beginning, as it ensures the best visibility. |
I would agree that a symbol (whether or not it is an asterisk) at the end of a group name is problematic. We use smart groups heavily and some of our names are a bit long. I also agree that adding the asterisk at the front messes up the left alignment. Is the solution that @francescbassas suggested - have the symbol off to the left with padding on the elements that don't have the symbol to keep the text alignment consistent - not entertainable? |
@lcdservices @colemanw @francescbassas @ray-wright if you all agree, should I keep asterisk only on smart group to the left (at start) of label and with some padding-left adjustment is the best solution here? |
I'm fine with that. I don't think there's a perfect solution, but this solution would address the most concerns/issues. |
@monishdeb Needs rebase |
I have rebased the PR and made the changes to show asterisk on left of smart group label. |
@@ -73,7 +73,7 @@ public function buildQuickForm() { | |||
if ($onlyPublicGroups && $group['visibility'] == 'User and User Admin Only') { | |||
continue; | |||
} | |||
$allGroups[$id] = $group; | |||
$allGroups[$group['id']] = $group; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you discard the as $id
from the foreach loop above? It will avoid someone accidentally changing it back to what it was before.
Code seems OK, and I'll rally to the majority of placing an asterisk before. I'm slightly concerned about changing the signature of For example, the Contact Layout Summary Editor does this:
And these might need a bit more testing, for example, on the search forms: $ grep -r getGroupsHierarchy |
@mlutfy the last comment on this (which seems blocking) is from you "I'm slightly concerned about changing the signature of CRM_Contact_BAO_Group::getGroupsHierarchy, since it could potentially break extensions?"
Can you comment & maybe merge if you see no remaining blockers |
hmm indeed, seems all fine. merging! |
Unfortunately this caused fatal errors - see #17888 - for now it is reverted as I think revert & redo is a sensible policy when the alternative is not obvious |
I think instead of putting the asterisk directly in the name of the smart groups it would be better to add a class to be able to define the visual variations at CSS level. |
Overview
Currently, there is no way to tell which group is smart or regular group from UI. It would be ideal to use icon against such smart group options to differentiate them from regular ones. This patch appends an icon against smart group option of the select2 widget
https://lab.civicrm.org/dev/core/-/issues/785
Before
After
Comments
ping @colemanw @lcdservices