-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1764 from jhawthorn/handlebars_image_partial
Add image partial to handlebars
- Loading branch information
Showing
11 changed files
with
30 additions
and
35 deletions.
There are no files selected for viewing
11 changes: 0 additions & 11 deletions
11
backend/app/assets/javascripts/spree/backend/handlebars_extensions.coffee
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
backend/app/assets/javascripts/spree/backend/handlebars_extensions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//= require handlebars | ||
//= require spree/backend/translation | ||
|
||
Handlebars.registerHelper("t", function(key, options) { | ||
return Spree.t(key, options.hash); | ||
}); | ||
|
||
Handlebars.registerHelper("human_attribute_name", function(model, attr) { | ||
return Spree.human_attribute_name(model, attr); | ||
}); | ||
|
||
Handlebars.registerHelper("admin_url", function() { | ||
return Spree.pathFor("admin") | ||
}); | ||
|
||
Handlebars.registerHelper("concat", function() { | ||
return Array.prototype.slice.call(arguments, 0, -1).join(''); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
backend/app/assets/javascripts/spree/backend/templates/_image.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{{#if image }} | ||
<img src='{{ lookup image (concat size "_url") }}' alt="{{ alt }}" /> | ||
{{ else }} | ||
<span class="image-placeholder {{ size }}"></span> | ||
{{/if}} |
1 change: 1 addition & 0 deletions
1
backend/app/assets/javascripts/spree/backend/templates/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
backend/app/assets/javascripts/spree/backend/templates/variants/autocomplete.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters