mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 19:15:42 +08:00
FIX: Backwards compatibility for controller in raw templates
This commit is contained in:
parent
1463e9ae46
commit
89bdca9c8c
@ -1,3 +1,5 @@
|
||||
import deprecated from 'discourse-common/lib/deprecated';
|
||||
|
||||
// This is a mechanism for quickly rendering templates which is Ember aware
|
||||
// templates are highly compatible with Ember so you don't need to worry about calling "get"
|
||||
// and computed properties function, additionally it uses stringParams like Ember does
|
||||
@ -18,6 +20,11 @@ RawHandlebars.helpers['get'] = function(context, options) {
|
||||
var firstContext = options.contexts[0];
|
||||
var val = firstContext[context];
|
||||
|
||||
if (context.indexOf('controller') === 0) {
|
||||
deprecated("Don't `use controller` in raw templates");
|
||||
context = context.replace(/^controller\./, '');
|
||||
}
|
||||
|
||||
if (val && val.isDescriptor) { return Em.get(firstContext, context); }
|
||||
val = val === undefined ? Em.get(firstContext, context): val;
|
||||
return val;
|
||||
|
Loading…
x
Reference in New Issue
Block a user