Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 1a02ab1

Browse files
committed
Merge pull request #1457 from OpenBazaar/discoverEnhancements
Discover enhancements
2 parents 4206105 + 62cc534 commit 1a02ab1

File tree

5 files changed

+141
-10
lines changed

5 files changed

+141
-10
lines changed

css/obBase.css

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,32 @@ form {
477477
flex-grow: 1;
478478
}
479479

480+
.listingType {
481+
background-color: #252525;
482+
color: #ffffff;
483+
position: absolute;
484+
padding: 6px;
485+
top: 40px;
486+
right: 40px;
487+
font-size: 11px;
488+
font-weight: 500;
489+
transition: top .3s cubic-bezier(0, 0, 0.2, 1);
490+
}
491+
492+
.listingDoesNotShipToYou {
493+
background-color: rgba(37, 37, 37, 0.65);
494+
/*border-radius: 20px;*/
495+
height: 20px;
496+
left: 32px;
497+
line-height: 20px;
498+
padding: 8px 4px;
499+
position: absolute;
500+
text-align: center;
501+
top: calc(50% - 32px);
502+
width: 242px;
503+
transition: top .3s cubic-bezier(0, 0, 0.2, 1);
504+
}
505+
480506
.noPointerEvents {
481507
pointer-events: none;
482508
}
@@ -533,6 +559,17 @@ form {
533559
padding-top: 20px;
534560
}
535561

562+
.userPage-subViews .gridItem:hover > .listingType,
563+
.homeView .gridItem:hover > .listingType {
564+
opacity: 1;
565+
top: 26px;
566+
}
567+
568+
.userPage-subViews .gridItem:hover > .listingDoesNotShipToYou,
569+
.homeView .gridItem:hover > .listingDoesNotShipToYou {
570+
top: calc(50% - 46px);
571+
}
572+
536573
.userPage-subViews .gridItem:hover .gridItemControls,
537574
.homeView .gridItem:hover .gridItemControls{
538575
opacity: 1;
@@ -4045,6 +4082,14 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
40454082
top: 100%;
40464083
}
40474084
4085+
.tooltip.tooltip-box2:hover:after {
4086+
height: auto;
4087+
width: 200px;
4088+
white-space: normal;
4089+
bottom: auto;
4090+
top: 100%;
4091+
}
4092+
40484093
.tooltip.tooltip-box.tooltip-boxUp:hover:after {
40494094
bottom: 120%;
40504095
}
@@ -4261,7 +4306,53 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
42614306
42624307
}
42634308
4264-
/* protect customize controls from custom page styles */
4309+
.violatorTR {
4310+
/* sets triangle to be in the top right corner */
4311+
/* must be given equal height and width properties */
4312+
/* text or icons inside the violator should have positionTopRight and a right and top margin or padding based on the violator size */
4313+
position: absolute;
4314+
top: 0;
4315+
right: 0;
4316+
-webkit-clip-path: polygon(50% 0, 100% 0, 100% 50%);
4317+
z-index: 1; /* this shouldn't need to be higher. Make it the last element in its container */
4318+
text-align: center;
4319+
}
4320+
4321+
.violator1 {
4322+
width: 50px;
4323+
height: 50px;
4324+
background: #215175; /* this should be overridden with a color class */
4325+
color: #fff;
4326+
}
4327+
4328+
.violatorTxt{
4329+
/* use on content of a violator to rotate it to match the violator */
4330+
display: block;
4331+
transform: rotate(45deg);
4332+
}
4333+
4334+
.listingTypeDigital:before {
4335+
color: #EFEF4C;
4336+
content: "\f137";
4337+
font-family: Ionicons;
4338+
font-size: 12px;
4339+
}
4340+
4341+
.listingTypePhysical:before {
4342+
color: #805C17;
4343+
content: "\f318";
4344+
font-family: Ionicons;
4345+
font-size: 12px;
4346+
}
4347+
4348+
.listingTypeService:before {
4349+
color: #DEDEDE;
4350+
content: "\f2ad";
4351+
font-family: Ionicons;
4352+
font-size: 12px;
4353+
}
4354+
4355+
/* protect customize controls from custom page styles */
42654356
#ov1 #customizeControls .labelWrap {
42664357
height: 40px;
42674358
border-radius: 0;
@@ -4517,11 +4608,13 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
45174608
#ov1 .positionBottom {
45184609
position: absolute;
45194610
bottom: 0;
4611+
right: 0;
45204612
}
45214613

45224614
#ov1 .positionTop {
45234615
position: absolute;
45244616
top: 0;
4617+
right: 0;
45254618
}
45264619

45274620
#ov1 .positionTopRight {

