mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
Use HTMLBars API for inserting partials and views
This commit is contained in:
parent
39a1444838
commit
d34334ecbe
3 changed files with 7 additions and 16 deletions
|
@ -316,7 +316,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<div class='display-row' {{bind-attr class=":display-row blocked:highlight-danger"}}>
|
<div {{bind-attr class=":display-row blocked:highlight-danger"}}>
|
||||||
<div class='field'>{{i18n 'admin.user.blocked'}}</div>
|
<div class='field'>{{i18n 'admin.user.blocked'}}</div>
|
||||||
<div class='value'>{{blocked}}</div>
|
<div class='value'>{{blocked}}</div>
|
||||||
<div class='controls'>
|
<div class='controls'>
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
Ember.Handlebars.registerHelper('custom-html', function(name, contextString, options) {
|
Ember.HTMLBars._registerHelper('custom-html', function(params, hash, options, env) {
|
||||||
var html = Discourse.HTML.getCustomHTML(name);
|
const name = params[0];
|
||||||
|
const html = Discourse.HTML.getCustomHTML(name);
|
||||||
if (html) { return html; }
|
if (html) { return html; }
|
||||||
|
|
||||||
var container = (options || contextString).data.view.container;
|
const contextString = params[1];
|
||||||
|
const container = (env || contextString).data.view.container;
|
||||||
if (container.lookup('template:' + name)) {
|
if (container.lookup('template:' + name)) {
|
||||||
return Ember.Handlebars.helpers.partial.apply(this, arguments);
|
return env.helpers.partial.helperFunction.apply(this, arguments);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -123,16 +123,5 @@ Ember.HTMLBars._registerHelper('plugin-outlet', function(params, hash, options,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (options.fn) {
|
|
||||||
// If a block is passed, render its content.
|
|
||||||
return Ember.Handlebars.helpers.view.call(this,
|
|
||||||
[Ember.View.extend({
|
|
||||||
isVirtual: true,
|
|
||||||
tagName: '',
|
|
||||||
template: function() {
|
|
||||||
return options.hash.template;
|
|
||||||
}.property()
|
|
||||||
})],
|
|
||||||
hash, options, env);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue