Skip to content
This repository was archived by the owner on Apr 24, 2020. It is now read-only.

Commit a8bb8e3

Browse files
committed
fix and unify urls
1 parent 18ef0d0 commit a8bb8e3

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/jade/partials/tournaments/in-progress.jade

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ script(type="text/ng-template", id="/tournaments/in-progress")
1717
.hide-underline(ng-show="ref.public && hasAccess")
1818
a.copy-url(data-clipboard-text="{{url}}")
1919
ng-md-icon.pointer.margin-left-10(size="20", icon="link")
20-
a(target="_blank", ng-href="https://twitter.com/home?status={{url}}")
21-
ng-md-icon.pointer.margin-left-10(size="20", icon="twitter")
22-
a(target="_blank", ng-href="https://www.facebook.com/sharer/sharer.php?u={{url}}")
20+
a(ng-click="share('facebook')")
2321
ng-md-icon.pointer.margin-left-10(size="20", icon="facebook")
24-
a(target="_blank", ng-href="https://plus.google.com/share?url={{url}}")
22+
a(ng-click="share('twitter')")
23+
ng-md-icon.pointer.margin-left-10(size="20", icon="twitter")
24+
a(ng-click="share('google')")
2525
ng-md-icon.pointer.margin-left-10.margin-right-10(size="20", icon="google-plus")
2626

2727
.header-bar(layout="row", hide-gt-sm)
@@ -36,20 +36,20 @@ script(type="text/ng-template", id="/tournaments/in-progress")
3636
md-fab-trigger.align-with-text
3737
md-button.md-fab.md-primary.hidden(aria-label="hidden")
3838

39-
md-fab-actions(ng-if="isOpen")
39+
md-fab-actions(ng-if="isOpen && ref.public")
4040
md-button.md-fab.md-mini.md-raised.md-accent.md-hue-1.copy-url(data-clipboard-text="{{url}}", aria-label="share by link")
4141
ng-md-icon(size="24", icon="link", style="fill: white")
4242
md-tooltip(md-direction="top") Copy link to clipboard
4343

44-
md-button.md-fab.md-mini.md-raised.md-accent.md-hue-1(aria-label="share on facebook")
44+
md-button.md-fab.md-mini.md-raised.md-accent.md-hue-1(aria-label="share on facebook", ng-click="share('facebook')")
4545
ng-md-icon(size="24", icon="facebook", style="fill: white")
4646
md-tooltip(md-direction="top") Share on facebook
4747

48-
md-button.md-fab.md-mini.md-raised.md-accent.md-hue-1(aria-label="share on twitter")
48+
md-button.md-fab.md-mini.md-raised.md-accent.md-hue-1(aria-label="share on twitter", ng-click="share('twitter')")
4949
ng-md-icon(size="24", icon="twitter", style="fill: white")
5050
md-tooltip(md-direction="top") Share on twitter
5151

52-
md-button.md-fab.md-mini.md-raised.md-accent.md-hue-1(aria-label="share on google plus")
52+
md-button.md-fab.md-mini.md-raised.md-accent.md-hue-1(aria-label="share on google plus", ng-click="share('google')")
5353
ng-md-icon(size="24", icon="google-plus", style="fill: white")
5454
md-tooltip(md-direction="top") Share on google plus
5555

src/js/controllers/tournaments/inProgressCtrl.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ site.controller('inProgressController', ($scope, $timeout, EnsureLoggedIn, Sideb
3232

3333
$scope.doOrOpen = (event) => $scope.isOpen && $scope.trn.isDone() ? $scope.showResults(event) : $scope.isOpen = true;
3434

35+
$scope.share = (service) => {
36+
const services = {
37+
facebook: 'https://www.facebook.com/sharer/sharer.php?u=',
38+
twitter: 'https://twitter.com/home?status=',
39+
google: 'https://plus.google.com/share?url='
40+
};
41+
42+
window.open(services[service]+$scope.url, '_blank');
43+
};
44+
3545
const determineTemplate = (options) => {
3646
const hash = { singles: 'duel', doubles: 'duel', groupstage: 'groupstage', ffa: 'ffa', masters: 'masters' };
3747
return options.last ? 'duel' : hash[options.type]; // backwards compatibility. damn alpha testers

0 commit comments

Comments
 (0)