diff --git a/client/app/directives/audio/audio.player.directive.js b/client/app/directives/audio/audio.player.directive.js index dafb69f..62dd188 100644 --- a/client/app/directives/audio/audio.player.directive.js +++ b/client/app/directives/audio/audio.player.directive.js @@ -48,10 +48,15 @@ angular.module('dssWebApp') {size: 'md'}); }; $scope.shareFacebook = function () { - helpers.social.postToFacebook($scope.mix); + helpers.social.postToFacebook( + $scope.mix.title, + $scope.mix.mix_image, + $scope.mix.description, + $state.href('root.user.mix', {user: $scope.mix.user.slug, mix: $scope.mix.slug}) + ); }; $scope.shareTwitter = function () { - helpers.social.postToTwitter($scope.mix); + helpers.social.postToTwitter($state.href('root.user.mix', {user: $scope.mix.user.slug, mix: $scope.mix.slug})); }; $scope.toggleFollow = function () { if ($scope.currentUser) { diff --git a/client/app/helpers/social.js b/client/app/helpers/social.js index 5292c01..adb4d33 100644 --- a/client/app/helpers/social.js +++ b/client/app/helpers/social.js @@ -1,4 +1,8 @@ var helpers = helpers || {}; +function _getLink(url){ + return window.location.protocol + "//" + (window.location.host + '/' + url).replace(/([^:]\/)\/+/g, '$1'); +} + if (FB) { FB.init({ appId: '154504534677009', @@ -9,17 +13,17 @@ if (FB) { }); } helpers.social = { - postToFacebook: function (mix) { + postToFacebook: function (title, image, description, url) { FB.getLoginStatus(function (oResponse) { if (oResponse.status === "connected") { return FB.ui({ method: "feed", name: "Check out this mix on Deep South Sounds", display: "iframe", - link: "http://" + window.location.host + "/mixes/" + mix.slug, - picture: mix.mix_image, - caption: mix.title, - description: mix.description + link: _getLink(url), + picture: _getLink(image), + caption: title, + description: description }, function (response) { if (response && response.post_id) { return utils.showAlert("Success", "Post shared to facebook"); diff --git a/client/app/views/mixes/upload/upload.controller.js b/client/app/views/mixes/upload/upload.controller.js index 6ff96d1..3dfe1e9 100755 --- a/client/app/views/mixes/upload/upload.controller.js +++ b/client/app/views/mixes/upload/upload.controller.js @@ -110,10 +110,11 @@ angular.module('dssWebApp') var _processResult = function (result) { $scope.mix = result; $timeout(function () { + var url = $state.href('root.user.mix', {user: $scope.mix.user.slug, mix: $scope.mix.slug}); $scope.waveformFooter = "Waveform processing is taking longer than expected.
" + - "Your mix should be available Here"; + "Your mix should be available Here"; $scope.$apply(); - }, 120000); + }, 1200); var imageFile = document.getElementById('mix-image-fileinput').files[0]; if (imageFile) { diff --git a/client/index.html b/client/index.html index 11f3935..eee4528 100644 --- a/client/index.html +++ b/client/index.html @@ -123,8 +123,8 @@ - - + +