Skip to content
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

Embed afforms & search displays on contact summary screen as blocks and tabs #19887

Merged
merged 3 commits into from
Apr 7, 2021

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Mar 24, 2021

Overview

This enables the creation of blocks and tabs on the contact summary screen, using Afform & SearchKit.

Forms containing a search display will automatically receive the id of the contact being viewed as a filter. Tabs will automatically show a counter in the tab of the number of rows (like core tabs do).

The blocks/tabs will be placed in default positions, but can be rearranged with the Contact Layout Editor extension.

Embed Afform Like This:
image

This is the Contribution tab from core:
image

And here is the one I made with SearchKit:
image

Technical Details

One of the technical challenges was the ability to boostrap Angular more than once per page. This has been solved by #19922.

@civibot
Copy link

civibot bot commented Mar 24, 2021

(Standard links)

@mattwire
Copy link
Contributor

@colemanw This sounds great! Just a note that we need to make sure that selectedChild= for selecting tabs via URL still works after this change.

@colemanw
Copy link
Member Author

@colemanw This sounds great! Just a note that we need to make sure that selectedChild= for selecting tabs via URL still works after this change.

Yep, just tried it and it works. Just use the name of the afform as the value of selectedChild.

@colemanw colemanw force-pushed the afformContactSummary branch from f0bc90e to b6fdf56 Compare March 24, 2021 19:46
@seamuslee001 seamuslee001 self-assigned this Mar 24, 2021
@colemanw colemanw force-pushed the afformContactSummary branch from b6fdf56 to 9455ab6 Compare March 25, 2021 16:42
@eileenmcnaughton
Copy link
Contributor

I gave this a quick spin and it's VERY COOL

I'm trying to think of a great use case to demo with it

@eileenmcnaughton
Copy link
Contributor

@seamuslee001 I'd be happy to merge this based on my testing - but I think you want to do some too?

@colemanw
Copy link
Member Author

I'm hoping @totten will merge #19922 first and then I can rebase this to use the new AngularLoader service.

@colemanw colemanw force-pushed the afformContactSummary branch from 9455ab6 to 7a5a12a Compare April 6, 2021 13:39
@colemanw
Copy link
Member Author

colemanw commented Apr 6, 2021

Ok. The other PR has been merged & I've rebased this one.

Minor code cleanup, help text tweaks and organization on the config-form tab
@colemanw colemanw force-pushed the afformContactSummary branch from 7a5a12a to 67e290a Compare April 6, 2021 18:53
return;
}
$scanner = \Civi::service('afform_scanner');
$weight = 111;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colemanw is there any reasoning behind this specific weight? are we not able to just get the max weight of the current tabs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we generally want the "ChangeLog" tab to be last and that has a weight of 120, so this puts the afform tabs after core tabs but before changelog.

The default positions for tabs and blocks can be configured with the Contact Layout Editor, which I think is the right answer for anyone wanting to change it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also 111 is the emergency number in NZ

@colemanw colemanw force-pushed the afformContactSummary branch from 67e290a to 54a03b7 Compare April 6, 2021 23:21
@seamuslee001
Copy link
Contributor

I tested this and worked well merging

@seamuslee001 seamuslee001 merged commit 5da82bb into civicrm:master Apr 7, 2021
@seamuslee001 seamuslee001 deleted the afformContactSummary branch April 7, 2021 02:36
@eileenmcnaughton
Copy link
Contributor

woohoo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants