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

Commit b102153

Browse files
authored
Merge pull request #70 from topcoder-platform/universal-nav
Universal nav
2 parents 0b4d4f1 + 70c9b52 commit b102153

File tree

3 files changed

+119
-17
lines changed

3 files changed

+119
-17
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ install_dependency: &install_dependency
2424
install_deploysuite: &install_deploysuite
2525
name: Installation of install_deploysuite.
2626
command: |
27-
git clone --branch v1.3 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
27+
git clone --branch v1.4.14 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
2828
cp ./../buildscript/master_deploy.sh .
2929
cp ./../buildscript/buildenv.sh .
3030
cp ./../buildscript/awsconfiguration.sh .
@@ -106,7 +106,7 @@ workflows:
106106
- Hold [TC-Website-Build-Deploy]
107107
filters:
108108
branches:
109-
only: [dev, reskin-payment]
109+
only: [dev, reskin-payment, universal-nav, ci-script-fix]
110110
- build-prod:
111111
context : org-global
112112
requires:

src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
<c:set var="cr" value="<%= request.getAttribute(PaymentHistory.CODER) %>"/>
3939
<c:set var="paymentConfirmationTemplate" value="<%= request.getAttribute(PaymentHistory.PAYMENT_CONFIRMATION_TEMPLATE) %>"/>
4040
<c:set var="userPaymentMethod" value="<%= request.getAttribute(PaymentHistory.USER_PAYMENT_METHOD) %>"/>
41+
<c:set var="userHandle" value="<%= sessionInfo.getHandle() %>"/>
42+
<c:set var="userId" value="<%= sessionInfo.getUserId() %>"/>
43+
<c:set var="userInitials" value="<%= sessionInfo.getHandle() %>"/>
4144

4245
<c:set value="<%=PaymentHistory.DEFAULTS_KEY%>" var="defaults"/>
4346
<c:set value="<%=PaymentHistory.PAYMENT_ID%>" var="PAYMENT_ID"/>
@@ -77,6 +80,61 @@
7780
<jsp:param name="key" value="tc_stats"/>
7881
<jsp:param name="reskin" value="${isReskin ? 'paymentHistory' : ''}"/>
7982
</jsp:include>
83+
<div id="headerNav"></div>
84+
<script>
85+
function parseJwt (token) {
86+
var base64Url = token.split('.')[1];
87+
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
88+
var jsonPayload = decodeURIComponent(window.atob(base64).split('').map(function(c) {
89+
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
90+
}).join(''));
91+
92+
return JSON.parse(jsonPayload);
93+
}
94+
95+
var serverName = '<%=ApplicationServer.SERVER_NAME%>';
96+
var logoutURL = "https://" + serverName + "/logout";
97+
98+
var prodUrl = 'topcoder.com';
99+
var scriptURL = '//uni-nav.topcoder-dev.com/v1/tc-universal-nav.js';
100+
101+
if (serverName === prodUrl) {
102+
scriptURL = '//uni-nav.topcoder.com/v1/tc-universal-nav.js';
103+
}
104+
105+
!function(n,t,e,a,c,i,o){n['TcUnivNavConfig']=c,n[c]=n[c]||function(){
106+
(n[c].q=n[c].q??[]).push(arguments)},n[c].l=1*new Date();i=t.createElement(e),
107+
o=t.getElementsByTagName(e)[0];i.async=1;i.type="module";i.src=a;o.parentNode.insertBefore(i,o)
108+
}(window,document,"script",scriptURL,"tcUniNav");
109+
110+
var photoUrl = parseJwt($.cookie('tcjwt'))["picture"];
111+
112+
var userId = ${userId};
113+
var handle = '${userHandle}';
114+
var initials = handle ? handle.substr(0, 2).toUpperCase() : '';
115+
116+
var user = {
117+
photoUrl,
118+
userId,
119+
initials,
120+
handle
121+
};
122+
123+
tcUniNav('init', 'headerNav', {
124+
type: 'tool',
125+
toolName: 'Payments',
126+
user,
127+
toolRoot: '/PactsMemberServlet?module=PaymentHistory&full_list=true',
128+
signOut() {
129+
window.location.replace(logoutURL);
130+
}
131+
});
132+
133+
tcUniNav('init', 'footerNav', {
134+
type: 'footer',
135+
})
136+
137+
</script>
80138
81139
<script type="text/javascript">
82140
USER_PAYMENT_METHOD = ${userPaymentMethod eq null ? 'null' : userPaymentMethod};
@@ -186,11 +244,6 @@
186244
</head>
187245
<body>
188246
189-
<jsp:include page="../../top.jsp" >
190-
<jsp:param name="level1" value=""/>
191-
<jsp:param name="isReskin" value="${isReskin}"/>
192-
</jsp:include>
193-
194247
<c:if test="${isReskin}">
195248
<div class="page">
196249
</c:if>
@@ -841,9 +894,7 @@
841894
</div><!-- // end .page -->
842895
</c:if>
843896
844-
<jsp:include page="/foot.jsp" >
845-
<jsp:param name="isReskin" value="${isReskin}"/>
846-
</jsp:include>
897+
<div id="footerNav"></div>
847898
848899
<c:if test="${isReskin}">
849900
<div class="modal payment-confirm-modal" id="payment-confirm-modal-id">

