CRM-15341 - move cms-specific code to appropriate file
[civicrm-core.git] / js / crm.multilingual.js
CommitLineData
d606fff7
CW
1// http://civicrm.org/licensing
2// JS needed for multilingual installations
3CRM.$(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});