From e5ca033538140789c243a1214492de48fc9d94ca Mon Sep 17 00:00:00 2001 From: James Allen Date: Fri, 20 Jun 2014 21:35:42 +0100 Subject: [PATCH] Add in configurable headings/footers --- .../infrastructure/ExpressLocals.coffee | 5 +- services/web/app/views/layout/footer.jade | 51 ++++++------ services/web/app/views/layout/navbar.jade | 82 ++++++++++++------- services/web/app/views/user/login.jade | 2 +- services/web/config/settings.defaults.coffee | 36 ++++++++ .../public/stylesheets/components/navbar.less | 20 +++++ 6 files changed, 138 insertions(+), 58 deletions(-) diff --git a/services/web/app/coffee/infrastructure/ExpressLocals.coffee b/services/web/app/coffee/infrastructure/ExpressLocals.coffee index 0ec0b2e86e..7a9570e0ec 100644 --- a/services/web/app/coffee/infrastructure/ExpressLocals.coffee +++ b/services/web/app/coffee/infrastructure/ExpressLocals.coffee @@ -95,6 +95,7 @@ module.exports = (app)-> logger.err "No fingerprint for file: #{path}" return "" next() + app.use (req, res, next)-> res.locals.formatPrice = SubscriptionFormatters.formatPrice next() @@ -121,5 +122,7 @@ module.exports = (app)-> res.locals.scribtexPath = req.query.scribtex_path next() - + app.use (req, res, next) -> + res.locals.nav = Settings.nav + next() diff --git a/services/web/app/views/layout/footer.jade b/services/web/app/views/layout/footer.jade index d33e02edbc..eb6e1bdf89 100644 --- a/services/web/app/views/layout/footer.jade +++ b/services/web/app/views/layout/footer.jade @@ -2,29 +2,30 @@ footer .container .row ul.col-md-6 - li © 2014 ShareLaTeX - li - a(href="/tos") Terms - li - a(href="/privacy_policy") Privacy - li - a(href="/security") Security - li - a.js-tender-widget(href='#') Contact - li - a(href="/about") About - li - a(href="/blog") Blog + each item in nav.left_footer + li + if item.url + a(href=item.url) !{item.text} + else + | !{item.text} + ul.col-md-6 - li - a(href="http://www.twitter.com/sharelatex") - i.fa.fa-twitter-square - li - a(href="http://www.facebook.com/pages/ShareLaTeX/301671376556660") - i.fa.fa-facebook-square - li - a(href="https://plus.google.com/115074691861228882827", rel="publisher") - i.fa.fa-google-plus-square - li - a(href="https://github.com/sharelatex/sharelatex") - i.fa.fa-github-square + each item in nav.right_footer + li + if item.url + a(href=item.url) !{item.text} + else + | !{item.text} + + //- li + //- a(href="http://www.twitter.com/sharelatex") + //- i.fa.fa-twitter-square + //- li + //- a(href="http://www.facebook.com/pages/ShareLaTeX/301671376556660") + //- i.fa.fa-facebook-square + //- li + //- a(href="https://plus.google.com/115074691861228882827", rel="publisher") + //- i.fa.fa-google-plus-square + //- li + //- a(href="https://github.com/sharelatex/sharelatex") + //- i.fa.fa-github-square diff --git a/services/web/app/views/layout/navbar.jade b/services/web/app/views/layout/navbar.jade index 10ffe822d7..555d112b5b 100644 --- a/services/web/app/views/layout/navbar.jade +++ b/services/web/app/views/layout/navbar.jade @@ -7,37 +7,57 @@ nav.navbar.navbar-default .navbar-collapse.collapse#navbar-collapse ul.nav.navbar-nav.navbar-right - -if(session && session.user) - li - a(href='/project') Projects + each item in nav.header + if ((item.only_when_logged_in && session && session.user) || (item.only_when_logged_out && (!session || !session.user)) || (!item.only_when_logged_out && !item.only_when_logged_in)) + if item.dropdown + li.dropdown(class=item.class) + a.dropdown-toggle(href) + | !{item.text} + b.caret + ul.dropdown-menu + each child in item.dropdown + if child.divider + li.divider + else + li + if child.url + a(href=child.url) !{child.text} + else + | !{child.text} + else + li(class=item.class) + if item.url + a(href=item.url) !{item.text} + else + | !{item.text} - li.dropdown - a.dropdown-toggle(href='#',data-toggle="dropdown") - | Help - b.caret - ul.dropdown-menu - li - a(href='/learn') Documentation - -if(typeof(tenderUrl) != "undefined") - li - a.js-tender-widget(href='#') Contact + //- li.dropdown + //- a.dropdown-toggle(href='#',data-toggle="dropdown") + //- | Help + //- b.caret + //- ul.dropdown-menu + //- li + //- a(href='/learn') Documentation + //- -if(typeof(tenderUrl) != "undefined") + //- li + //- a.js-tender-widget(href='#') Contact Support - -if(session && session.user) - li.dropdown - a.dropdown-toggle(href="#",data-toggle="dropdown") - | Account - b.caret - ul.dropdown-menu - li - a(href='/user/settings').userSettingsLink User Settings - - if (settings.enableSubscriptions) - li - a(href='/user/subscription').subscriptionLink Subscription - li - a(href='/logout').logoutLink Logout - -else - li - a(href='/register') Register - li - a#loginLink(href='/login'+getRedirAsQueryString()) Login + //- -if(session && session.user) + //- li.dropdown + //- a.dropdown-toggle(href="#",data-toggle="dropdown") + //- | Account + //- b.caret + //- ul.dropdown-menu + //- li + //- a(href='/user/settings').userSettingsLink Account Settings + //- - if (settings.enableSubscriptions) + //- li + //- a(href='/user/subscription').subscriptionLink Subscription + //- li + //- a(href='/logout').logoutLink Logout + //- -else + //- li + //- a(href='/register') Register + //- li + //- a#loginLink(href='/login'+getRedirAsQueryString()) Login diff --git a/services/web/app/views/user/login.jade b/services/web/app/views/user/login.jade index 2336f38f5f..c078be6bd7 100644 --- a/services/web/app/views/user/login.jade +++ b/services/web/app/views/user/login.jade @@ -7,7 +7,7 @@ block content .col-md-6.col-md-offset-3.col-lg-4.col-lg-offset-4 .card .page-header - h1 Login + h1 Log In form(async-form="login", name="loginForm", action='/login', ng-cloak) input(name='_csrf', type='hidden', value=csrfToken) input(name='redir', type='hidden', value=redir) diff --git a/services/web/config/settings.defaults.coffee b/services/web/config/settings.defaults.coffee index 276e513efd..8febb274b4 100644 --- a/services/web/config/settings.defaults.coffee +++ b/services/web/config/settings.defaults.coffee @@ -219,3 +219,39 @@ module.exports = # user: "" # password: "" # projectId: "" + + nav: + left_footer: [{ + text: "Powered by ShareLaTeX © 2014" + }] + + right_footer: [{ + text: " Contribute on Github" + url: "https://github.com/sharelatex/sharelatex" + }] + + header: [{ + text: "Register" + url: "/register" + only_when_logged_out: true + }, { + text: "Log In" + url: "/login" + only_when_logged_out: true + }, { + text: "Projects" + url: "/project" + only_when_logged_in: true + }, { + text: "Account" + only_when_logged_in: true + dropdown: [{ + text: "Account Settings" + url: "/user/settings" + }, { + divider: true + }, { + text: "Log out" + url: "/logout" + }] + }] diff --git a/services/web/public/stylesheets/components/navbar.less b/services/web/public/stylesheets/components/navbar.less index 2a735bdc2e..ab15c51b51 100755 --- a/services/web/public/stylesheets/components/navbar.less +++ b/services/web/public/stylesheets/components/navbar.less @@ -416,6 +416,17 @@ } } + > li.subdued > a { + border: 0; + color: @gray; + padding: 12px 12px 13px; + &:hover, + &:focus { + color: @gray-dark; + background-color: @gray-lightest; + } + } + @media (min-width: @grid-float-breakpoint) { > li > a { border-color: @navbar-default-link-color; @@ -452,6 +463,15 @@ } } + > .open.subdued > a { + &, + &:hover, + &:focus { + color: @gray-dark; + background-color: @gray-lightest; + } + } + @media (max-width: @grid-float-breakpoint-max) { // Dropdowns get custom display when collapsed .open .dropdown-menu {