Skip to content

Commit

Permalink
Merge pull request #1072 from appirio-tech/dev
Browse files Browse the repository at this point in the history
Listings fixes
  • Loading branch information
ajefts authored Mar 6, 2017
2 parents 684c42f + 7b7bd0a commit c4c1a74
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.querySelectorAll('div[id*="_report_button"]')
if (usersnapWidget && usersnapWidget[0]) usersnapWidget[0].remove()
}
})
}])

function routes($stateProvider) {
Expand Down

0 comments on commit c4c1a74

Please sign in to comment.