add code comments
[civicrm-core.git] / js / crm.optionEdit.js
CommitLineData
53f2643c 1// https://civicrm.org/licensing
53f2643c 2jQuery(function($) {
53f2643c 3 $('body')
3cb1ef9e 4 // Enable administrators to edit option lists in a dialog
53f2643c 5 .on('click', 'a.crm-option-edit-link', CRM.popup)
4b472ff2
CW
6 .on('crmPopupFormSuccess', 'a.crm-option-edit-link', function() {
7 $(this).trigger('crmOptionsEdited');
8 var $elects = $('select[data-option-edit-path="' + $(this).data('option-edit-path') + '"]');
9 if ($elects.data('api-entity') && $elects.data('api-field')) {
10 CRM.api3($elects.data('api-entity'), 'getoptions', {sequential: 1, field: $elects.data('api-field')})
11 .done(function (data) {
12 CRM.utils.setOptions($elects, data.values);
13 });
53f2643c 14 }
4b472ff2 15 });
53f2643c 16});