From e0e9949da519a311b89819712803b1a2781aca37 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 18 Aug 2014 14:26:47 -0300 Subject: [PATCH] dynamic template menu by config settings --- .../infrastructure/ExpressLocals.coffee | 1 + .../web/app/views/project/list/side-bar.jade | 24 +++------ services/web/config/settings.defaults.coffee | 49 +++++++++---------- 3 files changed, 30 insertions(+), 44 deletions(-) diff --git a/services/web/app/coffee/infrastructure/ExpressLocals.coffee b/services/web/app/coffee/infrastructure/ExpressLocals.coffee index 2183b0608f..62be91eaee 100644 --- a/services/web/app/coffee/infrastructure/ExpressLocals.coffee +++ b/services/web/app/coffee/infrastructure/ExpressLocals.coffee @@ -131,6 +131,7 @@ module.exports = (app)-> app.use (req, res, next) -> res.locals.nav = Settings.nav + res.locals.templates = Settings.templates next() app.use (req, res, next) -> diff --git a/services/web/app/views/project/list/side-bar.jade b/services/web/app/views/project/list/side-bar.jade index c560ebc3c3..20e57e1c9e 100644 --- a/services/web/app/views/project/list/side-bar.jade +++ b/services/web/app/views/project/list/side-bar.jade @@ -21,22 +21,12 @@ href, ng-click="openUploadProjectModal()" ) #{translate("upload_project")} - li.divider - li.dropdown-header #{translate("templates")} - li - a.menu-indent(href="/templates/cv") #{translate("cv_or_resume")} - li - a.menu-indent(href="/templates/cover-letters") #{translate("cover_letter")} - li - a.menu-indent(href="/templates/journals") #{translate("journal_article")} - li - a.menu-indent(href="/templates/presentations") #{translate("presentation")} - li - a.menu-indent(href="/templates/thesis") #{translate("thesis")} - li - a.menu-indent(href="/templates/bibliographies") #{translate("bibliographies")} - li - a.menu-indent(href="/templates") #{translate("view_all")} ยป + if (templates) + li.divider + li.dropdown-header #{translate("templates")} + each item in templates + li + a.menu-indent(href=item.url) #{translate(item.name)} .row-spaced(ng-if="projects.length > 0", ng-cloak) ul.list-unstyled.folders-menu( @@ -101,4 +91,4 @@ a(href="/user/subscription/plans").btn.btn-primary #{translate("upgrade")} p.small | #{translate("or_unlock_features_bonus")} - a(href="/user/bonus") #{translate("sharing_sl")} . \ No newline at end of file + a(href="/user/bonus") #{translate("sharing_sl")} . diff --git a/services/web/config/settings.defaults.coffee b/services/web/config/settings.defaults.coffee index ae0da174c7..0802073e46 100644 --- a/services/web/config/settings.defaults.coffee +++ b/services/web/config/settings.defaults.coffee @@ -279,33 +279,28 @@ module.exports = }] }] - templates: [{ - name : "cv_or_resume", - url : "/templates/cv" - }, { - name : "cover_letter", - url : "/templates/cover-letters" - }, { - name : "journal_article", - url : "/templates/journals" - - }, { - name : "presentation", - url : "/templates/presentations" - - }, { - name : "thesis", - url : "/templates/thesis" - - }, { - name : "bibliographies", - url : "/templates/bibliographies" - - }, { - name : "view_all", - url : "/templates" - - }] +# templates: [{ +# name : "cv_or_resume", +# url : "/templates/cv" +# }, { +# name : "cover_letter", +# url : "/templates/cover-letters" +# }, { +# name : "journal_article", +# url : "/templates/journals" +# }, { +# name : "presentation", +# url : "/templates/presentations" +# }, { +# name : "thesis", +# url : "/templates/thesis" +# }, { +# name : "bibliographies", +# url : "/templates/bibliographies" +# }, { +# name : "view_all", +# url : "/templates" +# }] redirects: