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:31:59 UTC
[01/15] allura git commit: ticket:866 changed description in
development.ini
Repository: allura
Updated Branches:
refs/heads/ib/5940a [created] d9a26980a
ticket:866 changed description in development.ini
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/6e5974cd
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/6e5974cd
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/6e5974cd
Branch: refs/heads/ib/5940a
Commit: 6e5974cd12eb6a4c479a8ef45d95fe3ec0b2169b
Parents: b3e3b119
Author: DeV1doR <de...@ukr.net>
Authored: Fri Dec 4 09:28:17 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:19:25 2015 +0200
----------------------------------------------------------------------
Allura/development.ini | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/6e5974cd/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 70d0842..0e2d12e 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -82,11 +82,12 @@ base_url = http://localhost:8080
; This should be the same as base_url
forgemail.url = http://localhost:8080
-; Change this to configure your logo path and redirect link
+; Change this to configure your image path and redirect link
+; for the logo
; 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": "user.png"}
+; logo = {"redirect_link": "/", "image_path": "user.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)
@@ -497,7 +498,7 @@ limit_param_max = 500
;
; Override this to specify your custom navigation links
;
-global_nav = [{"title": "Link 1", "url": "http://example.com"}]
+; global_nav = [{"title": "Link 1", "url": "http://example.com"}]
;
[05/15] allura git commit: ticket:866 added link for photo (need to
specify correct path)
Posted by je...@apache.org.
ticket:866 added link for photo (need to specify correct path)
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/2ff1f47c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/2ff1f47c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/2ff1f47c
Branch: refs/heads/ib/5940a
Commit: 2ff1f47c61f7dfb3256058f9d606aa2c13b3cb33
Parents: 87cfb89
Author: DeV1doR <de...@ukr.net>
Authored: Wed Dec 2 15:56:40 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:19:25 2015 +0200
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 4 ++++
Allura/allura/templates/jinja_master/theme_macros.html | 1 +
Allura/development.ini | 6 +++---
3 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/2ff1f47c/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index ffbb535..3fd5cd2 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -602,6 +602,10 @@ class Globals(object):
def global_nav(self):
return json.loads(config.get('global_nav'))
+ @LazyProperty
+ def logo_path(self):
+ return config.get('logo_path')
+
class Icon(object):
http://git-wip-us.apache.org/repos/asf/allura/blob/2ff1f47c/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 aea5ebd..f7e2bdf 100644
--- a/Allura/allura/templates/jinja_master/theme_macros.html
+++ b/Allura/allura/templates/jinja_master/theme_macros.html
@@ -28,6 +28,7 @@ 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>
{% 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/2ff1f47c/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 40cd969..071b78c 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -81,8 +81,8 @@ 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 url
-logo_url = Allura
+; Change this to your logo path
+logo_path = http://localhost:8080/allura/nf/images/admin_24.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 +493,7 @@ limit_param_max = 500
;
; Override this to specify your custom navigation links
;
-global_nav = [{"title": "Logo", "url": "https://mail.google.com"}, {"title": "Ashot-one-shot", "url": "http://vk.com/id22568536"}]
+global_nav = [{"title": "Logo", "url": "https://mail.google.com"}]
;
[04/15] allura git commit: ticket:866 added global_nav with links;
Posted by je...@apache.org.
ticket:866 added global_nav with links;
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/8a804ad9
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/8a804ad9
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/8a804ad9
Branch: refs/heads/ib/5940a
Commit: 8a804ad955a27a82acbf557c90b5c168ec06ed40
Parents: a54dbbf
Author: DeV1doR <de...@ukr.net>
Authored: Wed Dec 2 00:13:50 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:19:25 2015 +0200
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 4 ++++
Allura/allura/nf/allura/css/site_style.css | 9 ++++++++-
Allura/allura/templates/jinja_master/theme_macros.html | 7 ++++++-
Allura/development.ini | 11 +++++++++++
4 files changed, 29 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/8a804ad9/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index d63c93f..ffbb535 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -598,6 +598,10 @@ class Globals(object):
def build_key(self):
return config.get('build_key', '')
+ @LazyProperty
+ def global_nav(self):
+ return json.loads(config.get('global_nav'))
+
class Icon(object):
http://git-wip-us.apache.org/repos/asf/allura/blob/8a804ad9/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 a0e268e..007f097 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -489,12 +489,19 @@ blockquote {
width: 280px;
}
#site-header nav {
- float: right !important;
margin-left: 20px;
padding: 12px 0 0 0;
text-shadow: rgba(0, 0, 0, 0.6) 0 0 0, rgba(255, 255, 255, 0.6) 0 1px 0;
}
+/* nav */
+.nav-left {
+ float: left;
+}
+.nav-right {
+ float: right;
+}
+
/* logo */
.logo {
width: 138px;
http://git-wip-us.apache.org/repos/asf/allura/blob/8a804ad9/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 5581037..aea5ebd 100644
--- a/Allura/allura/templates/jinja_master/theme_macros.html
+++ b/Allura/allura/templates/jinja_master/theme_macros.html
@@ -27,7 +27,12 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
{%- macro header(login_url, logout_url) %}
<header id="site-header">
<div class="wrapper">
- <nav>
+ <nav class="nav-left">
+ {% for nav_link in g.global_nav %}
+ <a href="{{ nav_link['url'] }}">{{ nav_link['title'] }}</a>
+ {% endfor %}
+ </nav>
+ <nav class="nav-right">
{% if c.user._id %}
<a href="/auth/preferences/">Account</a>
<a href="{{c.user.url()}}">{{name}}</a>
http://git-wip-us.apache.org/repos/asf/allura/blob/8a804ad9/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 4224bc8..2c58182 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -81,6 +81,8 @@ 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 url
+logo_url = Allura
; 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)
@@ -485,6 +487,15 @@ lcd_timeout = 60
; Allowing exceedingly high values may have a performance impact
limit_param_max = 500
+
+;
+; Settings for global navigation
+;
+; Override this to specify tou custom navigation links
+;
+global_nav = [{"title": "Logo", "url": "https://mail.google.com"}, {"title": "Ashot-one-shot", "url": "http://vk.com/id22568536"}]
+
+
;
; Settings for the Blog tool
;
[03/15] allura git commit: ticket:866 fixed text in development.ini
Posted by je...@apache.org.
ticket:866 fixed text in development.ini
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/87cfb89c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/87cfb89c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/87cfb89c
Branch: refs/heads/ib/5940a
Commit: 87cfb89c6d5f0c392f65797b778496f06f9e846c
Parents: 8a804ad
Author: DeV1doR <de...@ukr.net>
Authored: Wed Dec 2 00:19:28 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:19:25 2015 +0200
----------------------------------------------------------------------
Allura/development.ini | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/87cfb89c/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 2c58182..40cd969 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -491,7 +491,7 @@ limit_param_max = 500
;
; Settings for global navigation
;
-; Override this to specify tou custom navigation links
+; Override this to specify your custom navigation links
;
global_nav = [{"title": "Logo", "url": "https://mail.google.com"}, {"title": "Ashot-one-shot", "url": "http://vk.com/id22568536"}]
[09/15] allura git commit: [#5940] ticket:866 updated tests for
navigation
Posted by je...@apache.org.
[#5940] ticket:866 updated tests for navigation
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/9996885c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/9996885c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/9996885c
Branch: refs/heads/ib/5940a
Commit: 9996885c2c38d202cd9a9a912a4c3e0c5f69189a
Parents: e9572ec
Author: DeV1doR <de...@ukr.net>
Authored: Fri Dec 4 14:40:14 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:19:26 2015 +0200
----------------------------------------------------------------------
Allura/allura/tests/functional/test_nav.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/9996885c/Allura/allura/tests/functional/test_nav.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_nav.py b/Allura/allura/tests/functional/test_nav.py
index c382941..a0fe530 100644
--- a/Allura/allura/tests/functional/test_nav.py
+++ b/Allura/allura/tests/functional/test_nav.py
@@ -17,13 +17,11 @@ class TestNavigation(TestController):
def setUp(self):
super(TestNavigation, self).setUp()
self.logo_pattern = ('div', {'class': 'nav-logo'})
- self.global_nav_pattent = ('nav', {'class': 'nav-left'})
+ self.global_nav_pattern = ('nav', {'class': 'nav-left'})
self.nav_data = {
"title": "Link Test", "url": "http://example.com"}
self.logo_data = {
"redirect_link": "/", "image_path": "test_image.png"}
-
- def tearDown(self):
g._Globals__shared_state.pop('global_nav', None)
g._Globals__shared_state.pop('nav_logo', None)
@@ -36,7 +34,7 @@ class TestNavigation(TestController):
def test_global_nav_links_present(self):
with h.push_config(config, **self._set_config()):
response = self.app.get('/')
- nav_left = response.html.find(*self.global_nav_pattent)
+ nav_left = response.html.find(*self.global_nav_pattern)
assert len(nav_left.findAll('a')) == 1
assert nav_left.a.get('href') == self.nav_data['url']
assert nav_left.a.text == self.nav_data['title']
@@ -45,7 +43,7 @@ class TestNavigation(TestController):
def test_global_nav_links_absent(self, global_nav):
with h.push_config(config, **self._set_config()):
response = self.app.get('/')
- nav_left = response.html.find(*self.global_nav_pattent)
+ nav_left = response.html.find(*self.global_nav_pattern)
assert len(nav_left.findAll('a')) == 0
def test_logo_absent_if_not_image_path(self):
[10/15] allura git commit: [#5940] ticket:866 global logo fix
Posted by je...@apache.org.
[#5940] ticket:866 global logo fix
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/9e184ab4
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/9e184ab4
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/9e184ab4
Branch: refs/heads/ib/5940a
Commit: 9e184ab4fd7d1d63d659abe127788eaee43ea83b
Parents: 6e5974c
Author: DeV1doR <de...@ukr.net>
Authored: Fri Dec 4 11:29:11 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:19:26 2015 +0200
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 2 ++
Allura/allura/tests/functional/test_nav.py | 30 ++++++++++++++++++-------
2 files changed, 24 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/9e184ab4/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index c532bdd..c7aee45 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -607,6 +607,8 @@ class Globals(object):
@LazyProperty
def nav_logo(self):
+ if not config.get('logo', False):
+ return False
logo = json.loads(config.get('logo'))
image_path = logo.get('image_path', False)
if not image_path:
http://git-wip-us.apache.org/repos/asf/allura/blob/9e184ab4/Allura/allura/tests/functional/test_nav.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_nav.py b/Allura/allura/tests/functional/test_nav.py
index d9d267e..8f75bd8 100644
--- a/Allura/allura/tests/functional/test_nav.py
+++ b/Allura/allura/tests/functional/test_nav.py
@@ -22,13 +22,15 @@ class TestNavigation(TestController):
"title": "Link Test", "url": "http://example.com"}
self.logo_data = {
"redirect_link": "/", "image_path": "test_image.png"}
- self.config_data = {
+
+ def _set_config(self):
+ return {
"global_nav": json.dumps([self.nav_data]),
"logo": json.dumps(self.logo_data)
}
def test_global_nav_links_present(self):
- with h.push_config(config, **self.config_data):
+ with h.push_config(config, **self._set_config()):
response = self.app.get('/')
nav_left = response.html.find(*self.global_nav_pattent)
assert len(nav_left.findAll('a')) == 1
@@ -36,13 +38,25 @@ class TestNavigation(TestController):
assert nav_left.a.text == self.nav_data['title']
def test_logo_absent_if_not_image_path(self):
- with h.push_config(config, **self.config_data):
+ with h.push_config(config, **self._set_config()):
response = self.app.get('/')
nav_logo = response.html.find(*self.logo_pattern)
assert len(nav_logo.findAll('a')) == 0
- @mock.patch.object(g, 'nav_logo')
- def test_logo_present(self, glogo):
- response = self.app.get('/')
- nav_logo = response.html.find(*self.logo_pattern)
- assert len(nav_logo.findAll('img')) == 1
+ # def test_logo_present(self):
+ # self.logo_data = {
+ # "redirect_link": "/", "image_path": "user.png"}
+ # with h.push_config(config, **self._set_config()):
+ # response = self.app.get('/')
+ # nav_logo = response.html.find(*self.logo_pattern)
+ # import ipdb; ipdb.set_trace()
+ # assert len(nav_logo.findAll('a')) == 1
+
+ # def test_logo_no_redirect_url_set_default(self):
+ # self.logo_data = {
+ # "redirect_link": "", "image_path": "user.png"}
+ # with h.push_config(config, **self._set_config()):
+ # response = self.app.get('/')
+ # nav_logo = response.html.find(*self.logo_pattern)
+ # assert len(nav_logo.findAll('a')) == 1
+ # assert nav_left.a.get('href') == '/'
[08/15] allura git commit: [#5940] ticket:866 fixed and updated tests
of global_nav and logo
Posted by je...@apache.org.
[#5940] ticket:866 fixed and updated tests of global_nav and logo
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/e9572ec0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/e9572ec0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/e9572ec0
Branch: refs/heads/ib/5940a
Commit: e9572ec0c555b857fcba8e4ea522a26ed22bec26
Parents: 9e184ab
Author: DeV1doR <de...@ukr.net>
Authored: Fri Dec 4 12:25:44 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:19:26 2015 +0200
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 2 +-
Allura/allura/tests/functional/test_nav.py | 47 +++++++++++++++----------
2 files changed, 30 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/e9572ec0/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index c7aee45..6c0cf78 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -621,7 +621,7 @@ class Globals(object):
return False
if not logo.get('redirect_link', False):
- logo['redirect_url'] = '/'
+ logo['redirect_link'] = '/'
path = 'images/%s' % logo['image_path']
return {
"image_path": self.forge_static(path),
http://git-wip-us.apache.org/repos/asf/allura/blob/e9572ec0/Allura/allura/tests/functional/test_nav.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_nav.py b/Allura/allura/tests/functional/test_nav.py
index 8f75bd8..c382941 100644
--- a/Allura/allura/tests/functional/test_nav.py
+++ b/Allura/allura/tests/functional/test_nav.py
@@ -9,7 +9,7 @@ from allura.lib import helpers as h
class TestNavigation(TestController):
"""
- Test left navigation in top nav.
+ Test div-logo and nav-left:
- Test of global_nav links.
- Test of logo.
"""
@@ -23,6 +23,10 @@ class TestNavigation(TestController):
self.logo_data = {
"redirect_link": "/", "image_path": "test_image.png"}
+ def tearDown(self):
+ g._Globals__shared_state.pop('global_nav', None)
+ g._Globals__shared_state.pop('nav_logo', None)
+
def _set_config(self):
return {
"global_nav": json.dumps([self.nav_data]),
@@ -37,26 +41,33 @@ class TestNavigation(TestController):
assert nav_left.a.get('href') == self.nav_data['url']
assert nav_left.a.text == self.nav_data['title']
+ @mock.patch.object(g, 'global_nav', return_value=[])
+ def test_global_nav_links_absent(self, global_nav):
+ with h.push_config(config, **self._set_config()):
+ response = self.app.get('/')
+ nav_left = response.html.find(*self.global_nav_pattent)
+ assert len(nav_left.findAll('a')) == 0
+
def test_logo_absent_if_not_image_path(self):
with h.push_config(config, **self._set_config()):
response = self.app.get('/')
nav_logo = response.html.find(*self.logo_pattern)
assert len(nav_logo.findAll('a')) == 0
- # def test_logo_present(self):
- # self.logo_data = {
- # "redirect_link": "/", "image_path": "user.png"}
- # with h.push_config(config, **self._set_config()):
- # response = self.app.get('/')
- # nav_logo = response.html.find(*self.logo_pattern)
- # import ipdb; ipdb.set_trace()
- # assert len(nav_logo.findAll('a')) == 1
-
- # def test_logo_no_redirect_url_set_default(self):
- # self.logo_data = {
- # "redirect_link": "", "image_path": "user.png"}
- # with h.push_config(config, **self._set_config()):
- # response = self.app.get('/')
- # nav_logo = response.html.find(*self.logo_pattern)
- # assert len(nav_logo.findAll('a')) == 1
- # assert nav_left.a.get('href') == '/'
+ def test_logo_present(self):
+ self.logo_data = {
+ "redirect_link": "/", "image_path": "user.png"}
+ with h.push_config(config, **self._set_config()):
+ response = self.app.get('/')
+ nav_logo = response.html.find(*self.logo_pattern)
+ assert len(nav_logo.findAll('a')) == 1
+ assert self.logo_data['image_path'] in nav_logo.a.img.get('src')
+
+ def test_logo_no_redirect_url_set_default(self):
+ self.logo_data = {
+ "redirect_link": "", "image_path": "user.png"}
+ with h.push_config(config, **self._set_config()):
+ response = self.app.get('/')
+ nav_logo = response.html.find(*self.logo_pattern)
+ assert len(nav_logo.findAll('a')) == 1
+ assert nav_logo.a.get('href') == '/'
[07/15] allura git commit: ticket:866 added tests 2 tests
Posted by je...@apache.org.
ticket:866 added tests 2 tests
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/58a993c7
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/58a993c7
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/58a993c7
Branch: refs/heads/ib/5940a
Commit: 58a993c7226934c79471975be80c2ef09deccb13
Parents: 401cb4f
Author: DeV1doR <de...@ukr.net>
Authored: Thu Dec 3 18:55:53 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:19:25 2015 +0200
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 5 +-
Allura/allura/nf/allura/css/site_style.css | 11 ++--
.../templates/jinja_master/theme_macros.html | 18 +++----
Allura/allura/tests/functional/test_auth.py | 4 +-
Allura/allura/tests/functional/test_nav.py | 56 ++++++++++++++++++++
Allura/development.ini | 4 +-
6 files changed, 77 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/58a993c7/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 43840b0..84ea20e 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -600,11 +600,14 @@ class Globals(object):
@LazyProperty
def global_nav(self):
+ if not config.get('global_nav', False):
+ return []
+
return json.loads(config.get('global_nav'))
@LazyProperty
def nav_logo(self):
- logo = json.loads(config.get('logo'))
+ logo = json.loads(config.get('logo').replace("\'", '"'))
image_path = logo.get('image_path', False)
if not image_path:
return {}
http://git-wip-us.apache.org/repos/asf/allura/blob/58a993c7/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 19ce6b1..53f3a5b 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -495,16 +495,15 @@ blockquote {
}
/* nav */
-.nav-left {
+nav .link-left {
float: left;
}
-.nav-right {
+nav .link-right {
float: right;
}
-.nav-logo {
- vertical-align: top;
- margin-bottom: 5px;
-}
+/*.link-right, .link-left {
+ line-height: 45px;
+}*/
/* logo */
.logo {
http://git-wip-us.apache.org/repos/asf/allura/blob/58a993c7/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 3bede3e..40f03dc 100644
--- a/Allura/allura/templates/jinja_master/theme_macros.html
+++ b/Allura/allura/templates/jinja_master/theme_macros.html
@@ -27,24 +27,22 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
{%- macro header(login_url, logout_url) %}
<header id="site-header">
<div class="wrapper">
- <nav class="nav-left">
+ <nav>
{% if g.nav_logo %}
- <a href="{{ g.nav_logo['redirect_link'] }}"><img class="nav-logo" src="{{ g.nav_logo['image_path'] }}" /></a>
+ <a class="link-left" 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>
+ <a class="link-left" href="{{ nav_link['url'] }}">{{ nav_link['title'] }}</a>
{% endfor %}
- </nav>
- <nav class="nav-right">
{% if c.user._id %}
- <a href="/auth/preferences/">Account</a>
- <a href="{{c.user.url()}}">{{name}}</a>
- <a href="{{logout_url}}">Log Out</a>
+ <a class="link-right" href="/auth/preferences/">Account</a>
+ <a class="link-right" href="{{c.user.url()}}">{{name}}</a>
+ <a class="link-right" href="{{logout_url}}">Log Out</a>
{% else %}
{% if h.asbool(config.get('auth.allow_user_registration', True)) %}
- <a href="/auth/create_account">Register</a>
+ <a class="link-right" href="/auth/create_account">Register</a>
{% endif %}
- <a href="{{login_url}}">Log In</a>
+ <a class="link-right" href="{{login_url}}">Log In</a>
{% endif %}
</nav>
</div>
http://git-wip-us.apache.org/repos/asf/allura/blob/58a993c7/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 62b14d0..ed926da 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.findAll('nav')[1]('a')[-1].string, "Log Out")
+ assert_equal(r.html.nav('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.findAll('nav')[1]('a')[-1].string, 'Log In')
+ assert_equal(r.html.nav('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/58a993c7/Allura/allura/tests/functional/test_nav.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_nav.py b/Allura/allura/tests/functional/test_nav.py
new file mode 100644
index 0000000..306d2e1
--- /dev/null
+++ b/Allura/allura/tests/functional/test_nav.py
@@ -0,0 +1,56 @@
+import mock
+import json
+from tg import config
+
+from allura.tests import TestController
+from allura.lib import helpers as h
+
+
+class TestNavigation(TestController):
+ """
+ Test left navigation in top nav.
+ - Test of global_nav links.
+ - Test of logo.
+ """
+
+ def setUp(self):
+ super(TestNavigation, self).setUp()
+
+ def test_global_nav_links_present(self):
+ data = {"title": "Link Test", "url": "http://example.com"}
+ with h.push_config(config, **{"global_nav": json.dumps([data])}):
+ response = self.app.get('/')
+ assert response.html.nav('a')[0].text == \
+ data['title']
+ assert response.html.nav('a')[0].attrs[-1][-1] == \
+ data['url']
+
+ def test_logo_absent_if_not_image_path(self):
+ data = {"redirect_link": "/", "image_path": "bad_image.png"}
+ with h.push_config(config, **{"logo": json.dumps(data)}):
+ response = self.app.get('/')
+ self.logo = json.loads(config.get('logo'))
+ main_page_link = response.html.nav('a')[0].attrs[-1][-1]
+ assert main_page_link != self.logo['redirect_link']
+
+ # @mock.patch('allura.lib.app_globals.os.path.exists')
+ # def test_logo_present(self, path_exists):
+ # path_exists.return_value = True
+ # data = {"redirect_link": "/", "image_path": "user123.png"}
+ # with h.push_config(config, **{"logo": json.dumps(data)}):
+ # response = self.app.get('/')
+ # self.logo = json.loads(config.get('logo'))
+ # main_page_link = response.html.nav('a')[0].attrs[-1][-1]
+ # image_link = response.html.html.nav('a')[0].img.attrs[-1][-1]
+ # assert main_page_link == self.logo['redirect_link']
+ # assert self.logo['image_path'] in image_link
+
+ # @mock.patch("allura.lib.app_globals.config")
+ # def test_logo_redirect_url_absent_and_set_default(self, _config):
+ # _config.get('logo').return_value = str({
+ # "redirect_link": "/",
+ # "image_path": "a.png"
+ # })
+ # response = self.app.get('/')
+ # main_page_link = response.html.findAll('nav')[0]('a')[0].attrs[-1][-1]
+ # assert main_page_link == '/'
http://git-wip-us.apache.org/repos/asf/allura/blob/58a993c7/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 02808ae..057850c 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -86,7 +86,7 @@ forgemail.url = http://localhost:8080
; 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"}
+; logo = {"redirect_link": "/", "image_path": "user.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)
@@ -497,7 +497,7 @@ limit_param_max = 500
;
; Override this to specify your custom navigation links
;
-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"}]
+global_nav = [{"title": "Link 1", "url": "http://example.com"}]
;
[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;
Posted by je...@apache.org.
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"}]
;
[13/15] allura git commit: [#5940] ticket:880 Logo and global bav
improvements
Posted by je...@apache.org.
[#5940] ticket:880 Logo and global bav improvements
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/eb76ff59
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/eb76ff59
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/eb76ff59
Branch: refs/heads/ib/5940a
Commit: eb76ff59d3ae4a883400f762b3ace61416c00965
Parents: 93e174f
Author: DeV1doR <de...@ukr.net>
Authored: Thu Dec 10 15:03:49 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:21:01 2015 +0200
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 26 +++++++----
.../templates/jinja_master/theme_macros.html | 2 +-
Allura/allura/tests/functional/test_nav.py | 49 ++++++++++++++++++--
Allura/development.ini | 5 +-
4 files changed, 66 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/eb76ff59/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 6c0cf78..f7392cd 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -607,25 +607,33 @@ class Globals(object):
@LazyProperty
def nav_logo(self):
- if not config.get('logo', False):
- return False
- logo = json.loads(config.get('logo'))
- image_path = logo.get('image_path', False)
- if not image_path:
+ logo = dict(
+ redirect_link=config.get('logo.link', False),
+ image_path=config.get('logo.path', False),
+ image_width=config.get('logo.width', False),
+ image_height=config.get('logo.height', False)
+ )
+ if not logo['redirect_link']:
+ logo['redirect_link'] = '/'
+
+ if not logo['image_path']:
+ log.warning('Image path not set for nav_logo')
return False
+
allura_path = os.path.dirname(os.path.dirname(__file__))
image_full_path = '%s/public/nf/images/%s' % (
- allura_path, image_path)
+ allura_path, logo['image_path'])
if not os.path.isfile(image_full_path):
+ log.warning('Could not find logo at: %s' % image_full_path)
return False
- if not logo.get('redirect_link', False):
- logo['redirect_link'] = '/'
path = 'images/%s' % logo['image_path']
return {
"image_path": self.forge_static(path),
- "redirect_link": logo['redirect_link']
+ "redirect_link": logo['redirect_link'],
+ "image_width": logo['image_width'],
+ "image_height": logo['image_height']
}
http://git-wip-us.apache.org/repos/asf/allura/blob/eb76ff59/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 2ca9fd5..25c3eb5 100644
--- a/Allura/allura/templates/jinja_master/theme_macros.html
+++ b/Allura/allura/templates/jinja_master/theme_macros.html
@@ -29,7 +29,7 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
<div class="wrapper">
<div class="nav-logo">
{% if g.nav_logo %}
- <a class="link-left" href="{{ g.nav_logo['redirect_link'] }}"><img class="nav-logo" src="{{ g.nav_logo['image_path'] }}" /></a>
+ <a class="link-left" href="{{ g.nav_logo['redirect_link'] }}"><img class="nav-logo" style="{% if g.nav_logo['image_width'] %}width: {{g.nav_logo['image_width']}}px;{% endif %} {% if g.nav_logo['image_height'] %}height: {{ g.nav_logo['image_height'] }}px;{% endif %}" src="{{ g.nav_logo['image_path'] }}" /></a>
{% endif %}
</div>
<nav class="nav-left">
http://git-wip-us.apache.org/repos/asf/allura/blob/eb76ff59/Allura/allura/tests/functional/test_nav.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_nav.py b/Allura/allura/tests/functional/test_nav.py
index a0fe530..78d8aa6 100644
--- a/Allura/allura/tests/functional/test_nav.py
+++ b/Allura/allura/tests/functional/test_nav.py
@@ -21,14 +21,19 @@ class TestNavigation(TestController):
self.nav_data = {
"title": "Link Test", "url": "http://example.com"}
self.logo_data = {
- "redirect_link": "/", "image_path": "test_image.png"}
+ "link": "/", "path": "test_image.png"}
+ self.width = 'width: %spx;'
+ self.height = 'height: %spx;'
g._Globals__shared_state.pop('global_nav', None)
g._Globals__shared_state.pop('nav_logo', None)
def _set_config(self):
return {
"global_nav": json.dumps([self.nav_data]),
- "logo": json.dumps(self.logo_data)
+ "logo.link": self.logo_data['link'],
+ "logo.path": self.logo_data['path'],
+ "logo.width": self.logo_data.get('width', ''),
+ "logo.height": self.logo_data.get('height', '')
}
def test_global_nav_links_present(self):
@@ -54,18 +59,52 @@ class TestNavigation(TestController):
def test_logo_present(self):
self.logo_data = {
- "redirect_link": "/", "image_path": "user.png"}
+ "link": "/", "path": "user.png"}
with h.push_config(config, **self._set_config()):
response = self.app.get('/')
nav_logo = response.html.find(*self.logo_pattern)
assert len(nav_logo.findAll('a')) == 1
- assert self.logo_data['image_path'] in nav_logo.a.img.get('src')
+ assert self.logo_data['path'] in nav_logo.a.img.get('src')
def test_logo_no_redirect_url_set_default(self):
self.logo_data = {
- "redirect_link": "", "image_path": "user.png"}
+ "link": "", "path": "user.png"}
with h.push_config(config, **self._set_config()):
response = self.app.get('/')
nav_logo = response.html.find(*self.logo_pattern)
assert len(nav_logo.findAll('a')) == 1
assert nav_logo.a.get('href') == '/'
+
+ def test_logo_image_width_and_height(self):
+ self.logo_data = {
+ "link": "", "path": "user.png",
+ "width": 20, "height": 20}
+ with h.push_config(config, **self._set_config()):
+ response = self.app.get('/')
+ nav_logo = response.html.find(*self.logo_pattern)
+ width = self.width % self.logo_data["width"]
+ height = self.height % self.logo_data["height"]
+ assert nav_logo.find(
+ 'img', style='%s %s' % (width, height)) is not None
+
+ def test_missing_logo_width(self):
+ self.logo_data = {
+ "link": "", "path": "user.png",
+ "height": 20}
+ with h.push_config(config, **self._set_config()):
+ response = self.app.get('/')
+ nav_logo = response.html.find(*self.logo_pattern)
+ height = self.height % self.logo_data["height"]
+ assert nav_logo.find(
+ 'img', style=' %s' % height) is not None
+
+ def test_missing_logo_height(self):
+ self.logo_data = {
+ "link": "/", "path": "user.png",
+ "width": 20}
+ with h.push_config(config, **self._set_config()):
+ response = self.app.get('/')
+ nav_logo = response.html.find(*self.logo_pattern)
+ width = self.width % self.logo_data["width"]
+ assert nav_logo.find(
+ 'img', style='%s ' % width) is not None
http://git-wip-us.apache.org/repos/asf/allura/blob/eb76ff59/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index d9273bd..203428e 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -89,7 +89,10 @@ forgemail.url = http://localhost:8080
; Example: ../<static_path>/images/<logo_path>
; In default configuration you can place images under
; `Allura/allura/public/nf/images/` and specify file name below
-; logo = {"redirect_link": "/", "image_path": "sf10a.png"}
+; logo.link = /
+; logo.path = sf10a.png
+; logo.width = 78 ; in px
+; logo.height = 16 ; in px
; 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)
[06/15] allura git commit: ticket:866 updated template with mavbar;
updated tests for nav and logo;
Posted by je...@apache.org.
ticket:866 updated template with mavbar; updated tests for nav and logo;
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/b3e3b119
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/b3e3b119
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/b3e3b119
Branch: refs/heads/ib/5940a
Commit: b3e3b119680a32cae35e032fb16daf830aa50000
Parents: 58a993c
Author: DeV1doR <de...@ukr.net>
Authored: Fri Dec 4 02:12:22 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:19:25 2015 +0200
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 8 +--
Allura/allura/nf/allura/css/site_style.css | 9 +--
.../templates/jinja_master/theme_macros.html | 6 +-
Allura/allura/tests/functional/test_auth.py | 7 ++-
Allura/allura/tests/functional/test_nav.py | 58 +++++++++-----------
Allura/development.ini | 2 +-
6 files changed, 43 insertions(+), 47 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/b3e3b119/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 84ea20e..c532bdd 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -607,16 +607,16 @@ class Globals(object):
@LazyProperty
def nav_logo(self):
- logo = json.loads(config.get('logo').replace("\'", '"'))
+ logo = json.loads(config.get('logo'))
image_path = logo.get('image_path', False)
if not image_path:
- return {}
+ return False
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 os.path.isfile(image_full_path):
+ return False
if not logo.get('redirect_link', False):
logo['redirect_url'] = '/'
http://git-wip-us.apache.org/repos/asf/allura/blob/b3e3b119/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 53f3a5b..50bda3b 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -446,7 +446,7 @@ blockquote {
color: #555555;
}
#site-header a:first-child, #site-footer a:first-child {
- margin-left: 0;
+ margin-left: 1em;
}
/* site header */
@@ -495,15 +495,12 @@ blockquote {
}
/* nav */
-nav .link-left {
+.nav-left, .nav-logo {
float: left;
}
-nav .link-right {
+.nav-main {
float: right;
}
-/*.link-right, .link-left {
- line-height: 45px;
-}*/
/* logo */
.logo {
http://git-wip-us.apache.org/repos/asf/allura/blob/b3e3b119/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 40f03dc..2ca9fd5 100644
--- a/Allura/allura/templates/jinja_master/theme_macros.html
+++ b/Allura/allura/templates/jinja_master/theme_macros.html
@@ -27,13 +27,17 @@ http://stackoverflow.com/questions/26582731/redefining-imported-jinja-macros
{%- macro header(login_url, logout_url) %}
<header id="site-header">
<div class="wrapper">
- <nav>
+ <div class="nav-logo">
{% if g.nav_logo %}
<a class="link-left" href="{{ g.nav_logo['redirect_link'] }}"><img class="nav-logo" src="{{ g.nav_logo['image_path'] }}" /></a>
{% endif %}
+ </div>
+ <nav class="nav-left">
{% for nav_link in g.global_nav %}
<a class="link-left" href="{{ nav_link['url'] }}">{{ nav_link['title'] }}</a>
{% endfor %}
+ </nav>
+ <nav class="nav-main">
{% if c.user._id %}
<a class="link-right" href="/auth/preferences/">Account</a>
<a class="link-right" href="{{c.user.url()}}">{{name}}</a>
http://git-wip-us.apache.org/repos/asf/allura/blob/b3e3b119/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..855d315 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -81,18 +81,21 @@ class TestAuth(TestController):
def test_logout(self):
self.app.extra_environ = {'disable_auth_magic': 'True'}
+ nav_pattern = ('nav', {'class': 'nav-main'})
r = self.app.get('/auth/')
f = r.forms[0]
f['username'] = 'test-user'
f['password'] = 'foo'
r = f.submit().follow()
logged_in_session = r.session['_id']
- assert_equal(r.html.nav('a')[-1].string, "Log Out")
+ links = r.html.find(*nav_pattern).findAll('a')
+ assert_equal(links[-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')
+ links = r.html.find(*nav_pattern).findAll('a')
+ assert_equal(links[-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/b3e3b119/Allura/allura/tests/functional/test_nav.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_nav.py b/Allura/allura/tests/functional/test_nav.py
index 306d2e1..d9d267e 100644
--- a/Allura/allura/tests/functional/test_nav.py
+++ b/Allura/allura/tests/functional/test_nav.py
@@ -1,6 +1,7 @@
import mock
import json
from tg import config
+from pylons import app_globals as g
from allura.tests import TestController
from allura.lib import helpers as h
@@ -15,42 +16,33 @@ class TestNavigation(TestController):
def setUp(self):
super(TestNavigation, self).setUp()
+ self.logo_pattern = ('div', {'class': 'nav-logo'})
+ self.global_nav_pattent = ('nav', {'class': 'nav-left'})
+ self.nav_data = {
+ "title": "Link Test", "url": "http://example.com"}
+ self.logo_data = {
+ "redirect_link": "/", "image_path": "test_image.png"}
+ self.config_data = {
+ "global_nav": json.dumps([self.nav_data]),
+ "logo": json.dumps(self.logo_data)
+ }
def test_global_nav_links_present(self):
- data = {"title": "Link Test", "url": "http://example.com"}
- with h.push_config(config, **{"global_nav": json.dumps([data])}):
+ with h.push_config(config, **self.config_data):
response = self.app.get('/')
- assert response.html.nav('a')[0].text == \
- data['title']
- assert response.html.nav('a')[0].attrs[-1][-1] == \
- data['url']
+ nav_left = response.html.find(*self.global_nav_pattent)
+ assert len(nav_left.findAll('a')) == 1
+ assert nav_left.a.get('href') == self.nav_data['url']
+ assert nav_left.a.text == self.nav_data['title']
def test_logo_absent_if_not_image_path(self):
- data = {"redirect_link": "/", "image_path": "bad_image.png"}
- with h.push_config(config, **{"logo": json.dumps(data)}):
+ with h.push_config(config, **self.config_data):
response = self.app.get('/')
- self.logo = json.loads(config.get('logo'))
- main_page_link = response.html.nav('a')[0].attrs[-1][-1]
- assert main_page_link != self.logo['redirect_link']
-
- # @mock.patch('allura.lib.app_globals.os.path.exists')
- # def test_logo_present(self, path_exists):
- # path_exists.return_value = True
- # data = {"redirect_link": "/", "image_path": "user123.png"}
- # with h.push_config(config, **{"logo": json.dumps(data)}):
- # response = self.app.get('/')
- # self.logo = json.loads(config.get('logo'))
- # main_page_link = response.html.nav('a')[0].attrs[-1][-1]
- # image_link = response.html.html.nav('a')[0].img.attrs[-1][-1]
- # assert main_page_link == self.logo['redirect_link']
- # assert self.logo['image_path'] in image_link
-
- # @mock.patch("allura.lib.app_globals.config")
- # def test_logo_redirect_url_absent_and_set_default(self, _config):
- # _config.get('logo').return_value = str({
- # "redirect_link": "/",
- # "image_path": "a.png"
- # })
- # response = self.app.get('/')
- # main_page_link = response.html.findAll('nav')[0]('a')[0].attrs[-1][-1]
- # assert main_page_link == '/'
+ nav_logo = response.html.find(*self.logo_pattern)
+ assert len(nav_logo.findAll('a')) == 0
+
+ @mock.patch.object(g, 'nav_logo')
+ def test_logo_present(self, glogo):
+ response = self.app.get('/')
+ nav_logo = response.html.find(*self.logo_pattern)
+ assert len(nav_logo.findAll('img')) == 1
http://git-wip-us.apache.org/repos/asf/allura/blob/b3e3b119/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 057850c..70d0842 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -86,7 +86,7 @@ forgemail.url = http://localhost:8080
; 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": "user.png"}
+logo = {"redirect_link": "/", "image_path": "user.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)
[12/15] allura git commit: [#5940] ticket:866 Add default style for
nv image
Posted by je...@apache.org.
[#5940] ticket:866 Add default style for nv image
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/ae40bafe
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/ae40bafe
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/ae40bafe
Branch: refs/heads/ib/5940a
Commit: ae40bafea72c70b4ea7b020e978c3a294ea50d9d
Parents: 9996885
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Dec 7 10:18:53 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:19:26 2015 +0200
----------------------------------------------------------------------
Allura/allura/nf/allura/css/site_style.css | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/ae40bafe/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 50bda3b..3506ebe 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -501,6 +501,9 @@ blockquote {
.nav-main {
float: right;
}
+img.nav-logo {
+ margin-top: 13px;
+}
/* logo */
.logo {
[15/15] allura git commit: [#5940] ticket:880 Change image size in
example config to match real image dimensions
Posted by je...@apache.org.
[#5940] ticket:880 Change image size in example config to match real image dimensions
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/d9a26980
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/d9a26980
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/d9a26980
Branch: refs/heads/ib/5940a
Commit: d9a26980a18d2254d838886adaeb5fc4bb2b37fd
Parents: 2d89269
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Dec 15 13:29:33 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:29:33 2015 +0200
----------------------------------------------------------------------
Allura/development.ini | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/d9a26980/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 203428e..930f7f3 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -91,8 +91,8 @@ forgemail.url = http://localhost:8080
; `Allura/allura/public/nf/images/` and specify file name below
; logo.link = /
; logo.path = sf10a.png
-; logo.width = 78 ; in px
-; logo.height = 16 ; in px
+; logo.width = 125 ; in px
+; logo.height = 18 ; in px
; 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)
[11/15] allura git commit: [#5940] ticket:866 Amend development.ini
docstrings
Posted by je...@apache.org.
[#5940] ticket:866 Amend development.ini docstrings
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/93e174f4
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/93e174f4
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/93e174f4
Branch: refs/heads/ib/5940a
Commit: 93e174f40dd845a5c8eecfff49c24fefd7f80448
Parents: ae40baf
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Dec 7 10:22:00 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:19:26 2015 +0200
----------------------------------------------------------------------
Allura/development.ini | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/93e174f4/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 0e2d12e..d9273bd 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -87,7 +87,9 @@ forgemail.url = http://localhost:8080
; 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": "user.png"}
+; In default configuration you can place images under
+; `Allura/allura/public/nf/images/` and specify file name below
+; logo = {"redirect_link": "/", "image_path": "sf10a.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)
@@ -497,7 +499,6 @@ limit_param_max = 500
; Settings for global navigation
;
; Override this to specify your custom navigation links
-;
; global_nav = [{"title": "Link 1", "url": "http://example.com"}]
[14/15] allura git commit: [#5940] ticket:880 Add documentation
Posted by je...@apache.org.
[#5940] ticket:880 Add documentation
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/2d89269e
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/2d89269e
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/2d89269e
Branch: refs/heads/ib/5940a
Commit: 2d89269ed2b5d24e6ac67a596c4ec8896b1bb994
Parents: eb76ff5
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Dec 11 13:37:11 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Dec 15 13:23:27 2015 +0200
----------------------------------------------------------------------
Allura/docs/getting_started/administration.rst | 33 +++++++++++++++++++++
1 file changed, 33 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/2d89269e/Allura/docs/getting_started/administration.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/getting_started/administration.rst b/Allura/docs/getting_started/administration.rst
index d1b4b93..e749860 100644
--- a/Allura/docs/getting_started/administration.rst
+++ b/Allura/docs/getting_started/administration.rst
@@ -43,6 +43,39 @@ The admin interface allows you to:
* Subscribe a user to an artifact
* Reclone a repository
+Customizing appearance
+======================
+
+Global navigation
+-----------------
+
+Allura supports adding global navigation links which will be displayed in the header of every page.
+
+To set up this add :code:`global_nav` option to :code:`[app:main]` section of your :file:`development.ini`. It should be a JSON list of dicts like the following:
+
+.. code-block:: ini
+
+ [app:main]
+ ...
+ global_nav = [{"title": "Example", "url": "http://example.com"}, {"title": "Another", "url": "http://another.com"}]
+
+Site logo
+---------
+
+You can set up logo to be displayed in the top left corner of the site.
+
+Add the following to your :file:`development.ini`:
+
+.. code-block:: ini
+
+ [app:main]
+ ...
+ logo.link = / ; link to attach to the logo (optional, defaults to "/")
+ logo.path = sf10a.png ; fs path to the logo image, relative to Allura/allura/public/nf/images/
+ logo.width = 78 ; logo width in pixels (optional)
+ logo.height = 30 ; logo height in pixels (optional)
+
+
Commands, Scripts, and Tasks
============================