-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/0.5.3-dev' into 0.5.3-bb
- Loading branch information
Showing
22 changed files
with
407 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
*.iml | ||
*.DS_Store | ||
node_modules | ||
npm-debug.log | ||
|
||
# Generated data for API | ||
/core/api/data | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,26 @@ | ||
'use strict'; | ||
|
||
var fs = require('fs'); | ||
var path = require('path'); | ||
var pathToApp = path.dirname(require.main.filename); | ||
var ejs = require('ejs'); | ||
|
||
exports.getHeaderAndFooter = function () { | ||
var defaultTemplatePath = pathToApp + "/assets/templates/"; | ||
var userTemplatePath = global.app.get('user') + "/assets/templates/"; | ||
var headerFile = "header.inc.html"; | ||
var footerFile = "footer.inc.html"; | ||
var defaultTemplatePath = global.pathToApp + '/assets/templates/'; | ||
var userTemplatePath = global.app.get('user') + '/assets/templates/'; | ||
var headerFile = 'header.inc.html'; | ||
var footerFile = 'footer.inc.html'; | ||
|
||
var data = {}; | ||
var output = {}; | ||
|
||
if(fs.existsSync(userTemplatePath + headerFile)) { | ||
data.header = ejs.render(fs.readFileSync(userTemplatePath + headerFile, "utf-8")); | ||
} else { | ||
data.header = ejs.render(fs.readFileSync(defaultTemplatePath + headerFile, "utf-8")); | ||
} | ||
var userHeaderTplPath = userTemplatePath + headerFile; | ||
var headerTplPath = fs.existsSync(userHeaderTplPath) ? userHeaderTplPath : defaultTemplatePath + headerFile; | ||
|
||
if(fs.existsSync(userTemplatePath + footerFile)) { | ||
data.footer = ejs.render(fs.readFileSync(userTemplatePath + footerFile, "utf-8")); | ||
} else { | ||
data.footer = ejs.render(fs.readFileSync(defaultTemplatePath + footerFile, "utf-8")); | ||
} | ||
var userFooterTplPath = userTemplatePath + footerFile; | ||
var footerTplPath = fs.existsSync(userFooterTplPath) ? userFooterTplPath : defaultTemplatePath + footerFile; | ||
|
||
return data; | ||
output.header = ejs.render(fs.readFileSync(headerTplPath, 'utf-8')); | ||
output.footer = ejs.render(fs.readFileSync(footerTplPath, 'utf-8'), { | ||
engineVersion: global.engineVersion | ||
}); | ||
|
||
return output; | ||
}; |
Oops, something went wrong.