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

Commit

Permalink
fix and unify urls
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Oct 14, 2015
1 parent 18ef0d0 commit a8bb8e3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/jade/partials/tournaments/in-progress.jade
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ script(type="text/ng-template", id="/tournaments/in-progress")
.hide-underline(ng-show="ref.public && hasAccess")
a.copy-url(data-clipboard-text="{{url}}")
ng-md-icon.pointer.margin-left-10(size="20", icon="link")
a(target="_blank", ng-href="https://twitter.com/home?status={{url}}")
ng-md-icon.pointer.margin-left-10(size="20", icon="twitter")
a(target="_blank", ng-href="https://www.facebook.com/sharer/sharer.php?u={{url}}")
a(ng-click="share('facebook')")
ng-md-icon.pointer.margin-left-10(size="20", icon="facebook")
a(target="_blank", ng-href="https://plus.google.com/share?url={{url}}")
a(ng-click="share('twitter')")
ng-md-icon.pointer.margin-left-10(size="20", icon="twitter")
a(ng-click="share('google')")
ng-md-icon.pointer.margin-left-10.margin-right-10(size="20", icon="google-plus")

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

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

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

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

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

Expand Down
10 changes: 10 additions & 0 deletions src/js/controllers/tournaments/inProgressCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ site.controller('inProgressController', ($scope, $timeout, EnsureLoggedIn, Sideb

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

$scope.share = (service) => {
const services = {
facebook: 'https://www.facebook.com/sharer/sharer.php?u=',
twitter: 'https://twitter.com/home?status=',
google: 'https://plus.google.com/share?url='
};

window.open(services[service]+$scope.url, '_blank');
};

const determineTemplate = (options) => {
const hash = { singles: 'duel', doubles: 'duel', groupstage: 'groupstage', ffa: 'ffa', masters: 'masters' };
return options.last ? 'duel' : hash[options.type]; // backwards compatibility. damn alpha testers
Expand Down

0 comments on commit a8bb8e3

Please sign in to comment.