mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
build titles for tempaltes page in web
This commit is contained in:
parent
b80f751cb2
commit
27a97b7fa8
2 changed files with 6 additions and 3 deletions
|
@ -7,12 +7,14 @@ module.exports = TemplatesWebController =
|
||||||
renderTemplatesIndexPage: (req, res)->
|
renderTemplatesIndexPage: (req, res)->
|
||||||
logger.log "rendering index page of templates"
|
logger.log "rendering index page of templates"
|
||||||
TemplatesWebController._getDataFromTemplatesApi "/user/#{req.params.user_id}", (err, data)->
|
TemplatesWebController._getDataFromTemplatesApi "/user/#{req.params.user_id}", (err, data)->
|
||||||
|
data.title = "LaTeX Templates"
|
||||||
res.render "templates/index", data
|
res.render "templates/index", data
|
||||||
|
|
||||||
renerTemplateInTag: (req, res)->
|
renerTemplateInTag: (req, res)->
|
||||||
logger.log "rendering latex template page"
|
logger.log "rendering latex template page"
|
||||||
{user_id, tag_name, template_name} = req.params
|
{user_id, tag_name, template_name} = req.params
|
||||||
TemplatesWebController._getDataFromTemplatesApi "/user/#{user_id}/tag/#{tag_name}/template/#{template_name}", (err, data)->
|
TemplatesWebController._getDataFromTemplatesApi "/user/#{user_id}/tag/#{tag_name}/template/#{template_name}", (err, data)->
|
||||||
|
data.title = data.template.name
|
||||||
res.render "templates/template", data
|
res.render "templates/template", data
|
||||||
|
|
||||||
tagOrCanonicalPage: (req, res)->
|
tagOrCanonicalPage: (req, res)->
|
||||||
|
@ -26,7 +28,6 @@ module.exports = TemplatesWebController =
|
||||||
logger.log params:req.params, "problem rendering tagOrCanonicalPage"
|
logger.log params:req.params, "problem rendering tagOrCanonicalPage"
|
||||||
res.send 500
|
res.send 500
|
||||||
|
|
||||||
|
|
||||||
proxyToTemplatesApi: (req, res)->
|
proxyToTemplatesApi: (req, res)->
|
||||||
url = req.url
|
url = req.url
|
||||||
logger.log url:url, "proxying request to templates api"
|
logger.log url:url, "proxying request to templates api"
|
||||||
|
@ -47,13 +48,14 @@ module.exports = TemplatesWebController =
|
||||||
{user_id} = req.params
|
{user_id} = req.params
|
||||||
logger.log user_id:user_id, "rendering all templates page"
|
logger.log user_id:user_id, "rendering all templates page"
|
||||||
TemplatesWebController._getDataFromTemplatesApi "/user/#{user_id}/all", (err, data)->
|
TemplatesWebController._getDataFromTemplatesApi "/user/#{user_id}/all", (err, data)->
|
||||||
data.title = "HELLLLo"
|
data.title = "All Templates"
|
||||||
res.render "templates/tag", data
|
res.render "templates/tag", data
|
||||||
|
|
||||||
_renderTagPage: _renderTagPage = (req, res)->
|
_renderTagPage: _renderTagPage = (req, res)->
|
||||||
{user_id, tag_name} = req.params
|
{user_id, tag_name} = req.params
|
||||||
logger.log user_id:user_id, tag_name:tag_name, "rendinging tag page for templates"
|
logger.log user_id:user_id, tag_name:tag_name, "rendinging tag page for templates"
|
||||||
TemplatesWebController._getDataFromTemplatesApi "/user/#{user_id}/tag/#{tag_name}", (err, data)->
|
TemplatesWebController._getDataFromTemplatesApi "/user/#{user_id}/tag/#{tag_name}", (err, data)->
|
||||||
|
data.title = data.tag.name
|
||||||
res.render "templates/tag", data
|
res.render "templates/tag", data
|
||||||
|
|
||||||
_getDataFromTemplatesApi: _getDataFromTemplatesApi = (path, callback)->
|
_getDataFromTemplatesApi: _getDataFromTemplatesApi = (path, callback)->
|
||||||
|
|
|
@ -18,7 +18,8 @@ describe "TemplatesWebController", ->
|
||||||
"settings-sharelatex":@settings
|
"settings-sharelatex":@settings
|
||||||
"logger-sharelatex": log:->
|
"logger-sharelatex": log:->
|
||||||
@stubbedApiData =
|
@stubbedApiData =
|
||||||
templates:[{_id:"12312321"}]
|
template:{_id:"12312321", name:"bob"}
|
||||||
|
tag: {name:"tag name"}
|
||||||
|
|
||||||
@TemplatesWebController._getDataFromTemplatesApi = sinon.stub().callsArgWith(1, null, @stubbedApiData)
|
@TemplatesWebController._getDataFromTemplatesApi = sinon.stub().callsArgWith(1, null, @stubbedApiData)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue