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

Commit 5fb3b6e

Browse files
authored
Merge pull request #1783 from OpenBazaar/pinnedAndQuantity
Pinned, Quantity and Hidden
2 parents 95f0863 + c8eb9f4 commit 5fb3b6e

File tree

15 files changed

+187
-48
lines changed

15 files changed

+187
-48
lines changed

css/obBase.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4820,12 +4820,12 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
48204820

48214821
.buyAddressWrapper {
48224822
padding: 15px;
4823-
overflow: hidden;
4823+
word-wrap: break-word;
48244824
}
48254825

4826-
.buyAddressWrapper > div {
4827-
overflow: hidden;
4828-
text-overflow: ellipsis;
4826+
.payAddressWrapper {
4827+
padding: 20px 15px;
4828+
word-wrap: break-word;
48294829
}
48304830

48314831
/*========== utility classes ==========*/

js/languages/en-US.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@
130130
"ReturnsPolicy": "Returns Policy",
131131
"Tags": "Tags",
132132
"Keywords": "Keywords",
133+
"MaxQuantityDisplay": "Up to %{quantity} are available per purchase.",
134+
"MaxQuantityDisplayShort": "Max of %{quantity}",
135+
"NoQuantityDisplay": "This listing is not currently available for purchase.",
133136
"ShipsFrom": "Ships From",
134137
"ShipsFrom2": "Ships From %{country}",
135138
"ShipsTo": "Ships To",
@@ -190,7 +193,14 @@
190193
"Price": "Price",
191194
"Type": "Type",
192195
"Condition": "Condition",
196+
"MaxQuantity": "Max Quantity",
197+
"MaxQuantityPlaceholder": "The Maximum Per Purchase (0 to 999998)",
198+
"MaxQuantityHelp": "If the maximum is zero, this listing will be visible but will not be purchasable.",
193199
"NSFW": "Adult or Offensive Content",
200+
"Pinned": "Pinned",
201+
"PinnedHelp": "Pinned listings will be shown in your store before unpinned listings.",
202+
"Hidden": "Hidden",
203+
"HiddenHelp": "Only you can see the hidden listings in your store. The listing page can still be viewed via its guid.",
194204
"Social": "Social",
195205
"Theme": "Theme",
196206
"Listing": "Listing",

js/templates/buyAddresses.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<%= address.state %> <%= address.postal_code %>
2626
</div>
2727
<div>
28-
<%= address.other %>
28+
<%= address.alternate_contact %>
2929
</div>
3030
<div>
3131
<%= address.displayCountry %>
@@ -78,7 +78,7 @@
7878
<%= address.state %> <%= address.postal_code %>
7979
</div>
8080
<div>
81-
<%= address.other %>
81+
<%= address.alternate_contact %>
8282
</div>
8383
<div>
8484
<%= address.displayCountry %>

js/templates/buyDetails.html

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,33 @@
3232
<div class="flexCol-2">
3333
<div class="rowItem padding0 paddingTop20">
3434
<form id="buyWizardQuantity" class="positionWrapper">
35-
<input type="number" step="1" min="1" class="fieldItem spinButtons js-buyWizardQuantity border1 custCol-border marginTop4" value="1"/>
35+
<input type="number"
36+
step="1"
37+
min="1"
38+
name="max_quantity"
39+
max="<%= ob.vendor_offer.listing.metadata.max_quantity %>"
40+
class="fieldItem spinButtons js-buyWizardQuantity border1 custCol-border marginTop4"
41+
value="1"/>
3642
<div class="numberSpinnerUp"></div>
3743
<div class="numberSpinnerDown"></div>
3844
</form>
45+
<% if(ob.vendor_offer.listing.metadata.max_quantity && ob.vendor_offer.listing.metadata.max_quantity < 999999) { %>
46+
<div class="textOpacity75 fontSize10 txt-center rowTop5">
47+
<%= polyglot.t('MaxQuantityDisplayShort', {quantity: ob.vendor_offer.listing.metadata.max_quantity}) %>
48+
</div>
49+
<% } %>
3950
</div>
4051
</div>
4152
<div class="flexCol-4 overflowHidden">
4253
<div class="rowItem padding5 paddingTop20 alignRight marginTop20">
43-
<span class="noOverflow fontSize13 js-buyWizardBTCPrice"></span>
44-
<span class="noOverflow textOpacity75 fontSize13 js-buyWizardPrice">
45-
<% if(ob.userCurrencyCode != 'BTC'){ %>
46-
(<%= ob.displayPrice %>)
47-
<% } %>
48-
</span>
54+
<div>
55+
<span class="noOverflow fontSize13 js-buyWizardBTCPrice"></span>
56+
<span class="noOverflow textOpacity75 fontSize13 js-buyWizardPrice">
57+
<% if(ob.userCurrencyCode != 'BTC'){ %>
58+
(<%= ob.displayPrice %>)
59+
<% } %>
60+
</span>
61+
</div>
4962
</div>
5063
</div>
5164
</div>
@@ -54,7 +67,7 @@
5467
<% if( ob.vendor_offer.listing.metadata.category === "physical good" ) { %>
5568
<div class="flexRow custCol-border borderBottom">
5669
<div class="flexCol-8">
57-
<div class="rowItem padding2015">
70+
<div class="payAddressWrapper">
5871
<div class="table">
5972
<div>
6073
<div class="thumbnail-large-slim">
@@ -67,8 +80,11 @@
6780
<% if(ob.selectedAddress) { %>
6881
<div class="marginBottom2"><%= ob.selectedAddress.name %></div>
6982
<div class="marginBottom2"><%= ob.selectedAddress.street %></div>
70-
<div class="marginBottom2"><%= ob.selectedAddress.city %>, <%= ob.selectedAddress.state %> <%= ob.selectedAddress.postal_code %></div>
71-
<div class="marginBottom2"><%= ob.selectedAddress.other %></div>
83+
<div class="marginBottom2">
84+
<%= ob.selectedAddress.city %><% if(ob.selectedAddress.state || ob.selectedAddress.postal_code && ob.selectedAddress.city){ %>,<% } %>
85+
<%= ob.selectedAddress.state %> <%= ob.selectedAddress.postal_code %>
86+
</div>
87+
<div class="marginBottom2"><%= ob.selectedAddress.alternate_contact %></div>
7288
<div><%= ob.selectedAddress.displayCountry %></div>
7389
<% } %>
7490
</div>

js/templates/item.html

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ <h2 class="page-contractTitle noOverflow textOpacity1 marginLeft20 marginBottom8
4848
<% } %>
4949
</li>
5050
<li class="border0 alignCenter padding10 height70 marginBottom12">
51-
<div class="btn btn-light btn-buyNow js-buyButton custCol-secondary">
51+
<div class="btn btn-light btn-buyNow js-buyButton custCol-secondary
52+
<% if(ob.vendor_offer.listing.metadata.max_quantity === 0) { %>disabled<% } %>">
5253
<%= polyglot.t('BUYNOW') %>
5354
</div>
5455
</li>
@@ -58,8 +59,20 @@ <h2 class="page-contractTitle noOverflow textOpacity1 marginLeft20 marginBottom8
5859
</li>
5960
<% } %>
6061
</ul>
61-
</div>
6262

