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

Commit 088c595

Browse files
committed
Merge pull request #68 from appirio-tech/dev
Release dev to qa
2 parents 15eda95 + d26cdd1 commit 088c595

15 files changed

+244
-101
lines changed

Gruntfile.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ module.exports = function (grunt) {
2626
auth0Domain : process.env.AUTH0_DOMAIN || 'topcoder-dev.auth0.com',
2727
auth0Callback : 'no-callback-needed-without-social-login',
2828
submissionDownloadPath: '/review/actions/DownloadContestSubmission?uid=',
29-
photoLinkLocation : process.env.PHOTO_LINK_LOCATION || 'http://community.topcoder.com'
29+
photoLinkLocation : process.env.PHOTO_LINK_LOCATION || 'http://community.topcoder.com',
30+
LIME_PROGRAM_ID : 3445
3031
};
3132

3233
// Define the configuration for all the tasks
@@ -55,7 +56,8 @@ module.exports = function (grunt) {
5556
auth0Domain : appConfig.auth0Domain,
5657
auth0Callback : appConfig.auth0Callback,
5758
submissionDownloadPath: appConfig.submissionDownloadPath,
58-
photoLinkLocation : appConfig.photoLinkLocation
59+
photoLinkLocation : appConfig.photoLinkLocation,
60+
LIME_PROGRAM_ID : appConfig.LIME_PROGRAM_ID
5961
}
6062
}
6163
},
@@ -73,7 +75,8 @@ module.exports = function (grunt) {
7375
auth0Domain : 'topcoder-qa.auth0.com',
7476
auth0Callback : appConfig.auth0Callback,
7577
submissionDownloadPath: appConfig.submissionDownloadPath,
76-
photoLinkLocation : appConfig.photoLinkLocation
78+
photoLinkLocation : appConfig.photoLinkLocation,
79+
LIME_PROGRAM_ID : appConfig.LIME_PROGRAM_ID
7780
}
7881
}
7982
},
@@ -91,7 +94,8 @@ module.exports = function (grunt) {
9194
auth0Domain : 'topcoder.auth0.com',
9295
auth0Callback : appConfig.auth0Callback,
9396
submissionDownloadPath: appConfig.submissionDownloadPath,
94-
photoLinkLocation : appConfig.photoLinkLocation
97+
photoLinkLocation : appConfig.photoLinkLocation,
98+
LIME_PROGRAM_ID : appConfig.LIME_PROGRAM_ID
9599
}
96100
}
97101
}

app/app.routes.coffee

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
'use strict'
22

3-
routes = ($stateProvider, $urlRouterProvider, $httpProvider) ->
3+
routes = ($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) ->
4+
5+
$locationProvider.html5Mode true
6+
47
states =
58
landing:
69
url : '/'
@@ -9,7 +12,10 @@ routes = ($stateProvider, $urlRouterProvider, $httpProvider) ->
912
learn:
1013
url : '/learn'
1114
templateUrl : 'learn/learn.html'
12-
controller : 'learn'
15+
#binded controller in view as workaround to use controller as vm style
16+
#controllerAs property is working with coffee script
17+
#more info: http://stackoverflow.com/questions/28953289/using-controller-as-with-the-ui-router-isnt-working-as-expected
18+
#controller : 'learn'
1319
login:
1420
url : '/login?retUrl&retState'
1521
templateUrl : 'login/login.html'
@@ -44,5 +50,6 @@ angular.module('lime-topcoder').config [
4450
'$stateProvider'
4551
'$urlRouterProvider'
4652
'$httpProvider'
53+
'$locationProvider'
4754
routes
4855
]

app/challenges/challenges.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ div(ng-controller="challenges as vm")
5151
.ca SUBMISSIONS
5252
.vl(ng-bind="challenge.numSubmissions")
5353
.actns
54-
a.btn.secondary.btnReg(ng-href="https://www.{{vm.domain}}/challenge-details/{{challenge.challengeId}}/?type=develop", target="_blank") Register
55-
//a.lnkLiked
54+
a.btn.secondary.btnReg(ng-href="https://www.{{vm.domain}}/challenge-details/{{challenge.challengeId}}/?type=develop", target="_blank") View
55+
5656
a.lnk(href='#view-challenges', du-smooth-scroll) View all challenges
5757

5858
.challenges-section.landing-annon-page#view-challenges

app/content/css/app.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,7 @@ button {
8686
.padding-reset {
8787
padding: 0px;
8888
}
89+
90+
.margin-left-2x {
91+
margin-left: 10px;
92+
}

app/content/css/challenges.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,14 +1003,6 @@
10031003
font-size: 16px;
10041004
margin-right: 30px;
10051005
}
1006-
.lnkLiked {
1007-
height: 35px;
1008-
width: 35px;
1009-
background: #031625 url(../images/ico-heart.png) 50% 50% no-repeat;
1010-
display: inline-block;
1011-
border-radius: 3px;
1012-
margin: 0 30px 0 16px;
1013-
}
10141006
.lnk,
10151007
.lnk:hover {
10161008
line-height: 35px;

app/content/css/learn.scss

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@
139139
position: absolute;
140140
top: 0;
141141
}
142+
143+
.badge-desc {
144+
img.achieved {
145+
vertical-align: middle;
146+
}
147+
}
142148
}
143149

144150
.participant-badge:before {
@@ -305,6 +311,24 @@
305311
}
306312
}
307313

