mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 15:49:01 +02:00
Hook module system into project list page
This commit is contained in:
@@ -164,6 +164,7 @@ module.exports = (grunt) ->
|
||||
moduleUnitTestTasks = []
|
||||
moduleCompileClientTasks = []
|
||||
moduleIdeClientSideIncludes = []
|
||||
moduleMainClientSideIncludes = []
|
||||
if fs.existsSync "./modules"
|
||||
for module in fs.readdirSync "./modules"
|
||||
if fs.existsSync "./modules/#{module}/index.coffee"
|
||||
@@ -201,6 +202,7 @@ module.exports = (grunt) ->
|
||||
moduleCompileUnitTestTasks.push "coffee:module_#{module}_unit_tests"
|
||||
moduleUnitTestTasks.push "mochaTest:module_#{module}_unit"
|
||||
|
||||
if fs.existsSync "./modules/#{module}/public/coffee/ide/index.coffee"
|
||||
config.coffee["module_#{module}_client_ide"] = {
|
||||
expand: true,
|
||||
flatten: false,
|
||||
@@ -211,6 +213,18 @@ module.exports = (grunt) ->
|
||||
}
|
||||
moduleCompileClientTasks.push "coffee:module_#{module}_client_ide"
|
||||
moduleIdeClientSideIncludes.push "ide/#{module}/index"
|
||||
|
||||
if fs.existsSync "./modules/#{module}/public/coffee/main/index.coffee"
|
||||
config.coffee["module_#{module}_client_main"] = {
|
||||
expand: true,
|
||||
flatten: false,
|
||||
cwd: "modules/#{module}/public/coffee/main",
|
||||
src: ['**/*.coffee'],
|
||||
dest: "public/js/main/#{module}",
|
||||
ext: '.js'
|
||||
}
|
||||
moduleCompileClientTasks.push "coffee:module_#{module}_client_main"
|
||||
moduleMainClientSideIncludes.push "main/#{module}/index"
|
||||
|
||||
grunt.initConfig config
|
||||
|
||||
@@ -232,6 +246,10 @@ module.exports = (grunt) ->
|
||||
content = fs.readFileSync("public/js/ide.js").toString()
|
||||
content = content.replace(/"__IDE_CLIENTSIDE_INCLUDES__"/g, moduleIdeClientSideIncludes.map((i) -> "\"#{i}\"").join(", "))
|
||||
fs.writeFileSync "public/js/ide.js", content
|
||||
|
||||
content = fs.readFileSync("public/js/main.js").toString()
|
||||
content = content.replace(/"__MAIN_CLIENTSIDE_INCLUDES__"/g, moduleMainClientSideIncludes.map((i) -> "\"#{i}\"").join(", "))
|
||||
fs.writeFileSync "public/js/main.js", content
|
||||
|
||||
grunt.registerTask 'compile:server', 'Compile the server side coffee script', ['clean:app', 'coffee:app', 'coffee:app_dir', 'compile:modules:server']
|
||||
grunt.registerTask 'compile:client', 'Compile the client side coffee script', ['coffee:client', 'coffee:sharejs', 'wrap_sharejs', "compile:modules:client", 'compile:modules:inject_clientside_includes']
|
||||
|
||||
@@ -29,7 +29,7 @@ module.exports = Modules =
|
||||
partials = Modules.viewIncludes[view] or []
|
||||
html = ""
|
||||
for partial in partials
|
||||
compiler = jade.compile(partial)
|
||||
compiler = jade.compile(partial, doctype: "html")
|
||||
html += compiler(locals)
|
||||
return html
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
href,
|
||||
ng-click="openUploadProjectModal()"
|
||||
) #{translate("upload_project")}
|
||||
!{moduleIncludes("newProjectMenu", locals)}
|
||||
if (templates)
|
||||
li.divider
|
||||
li.dropdown-header #{translate("templates")}
|
||||
|
||||
@@ -22,5 +22,6 @@ define [
|
||||
"directives/selectAll"
|
||||
"directives/maxHeight"
|
||||
"filters/formatDate"
|
||||
"__MAIN_CLIENTSIDE_INCLUDES__"
|
||||
], () ->
|
||||
angular.bootstrap(document.body, ["SharelatexApp"])
|
||||
|
||||
Reference in New Issue
Block a user