63+
<% if(ob.vendor_offer.listing.metadata.max_quantity && ob.vendor_offer.listing.metadata.max_quantity < 999999 || ob.vendor_offer.listing.metadata.max_quantity === 0) { %>
64+
<div class="flexRow width100">
65+
<div class="width100 fontSize15 marginLeft10 textOpacity75 row10 txt-center">
66+
<% if(ob.vendor_offer.listing.metadata.max_quantity > 0) { %>
67+
<h5><%= polyglot.t('MaxQuantityDisplay', {quantity: ob.vendor_offer.listing.metadata.max_quantity}) %></h5>
68+
<% } else { %>
69+
<h5><%= polyglot.t('NoQuantityDisplay') %></h5>
70+
<% } %>
71+
</div>
72+
</div>
73+
<% } %>
74+
75+
</div>
6376

6477
<div class="width100 custCol-text borderBottom paddingBottom12 paddingLeft6 custCol-border">
6578
<div class="flexRow width100 row20">
@@ -257,4 +270,3 @@ <h4 class="txt-center row20 fontSize14 textOpacity75"><%= polyglot.t('NoDetailsS
257270
</div>
258271
</div>
259272

260-
</div>

js/templates/itemEdit.html

Lines changed: 93 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,22 @@ <h5><%= polyglot.t('Listing') %></h5>
6060
</div>
6161
</div>
6262
<div class="flexRow custCol-border">
63-
<div class="flexCol-3 borderRight custCol-border">
63+
<div class="flexCol-4 borderRight custCol-border">
6464
<div class="fieldItem">
6565
<label for="inputName"><%= polyglot.t('Title') %></label>
6666
</div>
6767
</div>
68-
<div class="flexCol-9">
68+
<div class="flexCol-8">
6969
<input name="title" id="inputName" type="text" class="fieldItem custCol-text" required placeholder="<%= polyglot.t('TitlePlaceholder') %>" value="<%= ob.vendor_offer.listing.item.title %>">
7070
</div>
7171
</div>
7272
<div class="flexRow custCol-border">
73-
<div class="flexCol-3 borderRight custCol-border">
73+
<div class="flexCol-4 borderRight custCol-border">
7474
<div class="fieldItem">
7575
<label for="inputType"><%= polyglot.t('Type') %></label>
7676
</div>
7777
</div>
78-
<div class="flexCol-9">
78+
<div class="flexCol-8">
7979
<div class="fieldItem padding0">
8080
<div class="fieldItem-selectWrapper">
8181
<select name="metadata_category" id="inputType" class="custCol-text">
@@ -88,7 +88,7 @@ <h5><%= polyglot.t('Listing') %></h5>
8888
</div>
8989
</div>
9090
<div class="flexRow custCol-border js-inputParent zIndex1">
91-
<div class="flexCol-3 borderRight custCol-border">
91+
<div class="flexCol-4 borderRight custCol-border">
9292
<div class="fieldItem">
9393
<label for="priceLocal">
9494
<%= polyglot.t('Price') %> (<%= ob.userCurrencyCode %>)
@@ -114,9 +114,9 @@ <h5><%= polyglot.t('Listing') %></h5>
114114
<% } %>
115115
>
116116
</div>
117-
<div class="flexCol-5">
117+
<div class="flexCol-4">
118118
<span class="fieldItem pull-right">
119-
<span class="tooltip" data-tooltip="<%= polyglot.t('MinimumPrice') %>">
119+
<span class="tooltip tooltip-left" data-tooltip="<%= polyglot.t('MinimumPrice') %>">
120120
<span class="txt-placeholder custCol-text">
121121
<%= polyglot.t('MinimumIs', { amount: ob.userCurrencyCode == "BTC" ? ob.intlNumFormat(minBTCPrice, 4) : ob.intlNumFormat(window.currentBitcoin * minBTCPrice, 4) }) %>
122122
<span class="ion-help-circled fontSize12"></span>
@@ -125,13 +125,41 @@ <h5><%= polyglot.t('Listing') %></h5>
125125
</span>
126126
</div>
127127
</div>
128+
<div class="flexRow custCol-border">
129+
<div class="flexCol-4 borderRight custCol-border">
130+
<div class="fieldItem">
131+
<label for="inputCondition"><%= polyglot.t('MaxQuantity') %></label>
132+
</div>
133+
</div>
134+
<div class="flexCol-7">
135+
<% maxQ = ob.vendor_offer.listing.metadata.max_quantity %>
136+
<input type="number"
137+
step="any"
138+
min="0"
139+
max="999998"
140+
name="max_quantity"
141+
id="inputMaxQuantity"
142+
placeholder="<%= polyglot.t('MaxQuantityPlaceholder') %>"
143+
class="fieldItem custCol-text"
144+
value="<%= maxQ && maxQ < 999999 ? maxQ : '' %>"/>
145+
</div>
146+
<div class="flexCol-1">
147+
<span class="fieldItem">
148+
<span class="tooltip tooltip-left" data-tooltip="<%= polyglot.t('MaxQuantityHelp') %>">
149+
<span class="txt-placeholder custCol-text">
150+
<span class="ion-help-circled fontSize12"></span>
151+
</span>
152+
</span>
153+
</span>
154+
</div>
155+
</div>
128156
<div class="flexRow custCol-border js-shippingRow">
129-
<div class="flexCol-3 borderRight custCol-border">
157+
<div class="flexCol-4 borderRight custCol-border">
130158
<div class="fieldItem">
131159
<label for="inputCondition"><%= polyglot.t('Condition') %></label>
132160
</div>
133161
</div>
134-
<div class="flexCol-9">
162+
<div class="flexCol-8">
135163
<div class="fieldItem padding0">
136164
<div class="fieldItem-selectWrapper">
137165
<select name="condition" id="inputCondition" class="custCol-text">
@@ -146,7 +174,7 @@ <h5><%= polyglot.t('Listing') %></h5>
146174
</div>
147175
</div>
148176
<div class="flexRow custCol-border">
149-
<div class="flexCol-3 borderRight custCol-border">
177+
<div class="flexCol-4 borderRight custCol-border">
150178
<div class="fieldItem">
151179
<label for="nsfwFalse"><%= polyglot.t('NSFW') %></label>
152180
</div>
@@ -159,7 +187,59 @@ <h5><%= polyglot.t('Listing') %></h5>
159187
</div>
160188
</div>
161189
<div class="flexRow custCol-border">
162-
<div class="flexCol-3 borderRight custCol-border">
190+
<div class="flexCol-4 borderRight custCol-border">
191+
<div class="fieldItem">
192+
<label for="nsfwFalse"><%= polyglot.t('Pinned') %></label>
193+
</div>
194+
</div>
195+
<div class="flexCol-7">
196+
<div class="fieldItem">
197+
<input type="radio" class="fieldItem" id="pinnedTrue" name="pinned" value="true"
198+
<% if(ob.vendor_offer.listing.metadata.pinned){ %>checked<% } %> />
199+
<label for="pinnedTrue" class="radioLabel"><%= polyglot.t('Yes') %></label>
200+
<input type="radio" class="fieldItem" id="pinnedFalse" name="pinned" value="false"
201+
<% if(!ob.vendor_offer.listing.metadata.pinned){ %>checked<% } %> />
202+
<label for="pinnedFalse" class="radioLabel"><%= polyglot.t('No') %></label>
203+
</div>
204+
</div>
205+
<div class="flexCol-1">
206+
<span class="fieldItem">
207+
<span class="tooltip tooltip-left" data-tooltip="<%= polyglot.t('PinnedHelp') %>">
208+
<span class="txt-placeholder custCol-text">
209+
<span class="ion-help-circled fontSize12"></span>
210+
</span>
211+
</span>
212+
</span>
213+
</div>
214+
</div>
215+
<div class="flexRow custCol-border">
216+
<div class="flexCol-4 borderRight custCol-border">
217+
<div class="fieldItem">
218+
<label for="nsfwFalse"><%= polyglot.t('Hidden') %></label>
219+
</div>
220+
</div>
221+
<div class="flexCol-7">
222+
<div class="fieldItem">
223+
<input type="radio" class="fieldItem" id="hiddenTrue" name="hidden" value="true"
224+
<% if(ob.vendor_offer.listing.metadata.hidden){ %>checked<% } %> />
225+
<label for="hiddenTrue" class="radioLabel"><%= polyglot.t('Yes') %></label>
226+
<input type="radio" class="fieldItem" id="hiddenFalse" name="hidden" value="false"
227+
<% if(!ob.vendor_offer.listing.metadata.hidden){ %>checked<% } %> />
228+
<label for="hiddenFalse" class="radioLabel"><%= polyglot.t('No') %></label>
229+
</div>
230+
</div>
231+
<div class="flexCol-1">
232+
<span class="fieldItem">
233+
<span class="tooltip tooltip-left" data-tooltip="<%= polyglot.t('HiddenHelp') %>">
234+
<span class="txt-placeholder custCol-text">
235+
<span class="ion-help-circled fontSize12"></span>
236+
</span>
237+
</span>
238+
</span>
239+
</div>
240+
</div>
241+
<div class="flexRow custCol-border">
242+
<div class="flexCol-4 borderRight custCol-border">
163243
<div class="fieldItem">
164244
<label for="inputSku"><%= polyglot.t('SKU') %> </label>
165245
</div>
@@ -169,13 +249,13 @@ <h5><%= polyglot.t('Listing') %></h5>
169249
</div>
170250
</div>
171251
<div class="flexRow custCol-border">
172-
<div class="flexCol-3 borderRight custCol-border">
252+
<div class="flexCol-4 borderRight custCol-border">
173253
<div class="fieldItem">
174254
<label for="inputDescription"><%= polyglot.t('Description') %></label>
175255
<div class="note rowTop5"><%= polyglot.t('HighlightToStyle') %></div>
176256
</div>
177257
</div>
178-
<div class="flexCol-9" data-label="<%= polyglot.t('Description') %>">
258+
<div class="flexCol-8" data-label="<%= polyglot.t('Description') %>">
179259
<textarea name="description"
180260
rows="8"
181261
class="fieldItem-textarea custCol-text height130 customThemeScrollbar"

