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

Commit c49a08a

Browse files
committed
Merge pull request #35 from appirio-tech/vikas-sup-156-show-user-certification-status
SUP-156, Show User's Certification Status
2 parents 71bef51 + 611957b commit c49a08a

File tree

17 files changed

+258
-15
lines changed

17 files changed

+258
-15
lines changed

Gruntfile.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ module.exports = function(grunt) {
3232
auth0URL: grunt.option('auth-main-url') || 'topcoder.auth0.com',
3333
mainURL: grunt.option('main-url') || 'http://local.topcoder.com',
3434
apiURL: grunt.option('api-url') || 'https://api.topcoder.com/v2',
35+
api3URL: grunt.option('api3-url') || 'https://api.topcoder.com/v3',
3536
cdnURL: grunt.option('cdn-url') || '/mf',
3637
useVer: grunt.option('use-ver') || false,
3738
version: grunt.option('cdn-version') || '',
3839
communityURL: grunt.option('community-url') || '//community.topcoder.com',
3940
reviewAppURL: grunt.option('review-app-url') || 'software.topcoder.com/review',
4041
helpAppURL: grunt.option('help-app-url') || 'help.topcoder.com',
4142
forumsAppURL: grunt.option('review-app-url') || 'forums.topcoder.com',
43+
swiftProgramId: grunt.option('swift-program-id') || 3445,
4244

4345
// only used on wp setup
4446
useGz: grunt.option('use-gz') || false,

src/conf/build-dev.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
grunt --main-url=https://www.topcoder-dev.com --auth-main-url=topcoder-dev.auth0.com --auth-client-id=JFDo7HMkf0q2CkVFHojy3zHWafziprhT --auth-callback-url=https://www.topcoder-dev.com/reg2/callback.action --api-url=https://api.topcoder-dev.com/v2 --lc-url=https://dev-lc1-ext-challenge-service.herokuapp.com --lc-discussion-url=https://dev-lc1-discussion-service.herokuapp.com --lc-user-url=https://dev-lc1-user-service.herokuapp.com --lc-site-url=https://dev-lc1-challenge-app.herokuapp.com --my-filters-url=https://staging-user-settings-service.herokuapp.com --community-url=//community.topcoder-dev.com --blog-rss-feed="https://www.topcoder-dev.com/feed/?post_type=blog" --use-cdn=1 --use-min=1
1+
grunt --main-url=https://www.topcoder-dev.com --auth-main-url=topcoder-dev.auth0.com --auth-client-id=JFDo7HMkf0q2CkVFHojy3zHWafziprhT --auth-callback-url=https://www.topcoder-dev.com/reg2/callback.action --api-url=https://api.topcoder-dev.com/v2 --lc-url=https://dev-lc1-ext-challenge-service.herokuapp.com --lc-discussion-url=https://dev-lc1-discussion-service.herokuapp.com --lc-user-url=https://dev-lc1-user-service.herokuapp.com --lc-site-url=https://dev-lc1-challenge-app.herokuapp.com --my-filters-url=https://staging-user-settings-service.herokuapp.com --community-url=//community.topcoder-dev.com --blog-rss-feed="https://www.topcoder-dev.com/feed/?post_type=blog" --api3-url=http://api.topcoder-dev.com/v3 --use-cdn=1 --use-min=1

src/css/base.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,15 @@ sub, sup {
211211
margin-top: 5px;
212212
}
213213

214+
.margin-bottom-1x {
215+
margin-bottom: 5px;
216+
}
217+
218+
.margin-vert-1x {
219+
margin-top: 5px;
220+
margin-bottom: 5px;
221+
}
222+
214223
.margin-top-2x {
215224
margin-top: 10px;
216225
}

src/css/my-dashboard.css

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,69 @@
242242
margin-top: 20px;
243243
}
244244

