Skip to content

Commit

Permalink
Fix feedback widget to be visible only on the /listings page
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasKranitsas committed Mar 3, 2017
1 parent a9d156d commit 2a066ba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/listings/listings.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { loadUser } from '../services/userv3.service.js'
'TcAuthService', 'UserService', 'UserStatsService', 'ProfileService', 'ChallengeService', 'ExternalAccountService',
'ngDialog', '$anchorScroll'
]

function ListingsCtrl($location, $scope, CONSTANTS, logger, $q, TcAuthService,
UserService, UserStatsService,ProfileService, ChallengeService, ExternalAccountService, ngDialog, $anchorScroll) {
var vm = this
Expand All @@ -32,8 +32,8 @@ import { loadUser } from '../services/userv3.service.js'
s.async = true
s.src = '//api.usersnap.com/load/'+
'3e7c8f0c-6cf6-41b6-9f2c-e8e4e60dfc59.js'
var x = document.getElementsByTagName('script')[0]
x.parentNode.insertBefore(s, x)
var x = document.getElementById('react-component')
x.appendChild(s, x)
})()

$scope.myChallenges = []
Expand Down
2 changes: 1 addition & 1 deletion app/listings/listings.jade
Original file line number Diff line number Diff line change
@@ -1 +1 @@
react-component.listings(name="ChallengeFiltersExample" props="reactProps" watch-depth="reference")
react-component.listings(name="ChallengeFiltersExample" props="reactProps" watch-depth="reference" id="react-component")
7 changes: 7 additions & 0 deletions app/listings/listings.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ import angular from 'angular'
// $state.go('404')
// }
})
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams, error) {
if (toState.name !== 'listings') {
// remove usersnap widget if not in listings page
var usersnapWidget = document.getElementById("us_report_button")
if (usersnapWidget) usersnapWidget.remove()
}
})
}])

function routes($stateProvider) {
Expand Down

0 comments on commit 2a066ba

Please sign in to comment.