js/templates/itemShort.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
%>
77

88

9-
<div class="gridItem clearfix custCol-border">
9+
<div class="gridItem clearfix custCol-border <% if(ob.hidden){ %>div-fadeExtra<% } %>">
1010

1111
<div class="itemImg row10 color-secondary custCol-secondary overflowHidden js-item" data-id="<%= ob.contract_hash %>">
1212
<div class="itemImg <% if(ob.cloak){ %> nsfw <% } %>" style="background-image: url(<%= ob.imageURL %>), url(imgs/defaultItem.png);"></div>
@@ -61,7 +61,7 @@
6161
<div class="btn-gridItemControl borderRight custCol-border js-itemShortEdit">
6262
<span class="ion-compose fontSize11 marginRight2 txt-fade"></span>
6363
<span class="txt-fade"><%= polyglot.t('Edit') %></span>
64-
</div>
64+
</div>
6565
<div class="btn-gridItemControl borderRight custCol-border js-itemShortClone">
6666
<span class="ion-ios-copy fontSize11 marginRight2 txt-fade"></span>
6767
<span class="txt-fade"><%= polyglot.t('Clone') %></span>
@@ -83,7 +83,7 @@
8383
<div class="btn-gridItemControl borderRight custCol-border js-item" data-id="<%= ob.contract_hash %>">
8484
<span class="ion-ios-pricetag fontSize10 marginRight2 txt-fade"></span>
8585
<span class="txt-fade"><%= polyglot.t('ViewListing') %></span>
86-
</div>
86+
</div>
8787
<% } %>
8888
</div>
8989
</div>

js/templates/settings.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('CurrentAddress') %><
846846
<% if(address.city && address.state || address.city && address.postal_code) print(",") %>
847847
<%= address.state %> <%= address.postal_code %>
848848
</div>
849-
<div><%= address.other %></div>
849+
<div><%= address.alternate_contact %></div>
850850
<div><%= address.displayCountry %></div>
851851
</div>
852852

js/templates/transactionModal.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ <h3 class="txt-bright"><%= polyglot.t('CheckExchanges') %> </h3>
773773
<div><%- ob.buyer_order.order.shipping.ship_to %></div>
774774
<div><%- ob.buyer_order.order.shipping.address %></div>
775775
<div><%- ob.buyer_order.order.shipping.city %> <%- ob.buyer_order.order.shipping.state %> <%- ob.buyer_order.order.shipping.postal_code %></div>
776-
<div><%- ob.buyer_order.order.shipping.other %></div>
776+
<div><%- ob.buyer_order.order.alternate_contact %></div>
777777
<div><%= polyglot.t('countries.' + ob.buyer_order.order.shipping.country) %></div>
778778
</div>
779779
</div>

0 commit comments

Comments
 (0)