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

Commit 6cde946

Browse files
committed
Adds clear all button to the Ships To field
Closes #1702
1 parent 550089e commit 6cde946

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

css/obBase.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4977,6 +4977,7 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
49774977
background: none;
49784978
box-shadow: none;
49794979
border: none;
4980+
padding: 0;
49804981
}
49814982

49824983
#ov1 .overflowHidden {

js/languages/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"KeywordsHelperText": "Adding tags helps your listing to be discovered in the market. You can only have one of each tag, and a maximum of 10 tags, separated by commas or the enter key.",
9898
"ExpirationDateHelperText": "Set a date for the listing to automatically be pulled from your store.",
9999
"ClearExpirationDate": "Clear Expiration Date",
100+
"ClearShippingLocations": "Clear All",
100101
"ReturnPolicy": "Return Policy",
101102
"TermsAndConditions": "Terms and Conditions",
102103
"Photos": "Photos",

js/templates/itemEdit.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ <h5><%= polyglot.t('Shipping') %></h5>
208208
<div class="flexCol-4 borderRight custCol-border">
209209
<div class="fieldItem">
210210
<label for="shipsTo"><%= polyglot.t('ShipsTo') %></label>
211+
<div>
212+
<a class="btn btn-txtOnly btn-small js-clearShipsTo">
213+
<%= polyglot.t('ClearShippingLocations') %></a>
214+
</div>
211215
</div>
212216
</div>
213217
<div class="flexCol-8">

js/views/itemEditVw.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ module.exports = baseVw.extend({
2727
'blur textarea': 'validateInput',
2828
'focus #inputExpirationDate': 'addDefaultTime',
2929
'click .js-itemEditClearDate': 'clearDate',
30-
'change #shipsToRegions': 'selectRegions'
30+
'change #shipsToRegions': 'selectRegions',
31+
'click .js-clearShipsTo': 'clearShipsTo'
3132
},
3233

3334
MAX_PHOTOS: 10,
@@ -210,8 +211,6 @@ module.exports = baseVw.extend({
210211
saveOnBlur: true,
211212
placeholder: window.polyglot.t('KeywordsPlaceholder'),
212213
onBeforeTagAdd: (event, tag) => {
213-
console.log(tag);
214-
console.log(tag.length);
215214
if(tag.length > 40) {
216215
app.simpleMessageModal.open({
217216
title: window.polyglot.t('errorMessages.tagIsTooLongHeadline'),
@@ -302,6 +301,10 @@ module.exports = baseVw.extend({
302301
this.$('.chosenRegions').trigger('chosen:updated');
303302
},
304303

304+
clearShipsTo: function(){
305+
this.$('#shipsTo').val("").trigger('chosen:updated');
306+
},
307+
305308
addDefaultTime: function(){
306309
var timeInput = this.$el.find('#inputExpirationDate'),
307310
currentValue = timeInput.val();
@@ -314,7 +317,8 @@ module.exports = baseVw.extend({
314317
shipsToChange: function(e){
315318
var newVal = $(e.target).val() || [],
316319
newSelection = __.difference(newVal, this.prevShipsToVal),
317-
wwNewIndex = newVal.indexOf('ALL');
320+
wwNewIndex = newVal.indexOf('ALL'),
321+
$shipsToWrapper = this.$('.js-shipToWrapper');
318322

319323
//is the new value different from ALL?
320324
if (newSelection[0] != "ALL"){
@@ -331,9 +335,9 @@ module.exports = baseVw.extend({
331335
this.prevShipsToVal = newVal;
332336

333337
if (newVal.length) {
334-
this.$('.js-shipToWrapper').removeClass('invalid');
338+
$shipsToWrapper.removeClass('invalid');
335339
} else {
336-
this.$('.js-shipToWrapper').addClass('invalid');
340+
$shipsToWrapper.addClass('invalid');
337341
}
338342
},
339343

0 commit comments

Comments
 (0)