This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/cdn-img.js.es6
2018-11-29 09:32:03 +05:30

18 lines
373 B
JavaScript

import computed from "ember-addons/ember-computed-decorators";
export default Ember.Component.extend({
tagName: "",
@computed("src")
cdnSrc(src) {
return Discourse.getURLWithCDN(src);
},
@computed("width", "height")
style(width, height) {
if (width && height) {
return Ember.String.htmlSafe(`--aspect-ratio: ${width / height};`);
}
}
});