Details
-
Type: Task
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.4.0
-
Fix Version/s: 4.5
-
Component/s: None
-
Labels:None
Description
Need to migrate custom data tabs to use LivePage ajax helper. Existing js/ajax code is old and has some bugs/limitations:
- Page jumps around when you click on a link
- Can't right-click a link to open in a new browser tab
- Forms don't submit via ajax
- Popup has no title and no .crm-container css class for styling
- crmLoad events not triggered, so not compatible with select2 or entityRef widgets
So the first task is to get rid of all that old code and strip everything back to simple non-ajax functionality:
- Remove all js for handling links and popups in custom data tabs
- Remove associated ajax callbacks or json outputs if any
- Ensure all forms are working in simple non-ajax mode.
- Make sure no redirects are being issued from the form layer as that breaks livePage functionality - use session->pushUserContext as an alternative.
Then enable the new ajax with 2 lines of code:
- Add class "livePage" to the tab e.g. https://github.com/civicrm/civicrm-core/blob/master/CRM/Contact/Page/View/Summary.php#L345
- For a bit of gravy, add tabCount to the view so the tab numbers get updated in real-time. e.g. https://github.com/civicrm/civicrm-core/blob/master/CRM/Contribute/Page/Tab.php#L200
You should notice some nice improvements. FYI if you were to add "save and new" button to a popup form livePage is smart enough to handle that