js/languages/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@
333333
"Avatar": "Avatar",
334334
"AdditionalPaymentData": "Additional payment data",
335335
"AdditionalPaymentDataInfo": "Include name of purchase and order number in payment QR code?",
336+
"ShippableHelp": "This product can be shipped to one of your currently saved addresses. Add more addresses in the Settings/Addresses section to be able to purchase more listings.",
336337
"firewall": {
337338
"Open": "Open",
338339
"Restricted": "Restricted",

js/templates/itemShort.html

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
1+
<%
2+
var shipsToYou = false;
3+
if(_.intersection(ob.userCountries, ob.ships_to).length > 0 || ob.ships_to == "ALL" || ob.ships_to.length == 0){
4+
shipsToYou = true;
5+
}
6+
%>
7+
8+
19
<div class="gridItem clearfix custCol-border">
2-
<div class="itemImg row10 color-secondary custCol-secondary overflowHidden js-item" data-id="<%= ob.contract_hash %>">
10+
11+
<div class="itemImg row10 color-secondary custCol-secondary overflowHidden js-item <% if(!shipsToYou){ %>textOpacity25<% } %>" data-id="<%= ob.contract_hash %>">
312
<div class="itemImg <% if(ob.cloak){ %> nsfw <% } %>" style="background-image: url(<%= ob.imageURL %>), url(imgs/defaultItem.png);"></div>
413
</div>
5-
<div class="table">
14+
<div class="table <% if(!shipsToYou){ %>textOpacity25<% } %>">
615
<div>
716
<% if(ob.showAvatar) { %>
817
<div class="thumbnail-small js-avatar tooltip" data-tooltip="<% if(ob.handle) { %><%= ob.handle %><% }else{ %><%= ob.guid %><% } %>" data-handle="<%= ob.handle %>"
918
style="background-image: <% if(ob.avatar_hash && ob.avatarURL) { %> url(<%= ob.avatarURL %>), <% } %>url(imgs/defaultUser.png);"></div>
1019
<% } %>
11-
<div class="js-item pad8Left <% if(ob.title.length >= 30) { %>tooltip<% } %>" <% if(ob.title.length >= 30) { %>data-tooltip="<%= ob.title.substring(0, 40) %>"<% } %> data-id="<%= ob.contract_hash %>">
12-
<div class="textSize14px noOverflow textOpacity1 js-searchTitle"><%= ob.title %></div>
20+
<div class="js-item pad8Left <% if(ob.title.length >= 30) { %>tooltip<% } %>"
21+
<% if(ob.title.length >= 30) { %>data-tooltip="<%= ob.title.substring(0, 40) %>"<% } %> data-id="<%= ob.contract_hash %>">
22+
<div class="textSize14px noOverflow textOpacity1 js-searchTitle">
23+
<%= ob.title %>
24+
</div>
1325
<div class="textSize13px txt-fade textWeightNormal">
1426
<%= ob.intlNumFormat(ob.vendorBTCPrice, 4) %> BTC
1527
<% if(ob.userCurrencyCode != 'BTC'){ %>
16-
(<%= ob.displayPrice %>)
28+
(<%= ob.displayPrice %>)
1729
<% } %>
1830
</div>
1931
</div>
@@ -69,7 +81,22 @@
6981
</div>
7082
</div>
7183
</div>
84+
85+
<% if(ob.type){ %><!-- type is not yet implemented -->
86+
<div class="listingType borderRadius3 js-item <% if(shipsToYou){ %>textOpacity90<% }else{ %>textOpacity25<% } %>">
87+
<span class="<% print('listingType'+ob.type) %>"></span>
88+
</div>
89+
<% } %>
90+
91+
<% if(!shipsToYou && ob.ships_to.length != 0){ %>
92+
<div class="listingDoesNotShipToYou">
93+
<span class="ion-alert-circled fontSize11" style="color: #EFEF4C"></span>
94+
Does not ship to you
95+
</div>
96+
<% } %>
97+
7298
</div>
99+
73100
<% if(ob.cloak){ %>
74101
<div class="fullCentered btn btn-large custCol-secondary div-fade">
75102
NSFW

js/views/homeVw.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,11 @@ module.exports = baseVw.extend({
188188

189189
renderItem: function(item){
190190
var self = this,
191-
blocked;
191+
blocked,
192+
addressCountries = this.userModel.get('shipping_addresses').map(function(address){ return address.country }),
193+
userCountry = this.userModel.get('country');
194+
195+
addressCountries.push(userCountry);
192196

193197
//don't show if NSFW and filter is set to false
194198
if(item.listing.nsfw && !this.showNSFW) return;
@@ -201,6 +205,7 @@ module.exports = baseVw.extend({
201205
item.userID = item.guid;
202206
item.discover = true;
203207
item.ownGuid = this.userModel.get('guid');
208+
item.userCountries = addressCountries;
204209

205210

206211
item.ownFollowing = this.ownFollowing.indexOf(item.guid) != -1;

js/views/userPageVw.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,13 @@ module.exports = baseVw.extend({
722722
renderItems: function (model, skipNSFWmodal) {
723723
"use strict";
724724

725-
var self = this;
726-
var select = this.$el.find('.js-categories');
727-
var selectOptions = [];
725+
var self = this,
726+
select = this.$el.find('.js-categories'),
727+
selectOptions = [],
728+
addressCountries = this.userModel.get('shipping_addresses').map(function(address){ return address.country }),
729+
userCountry = this.userModel.get('country');
730+
731+
addressCountries.push(userCountry);
728732
skipNSFWmodal = skipNSFWmodal || this.skipNSFWmodal;
729733
model = model || [];
730734
__.each(model, function (arrayItem) {
@@ -742,6 +746,7 @@ module.exports = baseVw.extend({
742746
arrayItem.userID = self.pageID;
743747
arrayItem.ownPage = self.options.ownPage;
744748
arrayItem.onUserPage = true;
749+
arrayItem.userCountries = addressCountries;
745750
arrayItem.skipNSFWmodal = skipNSFWmodal;
746751
if (arrayItem.category != "" && self.$el.find('.js-categories option[value="' + arrayItem.category + '"]').length == 0){
747752
selectOptions[arrayItem.category] = true;

0 commit comments

Comments
 (0)