Skip to content

Commit

Permalink
Move handlebar templates to locals
Browse files Browse the repository at this point in the history
These being set on the window is a relic of when they were compiled in
JS from templates in the HTML.
  • Loading branch information
jhawthorn committed Mar 17, 2016
1 parent 652b8de commit 0f5c0d0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ $(document).ready(function () {
var variant = _.find(window.variants, function(variant){
return variant.id == variant_id
})

var variantLineItemTemplate = HandlebarsTemplates["variants/line_items_autocomplete_stock"];
$('#stock_details').html(variantLineItemTemplate({variant: variant}));
$('#stock_details').show();

Expand Down
2 changes: 2 additions & 0 deletions backend/app/assets/javascripts/spree/backend/shipments.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ $(document).ready(function () {
var variant = _.find(window.variants, function(variant){
return variant.id == variant_id
})

var variantStockTemplate = HandlebarsTemplates["variants/autocomplete_stock"];
$('#stock_details').html(variantStockTemplate({variant: variant}));
$('#stock_details').show();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# variant autocompletion
$(document).ready ->
window.variantTemplate = HandlebarsTemplates["variants/autocomplete"]
window.variantStockTemplate = HandlebarsTemplates["variants/autocomplete_stock"]
window.variantLineItemTemplate = HandlebarsTemplates["variants/line_items_autocomplete_stock"]

variantTemplate = HandlebarsTemplates["variants/autocomplete"]

formatVariantResult = (variant) ->
variant.image = variant.images[0].mini_url if variant["images"][0] isnt `undefined` and variant["images"][0].mini_url isnt `undefined`
Expand Down

0 comments on commit 0f5c0d0

Please sign in to comment.