From 5b61ee29fc204ed34262180b43ae882aff0ef30f Mon Sep 17 00:00:00 2001 From: "Dr. Sergey Pogodin" Date: Fri, 10 Feb 2017 03:45:24 +0100 Subject: [PATCH 01/15] Changes to support updates to the /listings page --- app/listings/listings.controller.js | 11 +++++++++-- app/listings/listings.jade | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/listings/listings.controller.js b/app/listings/listings.controller.js index 5ed5eae6a..9428c621c 100644 --- a/app/listings/listings.controller.js +++ b/app/listings/listings.controller.js @@ -5,15 +5,22 @@ import angular from 'angular' angular.module('tc.listings').controller('ListingsCtrl', ListingsCtrl) - ListingsCtrl.$inject = ['CONSTANTS', 'logger', '$q', + ListingsCtrl.$inject = ['$location', '$scope', 'CONSTANTS', 'logger', '$q', 'TcAuthService', 'UserService', 'UserStatsService', 'ProfileService', 'ChallengeService', 'ExternalAccountService', 'ngDialog', '$anchorScroll' ] - function ListingsCtrl(CONSTANTS, logger, $q, TcAuthService, UserService, UserStatsService, ProfileService, ChallengeService, ExternalAccountService, ngDialog, $anchorScroll) { + function ListingsCtrl($location, $scope, CONSTANTS, logger, $q, TcAuthService, UserService, UserStatsService, ProfileService, ChallengeService, ExternalAccountService, ngDialog, $anchorScroll) { activate() + $scope.listingProps = { + filterFromUrl: $location.hash(), + onSaveFilterToUrl: function(filter) { + $location.hash(filter) + } + } + function activate() { logger.debug('Calling ListingsController activate()') diff --git a/app/listings/listings.jade b/app/listings/listings.jade index 1774c70e3..10bfdf081 100644 --- a/app/listings/listings.jade +++ b/app/listings/listings.jade @@ -1 +1 @@ -react-component(name="ChallengeFiltersExample") +react-component(name="ChallengeFiltersExample" props="listingProps") From 4363a2e889db7187441a45fbb7cc8457e811a89f Mon Sep 17 00:00:00 2001 From: shubhu Date: Fri, 17 Feb 2017 17:33:59 +0530 Subject: [PATCH 02/15] fixed #994 challenge cards in mobile --- assets/css/directives/challenge-tile.scss | 5 +++++ assets/css/my-dashboard/my-challenges.scss | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/assets/css/directives/challenge-tile.scss b/assets/css/directives/challenge-tile.scss index 28e6de3e3..357643b6f 100644 --- a/assets/css/directives/challenge-tile.scss +++ b/assets/css/directives/challenge-tile.scss @@ -280,6 +280,11 @@ challenge-tile .challenge.tile-view { } + @media only screen and (max-width: 768px) { + .active-challenge { + height: auto; + } + } .completed-challenge { height: 390px; display: flex; diff --git a/assets/css/my-dashboard/my-challenges.scss b/assets/css/my-dashboard/my-challenges.scss index 92dc8a5d1..94ae21b52 100644 --- a/assets/css/my-dashboard/my-challenges.scss +++ b/assets/css/my-dashboard/my-challenges.scss @@ -131,7 +131,10 @@ } .challenges { - @include horizontal-scroll; + display: flex; + flex-direction: column; + justify-content: center; + margin-left: 0; &.tile-view, &.list-view { @media only screen and (min-width: 768px) { @@ -168,7 +171,6 @@ margin-bottom: 15px; @media only screen and (max-width: 767px) { display: inline-block; - margin-left: 15px; &:first-child { margin-left: 0; From bd526f2f8fc25d5332d36c3eb8508cf216bb30b9 Mon Sep 17 00:00:00 2001 From: Tom Ladendorf Date: Sat, 18 Feb 2017 00:35:10 +0100 Subject: [PATCH 03/15] new widget code --- app/my-dashboard/my-dashboard.jade | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/my-dashboard/my-dashboard.jade b/app/my-dashboard/my-dashboard.jade index 81ab325ba..bbe2191fe 100644 --- a/app/my-dashboard/my-dashboard.jade +++ b/app/my-dashboard/my-dashboard.jade @@ -12,14 +12,6 @@ .description Learn about Cognitive technologies and get hands on experience as a member of the Topcoder Cognitive Community. a(href="https://cognitive.topcoder.com").cta.tc-btn-white.tc-btn-radius Learn More -// .tco.tco17 -// .tc-banner-placeholder.predix -// .subtitle Ready for the future? The Industrial Internet is here -// .description Get hands-on with the Predix platform and the Industrial Internet -// a(href="http://predix.topcoder.com/").cta.tc-btn-white.tc-btn-radius Learn More - - //- .ttl - //- tc-banner(theme="black", banner-name="ttl") .tco.tco17 .tc-banner-placeholder.black.bg-image .title 2017 Topcoder Open @@ -32,3 +24,14 @@ .programs(id="community", ui-view="programs") .community-updates(ui-view="community-updates") + +script. + (function() { + var s = document.createElement("script"); + s.type = "text/javascript"; + 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); + })(); From 9ef891f3c73d41e06c82b7100791ae39bff133bf Mon Sep 17 00:00:00 2001 From: Tom Ladendorf Date: Sat, 18 Feb 2017 00:37:54 +0100 Subject: [PATCH 04/15] added widget --- app/listings/listings.jade | 13 ++++++++++++- app/my-dashboard/my-dashboard.jade | 10 ---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/listings/listings.jade b/app/listings/listings.jade index ccbc73bd0..859ef2b9b 100755 --- a/app/listings/listings.jade +++ b/app/listings/listings.jade @@ -1,2 +1,13 @@ - \ No newline at end of file + + +script. + (function() { + var s = document.createElement("script"); + s.type = "text/javascript"; + 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); + })(); diff --git a/app/my-dashboard/my-dashboard.jade b/app/my-dashboard/my-dashboard.jade index bbe2191fe..18d25b980 100644 --- a/app/my-dashboard/my-dashboard.jade +++ b/app/my-dashboard/my-dashboard.jade @@ -25,13 +25,3 @@ .community-updates(ui-view="community-updates") -script. - (function() { - var s = document.createElement("script"); - s.type = "text/javascript"; - 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); - })(); From 852624efeba9dee3afd0ca913963d431858971a8 Mon Sep 17 00:00:00 2001 From: Sukma Nugraha Date: Sun, 19 Feb 2017 03:13:24 +0700 Subject: [PATCH 05/15] Fix for issue #1001: blog feed is now loading on my-dashboard --- app/services/blog.service.js | 3 ++- app/services/jwtInterceptor.service.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/services/blog.service.js b/app/services/blog.service.js index fe632e3d6..0e957855a 100644 --- a/app/services/blog.service.js +++ b/app/services/blog.service.js @@ -19,7 +19,8 @@ import X2JS from 'xml2js' // fetch blog rss feed $http.get(CONSTANTS.BLOG_LOCATION) - .then(function(data) { + .then(function(response) { + var data = response.data // parse the blog rss feed using x2js var parseString = X2JS.parseString parseString(data.trim(), function (err, res) { diff --git a/app/services/jwtInterceptor.service.js b/app/services/jwtInterceptor.service.js index 111840e23..693ec3bc9 100644 --- a/app/services/jwtInterceptor.service.js +++ b/app/services/jwtInterceptor.service.js @@ -38,7 +38,7 @@ import { isTokenExpired, getFreshToken } from 'tc-accounts' function getToken(config) { // skip token for .html - if (config.url.indexOf('.html') > -1) + if (config.url.indexOf('.html') > -1 || config.url === CONSTANTS.BLOG_LOCATION) return null var haveItAddItEndpoints = [ From b31c65cfd4ddc10c5f2e07957b7ee91e0d721bef Mon Sep 17 00:00:00 2001 From: Victor George Date: Sat, 18 Feb 2017 14:06:44 -0800 Subject: [PATCH 06/15] Fix the syntax to render the script portion of the template. --- app/listings/listings.jade | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/listings/listings.jade b/app/listings/listings.jade index 859ef2b9b..17befdd61 100755 --- a/app/listings/listings.jade +++ b/app/listings/listings.jade @@ -1,5 +1,4 @@ - - +react-component(name="ChallengeFiltersExample" props="userProps" watch-depth="reference") script. (function() { From f475776cbc104659467f7f77a64b6a3137e6e69f Mon Sep 17 00:00:00 2001 From: "Dr. Sergey Pogodin" Date: Sun, 19 Feb 2017 00:28:31 +0100 Subject: [PATCH 07/15] Small correction of styling --- assets/css/directives/challenge-tile.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/css/directives/challenge-tile.scss b/assets/css/directives/challenge-tile.scss index 357643b6f..8f8adace9 100644 --- a/assets/css/directives/challenge-tile.scss +++ b/assets/css/directives/challenge-tile.scss @@ -111,6 +111,7 @@ challenge-tile .challenge.tile-view { flex-direction: column; align-items: center; justify-content: center; + padding: 12px 0; flex: 2; } @@ -283,6 +284,7 @@ challenge-tile .challenge.tile-view { @media only screen and (max-width: 768px) { .active-challenge { height: auto; + margin: auto; } } .completed-challenge { From 1d65f4478cf3300fe90dd5047fa2b02ae687cefc Mon Sep 17 00:00:00 2001 From: "Dr. Sergey Pogodin" Date: Sun, 19 Feb 2017 20:08:20 +0100 Subject: [PATCH 08/15] Minor changes - A note on running the App against the prod backend locally has been added into README.md. - Env config (holds API URL to use) is now passed into the React Component responsible for new challenge listings, as `config` prop. --- README.md | 12 ++++++++++++ app/listings/listings.controller.js | 6 +++++- package.json | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b1d5e8923..cd076c5c2 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,18 @@ In order to test a logged in user, you must make an entry in your `/etc/hosts` f - To create the build: `npm run build` - To run code linting: `npm run lint` - To run the tests: `npm test` + +## Running against Production backend +To run this App against the production backend, you should configure your system in a way that a call to `local.topcoder.com` redirects to `localhost:3000` where the App is running. Then you just `npm run start-prod`, go to `local.topcoder.com` and use your credentials for the production web site (and, sure, be careful with what you are doing, it all will go through the production TopCoder API). + +To make the mentioned configuration on Ubuntu 16.04 you: +- Add `127.0.0.1 local.topcoder.com` to your `/etc/hosts` +- `$ sudo apt install libcap2-bin` +- `$ which node` to figure out your `path/to/node` +- `$ sudo setcap cap_net_bind_service=+ep /path/to/node` +- Now run the App. + +*Disclaimer: I have no idea, what setcap does here, and how safe it is, but it does the job. Feel free to add your comments / modify this section, if you know more about it. Also, if you know how to make such configuration on other OS, please add it here.* ## Test Users - general member user accounts: diff --git a/app/listings/listings.controller.js b/app/listings/listings.controller.js index feef90d51..a96f53f50 100755 --- a/app/listings/listings.controller.js +++ b/app/listings/listings.controller.js @@ -75,7 +75,11 @@ import { loadUser } from '../services/userv3.service.js' vm.myChallenges = userChallenges.reverse().slice(0, 8) // update myChallenges - $scope.userProps = { isAuth: true, myChallenges: vm.myChallenges } + $scope.userProps = { + config: CONSTANTS, + isAuth: true, + myChallenges: vm.myChallenges + } vm.userHasChallenges = true vm.loading = false diff --git a/package.json b/package.json index d043c86d6..fae7efa46 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "scripts": { "build": "webpack --bail --progress --build --tc", "start": "webpack-dev-server --history-api-fallback --host 0.0.0.0 --dev --tc --inline --progress --port 3000", + "start-prod": "webpack-dev-server --history-api-fallback --host local.topcoder.com --prod --tc --inline --progress --port 80", "lint": "eslint .", "test": "karma start --tc --test" }, From b58fc4f1b2871283e7f9494ecd89f95042f5d178 Mon Sep 17 00:00:00 2001 From: "Dr. Sergey Pogodin" Date: Mon, 20 Feb 2017 13:32:22 +0100 Subject: [PATCH 09/15] New listings fix: Filter loading from URL --- app/listings/listings.controller.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/listings/listings.controller.js b/app/listings/listings.controller.js index 385cdb882..ee1c87791 100755 --- a/app/listings/listings.controller.js +++ b/app/listings/listings.controller.js @@ -25,7 +25,15 @@ import { loadUser } from '../services/userv3.service.js' function activate() { $scope.myChallenges = [] - $scope.reactProps = { isAuth: false, myChallenges: [] } + $scope.reactProps = { + config: CONSTANTS, + filterFromUrl: $location.hash(), + isAuth: false, + myChallenges: [], + onSaveFilterToUrl: function(filter) { + $location.hash(filter) + } + } logger.debug('Calling ListingsController activate()') vm.myChallenges = [] loadUser().then(function(token) { From 161c22a4e62ddc384fe72bde8dc87d1a71812ca1 Mon Sep 17 00:00:00 2001 From: "Dr. Sergey Pogodin" Date: Mon, 20 Feb 2017 17:56:12 +0100 Subject: [PATCH 10/15] Removes padding at the new challenge listings page --- app/listings/listings.jade | 2 +- app/listings/listings.routes.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/listings/listings.jade b/app/listings/listings.jade index 1f37fe753..ccf64b6d0 100755 --- a/app/listings/listings.jade +++ b/app/listings/listings.jade @@ -1,4 +1,4 @@ -react-component(name="ChallengeFiltersExample" props="reactProps" watch-depth="reference") +react-component.listings(name="ChallengeFiltersExample" props="reactProps" watch-depth="reference") script. (function() { diff --git a/app/listings/listings.routes.js b/app/listings/listings.routes.js index bffcc1672..1a7848577 100755 --- a/app/listings/listings.routes.js +++ b/app/listings/listings.routes.js @@ -21,7 +21,6 @@ import angular from 'angular' 'listings': { parent: 'root', url: '/listings/', - template: require('./listings')(), controller: 'ListingsCtrl as vm', resolve: { userHandle: ['$stateParams', function($stateParams) { @@ -31,6 +30,11 @@ import angular from 'angular' data: { authRequired: false, title: 'Listings' + }, + views: { + 'container@': { + template: require('./listings')() + } } } } From 801c118b1fac8e0068e237aa7812ab7c9f99d04c Mon Sep 17 00:00:00 2001 From: "Dr. Sergey Pogodin" Date: Mon, 20 Feb 2017 18:11:34 +0100 Subject: [PATCH 11/15] Small fix of the header It is necessary to have no spacing between the header and the main content of the page. --- assets/css/layout/header.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/css/layout/header.scss b/assets/css/layout/header.scss index f5bdcf22b..a59a4029f 100644 --- a/assets/css/layout/header.scss +++ b/assets/css/layout/header.scss @@ -183,6 +183,7 @@ } .user-menu { + max-height: 54px; .user-avatar { height: 31px; width: 31px; From 75f950fef230d1ccb28630cfbaa59d46b403f671 Mon Sep 17 00:00:00 2001 From: "Dr. Sergey Pogodin" Date: Mon, 20 Feb 2017 19:33:49 +0100 Subject: [PATCH 12/15] A tiny fix of the new listings routing --- app/listings/listings.routes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/listings/listings.routes.js b/app/listings/listings.routes.js index 1a7848577..c6a89efd3 100755 --- a/app/listings/listings.routes.js +++ b/app/listings/listings.routes.js @@ -21,7 +21,6 @@ import angular from 'angular' 'listings': { parent: 'root', url: '/listings/', - controller: 'ListingsCtrl as vm', resolve: { userHandle: ['$stateParams', function($stateParams) { return $stateParams.userHandle @@ -33,6 +32,7 @@ import angular from 'angular' }, views: { 'container@': { + controller: 'ListingsCtrl as vm', template: require('./listings')() } } From 3917bbdb1f9e8997e7ce54d6fc7fbb4e4ad7a1bd Mon Sep 17 00:00:00 2001 From: Tom Ladendorf Date: Mon, 20 Feb 2017 20:55:53 +0100 Subject: [PATCH 13/15] updated package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 371e15d6a..fae7efa46 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,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": "birdofpreyru/react-components.git#dev", + "appirio-tech-react-components": "appirio-tech/react-components.git#cl-misc-fixes-3", "auth0-angular": "^4.1.0", "auth0-js": "^6.8.0", "d3": "^3.5.14", From f8dfb11c971519c0a34604f49f928d8b6cbfb33e Mon Sep 17 00:00:00 2001 From: Tom Ladendorf Date: Mon, 20 Feb 2017 21:17:31 +0100 Subject: [PATCH 14/15] changed usersnap widget position --- app/index.jade | 13 ++++++++++++- app/listings/listings.jade | 11 ----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/index.jade b/app/index.jade index 896c34883..24cddfb2d 100644 --- a/app/index.jade +++ b/app/index.jade @@ -17,6 +17,17 @@ html h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s) })(document); + script. + (function() { + var s = document.createElement("script"); + s.type = "text/javascript"; + 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); + })(); + include ../assets/scripts/google.analytics.jade include ../assets/scripts/zendesk-widget.jade include ../assets/scripts/raven-js.jade @@ -38,4 +49,4 @@ html div(ui-view="footer") - #chart-tooltip \ No newline at end of file + #chart-tooltip diff --git a/app/listings/listings.jade b/app/listings/listings.jade index ccf64b6d0..6401773e0 100755 --- a/app/listings/listings.jade +++ b/app/listings/listings.jade @@ -1,12 +1 @@ react-component.listings(name="ChallengeFiltersExample" props="reactProps" watch-depth="reference") - -script. - (function() { - var s = document.createElement("script"); - s.type = "text/javascript"; - 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); - })(); From bb808bdfccd181f51c49f0ed3ccd76640d778832 Mon Sep 17 00:00:00 2001 From: shubhu Date: Tue, 21 Feb 2017 12:47:42 +0530 Subject: [PATCH 15/15] fixed #1041 corrected footer height and margin --- assets/css/layout/footer.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/css/layout/footer.scss b/assets/css/layout/footer.scss index dcbcb09fb..a343f9d49 100644 --- a/assets/css/layout/footer.scss +++ b/assets/css/layout/footer.scss @@ -8,6 +8,7 @@ footer { .bottom-footer { background-color: $gray-darkest; padding: 1px 20px 30px 20px; + margin-bottom: -20px; } .bottom-footer .menu-item .menu-link { @@ -125,7 +126,7 @@ footer { // removed fold-pusher from the rule to remove white space .bottom-footer, .fold-pusher { // .bottom-footer { - height: 200px; + height: auto; } .bottom-footer { padding-top: 40px;