Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1211 from OpenBazaar/checkModCoin
Browse files Browse the repository at this point in the history
Don't allow adding moderators without compatible coins
  • Loading branch information
rmisio authored Jan 29, 2018
2 parents a151b16 + 3155819 commit 9256d6a
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 20 deletions.
5 changes: 4 additions & 1 deletion js/languages/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@
"termsOfService": "Terms of Service",
"addAsModeratorButton": "Add as Moderator",
"disclaimer": "**The moderator service charge only applies when a dispute arises.",
"languages": "Languages"
"languages": "Languages",
"currenciesSupported": "Currencies Supported",
"noCoinSupport": "This moderator does not support %{coin}."
},
"about": {
"linkText": "About OpenBazaar",
Expand Down Expand Up @@ -917,6 +919,7 @@
"type": "Type: %{type}",
"condition": "Condition: %{condition}",
"tags": "Tags",
"paymentsAccepted": "Payments Accepted",
"noTags": "No tags entered",
"buyNow": "BUY NOW",
"description": "Description",
Expand Down
8 changes: 4 additions & 4 deletions js/templates/modals/listingDetail/listing.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<div class="flex gutterHLg">
<h2 class="txUnb flexExpand"><%= ob.item.title %></h2>
<h2 class="txUnb flexNoShrink js-price">
<%=
<%=
ob.currencyMod.formattedCurrency(
ob.item.price,
ob.metadata.pricingCurrency,
Expand Down Expand Up @@ -104,7 +104,7 @@ <h2 class="txUnb flexNoShrink js-price">
unpurchaseable = false;
}

let unpurchasableMarkup = `<div class="flexHRight clrTErr">${ob.polyT('listingDetail.unableToPurchase.unpurchaseable') } &nbsp;<span class="toolTip" data-tip="${tip}" style="text-align: left"><span class="ion-alert-circled clrTErr"></span></span></div>`;
let unpurchasableMarkup = `<div class="flexHRight clrTErr">${ob.polyT('listingDetail.unableToPurchase.unpurchaseable') } &nbsp;<span class="toolTip" data-tip="${tip}" style="text-align: left"><span class="ion-alert-circled clrTErr"></span></span></div>`;
%>
<button class="btnHg clrBAttGrad clrBrDec1 clrTOnEmph js-purchaseBtn <%= buyNowClass %>">
<%= ob.polyT('listingDetail.buyNow') %>
Expand Down Expand Up @@ -136,7 +136,7 @@ <h5><%= ob.polyT('listingDetail.tags') %></h5>
}); %>
<% if(!ob.item.tags.length) { print(`<i class="clrT2">${ob.polyT('listingDetail.noTags')}</i>`) } %>
</div>
<h5>Payments Accepted</h5>
<h5><%= ob.polyT('listingDetail.paymentsAccepted') %></h5>
<ul class="unstyled">
<% ob.metadata.acceptedCurrencies.forEach(cur => {
const curData = ob.currencyMod.getCryptoCurByCode(cur);
Expand All @@ -146,7 +146,7 @@ <h5>Payments Accepted</h5>
<%= ob.currencyMod.cryptoIcon({ code: curData.code }) %>
<div class="acceptedCurName"><%= ob.polyT(`cryptoCurrencies.${curData.code}`) %></div>
</li>
<% }
<% }
}) %>
</ul>
</div>
Expand Down
41 changes: 33 additions & 8 deletions js/templates/modals/moderatorDetails.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,25 @@
</div>
</div>
<div class="contentBox mDetailBox padMd clrP clrBr clrSh3 tx5">
<div class="rowMd">
<h4><%= ob.polyT('moderatorDetails.currenciesSupported') %></h4>
<ul class="unstyled">
<% ob.moderatorInfo.acceptedCurrencies.forEach(cur => {
const curData = ob.currencyMod.getCryptoCurByCode(cur);
if (curData) { %>
<li class="flexVCent gutterHSm clrBr">
<span class="ion-ios-checkmark-empty clrTEm tx2"></span>
<%= ob.currencyMod.cryptoIcon({ code: curData.code }) %>
<div class="acceptedCurName"><%= ob.polyT(`cryptoCurrencies.${curData.code}`) %></div>
</li>
<% }
}) %>
</ul>
</div>
<div class="rowLg">
<h4><%= ob.polyT('moderatorDetails.languages') %></h4>
<% ob.modLanguages.forEach(lang => { %>
<div class="rowSm txSm"><%= lang %></div>
<div class="rowSm txSm"><%= lang %></div>
<% }); %>
</div>
<div class="row">
Expand All @@ -57,13 +72,23 @@ <h4><%= ob.polyT('moderatorDetails.termsOfService') %></h4>
</div>
<div class="flexCol flexHCent gutterV">
<% if (ob.cardState !== 'selected' && (!ob.ownMod || ob.purchase)) { %>
<button class="btn clrP clrBr js-addAsModerator">
<% if (ob.purchase) { %>
<%= ob.polyT('purchase.chooseModerator') %>
<% } else { %>
<%= ob.polyT('moderatorDetails.addAsModeratorButton') %>
<% } %>
</button>
<%
const curSupported = ob.moderatorInfo.acceptedCurrencies.includes(
ob.currencyMod.getServerCurrency().isTestnet ? ob.currencyMod.getServerCurrency().testnetCode : ob.currencyMod.getServerCurrency().code
);
if (curSupported) { %>
<button class="btn clrP clrBr js-addAsModerator">
<% if (ob.purchase) { %>
<%= ob.polyT('purchase.chooseModerator') %>
<% } else { %>
<%= ob.polyT('moderatorDetails.addAsModeratorButton') %>
<% } %>
</button>
<% } else { %>
<strong>
<%= ob.polyT('moderatorDetails.noCoinSupport', { coin: ob.currencyMod.getServerCurrency().code }) %>
</strong>
<% } %>
<% } %>
<div>
<em class="tx6 clrT2"><%= ob.polyT('moderatorDetails.disclaimer') %></em>
Expand Down
18 changes: 11 additions & 7 deletions js/templates/userCard.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<% } %>>
<div class="blockedOverlay clrP flexCent tx5">
<div><%= ob.polyT('userShort.blockedUserOverlayText') %></div>
</div>
</div>
<div class="userIconWrap">
<a class="userIcon disc clrBr2 clrSh1"
<% var avatarHash = ob.avatarHashes ? ob.isHiRez() ? ob.avatarHashes.small : ob.avatarHashes.tiny : ''; %>
Expand All @@ -23,12 +23,16 @@
<% if (!ob.hideControls) { %>
<div class="userControls flexHRight gutterHSm">
<% if (!ob.ownGuid) { %>
<% if (ob.moderator) { %>
<%= ob.processingButton({
className: `iconBtnSm clrP clrBr toolTipNoWrap toolTipTop js-mod ${ob.ownMod ? 'active' : ''}`,
btnText: '<i class="ion-briefcase"></i>',
attrs: `data-tip="${ob.getModTip(ob.ownMod)}"`,
}) %>
<%
const curSupported = ob.moderator && ob.moderatorInfo.acceptedCurrencies.includes(
ob.currencyMod.getServerCurrency().isTestnet ? ob.currencyMod.getServerCurrency().testnetCode : ob.currencyMod.getServerCurrency().code
);
if (curSupported) { %>
<%= ob.processingButton({
className: `iconBtnSm clrP clrBr toolTipNoWrap toolTipTop js-mod ${ob.ownMod ? 'active' : ''}`,
btnText: '<i class="ion-briefcase"></i>',
attrs: `data-tip="${ob.getModTip(ob.ownMod)}"`,
}) %>
<% } %>
<%= ob.processingButton({
className: `iconBtnSm clrP clrBr toolTipNoWrap toolTipTop js-follow ${ob.followedByYou ? 'active' : ''}`,
Expand Down

0 comments on commit 9256d6a

Please sign in to comment.