mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 22:31:19 +08:00
REFACTOR: Split off raw handlebars helpers from compiler
This allows us to compile without Ember being present
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { rawGet } from "discourse-common/lib/raw-handlebars";
|
||||
import { get } from "@ember/object";
|
||||
|
||||
export function htmlHelper(fn) {
|
||||
return Ember.Helper.helper(function(...args) {
|
||||
@ -10,6 +10,17 @@ export function htmlHelper(fn) {
|
||||
|
||||
const _helpers = {};
|
||||
|
||||
function rawGet(ctx, property, options) {
|
||||
if (options.types && options.data.view) {
|
||||
var view = options.data.view;
|
||||
return view.getStream
|
||||
? view.getStream(property).value()
|
||||
: view.getAttr(property);
|
||||
} else {
|
||||
return get(ctx, property);
|
||||
}
|
||||
}
|
||||
|
||||
export function registerHelper(name, fn) {
|
||||
_helpers[name] = Ember.Helper.helper(fn);
|
||||
}
|
||||
|
Reference in New Issue
Block a user