245+
.member-program-content *[rel="badges"] {
246+
247+
}
248+
249+
.member-program-content *[rel="badges"] *[rel="badge"] div[rel="image"] {
250+
min-width: 30px;
251+
min-height: 30px;
252+
background-size: cover;
253+
}
254+
255+
.member-program-content *[rel="badges"] *[rel="badge"].badge1 div[rel="image"] {
256+
background-image: url("../i/member-program/get-ready-48.png");
257+
background-repeat: no-repeat;
258+
}
259+
260+
.member-program-content *[rel="badges"] *[rel="badge"].badge2 div[rel="image"] {
261+
background-image: url("../i/member-program/step-one-48.png");
262+
background-repeat: no-repeat;
263+
}
264+
265+
.member-program-content *[rel="badges"] *[rel="badge"].badge3 div[rel="image"] {
266+
background-image: url("../i/member-program/getting-ready-48.png");
267+
background-repeat: no-repeat;
268+
}
269+
270+
.member-program-content *[rel="badges"] *[rel="badge"].badge4 div[rel="image"] {
271+
background-image: url("../i/member-program/on-starting-line-48.png");
272+
background-repeat: no-repeat;
273+
}
274+
275+
.member-program-content *[rel="badges"] *[rel="badge"].badge5 div[rel="image"] {
276+
background-image: url("../i/member-program/break-the-finish-48.png");
277+
background-repeat: no-repeat;
278+
}
279+
280+
.member-program-content *[rel="badges"] *[rel="badge"].badge6 div[rel="image"] {
281+
background-image: url("../i/member-program/get-certified-48.png");
282+
background-repeat: no-repeat;
283+
}
284+
285+
.member-program-content *[rel="badges"] *[rel="badge"] div[rel="name"] {
286+
margin-top: 5px;
287+
margin-left: 5px;
288+
}
289+
290+
.member-program-content *[rel="badges"] *[rel="badge-status"] {
291+
padding-left: 20px;
292+
margin-top: 5px;
293+
}
294+
295+
.member-program-content *[rel="badges"] *[rel="badge-status"].pending {
296+
background: url("../i/check-box.png") no-repeat 0 0px;
297+
}
298+
299+
.member-program-content *[rel="badges"] *[rel="badge-status"].completed {
300+
background: url("../i/check-box.png") no-repeat 0 -20px;
301+
}
302+
303+
.member-program-content .nextstep {
304+
color: white;
305+
margin-top: 20px;
306+
}
307+
245308
.helpful-links {
246309

247310
}

src/js/app/my-dashboard/app.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
'myDashboard.services'
1717
])
1818
.constant("API_URL", tcLCApiURL)
19+
.constant("API3_URL", tcconfig.API3_URL)
1920

2021
.config(DataPreProcessing)
2122
.constant("MAIN_URL", tcconfig.mainURL)
@@ -26,6 +27,8 @@
2627
.constant("FORUMS_APP_URL", tcconfig.forumsAppURL)
2728
.constant("HELP_APP_URL", tcconfig.helpAppURL)
2829
.constant("PHOTO_LINK_LOCATION", tcconfig.photoLinkBaseURL)
30+
.constant('SWIFT_PROGRAM_ID', tcconfig.swiftProgramId)
31+
.factory('Restangular3', Restangular3)
2932
.run(['$rootScope', '$location', '$window', 'AuthService', run]);
3033

3134
DataPreProcessing.$inject = ['$httpProvider', 'RestangularProvider', 'API_URL'];
@@ -43,6 +46,14 @@
4346
});
4447
}
4548

49+
50+
// Restangular service that uses v3
51+
function Restangular3(Restangular) {
52+
return Restangular.withConfig(function(RestangularConfigurer) {
53+
RestangularConfigurer.setBaseUrl(tcconfig.api3URL);
54+
});
55+
}
56+
4657
/**
4758
* Sets restangular with specific configurations to access tc api
4859
*

src/js/app/my-dashboard/js/controllers/member-program-controller.js

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* Copyright (C) 2014 TopCoder Inc., All Rights Reserved.
33
* @author mdesiderio
4+
* @author vikas.agarwal@appirio.com
45
* @version 1.0
56
*
67
* Controller for the member program widget
@@ -18,26 +19,64 @@
1819
* Inject dependencies
1920
* @type {string[]}
2021
*/
21-
MemberProgramCtrl.$inject = ['$scope', 'AuthService'];
22+
MemberProgramCtrl.$inject = ['$scope', 'AuthService', 'MemberCertService', 'SWIFT_PROGRAM_ID'];
2223

