DEV: Upgrades to Ember 3.10 (#7871)

Co-Authored-By: majakomel <maja.komel@gmail.com>
This commit is contained in:
Joffrey JAFFEUX
2019-07-16 12:45:15 +02:00
committed by GitHub
parent e2fa5704e9
commit b3eb67976d
78 changed files with 332 additions and 263 deletions

View File

@ -13,6 +13,7 @@ class ThemeJavascriptCompiler
// Helper to replace old themeSetting syntax
function generateHelper(settingParts) {
console.log(settingParts)
const settingName = settingParts.join('.');
return {
"path": {
@ -64,7 +65,7 @@ class ThemeJavascriptCompiler
}
function manipulateNode(node) {
// Magically add theme id as the first param for each of these helpers
// Magically add theme id as the first param for each of these helpers)
if (node.path.parts && ["theme-i18n", "theme-prefix", "theme-setting"].includes(node.path.parts[0])) {
if(node.params.length === 1){
node.params.unshift({
@ -134,10 +135,16 @@ class ThemeJavascriptCompiler
def discourse_extension
<<~JS
Ember.HTMLBars.registerPlugin('ast', function(){
return { name: 'theme-template-manipulator',
visitor: { SubExpression: manipulateNode, MustacheStatement: manipulateNode, PathExpression: manipulatePath}
}});
Ember.HTMLBars.registerPlugin('ast', function() {
return {
name: 'theme-template-manipulator',
visitor: {
SubExpression: manipulateNode,
MustacheStatement: manipulateNode,
PathExpression: manipulatePath
}
}
});
JS
end
end