You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/12/15 13:32:00 UTC
[02/15] allura git commit: ticket:866 added global_nav and logo
configuration in development.ini;
updated theme_macro, added render of left navigation bar and logo image;
ticket:866 added global_nav and logo configuration in development.ini; updated theme_macro, added render of left navigation bar and logo image;
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/401cb4ff
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/401cb4ff
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/401cb4ff
Branch: refs/heads/ib/5940a
Commit: 401cb4ff9f657f0779464fa80f7a8e917badc4c6
Parents: 2ff1f47
Author: DeV1doR <de...@ukr.net>
Authored: Thu Dec 3 00:34:29 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:19:25 2015 +0200
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 21 ++++++++++++++++++--
Allura/allura/nf/allura/css/site_style.css | 4 ++++
.../templates/jinja_master/theme_macros.html | 4 +++-
Allura/allura/tests/functional/test_auth.py | 4 ++--
Allura/development.ini | 10 +++++++---
5 files changed, 35 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/401cb4ff/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 3fd5cd2..43840b0 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -603,8 +603,25 @@ class Globals(object):
return json.loads(config.get('global_nav'))
@LazyProperty
- def logo_path(self):
- return config.get('logo_path')
+ def nav_logo(self):
+ logo = json.loads(config.get('logo'))
+ image_path = logo.get('image_path', False)
+ if not image_path:
+ return {}
+ allura_path = os.path.dirname(os.path.dirname(__file__))
+ image_full_path = '%s/public/nf/images/%s' % (
+ allura_path, image_path)
+
+ if not os.path.exists(image_full_path):
+ return {}
+
+ if not logo.get('redirect_link', False):
+ logo['redirect_url'] = '/'
+ path = 'images/%s' % logo['image_path']
+ return {
+ "image_path": self.forge_static(path),
+ "redirect_link": logo['redirect_link']
+ }
class Icon(object):
http://git-wip-us.apache.org/repos/asf/allura/blob/401cb4ff/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index 007f097..19ce6b1 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -501,6 +501,10 @@ blockquote {
.nav-right {
float: right;
}
+.nav-logo {
+ vertical-align: top;
+ margin-bottom: 5px;
+}
/* logo */
.logo {
http://git-wip-us.apache.org/repos/asf/allura/blob/401cb4ff/Allura/allura/templates/jinja_master/theme_macros.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/theme_macros.html b/Allura/allura/templates/jinja_master/theme_macros.html
index f7e2bdf..3bede3e 100644
--- a/Allura/allura/templates/jinja_master/theme_macros.html
+++ b/Allura/allura/templates/jinja_master/theme_macros.html
@@ -28,7 +28,9 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
<header id="site-header">
<div class="wrapper">
<nav class="nav-left">
- <a href="/"><img src="{{ g.logo_path }}" /></a>
+ {% if g.nav_logo %}
+ <a href="{{ g.nav_logo['redirect_link'] }}"><img class="nav-logo" src="{{ g.nav_logo['image_path'] }}" /></a>
+ {% endif %}
{% for nav_link in g.global_nav %}
<a href="{{ nav_link['url'] }}">{{ nav_link['title'] }}</a>
{% endfor %}
http://git-wip-us.apache.org/repos/asf/allura/blob/401cb4ff/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index ed926da..62b14d0 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -87,12 +87,12 @@ class TestAuth(TestController):
f['password'] = 'foo'
r = f.submit().follow()
logged_in_session = r.session['_id']
- assert_equal(r.html.nav('a')[-1].string, "Log Out")
+ assert_equal(r.html.findAll('nav')[1]('a')[-1].string, "Log Out")
r = self.app.get('/auth/logout').follow()
logged_out_session = r.session['_id']
assert logged_in_session is not logged_out_session
- assert_equal(r.html.nav('a')[-1].string, 'Log In')
+ assert_equal(r.html.findAll('nav')[1]('a')[-1].string, 'Log In')
def test_track_login(self):
user = M.User.by_username('test-user')
http://git-wip-us.apache.org/repos/asf/allura/blob/401cb4ff/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 071b78c..02808ae 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -81,8 +81,12 @@ domain = localhost
base_url = http://localhost:8080
; This should be the same as base_url
forgemail.url = http://localhost:8080
-; Change this to your logo path
-logo_path = http://localhost:8080/allura/nf/images/admin_24.png
+
+; Change this to configure your logo path and redirect link
+; NOTE: specify your static.url_base before config this
+; Save your picture in images folder
+; Example: ../<static_path>/images/<logo_path>
+; logo = {"redirect_link": "/", "image_path": "al.png"}
; Used to uniquify references to static resources, can be a timestamp or any unique value
; This should be updated each time you deploy (or make significant changes, like new tools, new css)
@@ -493,7 +497,7 @@ limit_param_max = 500
;
; Override this to specify your custom navigation links
;
-global_nav = [{"title": "Logo", "url": "https://mail.google.com"}]
+global_nav = [{"title": "Link 1", "url": "http://example.com"}, {"title": "Link 2", "url": "http://example.com"}, {"title": "Link 3", "url": "http://example.com"}, {"title": "Link 4", "url": "http://example.com"}, {"title": "Link 5", "url": "http://example.com"}, {"title": "Link 6", "url": "http://example.com"}, {"title": "Link 7", "url": "http://example.com"}]
;