src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
<c:set value="<%=true%>" var="isReskin"/>
1616
<c:set value="<%=request.getAttribute("NUM_PENDING")%>" var="numPending" />
17+
<c:set var="userHandle" value="<%= sessionInfo.getHandle() %>"/>
18+
<c:set var="userId" value="<%= sessionInfo.getUserId() %>"/>
19+
<c:set var="userImagePath" value="<%= sessionInfo.getImagePath() %>"/>
20+
<c:set var="userInitials" value="<%= sessionInfo.getHandle() %>"/>
1721

1822
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
1923
<html>
@@ -27,6 +31,59 @@
2731
<jsp:param name="key" value="tc_stats"/>
2832
<jsp:param name="reskin" value="${isReskin ? 'paymentStatusSummary' : ''}"/>
2933
</jsp:include>
34+
<div id="headerNav"></div>
35+
<script>
36+
function parseJwt (token) {
37+
var base64Url = token.split('.')[1];
38+
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
39+
var jsonPayload = decodeURIComponent(window.atob(base64).split('').map(function(c) {
40+
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
41+
}).join(''));
42+
43+
return JSON.parse(jsonPayload);
44+
}
45+
46+
var serverName = '<%=ApplicationServer.SERVER_NAME%>';
47+
var prodUrl = 'topcoder.com';
48+
var scriptURL = '//uni-nav.topcoder-dev.com/v1/tc-universal-nav.js';
49+
50+
if (serverName === prodUrl) {
51+
scriptURL = '//uni-nav.topcoder.com/v1/tc-universal-nav.js';
52+
}
53+
54+
!function(n,t,e,a,c,i,o){n['TcUnivNavConfig']=c,n[c]=n[c]||function(){
55+
(n[c].q=n[c].q??[]).push(arguments)},n[c].l=1*new Date();i=t.createElement(e),
56+
o=t.getElementsByTagName(e)[0];i.async=1;i.type="module";i.src=a;o.parentNode.insertBefore(i,o)
57+
}(window,document,"script",scriptURL,"tcUniNav");
58+
59+
var photoUrl = parseJwt($.cookie('tcjwt'))["picture"];
60+
61+
var userId = ${userId};
62+
var handle = '${userHandle}';
63+
var initials = handle ? handle.substr(0, 2).toUpperCase() : '';
64+
65+
var user = {
66+
photoUrl,
67+
userId,
68+
initials,
69+
handle
70+
};
71+
72+
tcUniNav('init', 'headerNav', {
73+
type: 'tool',
74+
toolName: 'Payments',
75+
user,
76+
toolRoot: '/PactsMemberServlet?module=PaymentHistory&full_list=true',
77+
signOut() {
78+
window.location.replace("http://" + serverName + "/tc?module=Logout");
79+
}
80+
});
81+
82+
tcUniNav('init', 'footerNav', {
83+
type: 'footer',
84+
})
85+
86+
</script>
3087
3188
</head>
3289
<body>
@@ -35,10 +92,6 @@
3592
ResultSetContainer rsc = (ResultSetContainer) request.getAttribute(PaymentStatusSummary.PAYMENT_STATUS_SUMMARY);
3693
%>
3794
38-
<jsp:include page="../../top.jsp" >
39-
<jsp:param name="level1" value=""/>
40-
<jsp:param name="isReskin" value="${isReskin}"/>
41-
</jsp:include>
4295
4396
<c:if test="${isReskin}">
4497
<div class="page">
@@ -244,9 +297,7 @@
244297
</div><!-- // end .page -->
245298
</c:if>
246299
247-
<jsp:include page="/foot.jsp" >
248-
<jsp:param name="isReskin" value="${isReskin}"/>
249-
</jsp:include>
300+
<div id="footerNav"></div>
250301
251302
</body>
252303

0 commit comments

Comments
 (0)