incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [2/7] git commit: [#5481] Removed inline styles and use ULs for admins / members macros
Date Mon, 15 Apr 2013 14:02:54 GMT
[#5481] Removed inline styles and use ULs for admins / members macros

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/19585988
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/19585988
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/19585988

Branch: refs/heads/master
Commit: 19585988b7ad24fe594bb79f1c09e9494acdaaf7
Parents: 69153ad
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Fri Apr 12 22:40:38 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Mon Apr 15 14:01:51 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/macro.py                 |   17 +++++++++--------
 Allura/allura/nf/allura/css/site_style.css |    8 ++++++++
 Allura/allura/tests/test_globals.py        |   16 +++++++---------
 3 files changed, 24 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/19585988/Allura/allura/lib/macro.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
index 747ce58..53ebd6b 100644
--- a/Allura/allura/lib/macro.py
+++ b/Allura/allura/lib/macro.py
@@ -7,6 +7,7 @@ import traceback
 from operator import attrgetter
 
 import pymongo
+import jinja2
 from pylons import tmpl_context as c, app_globals as g
 from pylons import request
 from paste.deploy.converters import asint
@@ -335,30 +336,30 @@ def img(src=None, **kw):
         return '<img src="./attachment/%s" %s/>' % (src, ' '.join(attrs))
 
 
-template_project_admins = string.Template('<a href="$url">$name</a><br/>')
+template_project_admins = string.Template('<li><a href="$url">$name</a></li>')
 @macro()
 def project_admins():
     admins = c.project.users_with_role('Admin')
     output = ''.join(
         template_project_admins.substitute(dict(
             url=user.url(),
-            name=user.display_name))
+            name=jinja2.escape(user.display_name)))
         for user in admins)
-    return u'<h6>Project Admins:</h6><div class="grid-10" style="margin-left:
2em">{}</div><div style="clear: both;"></div>'.format(output)
+    return u'<h6>Project Admins:</h6><ul class="md-users-list">{0}</ul>'.format(output)
 
-template_members = string.Template('<a href="$url">$name</a>$admin<br/>')
+template_members = string.Template('<li><a href="$url">$name</a>$admin</li>')
 @macro()
 def members(limit=20):
     limit = asint(limit)
     admins = set(c.project.users_with_role('Admin'))
     members = sorted(c.project.users(), key=attrgetter('display_name'))
-    output = '<div style="margin-left: 0.5em; margin-bottom: 0.5em;">%s</div>'
% ''.join(
+    output = ''.join(
         template_members.substitute(dict(
             url=user.url(),
-            name=user.display_name,
+            name=jinja2.escape(user.display_name),
             admin=' (admin)' if user in admins else '',
             ))
         for user in members[:limit])
     if len(members) > limit:
-        output = output + '<a href="%s_members">All Members</a>' % c.project.url()
-    return u'<h6>Project Members:</h6><div style="margin-left: 1.5em;">{}</div><div
style="clear: both;"></div>'.format(output)
+        output = output + '<li class="md-users-list-more"><a href="%s_members">All
Members</a></li>' % c.project.url()
+    return u'<h6>Project Members:</h6><ul class="md-users-list">{0}</ul>'.format(output)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/19585988/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 2f96715..3256ad0 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -2066,6 +2066,14 @@ nav .ico {
   padding: 0;
 }
 
+.markdown_content ul.md-users-list {
+    list-style: none;
+}
+.markdown_content ul.md-users-list li.md-users-list-more {
+    margin-left: -0.5em;
+    margin-top: 0.5em;
+}
+
 .media a {
   float: left;
   margin-right: 20px;

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/19585988/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 1750bdc..c1dc9a8 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -160,13 +160,11 @@ def test_macro_members():
     assert_equal(r,
         '<div class="markdown_content">'
             '<h6>Project Members:</h6>'
-            '<div style="margin-left: 1.5em;">'
-                '<div style="margin-left: 0.5em; margin-bottom: 0.5em;">'
-                    '<a href="/u/test-admin/">Test Admin</a> (admin)<br />'
-                    '<a href="/u/test-user/">Test User</a><br />'
-                '</div>'
-                '<a href="/p/test/_members">All Members</a>'
-            '</div><div style="clear: both;"></div>\n'
+            '<ul class="md-users-list">'
+                '<li><a href="/u/test-admin/">Test Admin</a> (admin)</li>'
+                '<li><a href="/u/test-user/">Test User</a></li>'
+                '<li class="md-users-list-more"><a href="/p/test/_members">All
Members</a></li>'
+            '</ul>\n'
         '</div>')
 
 @with_setup(teardown=setUp) # reset everything we changed
@@ -174,7 +172,7 @@ def test_macro_project_admins():
     user = M.User.by_username('test-admin')
     user.display_name = u'Test Ådmin'
     r = g.markdown_wiki.convert('[[project_admins]]')
-    assert_equal(r, u'<div class="markdown_content"><h6>Project Admins:</h6><div
class="grid-10" style="margin-left: 2em;"><a href="/u/test-admin/">Test Ådmin</a><br
/></div><div style="clear: both;"></div>\n</div>')
+    assert_equal(r, u'<div class="markdown_content"><h6>Project Admins:</h6><ul
class="md-users-list"><li><a href="/u/test-admin/">Test Ådmin</a></li></ul>\n</div>')
 
 @with_setup(teardown=setUp) # reset everything we changed
 def test_macro_project_admins_one_br():
@@ -185,7 +183,7 @@ def test_macro_project_admins_one_br():
     r = g.markdown_wiki.convert('[[project_admins]]\n[[download_button]]')
 
     assert not '</a><br /><br /><a href=' in r, r
-    assert '</a><br /><a href=' in r, r
+    assert '</a></li><li><a href=' in r, r
 
 
 @td.with_wiki


Mime
View raw message