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

Commit 5bae027

Browse files
committed
Use variable for maximum tag length in view and templates.
1 parent 6cde946 commit 5bae027

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

js/languages/en-US.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"CategoryPlaceholder": "Enter category",
9595
"CategoryHelperText": "Categories are used to group and organize listing within your store.",
9696
"KeywordsPlaceholder": "Enter One or More Tags",
97-
"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.",
97+
"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. Tags cannot be longer than %{maxTagChars} characters.",
9898
"ExpirationDateHelperText": "Set a date for the listing to automatically be pulled from your store.",
9999
"ClearExpirationDate": "Clear Expiration Date",
100100
"ClearShippingLocations": "Clear All",
@@ -529,7 +529,7 @@
529529
"badSMTPAuthentication": "The username/password combination used failed.",
530530
"goodSMTPAuthentication": "You have successfully connected to the SMTP server.",
531531
"tagIsTooLongHeadline": "The tag is too long",
532-
"tagIsTooLongBody": "Tags cannot be more than 40 characters long."
532+
"tagIsTooLongBody": "Tags cannot be more than %{maxTagChars} characters long."
533533
},
534534
"pageConnectingMessages": {
535535
"listingConnect": "Connecting to listing ${listing}",

js/templates/itemEdit.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@ <h5><%= polyglot.t('Discover') %></h5>
413413
</div>
414414
</div>
415415
<div class="flexRow">
416-
<p class="textOpacity50 helper-text marginTop8"><%= polyglot.t('KeywordsHelperText') %></p>
416+
<p class="textOpacity50 helper-text marginTop8"><%= polyglot.t('KeywordsHelperText',
417+
{maxTagChars: ob.maxTagChars}) %></p>
417418
</div>
418419
</div>
419420

js/views/itemEditVw.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ module.exports = baseVw.extend({
7171

7272
self.model.set('expTime', self.model.get('vendor_offer').listing.metadata.expiry.replace(" UTC", ""));
7373

74+
this.maxTagChars = 40;
75+
7476
this.listenTo(this.model, 'change:priceSet', this.render());
7577
},
7678

@@ -80,7 +82,8 @@ module.exports = baseVw.extend({
8082
loadTemplate('./js/templates/itemEdit.html', function(loadedTemplate) {
8183
var context = __.extend({}, self.model.toJSON(), {
8284
MAX_PHOTOS: self.MAX_PHOTOS,
83-
images: self.imgHashes.map((hash) => self.getImageUrl(hash))
85+
images: self.imgHashes.map((hash) => self.getImageUrl(hash)),
86+
maxTagChars: self.maxTagChars
8487
});
8588

8689
self.$el.html(loadedTemplate(context));
@@ -211,10 +214,10 @@ module.exports = baseVw.extend({
211214
saveOnBlur: true,
212215
placeholder: window.polyglot.t('KeywordsPlaceholder'),
213216
onBeforeTagAdd: (event, tag) => {
214-
if(tag.length > 40) {
217+
if(tag.length > self.maxTagChars) {
215218
app.simpleMessageModal.open({
216219
title: window.polyglot.t('errorMessages.tagIsTooLongHeadline'),
217-
message: window.polyglot.t('errorMessages.tagIsTooLongBody')
220+
message: window.polyglot.t('errorMessages.tagIsTooLongBody', {maxTagChars: self.maxTagChars})
218221
});
219222
return false;
220223
}

0 commit comments

Comments
 (0)