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

Commit 550089e

Browse files
committed
Closes #1732
1 parent 2c0128c commit 550089e

File tree

3 files changed

+33
-20
lines changed

3 files changed

+33
-20
lines changed

js/languages/en-US.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189
"Listing": "Listing",
190190
"Listings": "Listings",
191191
"ViewPage": "View page",
192-
"ClearConvo": "Clear conversation",
192+
"ClearConvo": "Clear conversation",
193193
"Pages": "Pages",
194194
"Page": "Page",
195195
"Language": "Language",
@@ -526,7 +526,9 @@
526526
"smtpServerSuccess": "SMTP Connection Success",
527527
"noSMTPConnection": "The connection to the SMTP server failed.",
528528
"badSMTPAuthentication": "The username/password combination used failed.",
529-
"goodSMTPAuthentication": "You have successfully connected to the SMTP server."
529+
"goodSMTPAuthentication": "You have successfully connected to the SMTP server.",
530+
"tagIsTooLongHeadline": "The tag is too long",
531+
"tagIsTooLongBody": "Tags cannot be more than 40 characters long."
530532
},
531533
"pageConnectingMessages": {
532534
"listingConnect": "Connecting to listing ${listing}",
@@ -985,7 +987,7 @@
985987
"WESTERN_SAHARA": "Western Sahara",
986988
"YEMEN": "Yemen",
987989
"ZAMBIA": "Zambia",
988-
"ZIMBABWE": "Zimbabwe"
990+
"ZIMBABWE": "Zimbabwe"
989991
},
990992
"chosenJS": {
991993
"noResultsText": "No results match",

js/templates/item.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ <h4><%= polyglot.t('Tags') %></h4>
112112
if(data.length < 100 && i < 11) {
113113
%>
114114
<a href="#home/products/<%= data.replace(/\s+/g, '') %>">
115-
<div class="btn-pill custCol-secondary floatLeft">
115+
<div class="btn-pill custCol-secondary floatLeft taggle">
116116
#<%= data.replace(/\s+/g, '') %>
117117
</div>
118118
</a>
@@ -178,7 +178,7 @@ <h4><%= polyglot.t('CanBeShippedTo') %></h4>
178178
<div class="padding20 marginBottom12 width100 alignCenter">
179179
<div class="spinnerWrapper">
180180
<i class="ion-android-sync spinner textSize24px"></i>
181-
</div>
181+
</div>
182182
</div>
183183
<% } %>
184184
<div class="js-reviewsContainer <% (ob.fetchingRatings) && print ('hide') %>"></div>

js/views/itemEditVw.js

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = baseVw.extend({
1919
'click #shippingFreeFalse': 'enableShippingPrice',
2020
'change .js-itemImageUpload': 'onImageFileChange',
2121
'dragover .js-photosModule': 'onPhotoDragOver',
22-
'dragleave .js-photosModule': 'onPhotoDragLeave',
22+
'dragleave .js-photosModule': 'onPhotoDragLeave',
2323
'drop .js-photosModule': 'onPhotoDrop',
2424
'change #inputType': 'changeType',
2525
'click .js-editItemDeleteImage': 'deleteImage',
@@ -48,15 +48,15 @@ module.exports = baseVw.extend({
4848
countryList.forEach(function(country) {
4949
allRegions.push(country.dataName);
5050
});
51-
51+
5252
var europeanUnion = [
5353
'AUSTRIA', 'BELGIUM', 'BULGARIA', 'CROATIA', 'CYPRUS', 'CZECH_REPUBLIC', 'DENMARK', 'ESTONIA',
5454
'FINLAND', 'FRANCE', 'GERMANY', 'GREECE', 'HUNGARY', 'IRELAND', 'ITALY', 'LATVIA', 'LITHUANIA', 'LUXEMBOURG',
55-
'MALTA', 'NETHERLANDS', 'POLAND', 'PORTUGAL', 'ROMANIA', 'SLOVAKIA', 'SLOVENIA', 'SPAIN', 'SWEDEN', 'UNITED_KINGDOM'
55+
'MALTA', 'NETHERLANDS', 'POLAND', 'PORTUGAL', 'ROMANIA', 'SLOVAKIA', 'SLOVENIA', 'SPAIN', 'SWEDEN', 'UNITED_KINGDOM'
5656
];
57-
57+
5858
var europeanEconomicArea = europeanUnion.concat(['ICELAND', 'LIECHTENSTEIN', 'NORWAY']);
59-
59+
6060
this.regions = {
6161
'ALL': allRegions,
6262
'EUROPEAN_UNION': europeanUnion,
@@ -67,15 +67,15 @@ module.exports = baseVw.extend({
6767
this.defaultDate = nowDate.getFullYear() + "-" + padTime(nowMonth) + "-" + padTime(nowDate.getDate()) + "T" + padTime(nowDate.getHours()) + ":" + padTime(nowDate.getMinutes());
6868
this.imgHashes = this.model.get('vendor_offer').listing.item.image_hashes;
6969
__.bindAll(this, 'validateDescription');
70-
70+
7171
self.model.set('expTime', self.model.get('vendor_offer').listing.metadata.expiry.replace(" UTC", ""));
7272

7373
this.listenTo(this.model, 'change:priceSet', this.render());
7474
},
7575

7676
render: function(){
7777
var self = this;
78-
78+
7979
loadTemplate('./js/templates/itemEdit.html', function(loadedTemplate) {
8080
var context = __.extend({}, self.model.toJSON(), {
8181
MAX_PHOTOS: self.MAX_PHOTOS,
@@ -120,7 +120,7 @@ module.exports = baseVw.extend({
120120
}).change(function(e){
121121
self.shipsToChange(e);
122122
});
123-
123+
124124
self.$('.chosenRegions').chosen({
125125
width: '100%',
126126
disable_search: true,
@@ -209,6 +209,17 @@ module.exports = baseVw.extend({
209209
preserveCase: true,
210210
saveOnBlur: true,
211211
placeholder: window.polyglot.t('KeywordsPlaceholder'),
212+
onBeforeTagAdd: (event, tag) => {
213+
console.log(tag);
214+
console.log(tag.length);
215+
if(tag.length > 40) {
216+
app.simpleMessageModal.open({
217+
title: window.polyglot.t('errorMessages.tagIsTooLongHeadline'),
218+
message: window.polyglot.t('errorMessages.tagIsTooLongBody')
219+
});
220+
return false;
221+
}
222+
},
212223
onTagAdd: () => {
213224
this.$('#inputKeyword').removeClass('invalid');
214225
},
@@ -340,7 +351,7 @@ module.exports = baseVw.extend({
340351
onPhotoDragLeave: function(e) {
341352
this.$photosModule.removeClass('dragOver');
342353
e.preventDefault();
343-
},
354+
},
344355

345356
onPhotoDrop: function(e) {
346357
this.$photosModule.removeClass('dragOver');
@@ -373,11 +384,11 @@ module.exports = baseVw.extend({
373384

374385
if (this.imgHashes.length + imageFiles.length > this.MAX_PHOTOS) {
375386
imageFiles = imageFiles.slice(0, this.MAX_PHOTOS - this.imgHashes.length);
376-
387+
377388
app.simpleMessageModal.open({
378389
title: window.polyglot.t('errorMessages.tooManyPhotosTitle'),
379390
message: window.polyglot.t('errorMessages.tooManyPhotosBody')
380-
});
391+
});
381392
}
382393

383394
if (!imageFiles.length) return;
@@ -434,15 +445,15 @@ module.exports = baseVw.extend({
434445
});
435446
} else if (loaded === imageCount) {
436447
self.uploadImage(imageList);
437-
}
448+
}
438449
};
439450
});
440451
},
441452

442453
uploadImage: function(imageList){
443454
var self = this,
444455
formData = new FormData();
445-
456+
446457
__.each(imageList, function(dataURL){
447458
formData.append('image', dataURL);
448459
});
@@ -665,7 +676,7 @@ module.exports = baseVw.extend({
665676
message: window.polyglot.t('errorMessages.missingError') + '<br><i><br />' +
666677
invalidInputList.join('<br />') + '</i>'
667678
});
668-
679+
669680
return $.Deferred().reject('failed form validation').promise();
670681
},
671682

@@ -674,4 +685,4 @@ module.exports = baseVw.extend({
674685

675686
return this.$('#contractForm')[0].checkValidity();
676687
}
677-
});
688+
});

0 commit comments

Comments
 (0)