From 5bf8e4994f39271db0ba90f424143ff8d0ca0a8c Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 5 Nov 2014 18:48:59 -0500 Subject: [PATCH] info: Fix JavaScript to support older versions of CiviCRM and jQuery. * assets/js/member-info.js: Fall back to using 'jQuery' instead of 'CRM.$'. Parse profile JSON if it hasn't already been parsed. * templates/CRM/Memberdashboard/Page/Info.tpl --- assets/js/member-info.js | 11 +++++++---- templates/CRM/Memberdashboard/Page/Info.tpl | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/assets/js/member-info.js b/assets/js/member-info.js index 7158f05..b4ff8d0 100644 --- a/assets/js/member-info.js +++ b/assets/js/member-info.js @@ -19,9 +19,9 @@ * . */ -CRM.$(function($) { +(function($) { function loadProfile(gid, success) { - $.get('/drupal/civicrm/profile/edit', { + $.get('/civicrm/profile/edit', { gid: gid, json: 1 }, success); @@ -42,6 +42,9 @@ CRM.$(function($) { .value(); } + // Support older versions of jQuery that don't parse the JSON by + // default. + profile = _.isString(profile) ? JSON.parse(profile): profile; var form = $(''); form.append(profile.requirednote) @@ -49,10 +52,10 @@ CRM.$(function($) { .append.apply(form, renderFields()); $('#info-loading').remove(); - $('#crm-main-content-wrapper').append(form); + $('#info-form').append(form); } $(document).ready(function() { loadProfile(memberDashboard.profileId, renderProfile); }); -}); +})(jQuery); diff --git a/templates/CRM/Memberdashboard/Page/Info.tpl b/templates/CRM/Memberdashboard/Page/Info.tpl index cacca26..9382bff 100644 --- a/templates/CRM/Memberdashboard/Page/Info.tpl +++ b/templates/CRM/Memberdashboard/Page/Info.tpl @@ -29,3 +29,5 @@
+ +
-- 2.25.1