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

Feature/sup 2150 ext acc card add profile url link #601

Merged
merged 3 commits into from
Dec 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.external-link-list
div.external-link-tile(ng-repeat="account in linkedAccountsData", ng-class="{'external-link-tile--editable' : editable}")
.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)")
.top
.ext-link-tile_edit-header(ng-show="editable && account.provider === 'weblink'")
.ext-link-tile_edit-header_delete(ng-click="confirmDeletion(account)", ng-class="{'ext-link-tile_edit-header_delete--disabled': account.deletingAccount || account.status === 'PENDING'}")
Expand Down Expand Up @@ -106,4 +106,4 @@
p.link-title(data-ellipsis, ng-bind="account.title", ng-hide="account.status === 'PENDING'")
p.link-title(ng-show="account.status === 'PENDING'") Loading data. This will take a few minutes.

a.link-url(ng-href="{{account.URL | urlProtocol}}", ng-bind="account.URL")
a.link-url(ng-href="{{account.URL | urlProtocol}}", ng-bind="account.URL", target="_blank",prevent-event-propagation)
19 changes: 17 additions & 2 deletions app/directives/external-account/external-links-data.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,27 @@
editable: '=',
userHandle: '@'
},
controller: ['$log', '$scope', 'ExternalWebLinksService', 'toaster', 'ngDialog',
function($log, $scope, ExternalWebLinksService, toaster, ngDialog) {
controller: ['$log', '$scope', '$window', '$filter', 'ExternalWebLinksService', 'toaster', 'ngDialog',
function($log, $scope, $window, $filter, ExternalWebLinksService, toaster, ngDialog) {

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

$scope.openLink = function(account) {
var url = null;
if (account) {
if (account.data && account.data.profileURL && account.data.status !== 'PENDING') {
url = account.data.profileURL;
}
if (account.URL && account.status !== 'PENDING') {
url = account.URL;
}
}
if (url) {
$window.open($filter('urlProtocol')(url), '_blank');
}
}

$scope.confirmDeletion = function(account) {
$scope.deletionDialog = ngDialog.open({
className: 'ngdialog-theme-default tc-dialog',
Expand Down
15 changes: 15 additions & 0 deletions app/directives/preventEventPropagation.directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(function() {
'use strict';

angular.module('tcUIComponents').directive('preventEventPropagation', preventEventPropagation);

preventEventPropagation.$inject = ['$timeout', '$parse'];

function preventEventPropagation($timeout, $parse) {
return function(scope, element, attr) {
element.bind('click', function(evt) {
evt.stopPropagation();
});
};
}
})();
1 change: 1 addition & 0 deletions app/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ html
script(src="directives/on-file-change.directive.js")
script(src="directives/onoffswitch/onoffswitch.directive.js")
script(src="directives/page-state-header/page-state-header.directive.js")
script(src="directives/preventEventPropagation.directive.js")
script(src="directives/profile-widget/profile-widget.directive.js")
script(src="directives/responsive-carousel/responsive-carousel.directive.js")
script(src="directives/skill-tile/skill-tile.directive.js")
Expand Down
6 changes: 6 additions & 0 deletions assets/css/directives/external-link-data.scss
Original file line number Diff line number Diff line change
Expand Up @@ -313,5 +313,11 @@ external-accounts {
.external-link-tile--editable {
// height: 285px;
}

.external-link-tile--pending {
&:hover {
cursor: default;
}
}
}
}