Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Latest listings and some bug bash updates #1050

Merged
merged 22 commits into from
Feb 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5b61ee2
Changes to support updates to the /listings page
birdofpreyru Feb 10, 2017
4363a2e
fixed #994 challenge cards in mobile
shubhendusaurabh Feb 17, 2017
bd526f2
new widget code
tladendo Feb 17, 2017
9ef891f
added widget
tladendo Feb 17, 2017
50b801e
Merge pull request #1038 from appirio-tech/tom-fix-jade
tladendo Feb 17, 2017
852624e
Fix for issue #1001:
gets0ul Feb 18, 2017
b31c65c
Fix the syntax to render the script portion of the template.
Feb 18, 2017
ababeda
Merge pull request #1039 from gets0ul/issue_1001
birdofpreyru Feb 18, 2017
f475776
Small correction of styling
birdofpreyru Feb 18, 2017
43fa2c3
Merge pull request #1017 from shubhendusaurabh/issue-994
birdofpreyru Feb 18, 2017
1d65f44
Minor changes
birdofpreyru Feb 19, 2017
ca7b7e6
Merge branch 'dev' into listings-contest
birdofpreyru Feb 20, 2017
b58fc4f
New listings fix: Filter loading from URL
birdofpreyru Feb 20, 2017
161c22a
Removes padding at the new challenge listings page
birdofpreyru Feb 20, 2017
801c118
Small fix of the header
birdofpreyru Feb 20, 2017
75f950f
A tiny fix of the new listings routing
birdofpreyru Feb 20, 2017
3917bbd
updated package.json
tladendo Feb 20, 2017
882af59
Merge pull request #1042 from appirio-tech/tom-update-package
tladendo Feb 20, 2017
f8dfb11
changed usersnap widget position
tladendo Feb 20, 2017
9bb1570
Merge pull request #1043 from appirio-tech/tom-fix-usersnap-widget
tladendo Feb 20, 2017
bb808bd
fixed #1041 corrected footer height and margin
shubhendusaurabh Feb 21, 2017
0e67f88
Merge pull request #1045 from shubhendusaurabh/issue-1041
birdofpreyru Feb 21, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 12 additions & 1 deletion app/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -38,4 +49,4 @@ html

div(ui-view="footer")

#chart-tooltip
#chart-tooltip
32 changes: 24 additions & 8 deletions app/listings/listings.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { loadUser } from '../services/userv3.service.js'

angular.module('tc.listings').controller('ListingsCtrl', ListingsCtrl)

ListingsCtrl.$inject = ['CONSTANTS', 'logger', '$q','TcAuthService', 'UserService',
'UserStatsService', 'ProfileService', 'ChallengeService',
'ExternalAccountService', 'ngDialog', '$anchorScroll', '$scope'
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, $scope) {
function ListingsCtrl($location, $scope, CONSTANTS, logger, $q, TcAuthService,
UserService, UserStatsService,ProfileService, ChallengeService, ExternalAccountService, ngDialog, $anchorScroll) {
var vm = this
var handle
vm.neverParticipated = false
Expand All @@ -25,7 +25,15 @@ import { loadUser } from '../services/userv3.service.js'

function activate() {
$scope.myChallenges = []
$scope.userProps = { 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) {
Expand Down Expand Up @@ -75,7 +83,15 @@ import { loadUser } from '../services/userv3.service.js'
vm.myChallenges = userChallenges.reverse().slice(0, 8)

// update myChallenges
$scope.userProps = { isAuth: true, myChallenges: vm.myChallenges }
$scope.reactProps = {
config: CONSTANTS,
filterFromUrl: $location.hash(),
isAuth: true,
myChallenges: vm.myChallenges,
onSaveFilterToUrl: function(filter) {
$location.hash(filter)
}
}

vm.userHasChallenges = true
vm.loading = false
Expand Down
3 changes: 1 addition & 2 deletions app/listings/listings.jade
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

<react-component name="ChallengeFiltersExample" props="userProps" watch-depth="reference"/>
react-component.listings(name="ChallengeFiltersExample" props="reactProps" watch-depth="reference")
8 changes: 6 additions & 2 deletions app/listings/listings.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import angular from 'angular'
'listings': {
parent: 'root',
url: '/listings/',
template: require('./listings')(),
controller: 'ListingsCtrl as vm',
resolve: {
userHandle: ['$stateParams', function($stateParams) {
return $stateParams.userHandle
Expand All @@ -31,6 +29,12 @@ import angular from 'angular'
data: {
authRequired: false,
title: 'Listings'
},
views: {
'container@': {
controller: 'ListingsCtrl as vm',
template: require('./listings')()
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/my-dashboard/my-dashboard.jade
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
.programs(id="community", ui-view="programs")

.community-updates(ui-view="community-updates")

3 changes: 2 additions & 1 deletion app/services/blog.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion app/services/jwtInterceptor.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
7 changes: 7 additions & 0 deletions assets/css/directives/challenge-tile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ challenge-tile .challenge.tile-view {
flex-direction: column;
align-items: center;
justify-content: center;
padding: 12px 0;
flex: 2;
}

Expand Down Expand Up @@ -280,6 +281,12 @@ challenge-tile .challenge.tile-view {
}


@media only screen and (max-width: 768px) {
.active-challenge {
height: auto;
margin: auto;
}
}
.completed-challenge {
height: 390px;
display: flex;
Expand Down
3 changes: 2 additions & 1 deletion assets/css/layout/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions assets/css/layout/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
}

.user-menu {
max-height: 54px;
.user-avatar {
height: 31px;
width: 31px;
Expand Down
6 changes: 4 additions & 2 deletions assets/css/my-dashboard/my-challenges.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down