314+
315+
@media only screen and (max-width: 568px) {
316+
.newsletter-form {
317+
width: auto;
318+
319+
.mktoFormRow .mktoFormCol {
320+
width: 100%;
321+
322+
.mktoFieldWrap {
323+
width: 100%;
324+
}
325+
}
326+
input {
327+
width: 100% !important;
328+
}
329+
}
330+
}
331+
308332
@media only screen and (max-width: 640px) {
309333
.newsletter-form-wrapper {
310334
padding-left: 0;

app/content/images/ico-okay-check.png

1.18 KB
Loading

app/index.jade

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
- jsFiles.push('services/countries.service')
3636
- jsFiles.push('services/helpers.service')
3737
- jsFiles.push('services/challenge.service')
38+
- jsFiles.push('services/member-cert.service')
3839
- jsFiles.push('services/user.service')
3940
- jsFiles.push('directives/checkbox')
4041
- jsFiles.push('directives/requiredDropdown')
@@ -44,7 +45,9 @@
4445
doctype html
4546
html
4647
head
48+
base(href="/")
4749
meta(charset="utf-8")
50+
meta(name="fragment", content="!")
4851

4952
title topcoder iOS Member Program
5053

@@ -115,7 +118,7 @@ html
115118
include layout/header.jade
116119

117120
.view-container(ui-view, ng-class="$state.current.name", autoscroll="true")
118-
.view-container-loading(ng-show="main.loggingIn")
121+
.view-container-loading(ng-show="main.loading")
119122
div.circle-3-loading
120123
span.loading-wrapper
121124
span.outer-circle

app/layout/footer.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ footer.login-footer.footer
55

66
ul
77
li
8-
a(href='http://topcoder.com/community/how-it-works/privacy-policy/') Privacy Policy
8+
a(href='http://www.{{main.domain}}/community/how-it-works/privacy-policy/') Privacy Policy
99
li |
1010
li
11-
a(href='http://topcoder.com/community/how-it-works/terms/') Terms
11+
a(href='http://www.{{main.domain}}/community/how-it-works/terms/') Terms
1212

1313
section.social
1414
a.fb-icon(href='https://www.facebook.com/topcoder')

app/layout/main.coffee

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ main = ($scope, $state, ENV, AuthService, UserService) ->
55
vm.domain = ENV.domain
66

77
vm.loggedInUser = null
8-
vm.loggingIn = false
8+
vm.loading = false
99

1010
vm.updatePhotoLink = () ->
1111
user = vm.loggedInUser
@@ -26,16 +26,24 @@ main = ($scope, $state, ENV, AuthService, UserService) ->
2626
true
2727
false
2828

29+
loginHandlers = {}
30+
vm.addLoginEventHandler = (name, handler) ->
31+
loginHandlers[name] = handler
32+
2933
vm.activate = () ->
3034
if AuthService.isAuthenticated()
31-
vm.loggingIn = true
35+
vm.loading = true
3236
UserService.getLoggedInUser()
3337
.then (data) ->
34-
vm.loggingIn = false
38+
vm.loading = false
3539
vm.loggedInUser = data.data
40+
for name of loginHandlers
41+
handler = loginHandlers[name]
42+
if (handler && typeof handler == 'function')
43+
handler vm.loggedInUser
3644
vm.updatePhotoLink()
3745
.catch (error) ->
38-
vm.loggingIn = false
46+
vm.loading = false
3947
UserService.getUsername()
4048
.then (data) ->
4149
vm.loggedInUser =

app/learn/learn.coffee

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,75 @@
11
'use strict'
22

3-
learn = ($state) ->
3+
learn = ($scope, ENV, MemberCertService, $state) ->
44
MktoForms2.loadForm '//app-abc.marketo.com', '921-UOU-112', 1944, (form) ->
55
form.onSuccess () ->
66
$state.go 'confirmNewsletter'
77
false
88

9+
vm = this
10+
vm.registered = false
11+
vm.registrationSuccess = false
12+
vm.registrationError = null
13+
main = $scope.$parent.main
14+
15+
vm.checkRegStatus = () ->
16+
if !main.loggedInUser
17+
vm.registered = false
18+
return
19+
main.loading = true
20+
request =
21+
userId: main.loggedInUser.uid
22+
programId: ENV.LIME_PROGRAM_ID
23+
MemberCertService.getProgramForUser(request)
24+
.then (response) ->
25+
# set off loading flag
26+
main.loading = false
27+
console.log response
28+
registered = false
29+
if response.status == 200
30+
result = response.data.result
31+
program = result?.content
32+
if program
33+
vm.registered = true
34+
35+
.catch (error) ->
36+
# TODO show error
37+
main.loading = false
38+
vm.registered = false
39+
40+
41+
vm.registerForProgram = () ->
42+
vm.registrationError = null
43+
if !main.loggedInUser
44+
vm.registrationError = 'Please login to participate'
45+
return
46+
main.loading = true
47+
request =
48+
userId: main.loggedInUser.uid
49+
programId: ENV.LIME_PROGRAM_ID
50+
MemberCertService.registerForProgram(request)
51+
.then (response) ->
52+
# set off loading flag
53+
main.loading = false
54+
if response.status == 200
55+
vm.registrationSuccess = true
56+
vm.registered = true
57+
58+
.catch (error) ->
59+
# TODO show error
60+
main.loading = false
61+
vm.registered = false
62+
vm.registrationSuccess = false
63+
64+
# registers login even handler to handle timing of multiple ajax calls
65+
main.addLoginEventHandler('learn', vm.checkRegStatus)
66+
# check status on load
67+
vm.checkRegStatus()
68+
969
angular.module('lime-topcoder').controller 'learn', [
70+
'$scope'
71+
'ENV'
72+
'MemberCertService'
1073
'$state'
1174
learn
1275
]

0 commit comments

Comments
 (0)