2324
/**
2425
* Controller implementation
2526
*
2627
* @param $scope
2728
* @constructor
2829
*/
29-
function MemberProgramCtrl($scope, AuthService) {
30+
function MemberProgramCtrl($scope, AuthService, MemberCertService, SWIFT_PROGRAM_ID) {
3031
var vm = this;
32+
vm.loading = true;
33+
vm.loadingMessage = "";
34+
vm.program = null;
35+
vm.registration = null;
36+
vm.registerUser = registerUser;
37+
38+
// parent dashboard controller
39+
var db = $scope.$parent.vm;
3140

3241
// activate controller
3342
if (AuthService.isLoggedIn === true) {
34-
activate();
43+
db.addIdentityChangeListener("memberprogram", function(identity) {
44+
activate();
45+
});
46+
if (db.user) {
47+
activate();
48+
}
3549
} else {
3650
return false;
3751
}
3852

3953
function activate() {
40-
// nothing to do yet
54+
vm.loading = true;
55+
vm.loadingMessage = "Checking your program status";
56+
// gets member's registration status for the event
57+
return MemberCertService.getMemberRegistration(db.user.uid, SWIFT_PROGRAM_ID).then(function(data) {
58+
var result = data.result;
59+
var content = result ? result.content : null;
60+
if (content) {
61+
vm.registration = content;
62+
} else {
63+
vm.registration = null;
64+
}
65+
vm.loading = false;
66+
});
67+
}
68+
69+
function registerUser() {
70+
vm.loading = true;
71+
vm.loadingMessage = "Registering for the program";
72+
return MemberCertService.registerMember(db.user.uid, SWIFT_PROGRAM_ID).then(function(data) {
73+
var result = data.result;
74+
var content = result ? result.content : null;
75+
if (content) {
76+
vm.registration = content;
77+
}
78+
vm.loading = false;
79+
});
4180
}
4281
}
4382

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* Copyright (C) 2014 TopCoder Inc., All Rights Reserved.
3+
* @author mdesiderio
4+
* @version 1.0
5+
*
6+
* ProfileService. Factory to access topcoder api for profile information
7+
*/
8+
(function () {
9+
10+
angular
11+
.module('myDashboard.services')
12+
.factory('MemberCertService', ProfileService);
13+
14+
ProfileService.$inject = ['Restangular3'];
15+
16+
/**
17+
* SRMService
18+
* @param Restangular to access the REST api
19+
* @constructor
20+
*/
21+
function ProfileService(Restangular) {
22+
var service = Restangular.withConfig(function(RestangularConfigurer) {
23+
});
24+
25+
/**
26+
* getMemberRegistration Retrieves the registration status of the member for the given program
27+
* @param userId string id of the user
28+
* @param programId string id of the program of the registration
29+
* @returns promise
30+
*/
31+
service.getMemberRegistration = function(userId, programId) {
32+
return service.one("member-cert/registrations", userId).one("programs", programId).get();
33+
}
34+
35+
/**
36+
* registerMember Registers the given member for the given program.
37+
* @param userId string id of the member to be registered
38+
* @param programId string id of the program to be registered against
39+
* @returns promise
40+
*/
41+
service.registerMember = function(userId, programId) {
42+
return service.one("member-cert/registrations", userId).one("programs", programId).post();
43+
}
44+
45+
return service;
46+
}
47+
})();
Lines changed: 81 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,87 @@
11
<div class="member-program-content container-fluid" ng-controller="MemberProgramCtrl as vm">
2-
<div class="center-align-text margin-top-3x">
3-
<img src="/mf/i/swift-getting-started.png" />
4-
<!-- <span>Get Started with Swift</span> -->
2+
<div rel="validating-status-view" ng-show="vm.loading">
3+
<div class="widget-loading"></div>
4+
<div class="center-align-text" ng-bind="vm.loadingMessage"></div>
55
</div>
6-
<div class="description">
7-
<p>Apple’s latest and greatest programming language for iOS8 that will enable you to become a rockstar mobile developer and achieve fortune & glory untold.</p>
6+
<div rel="unregistered-view" ng-show="!vm.loading && !vm.registration">
7+
<div class="center-align-text margin-top-3x">
8+
<img src="/mf/i/swift-getting-started.png" />
9+
</div>
10+
<div class="description">
11+
<p>Apple’s latest and greatest programming language for iOS8 that will enable you to become a rockstar mobile developer and achieve fortune & glory untold.</p>
812

9-
10-
<p>We'll get you from a beginner to an expert and provide certifications to prove you are a great developer! Sign up now and check out the first mission</p>
13+
14+
<p>We'll get you from a beginner to an expert and provide certifications to prove you are a great developer! Sign up now and check out the first mission</p>
15+
</div>
16+
<div class="signup">
17+
<!-- used style as workaround to override display property -->
18+
<input type="button" class="btn btn-primary center-block block-display" value="Join Us" style="display:block;" ng-click="vm.registerUser()">
19+
</div>
1120
</div>
12-
<div class="signup">
13-
<!-- used style as workaround to override display property -->
14-
<input type="button" class="btn btn-primary center-block block-display" value="Join" style="display:block;">
21+
<div rel="registered-view" ng-show="!vm.loading && vm.registration">
22+
<!-- <div class="center-align-text margin-top-3x">
23+
<img src="/mf/i/swift-getting-started.png" />
24+
</div> -->
25+
<div class="description margin-top-3x">
26+
<div>
27+
<h3 class="col-xs-12">Swift Recognition</h3>
28+
<div class="clear"></div>
29+
</div>
30+
<!-- TODO make badge list dynamic -->
31+
<ul rel="badges" class="margin-top-3x">
32+
<li class="margin-vert-1x">
33+
<div rel="badge" class="col-xs-8 badge1">
34+
<div rel="image" class="pull-left"></div>
35+
<div rel="name" class="pull-left">Get Ready</div>
36+
</div>
37+
<div rel="badge-status" class="col-xs-4 completed">Completed</div>
38+
<div class="clearfix"></div>
39+
</li>
40+
<li class="margin-vert-1x">
41+
<div rel="badge" class="col-xs-8 badge2">
42+
<div rel="image" class="pull-left"></div>
43+
<div rel="name" class="pull-left">Step One</div>
44+
</div>
45+
<div rel="badge-status" class="col-xs-4 pending">Pending</div>
46+
<div class="clearfix"></div>
47+
</li>
48+
<li class="margin-vert-1x">
49+
<div rel="badge" class="col-xs-8 badge3">
50+
<div rel="image" class="pull-left"></div>
51+
<div rel="name" class="pull-left">Getting Ready</div>
52+
</div>
53+
<div rel="badge-status" class="col-xs-4 pending">Pending</div>
54+
<div class="clearfix"></div>
55+
</li>
56+
<li class="margin-vert-1x">
57+
<div rel="badge" class="col-xs-8 badge4">
58+
<div rel="image" class="pull-left"></div>
59+
<div rel="name" class="pull-left">On Starting Line</div>
60+
</div>
61+
<div rel="badge-status" class="col-xs-4 pending">Pending</div>
62+
<div class="clearfix"></div>
63+
</li>
64+
<li class="margin-vert-1x">
65+
<div rel="badge" class="col-xs-8 badge5">
66+
<div rel="image" class="pull-left"></div>
67+
<div rel="name" class="pull-left">Break the Finish</div>
68+
</div>
69+
<div rel="badge-status" class="col-xs-4 pending">Pending</div>
70+
<div class="clearfix"></div>
71+
</li>
72+
<li class="margin-vert-1x">
73+
<div rel="badge" class="col-xs-8 badge6">
74+
<div rel="image" class="pull-left"></div>
75+
<div rel="name" class="pull-left">Get Certified</div>
76+
</div>
77+
<div rel="badge-status" class="col-xs-4 pending">Pending</div>
78+
<div class="clearfix"></div>
79+
</li>
80+
</ul>
81+
</div>
82+
<div class="clearfix nextstep">
83+
<!-- used style as workaround to override display property -->
84+
<a href="http://apple.topcoder.com/challenges" class="btn btn-primary center-block block-display" style="display:block;">Participate</a>
85+
</div>
1586
</div>
1687
</div>

wp/wp-content/themes/tcs-responsive/config/script-register.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@
521521
"app/my-dashboard/js/services/my-dashboard-services.js",
522522
"app/my-dashboard/js/services/auth-service.js",
523523
"app/my-dashboard/js/services/blog-services.js",
524+
"app/my-dashboard/js/services/member-cert-services.js",
524525
"app/my-dashboard/js/services/challenge-services.js",
525526
"app/my-dashboard/js/services/profile-services.js",
526527
"app/my-dashboard/js/services/srm-services.js",
6.32 KB
Loading

0 commit comments

Comments
 (0)