From d2aaf7441c54f405a9c19db095b35324c3ccda9f Mon Sep 17 00:00:00 2001 From: shubhu Date: Wed, 15 Feb 2017 23:36:32 +0530 Subject: [PATCH 1/3] fixed #993 corrected badge positioning --- assets/css/directives/badge-tooltip.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/css/directives/badge-tooltip.scss b/assets/css/directives/badge-tooltip.scss index fbcf074cf..dcbd83b98 100644 --- a/assets/css/directives/badge-tooltip.scss +++ b/assets/css/directives/badge-tooltip.scss @@ -438,7 +438,7 @@ background-position: 0px -672px; } .Predix-Community { - background-position: -50px -672px; + background-position: -47px -672px; } .iOS-Community { background-position: -95px -672px; From c08637e7f8cdf85ee11a11bd32e4efcdb556cd49 Mon Sep 17 00:00:00 2001 From: nomo-kazza Date: Mon, 13 Feb 2017 10:12:55 -0500 Subject: [PATCH 2/3] update-listings Signed-off-by: Tom Ladendorf --- app/listings/listings.controller.js | 77 +++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 5 deletions(-) diff --git a/app/listings/listings.controller.js b/app/listings/listings.controller.js index 9d0774758..8c4ec4c05 100755 --- a/app/listings/listings.controller.js +++ b/app/listings/listings.controller.js @@ -1,5 +1,5 @@ import angular from 'angular' -import { loadUser } from '../services/userv3.service.js' +import { loadUser, getCurrentUser } from '../services/userv3.service.js' (function () { 'use strict' @@ -8,29 +8,96 @@ import { loadUser } from '../services/userv3.service.js' ListingsCtrl.$inject = ['CONSTANTS', 'logger', '$q','TcAuthService', 'UserService', 'UserStatsService', 'ProfileService', 'ChallengeService', - 'ExternalAccountService', 'ngDialog', '$anchorScroll', '$scope' + 'ExternalAccountService', 'ngDialog', '$anchorScroll', '$scope', ] function ListingsCtrl(CONSTANTS, logger, $q, TcAuthService, UserService, UserStatsService, ProfileService, ChallengeService, ExternalAccountService, ngDialog, $anchorScroll, $scope) { + var vm = this + var handle + vm.neverParticipated = false + vm.loading = true + vm.userHasChallenges = true + vm.challengeView = 'tile' activate() function activate() { $scope.myChallenges = [] - $scope.userProps = { isAuth: false } + $scope.userProps = { isAuth: false, myChallenges: [] } logger.debug('Calling ListingsController activate()') - + vm.myChallenges = [] loadUser().then(function(token) { + handle = UserService.getUserIdentity().handle + // mock current user have this challenges + vm.myChallenges.push({'id':30056409}) + vm.myChallenges.push({'id':30056067}) + vm.myChallenges.push({'id':16870}) + // update auth flag if(TcAuthService.isAuthenticated()) { - $scope.userProps = { isAuth: true } + getChallenges(handle) + $scope.userProps = { isAuth: true, myChallenges: vm.myChallenges } } }, function(error) { // do nothing, just show non logged in state of navigation bar }) } + function getChallenges(handle) { + var marathonMatchParams = { + limit: 8, + filter: 'status=active' + } + + var challengeParams = { + limit: 8, + orderBy: 'submissionEndDate', + filter: 'status=active' + } + + $q.all([ + ChallengeService.getUserMarathonMatches(handle, marathonMatchParams), + ChallengeService.getUserChallenges(handle, challengeParams) + ]).then(function(challenges){ + var marathonMatches = challenges[0] + var devDesignChallenges = challenges[1] + + if (!marathonMatches.length && !devDesignChallenges.length) { + vm.userHasChallenges = false + _checkForParticipation().then(function() { + vm.loading = false + }) + } else { + ChallengeService.processActiveDevDesignChallenges(devDesignChallenges) + ChallengeService.processActiveMarathonMatches(marathonMatches) + var userChallenges = marathonMatches.concat(devDesignChallenges) + + userChallenges = _.sortBy(userChallenges, function(n) { + return n.registrationEndDate + }) + vm.myChallenges = userChallenges.reverse().slice(0, 8) + + // update myChallenges + $scope.userProps = { isAuth: true, myChallenges: vm.myChallenges } + + vm.userHasChallenges = true + vm.loading = false + } + }) + .catch(function(err) { + logger.error('Error getting challenges and marathon matches', err) + + vm.userHasChallenges = true + vm.loading = false + }) + } + + function _checkForParticipation() { + return ChallengeService.checkChallengeParticipation(handle, function(participated) { + vm.neverParticipated = !participated + }) + } } })() From ffb01478ef278baa05a1f98609e06b4a2eee76b5 Mon Sep 17 00:00:00 2001 From: Tom Ladendorf Date: Thu, 16 Feb 2017 01:10:05 +0100 Subject: [PATCH 3/3] tweaks --- app/listings/listings.controller.js | 5 +++-- package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/listings/listings.controller.js b/app/listings/listings.controller.js index 8c4ec4c05..6f42e1103 100755 --- a/app/listings/listings.controller.js +++ b/app/listings/listings.controller.js @@ -1,5 +1,6 @@ +import _ from 'lodash' import angular from 'angular' -import { loadUser, getCurrentUser } from '../services/userv3.service.js' +import { loadUser } from '../services/userv3.service.js' (function () { 'use strict' @@ -8,7 +9,7 @@ import { loadUser, getCurrentUser } from '../services/userv3.service.js' ListingsCtrl.$inject = ['CONSTANTS', 'logger', '$q','TcAuthService', 'UserService', 'UserStatsService', 'ProfileService', 'ChallengeService', - 'ExternalAccountService', 'ngDialog', '$anchorScroll', '$scope', + 'ExternalAccountService', 'ngDialog', '$anchorScroll', '$scope' ] function ListingsCtrl(CONSTANTS, logger, $q, TcAuthService, UserService, UserStatsService, ProfileService, diff --git a/package.json b/package.json index 3f2ab1635..63161ef11 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "appirio-styles": "0.x.x", "appirio-tech-ng-iso-constants": "^1.0.6", "appirio-tech-ng-ui-components": "^2.1.2", - "appirio-tech-react-components": "nomo-kazza/react-components.git#challenge-listings", + "appirio-tech-react-components": "appirio-tech/react-components.git#cl-misc-fixes-2", "auth0-angular": "^4.1.0", "auth0-js": "^6.8.0", "d3": "^3.5.14",