From: Tim Otten Date: Wed, 3 Aug 2016 02:00:21 +0000 (-0700) Subject: CRM-19169 - ang/crmCxn - If `welcome` link defined, open it X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=757ef0aa533e1dec1a47593aca9472d19c48e56b;p=civicrm-core.git CRM-19169 - ang/crmCxn - If `welcome` link defined, open it --- diff --git a/ang/crmCxn.js b/ang/crmCxn.js index 2d2193959a..c2fa6ec287 100644 --- a/ang/crmCxn.js +++ b/ang/crmCxn.js @@ -14,7 +14,7 @@ apiCalls: function(crmApi){ var reqs = {}; reqs.cxns = ['Cxn', 'get', {sequential: 1}]; - reqs.appMetas = ['CxnApp', 'get', {sequential: 1, return: ['id', 'title', 'desc', 'appId', 'appUrl', 'perm']}]; + reqs.appMetas = ['CxnApp', 'get', {sequential: 1, return: ['id', 'title', 'desc', 'appId', 'appUrl', 'links', 'perm']}]; reqs.cfg = ['Cxn', 'getcfg', {}]; reqs.sysCheck = ['System', 'check', {}]; // FIXME: filter on checkCxnOverrides return crmApi(reqs); diff --git a/ang/crmCxn/ManageCtrl.js b/ang/crmCxn/ManageCtrl.js index b23901b0cf..cd843c3304 100644 --- a/ang/crmCxn/ManageCtrl.js +++ b/ang/crmCxn/ManageCtrl.js @@ -75,12 +75,20 @@ }; $scope.register = function(appMeta) { - var reg = crmApi('Cxn', 'register', {app_guid: appMeta.appId}).then($scope.refreshCxns); + var reg = crmApi('Cxn', 'register', {app_guid: appMeta.appId}).then($scope.refreshCxns).then(function() { + if (appMeta.links.welcome) { + return $scope.openLink(appMeta, 'welcome', {title: ts('%1: Welcome (External)', {1: appMeta.title})}); + } + }); return block(crmStatus({start: ts('Connecting...'), success: ts('Connected')}, reg)); }; $scope.reregister = function(appMeta) { - var reg = crmApi('Cxn', 'register', {app_guid: appMeta.appId}).then($scope.refreshCxns); + var reg = crmApi('Cxn', 'register', {app_guid: appMeta.appId}).then($scope.refreshCxns).then(function() { + if (appMeta.links.welcome) { + return $scope.openLink(appMeta, 'welcome', {title: ts('%1: Welcome (External)', {1: appMeta.title})}); + } + }); return block(crmStatus({start: ts('Reconnecting...'), success: ts('Reconnected')}, reg)); };