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

Universal nav #70

Merged
merged 20 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ install_dependency: &install_dependency
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
git clone --branch v1.3 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
git clone --branch v1.4.14 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
cp ./../buildscript/master_deploy.sh .
cp ./../buildscript/buildenv.sh .
cp ./../buildscript/awsconfiguration.sh .
Expand Down Expand Up @@ -106,7 +106,7 @@ workflows:
- Hold [TC-Website-Build-Deploy]
filters:
branches:
only: [dev, reskin-payment]
only: [dev, reskin-payment, universal-nav, ci-script-fix]
- build-prod:
context : org-global
requires:
Expand Down
67 changes: 59 additions & 8 deletions src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<c:set var="cr" value="<%= request.getAttribute(PaymentHistory.CODER) %>"/>
<c:set var="paymentConfirmationTemplate" value="<%= request.getAttribute(PaymentHistory.PAYMENT_CONFIRMATION_TEMPLATE) %>"/>
<c:set var="userPaymentMethod" value="<%= request.getAttribute(PaymentHistory.USER_PAYMENT_METHOD) %>"/>
<c:set var="userHandle" value="<%= sessionInfo.getHandle() %>"/>
<c:set var="userId" value="<%= sessionInfo.getUserId() %>"/>
<c:set var="userInitials" value="<%= sessionInfo.getHandle() %>"/>

<c:set value="<%=PaymentHistory.DEFAULTS_KEY%>" var="defaults"/>
<c:set value="<%=PaymentHistory.PAYMENT_ID%>" var="PAYMENT_ID"/>
Expand Down Expand Up @@ -77,6 +80,61 @@
<jsp:param name="key" value="tc_stats"/>
<jsp:param name="reskin" value="${isReskin ? 'paymentHistory' : ''}"/>
</jsp:include>
<div id="headerNav"></div>
<script>
function parseJwt (token) {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
var jsonPayload = decodeURIComponent(window.atob(base64).split('').map(function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));

return JSON.parse(jsonPayload);
}

var serverName = '<%=ApplicationServer.SERVER_NAME%>';
var logoutURL = "https://" + serverName + "/logout";

var prodUrl = 'topcoder.com';
var scriptURL = '//uni-nav.topcoder-dev.com/v1/tc-universal-nav.js';

if (serverName === prodUrl) {
scriptURL = '//uni-nav.topcoder.com/v1/tc-universal-nav.js';
}

!function(n,t,e,a,c,i,o){n['TcUnivNavConfig']=c,n[c]=n[c]||function(){
(n[c].q=n[c].q??[]).push(arguments)},n[c].l=1*new Date();i=t.createElement(e),
o=t.getElementsByTagName(e)[0];i.async=1;i.type="module";i.src=a;o.parentNode.insertBefore(i,o)
}(window,document,"script",scriptURL,"tcUniNav");

var photoUrl = parseJwt($.cookie('tcjwt'))["picture"];

var userId = ${userId};
var handle = '${userHandle}';
var initials = handle ? handle.substr(0, 2).toUpperCase() : '';

var user = {
photoUrl,
userId,
initials,
handle
};

tcUniNav('init', 'headerNav', {
type: 'tool',
toolName: 'Payments',
user,
toolRoot: '/PactsMemberServlet?module=PaymentHistory&full_list=true',
signOut() {
window.location.replace(logoutURL);
}
});

tcUniNav('init', 'footerNav', {
type: 'footer',
})

</script>

<script type="text/javascript">
USER_PAYMENT_METHOD = ${userPaymentMethod eq null ? 'null' : userPaymentMethod};
Expand Down Expand Up @@ -186,11 +244,6 @@
</head>
<body>

<jsp:include page="../../top.jsp" >
<jsp:param name="level1" value=""/>
<jsp:param name="isReskin" value="${isReskin}"/>
</jsp:include>

<c:if test="${isReskin}">
<div class="page">
</c:if>
Expand Down Expand Up @@ -841,9 +894,7 @@
</div><!-- // end .page -->
</c:if>

<jsp:include page="/foot.jsp" >
<jsp:param name="isReskin" value="${isReskin}"/>
</jsp:include>
<div id="footerNav"></div>

<c:if test="${isReskin}">
<div class="modal payment-confirm-modal" id="payment-confirm-modal-id">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

<c:set value="<%=true%>" var="isReskin"/>
<c:set value="<%=request.getAttribute("NUM_PENDING")%>" var="numPending" />
<c:set var="userHandle" value="<%= sessionInfo.getHandle() %>"/>
<c:set var="userId" value="<%= sessionInfo.getUserId() %>"/>
<c:set var="userImagePath" value="<%= sessionInfo.getImagePath() %>"/>
<c:set var="userInitials" value="<%= sessionInfo.getHandle() %>"/>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
Expand All @@ -27,6 +31,59 @@
<jsp:param name="key" value="tc_stats"/>
<jsp:param name="reskin" value="${isReskin ? 'paymentStatusSummary' : ''}"/>
</jsp:include>
<div id="headerNav"></div>
<script>
function parseJwt (token) {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
var jsonPayload = decodeURIComponent(window.atob(base64).split('').map(function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));

return JSON.parse(jsonPayload);
}

var serverName = '<%=ApplicationServer.SERVER_NAME%>';
var prodUrl = 'topcoder.com';
var scriptURL = '//uni-nav.topcoder-dev.com/v1/tc-universal-nav.js';

if (serverName === prodUrl) {
scriptURL = '//uni-nav.topcoder.com/v1/tc-universal-nav.js';
}

!function(n,t,e,a,c,i,o){n['TcUnivNavConfig']=c,n[c]=n[c]||function(){
(n[c].q=n[c].q??[]).push(arguments)},n[c].l=1*new Date();i=t.createElement(e),
o=t.getElementsByTagName(e)[0];i.async=1;i.type="module";i.src=a;o.parentNode.insertBefore(i,o)
}(window,document,"script",scriptURL,"tcUniNav");

var photoUrl = parseJwt($.cookie('tcjwt'))["picture"];

var userId = ${userId};
var handle = '${userHandle}';
var initials = handle ? handle.substr(0, 2).toUpperCase() : '';

var user = {
photoUrl,
userId,
initials,
handle
};

tcUniNav('init', 'headerNav', {
type: 'tool',
toolName: 'Payments',
user,
toolRoot: '/PactsMemberServlet?module=PaymentHistory&full_list=true',
signOut() {
window.location.replace("http://" + serverName + "/tc?module=Logout");
}
});

tcUniNav('init', 'footerNav', {
type: 'footer',
})

</script>

</head>
<body>
Expand All @@ -35,10 +92,6 @@
ResultSetContainer rsc = (ResultSetContainer) request.getAttribute(PaymentStatusSummary.PAYMENT_STATUS_SUMMARY);
%>

<jsp:include page="../../top.jsp" >
<jsp:param name="level1" value=""/>
<jsp:param name="isReskin" value="${isReskin}"/>
</jsp:include>

<c:if test="${isReskin}">
<div class="page">
Expand Down Expand Up @@ -244,9 +297,7 @@
</div><!-- // end .page -->
</c:if>

<jsp:include page="/foot.jsp" >
<jsp:param name="isReskin" value="${isReskin}"/>
</jsp:include>
<div id="footerNav"></div>

</body>

Expand Down