Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit c6634b3

Browse files
author
vikasrohit
committed
Merge pull request #601 from appirio-tech/feature/sup-2150-ext-acc-card-add-profile-url-link
Feature/sup 2150 ext acc card add profile url link
2 parents 596153a + 73ea575 commit c6634b3

File tree

5 files changed

+41
-4
lines changed

5 files changed

+41
-4
lines changed

app/directives/external-account/external-link-data.directive.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.external-link-list
2-
div.external-link-tile(ng-repeat="account in linkedAccountsData", ng-class="{'external-link-tile--editable' : editable}")
2+
.external-link-tile(ng-repeat="account in linkedAccountsData", ng-class="{'external-link-tile--editable' : editable, 'external-link-tile--pending' : account.status === 'PENDING' || account.data.status === 'PENDING'}", ng-click="openLink(account)")
33
.top
44
.ext-link-tile_edit-header(ng-show="editable && account.provider === 'weblink'")
55
.ext-link-tile_edit-header_delete(ng-click="confirmDeletion(account)", ng-class="{'ext-link-tile_edit-header_delete--disabled': account.deletingAccount || account.status === 'PENDING'}")
@@ -106,4 +106,4 @@
106106
p.link-title(data-ellipsis, ng-bind="account.title", ng-hide="account.status === 'PENDING'")
107107
p.link-title(ng-show="account.status === 'PENDING'") Loading data. This will take a few minutes.
108108

109-
a.link-url(ng-href="{{account.URL | urlProtocol}}", ng-bind="account.URL")
109+
a.link-url(ng-href="{{account.URL | urlProtocol}}", ng-bind="account.URL", target="_blank",prevent-event-propagation)

app/directives/external-account/external-links-data.directive.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,27 @@
1818
editable: '=',
1919
userHandle: '@'
2020
},
21-
controller: ['$log', '$scope', 'ExternalWebLinksService', 'toaster', 'ngDialog',
22-
function($log, $scope, ExternalWebLinksService, toaster, ngDialog) {
21+
controller: ['$log', '$scope', '$window', '$filter', 'ExternalWebLinksService', 'toaster', 'ngDialog',
22+
function($log, $scope, $window, $filter, ExternalWebLinksService, toaster, ngDialog) {
2323

2424
$log = $log.getInstance("ExternalLinksDataCtrl");
2525
$scope.deletionDialog = null;
2626

27+
$scope.openLink = function(account) {
28+
var url = null;
29+
if (account) {
30+
if (account.data && account.data.profileURL && account.data.status !== 'PENDING') {
31+
url = account.data.profileURL;
32+
}
33+
if (account.URL && account.status !== 'PENDING') {
34+
url = account.URL;
35+
}
36+
}
37+
if (url) {
38+
$window.open($filter('urlProtocol')(url), '_blank');
39+
}
40+
}
41+
2742
$scope.confirmDeletion = function(account) {
2843
// for non weblink provider, do nothing
2944
if (account.provider !== 'weblink') {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(function() {
2+
'use strict';
3+
4+
angular.module('tcUIComponents').directive('preventEventPropagation', preventEventPropagation);
5+
6+
preventEventPropagation.$inject = ['$timeout', '$parse'];
7+
8+
function preventEventPropagation($timeout, $parse) {
9+
return function(scope, element, attr) {
10+
element.bind('click', function(evt) {
11+
evt.stopPropagation();
12+
});
13+
};
14+
}
15+
})();

app/index.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ html
205205
script(src="directives/on-file-change.directive.js")
206206
script(src="directives/onoffswitch/onoffswitch.directive.js")
207207
script(src="directives/page-state-header/page-state-header.directive.js")
208+
script(src="directives/preventEventPropagation.directive.js")
208209
script(src="directives/profile-widget/profile-widget.directive.js")
209210
script(src="directives/responsive-carousel/responsive-carousel.directive.js")
210211
script(src="directives/skill-tile/skill-tile.directive.js")

assets/css/directives/external-link-data.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,5 +313,11 @@ external-accounts {
313313
.external-link-tile--editable {
314314
// height: 285px;
315315
}
316+
317+
.external-link-tile--pending {
318+
&:hover {
319+
cursor: default;
320+
}
321+
}
316322
}
317323
}

0 commit comments

Comments
 (0)