rename contact_1 to individual_1 for individual model
[civicrm-core.git] / js / crm.livePage.js
CommitLineData
b7798527 1// http://civicrm.org/licensing
6eafcb19 2// Adds ajaxy behavior to a simple CiviCRM page
b7798527
CW
3cj(function($) {
4 $('#crm-main-content-wrapper')
5 // Widgetize the content area
6eafcb19 6 .crmSnippet()
b7798527 7 // Open action links in a popup
4b628e67
CW
8 .off('click.crmLivePage')
9 .on('click.crmLivePage', 'a.button, a.action-item', function() {
a10432db 10 var url = $(this).attr('href');
c109be6c 11 // only follow real links not javascript buttons
8e4ec1f5 12 if (url === '#' || $(this).attr('onclick') || $(this).hasClass('no-popup')) {
c109be6c
CW
13 return;
14 }
8e4ec1f5 15 CRM.loadForm(url, {
a10432db 16 openInline: 'a:not("[href=#], .no-popup")'
6eafcb19 17 }).on('crmFormSuccess', function(e, data) {
b7798527
CW
18 // Refresh page when form completes
19 $('#crm-main-content-wrapper').crmSnippet('refresh');
20 });
21 return false;
22 });
23});