Commit | Line | Data |
---|---|---|
d606fff7 CW |
1 | // http://civicrm.org/licensing |
2 | // JS needed for multilingual installations | |
3 | CRM.$(function($) { | |
4 | // This is largely redundant with what the CRM.popup function would do, | |
5 | // with the difference that this loads unconditionally regardless of ajaxPopupsEnabled setting | |
6 | $('body').on('click', 'a.crm-multilingual-edit-button', function(e) { | |
7 | var $el = $(this), | |
8 | $form = $el.closest('form'), | |
9 | $field = $('#' + $el.data('field'), $form); | |
10 | ||
11 | CRM.loadForm($el.attr('href'), { | |
12 | dialog: {width: '50%', height: '50%'} | |
13 | }) | |
14 | .on('crmFormLoad', function() { | |
15 | $('.default-lang', this).val($field.val()); | |
16 | }) | |
17 | .on('crmFormSubmit', function() { | |
18 | $field.val($('.default-lang', this).val()); | |
19 | $el.trigger('crmPopupFormSuccess'); | |
20 | }); | |
21 | e.preventDefault(); | |
22 | }); | |
23 | }); |