Skip to content

Commit

Permalink
Added product brand
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvautin committed Oct 21, 2020
1 parent eba4c1a commit 1bb314c
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 10 deletions.
4 changes: 4 additions & 0 deletions lib/schemas/editProduct.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"format": "alphanumeric",
"maxLength": 16
},
"productBrand": {
"type": "string",
"maxLength": 50
},
"productPublished": {
"type": "boolean"
},
Expand Down
4 changes: 4 additions & 0 deletions lib/schemas/newProduct.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
"format": "alphanumeric",
"maxLength": 16
},
"productBrand": {
"type": "string",
"maxLength": 50
},
"productPublished": {
"type": "boolean"
},
Expand Down
4 changes: 3 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,7 @@
"Reviews can be filtered by: review title or review description keywords": "Reviews can be filtered by: review title or review description keywords",
"Reviews": "Reviews",
"Product GTIN": "Product GTIN",
"The Serial number, GTIN or Barcode": "The Serial number, GTIN or Barcode"
"The Serial number, GTIN or Barcode": "The Serial number, GTIN or Barcode",
"Product Brand": "Product Brand",
"The brand of the product": "The brand of the product"
}
2 changes: 2 additions & 0 deletions public/javascripts/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ $(document).ready(function (){
productStock: $('#productStock').val(),
productDescription: $('#productDescription').val(),
productGtin: $('#productGtin').val(),
productBrand: $('#productBrand').val(),
productPermalink: $('#productPermalink').val(),
productSubscription: $('#productSubscription').val(),
productComment: $('#productComment').is(':checked'),
Expand Down Expand Up @@ -257,6 +258,7 @@ $(document).ready(function (){
productStockDisable: $('#productStockDisable').is(':checked'),
productDescription: $('#productDescription').val(),
productGtin: $('#productGtin').val(),
productBrand: $('#productBrand').val(),
productPermalink: $('#productPermalink').val(),
productSubscription: $('#productSubscription').val(),
productComment: $('#productComment').is(':checked'),
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/admin.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions routes/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ router.post('/admin/product/insert', restrict, checkAccess, async (req, res) =>
productPrice: req.body.productPrice,
productDescription: cleanHtml(req.body.productDescription),
productGtin: cleanHtml(req.body.productGtin),
productBrand: cleanHtml(req.body.productBrand),
productPublished: convertBool(req.body.productPublished),
productTags: req.body.productTags,
productComment: checkboxBool(req.body.productComment),
Expand Down Expand Up @@ -328,6 +329,7 @@ router.post('/admin/product/update', restrict, checkAccess, async (req, res) =>
productPrice: req.body.productPrice,
productDescription: cleanHtml(req.body.productDescription),
productGtin: cleanHtml(req.body.productGtin),
productBrand: cleanHtml(req.body.productBrand),
productPublished: convertBool(req.body.productPublished),
productTags: req.body.productTags,
productComment: checkboxBool(req.body.productComment),
Expand Down
6 changes: 6 additions & 0 deletions views/layouts/layout.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@
{{else}}
"image": "{{config.baseUrl}}uploads/placeholder.png",
{{/if}}
{{#if result.productBrand}}
"brand": {
"@type": "Organization",
"name": "{{result.productBrand}}"
},
{{/if}}
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{{@root.reviewRating}}",
Expand Down
17 changes: 11 additions & 6 deletions views/product-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</div>
</div>
<div class="row ml-0 mr-0">
<div class="col-sm-4">
<div class="col-sm-3">
<div class="form-group">
<label for="productPrice" class="control-label">{{ @root.__ "Product price" }} *</label>
<div class="input-group">
Expand All @@ -28,20 +28,25 @@
</div>
</div>
</div>
<div class="col-sm-4">
<div class="col-sm-3">
<div class="form-group">
<label for="productPublished" class="control-label">{{ @root.__ "Status" }}</label>
<label for="productPublished" class="control-label">{{ @root.__ "Status" }} *</label>
<select class="form-control" id="productPublished">
<option value="true" {{selectState result.productPublished "true"}}>{{ @root.__ "Published" }}</option>
<option value="false" {{selectState result.productPublished "false"}}>{{ @root.__ "Draft" }}</option>
</select>
</div>
</div>
<div class="col-sm-4">
<div class="col-sm-3">
<div class="form-group">
<label for="productGtin" class="control-label">{{ @root.__ "Product GTIN" }}</label>
{{!-- <input type="number" id="productGtin" class="form-control" value="{{result.productGtin}}" step="any" /> --}}
<input type="string" id="productGtin" class="form-control" value="{{result.productGtin}}"/>
<input type="number" id="productGtin" class="form-control" value="{{result.productGtin}}" step="any" />
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label for="productBrand" class="control-label">{{ @root.__ "Product Brand" }}</label>
<input type="text" id="productBrand" class="form-control" value="{{result.productBrand}}" />
</div>
</div>
</div>
Expand Down
13 changes: 11 additions & 2 deletions views/product-new.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
</div>
<div class="row ml-0 mr-0">
<div class="col-sm-6">
<div class="col-sm-4">
<div class="form-group">
<label for="productPrice" class="control-label">{{ @root.__ "Product price" }} *</label>
<div class="input-group">
Expand All @@ -27,7 +27,7 @@
</div>
</div>
</div>
<div class="col-sm-6">
<div class="col-sm-4">
<div class="form-group">
<label for="productGtin" class="control-label">{{ @root.__ "Product GTIN" }}</label>
<div class="input-group">
Expand All @@ -36,6 +36,15 @@
<p class="help-block">{{ @root.__ "The Serial number, GTIN or Barcode" }}</p>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label for="productBrand" class="control-label">{{ @root.__ "Product Brand" }}</label>
<div class="input-group">
<input type="text" id="productBrand" class="form-control" value="{{productBrand}}" />
</div>
<p class="help-block">{{ @root.__ "The brand of the product" }}</p>
</div>
</div>
</div>
<div class="row ml-0 mr-0">
<div class="col-sm-6">
Expand Down

0 comments on commit 1bb314c

Please sign in to comment.