1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-30 11:24:21 +01:00
fab-manager/app/assets/javascripts/directives/socialLink.js

34 lines
977 B
JavaScript
Raw Normal View History

/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
Application.Directives.directive('socialLink', [ () =>
({
restrict: 'E',
scope: {
network: '@?',
2016-05-17 16:41:32 +02:00
user: '='
},
templateUrl: '<%= asset_path "shared/_social_link.html" %>',
link(scope, element, attributes) {
if (scope.network === 'dailymotion') {
scope.image = "<%= asset_path('social/dailymotion.png') %>";
return scope.altText = 'd';
} else if (scope.network === 'echosciences') {
scope.image = "<%= asset_path('social/echosciences.png') %>";
return scope.altText = 'E)';
} else {
if (scope.network === 'website') {
return scope.faClass = 'fa-globe';
} else {
return scope.faClass = `fa-${scope.network.replace('_', '-')}`;
}
}
}
})
]);
2016-05-17 16:41:32 +02:00