CRM-10693 HR-310 - Use ajax framework for edit case activities, relationships, etc
[civicrm-core.git] / templates / CRM / Case / Form / CaseView.js
1 // https://civicrm.org/licensing
2 cj(function($) {
3
4 function refresh() {
5 $('#crm-main-content-wrapper').crmSnippet('refresh');
6 }
7
8 function open(url) {
9 if (CRM.config.ajaxPopupsEnabled) {
10 CRM.loadForm(url).on('crmFormSuccess', refresh);
11 }
12 else {
13 window.location = url;
14 }
15 }
16
17 $('#crm-container')
18 .on('change', 'select[name=add_activity_type_id]', function() {
19 open($(this).val());
20 $(this).select2('val', '');
21 });
22 });