mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 05:43:16 +08:00
Fix issue for custom image badges urls (#5814)
This commit is contained in:
parent
4f508b2358
commit
1404294a12
|
@ -1,7 +1,14 @@
|
|||
import { htmlHelper } from 'discourse-common/lib/helpers';
|
||||
import { iconHTML } from 'discourse-common/lib/icon-library';
|
||||
|
||||
export default htmlHelper(function(str) {
|
||||
if (Ember.isEmpty(str)) { return ""; }
|
||||
return (str.indexOf('fa-') === 0) ? iconHTML(str.replace('fa-', '')) : `<img src='${str}'>`;
|
||||
export default htmlHelper(function({ icon, image }) {
|
||||
if (!Ember.isEmpty(image)) {
|
||||
return `<img src='${image}'>`;
|
||||
}
|
||||
|
||||
if (Ember.isEmpty(icon) || icon.indexOf('fa-') !== 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return iconHTML(icon.replace('fa-', ''));
|
||||
});
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{{icon-or-image badge.icon}}
|
||||
{{icon-or-image badge}}
|
||||
<span class="badge-display-name">{{badge.name}}</span>
|
||||
{{yield}}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div class='badge-contents'>
|
||||
<a href={{url}} class="badge-link">
|
||||
<div class='badge-icon {{badge.badgeTypeClassName}}'>
|
||||
{{icon-or-image badge.icon}}
|
||||
{{icon-or-image badge}}
|
||||
</div>
|
||||
<div class='badge-info'>
|
||||
<div class='badge-info-item'>
|
||||
|
|
Loading…
Reference in New Issue
Block a user