You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2014/02/13 21:21:29 UTC
[1/8] git commit: [#5395] Add video_url input to project Metadata,
validate YouTube URLs
Updated Branches:
refs/heads/cj/7097 9d6c69bbe -> cab098a1b (forced update)
[#5395] Add video_url input to project Metadata, validate YouTube URLs
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/bbba5f75
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/bbba5f75
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/bbba5f75
Branch: refs/heads/cj/7097
Commit: bbba5f753e22a362816e914e573e4648e8ff07ce
Parents: 36ba2d6
Author: Wayne Witzel III <ww...@slashdotmedia.com>
Authored: Wed Feb 5 13:11:14 2014 +0000
Committer: Wayne Witzel III <ww...@slashdotmedia.com>
Committed: Thu Feb 13 14:24:40 2014 +0000
----------------------------------------------------------------------
Allura/allura/ext/admin/admin_main.py | 5 +++++
.../templates/admin_widgets/metadata_admin.html | 4 ++++
Allura/allura/ext/admin/widgets.py | 2 ++
Allura/allura/lib/validators.py | 22 ++++++++++++++++++++
Allura/allura/model/project.py | 2 ++
5 files changed, 35 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bbba5f75/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 8c10e3d..0c79fea 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -346,6 +346,7 @@ class ProjectAdminController(BaseController):
icon=None,
category=None,
external_homepage='',
+ video_url='',
support_page='',
support_page_url='',
twitter_handle='',
@@ -407,6 +408,10 @@ class ProjectAdminController(BaseController):
M.AuditLog.log('change external home page to %s',
external_homepage)
c.project.external_homepage = external_homepage
+ if video_url != c.project.video_url:
+ h.log_action(log, 'change video url').info('')
+ M.AuditLog.log('change video url to %s', video_url)
+ c.project.video_url = video_url
if support_page != c.project.support_page:
h.log_action(log, 'change project support page').info('')
M.AuditLog.log('change project support page to %s', support_page)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bbba5f75/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
index a1a20ab..16b303b 100644
--- a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
+++ b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
@@ -32,6 +32,10 @@
<br>
{{widget.display_field(widget.fields.external_homepage) }}
+ {{ widget.display_label(widget.fields.video_url) }}
+ <br>
+ {{widget.display_field(widget.fields.video_url) }}
+
{{ widget.display_label(widget.fields.summary) }}
<br>
{{widget.display_field(widget.fields.summary) }}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bbba5f75/Allura/allura/ext/admin/widgets.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/widgets.py b/Allura/allura/ext/admin/widgets.py
index 805fa41..7a78ee4 100644
--- a/Allura/allura/ext/admin/widgets.py
+++ b/Allura/allura/ext/admin/widgets.py
@@ -181,6 +181,8 @@ class MetadataAdmin(ff.AdminForm):
icon = ew.FileField(label='Icon')
external_homepage = ew.InputField(field_type="text", label='Homepage',
validator=fev.URL(add_http=True))
+ video_url = ew.InputField(field_type="text", label="Video (YouTube)",
+ validator=V.YouTubeConverter())
support_page = ew.InputField(field_type="text", label='Support Page')
support_page_url = ew.InputField(
field_type="text", label='Support Page URL',
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bbba5f75/Allura/allura/lib/validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index 1c0acfd..f23a951 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -16,6 +16,7 @@
# under the License.
import json
+import re
from bson import ObjectId
import formencode as fe
from formencode import validators as fev
@@ -322,6 +323,27 @@ class MapValidator(fev.FancyValidator):
return conv_value
+class YouTubeConverter(fev.FancyValidator):
+ """Takes a given YouTube URL. Ensures that the video_id
+ is contained in the URL. Returns a clean URL to use for iframe embedding.
+
+ REGEX: http://stackoverflow.com/a/10315969/25690
+ """
+
+ REGEX = ('^(?:https?:\/\/)?(?:www\.)?'+
+ '(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))'+
+ '((\w|-){11})(?:\S+)?$')
+
+ def _to_python(self, value, state):
+ match = re.match(YouTubeConverter.REGEX, value)
+ if match:
+ video_id = match.group(1)
+ return 'www.youtube.com/embed/{}?rel=0'.format(video_id)
+ else:
+ raise fe.Invalid(
+ "The URL does not appear to be a valid YouTube video.",
+ value, state)
+
def convertDate(datestring):
formats = ['%Y-%m-%d', '%Y.%m.%d', '%Y/%m/%d', '%Y\%m\%d', '%Y %m %d',
'%d-%m-%Y', '%d.%m.%Y', '%d/%m/%Y', '%d\%m\%Y', '%d %m %Y']
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bbba5f75/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index eaec993..21b4792 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -188,6 +188,7 @@ class Project(MappedClass, ActivityNode, ActivityObject):
description_cache = FieldProperty(MarkdownCache)
homepage_title = FieldProperty(str, if_missing='')
external_homepage = FieldProperty(str, if_missing='')
+ video_url = FieldProperty(str, if_missing='')
support_page = FieldProperty(str, if_missing='')
support_page_url = FieldProperty(str, if_missing='')
socialnetworks = FieldProperty([dict(socialnetwork=str, accounturl=str)])
@@ -933,6 +934,7 @@ class Project(MappedClass, ActivityNode, ActivityObject):
short_description=self.short_description,
summary=self.summary,
external_homepage=self.external_homepage,
+ video_url=self.video_url,
socialnetworks=[dict(n) for n in self.socialnetworks],
status=self.removal or 'active',
moved_to_url=self.moved_to_url,
[4/8] git commit: [#6677] Account for spurious ProjectRoles for
non-members in User.my_projects
Posted by jo...@apache.org.
[#6677] Account for spurious ProjectRoles for non-members in User.my_projects
Signed-off-by: Cory Johns <cj...@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/6939145e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6939145e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6939145e
Branch: refs/heads/cj/7097
Commit: 6939145ef8a12894d2dce613989cb50c649537fc
Parents: bbba5f7
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Feb 12 23:03:49 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Feb 13 17:33:17 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/auth.py | 2 +-
Allura/allura/tests/model/test_auth.py | 18 +++++++++++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6939145e/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index dfbfc32..aa8e5dc 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -747,7 +747,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
if self.is_anonymous():
return
roles = g.credentials.user_roles(user_id=self._id)
- projects = [r['project_id'] for r in roles]
+ projects = [r['project_id'] for r in roles if r['roles']]
from .project import Project
return Project.query.find({'_id': {'$in': projects}, 'deleted': False})
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6939145e/Allura/allura/tests/model/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_auth.py b/Allura/allura/tests/model/test_auth.py
index 5119f68..606b3e2 100644
--- a/Allura/allura/tests/model/test_auth.py
+++ b/Allura/allura/tests/model/test_auth.py
@@ -20,7 +20,7 @@
"""
Model tests for auth
"""
-from nose.tools import with_setup, assert_equal
+from nose.tools import with_setup, assert_equal, assert_not_in
from pylons import tmpl_context as c, app_globals as g
from webob import Request
from mock import patch
@@ -255,6 +255,22 @@ def test_user_projects_by_role():
set(['test', 'u/test-admin', 'adobe-1', '--init--']))
+@td.with_user_project('test-admin')
+@with_setup(setUp)
+def test_user_projects_unnamed():
+ """
+ Confirm that spurious ProjectRoles associating a user with
+ a project to which they do not belong to any named group
+ don't cause the user to count as a member of the project.
+ """
+ sub1 = M.Project.query.get(shortname='test/sub1')
+ M.ProjectRole(
+ user_id=c.user._id,
+ project_id=sub1._id)
+ ThreadLocalORMSession.flush_all()
+ assert_not_in('test/sub1', [p.shortname for p in c.user.my_projects()])
+
+
@patch.object(g, 'user_message_max_messages', 3)
def test_check_sent_user_message_times():
user1 = M.User.register(dict(username='test-user'), make_project=False)
[2/8] git commit: update copyright year
Posted by jo...@apache.org.
update copyright year
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/cab6cfa7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/cab6cfa7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/cab6cfa7
Branch: refs/heads/cj/7097
Commit: cab6cfa7433cd4e4f0c59ab29b9a9323d31a1263
Parents: bbba5f7
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Feb 13 10:25:56 2014 -0500
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Thu Feb 13 10:25:56 2014 -0500
----------------------------------------------------------------------
Allura/NOTICE | 2 +-
Allura/docs/conf.py | 2 +-
ForgeDiscussion/NOTICE | 2 +-
ForgeGit/NOTICE | 2 +-
ForgeImporters/docs/conf.py | 2 +-
ForgeLink/NOTICE | 2 +-
ForgeSVN/NOTICE | 2 +-
ForgeTracker/NOTICE | 2 +-
ForgeWiki/NOTICE | 2 +-
NOTICE | 2 +-
NoWarnings/NOTICE | 2 +-
11 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab6cfa7/Allura/NOTICE
----------------------------------------------------------------------
diff --git a/Allura/NOTICE b/Allura/NOTICE
index 40b6969..3938e2b 100644
--- a/Allura/NOTICE
+++ b/Allura/NOTICE
@@ -1,5 +1,5 @@
Apache Allura (incubating)
-Copyright 2012-2013 The Apache Software Foundation
+Copyright 2012-2014 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab6cfa7/Allura/docs/conf.py
----------------------------------------------------------------------
diff --git a/Allura/docs/conf.py b/Allura/docs/conf.py
index 38e6c65..081dd0c 100644
--- a/Allura/docs/conf.py
+++ b/Allura/docs/conf.py
@@ -54,7 +54,7 @@ master_doc = 'index'
# General information about the project.
project = 'Apache Allura (incubating)'
-copyright = '2012-2013 The Apache Software Foundation'
+copyright = '2012-2014 The Apache Software Foundation'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab6cfa7/ForgeDiscussion/NOTICE
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/NOTICE b/ForgeDiscussion/NOTICE
index 40b6969..3938e2b 100644
--- a/ForgeDiscussion/NOTICE
+++ b/ForgeDiscussion/NOTICE
@@ -1,5 +1,5 @@
Apache Allura (incubating)
-Copyright 2012-2013 The Apache Software Foundation
+Copyright 2012-2014 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab6cfa7/ForgeGit/NOTICE
----------------------------------------------------------------------
diff --git a/ForgeGit/NOTICE b/ForgeGit/NOTICE
index 40b6969..3938e2b 100644
--- a/ForgeGit/NOTICE
+++ b/ForgeGit/NOTICE
@@ -1,5 +1,5 @@
Apache Allura (incubating)
-Copyright 2012-2013 The Apache Software Foundation
+Copyright 2012-2014 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab6cfa7/ForgeImporters/docs/conf.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/docs/conf.py b/ForgeImporters/docs/conf.py
index ea18df2..26fc1b9 100644
--- a/ForgeImporters/docs/conf.py
+++ b/ForgeImporters/docs/conf.py
@@ -54,7 +54,7 @@ master_doc = 'index'
# General information about the project.
project = 'Apache Allura (incubating)'
-copyright = '2012-2013 The Apache Software Foundation'
+copyright = '2012-2014 The Apache Software Foundation'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab6cfa7/ForgeLink/NOTICE
----------------------------------------------------------------------
diff --git a/ForgeLink/NOTICE b/ForgeLink/NOTICE
index 40b6969..3938e2b 100644
--- a/ForgeLink/NOTICE
+++ b/ForgeLink/NOTICE
@@ -1,5 +1,5 @@
Apache Allura (incubating)
-Copyright 2012-2013 The Apache Software Foundation
+Copyright 2012-2014 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab6cfa7/ForgeSVN/NOTICE
----------------------------------------------------------------------
diff --git a/ForgeSVN/NOTICE b/ForgeSVN/NOTICE
index 40b6969..3938e2b 100644
--- a/ForgeSVN/NOTICE
+++ b/ForgeSVN/NOTICE
@@ -1,5 +1,5 @@
Apache Allura (incubating)
-Copyright 2012-2013 The Apache Software Foundation
+Copyright 2012-2014 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab6cfa7/ForgeTracker/NOTICE
----------------------------------------------------------------------
diff --git a/ForgeTracker/NOTICE b/ForgeTracker/NOTICE
index 40b6969..3938e2b 100644
--- a/ForgeTracker/NOTICE
+++ b/ForgeTracker/NOTICE
@@ -1,5 +1,5 @@
Apache Allura (incubating)
-Copyright 2012-2013 The Apache Software Foundation
+Copyright 2012-2014 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab6cfa7/ForgeWiki/NOTICE
----------------------------------------------------------------------
diff --git a/ForgeWiki/NOTICE b/ForgeWiki/NOTICE
index 40b6969..3938e2b 100644
--- a/ForgeWiki/NOTICE
+++ b/ForgeWiki/NOTICE
@@ -1,5 +1,5 @@
Apache Allura (incubating)
-Copyright 2012-2013 The Apache Software Foundation
+Copyright 2012-2014 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab6cfa7/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index 40b6969..3938e2b 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
Apache Allura (incubating)
-Copyright 2012-2013 The Apache Software Foundation
+Copyright 2012-2014 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab6cfa7/NoWarnings/NOTICE
----------------------------------------------------------------------
diff --git a/NoWarnings/NOTICE b/NoWarnings/NOTICE
index 40b6969..3938e2b 100644
--- a/NoWarnings/NOTICE
+++ b/NoWarnings/NOTICE
@@ -1,5 +1,5 @@
Apache Allura (incubating)
-Copyright 2012-2013 The Apache Software Foundation
+Copyright 2012-2014 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
[6/8] git commit: [#6677] sort my_projects, by last_updated
Posted by jo...@apache.org.
[#6677] sort my_projects, by last_updated
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ea28b132
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ea28b132
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ea28b132
Branch: refs/heads/cj/7097
Commit: ea28b132aad8c00dc9b9cb89e05524787ab7875d
Parents: 6351476
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Feb 13 18:09:39 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Feb 13 18:09:39 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/auth.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ea28b132/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 0a68146..54dcbc3 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -750,7 +750,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
# filter out projects to which the user belongs to no named groups (i.e., role['roles'] is empty)
projects = [r['project_id'] for r in roles if r['roles']]
from .project import Project
- return Project.query.find({'_id': {'$in': projects}, 'deleted': False})
+ return Project.query.find({'_id': {'$in': projects}, 'deleted': False}).sort('last_updated', pymongo.DESCENDING)
def my_projects_by_role_name(self, role_name):
"""
[7/8] git commit: [#7097] Refactored User Profile to use Profile
Sections
Posted by jo...@apache.org.
[#7097] Refactored User Profile to use Profile Sections
Signed-off-by: Cory Johns <cj...@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/3726e3c0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3726e3c0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3726e3c0
Branch: refs/heads/cj/7097
Commit: 3726e3c09c6da9e923a3f8935a418a686e99f591
Parents: ea28b13
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Feb 12 02:00:38 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Feb 13 19:30:24 2014 +0000
----------------------------------------------------------------------
Allura/allura/config/app_cfg.py | 3 +
.../templates/profile_section_base.html | 28 ++
.../templates/sections/personal-data.html | 63 +++++
.../templates/sections/projects.html | 49 ++++
.../user_profile/templates/sections/skills.html | 39 +++
.../user_profile/templates/sections/tools.html | 39 +++
.../ext/user_profile/templates/user_index.html | 255 +------------------
Allura/allura/ext/user_profile/user_main.py | 34 ++-
Allura/allura/lib/helpers.py | 26 ++
Allura/allura/lib/plugin.py | 6 +-
.../allura/templates/jinja_master/nav_menu.html | 14 +-
Allura/setup.py | 6 +
ForgeActivity/forgeactivity/main.py | 1 -
.../templates/widgets/profile_section.html | 24 +-
14 files changed, 321 insertions(+), 266 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/Allura/allura/config/app_cfg.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/app_cfg.py b/Allura/allura/config/app_cfg.py
index 1661356..bcca0c2 100644
--- a/Allura/allura/config/app_cfg.py
+++ b/Allura/allura/config/app_cfg.py
@@ -31,6 +31,7 @@ convert them into boolean, for example, you should use the
"""
import logging
+from functools import partial
import tg
import jinja2
@@ -102,6 +103,8 @@ class ForgeConfig(AppConfig):
jinja2_env.install_gettext_translations(pylons.i18n)
jinja2_env.filters['filesizeformat'] = helpers.do_filesizeformat
jinja2_env.filters['datetimeformat'] = helpers.datetimeformat
+ jinja2_env.filters['filter'] = lambda s,t=None: filter(t and jinja2_env.tests[t], s)
+ jinja2_env.filters['map'] = helpers.map_jinja_filter
jinja2_env.globals.update({'hasattr': hasattr})
config['pylons.app_globals'].jinja2_env = jinja2_env
# Jinja's unable to request c's attributes without strict_c
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/Allura/allura/ext/user_profile/templates/profile_section_base.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/profile_section_base.html b/Allura/allura/ext/user_profile/templates/profile_section_base.html
new file mode 100644
index 0000000..7e15dad
--- /dev/null
+++ b/Allura/allura/ext/user_profile/templates/profile_section_base.html
@@ -0,0 +1,28 @@
+{#-
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-#}
+<div class="profile-section {% block section_class %}{% endblock %}">
+ <h3>
+ {% block title %}{% endblock %}
+ <span class="actions">{% block actions %}{% endblock %}</span>
+ </h3>
+
+ <div class="section-body">
+ {% block content %}{% endblock %}
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/Allura/allura/ext/user_profile/templates/sections/personal-data.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/personal-data.html b/Allura/allura/ext/user_profile/templates/sections/personal-data.html
new file mode 100644
index 0000000..94b0421
--- /dev/null
+++ b/Allura/allura/ext/user_profile/templates/sections/personal-data.html
@@ -0,0 +1,63 @@
+{#-
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-#}
+{% extends "allura.ext.user_profile:templates/profile_section_base.html" %}
+
+{% block title %}
+ Personal Data
+{% endblock %}
+
+{% block actions %}
+ {% if user == c.user %}
+ <a href="{{auth.account_urls['account_user_info']}}">Edit Personal Data</a>
+ {% endif %}
+{% endblock %}
+
+{% block section_class %}personal-data{% endblock %}
+
+{% block content %}
+ <dl class="personal-data">
+ <dt>Joined:</dt><dd>{{auth.user_registration_date(user)}}</dd>
+ <dt>Location:</dt><dd>
+ {% set loc = user.get_pref('localization') %}
+ {{ [loc.city, loc.country, timezone]|filter|join(' / ') }}
+ </dd>
+ <dt>Username:</dt><dd>
+ {{user.username}}
+ </dd>
+ <dt>Gender:</dt><dd>
+ {{user.get_pref('sex')}}
+ </dd>
+ <dt>Phone Number:</dt><dd>
+ {{user.get_pref('telnumbers')|join(', ')}}
+ </dd>
+ <dt>Skype:</dt><dd>
+ {{user.get_pref('skypeaccount')}}
+ </dd>
+ <dt>Web Site{% if user.get_pref('webpages')|length > 1 %}s{% endif %}:</dt><dd>
+ {{user.get_pref('webpages')|filter|map('urlize', 20, true)|join(', ')}}
+ </dd>
+ <dt>Availability:</dt><dd>
+ <ol>
+ {% for slot in user.get_localized_availability('utc') %}
+ <li>{{ slot.week_day }}: {{ slot.start_time.strftime('%H:%M') }} to {{ slot.end_time.strftime('%H:%M') }}</li>
+ {% endfor %}
+ </ol>
+ </dd>
+ </dl>
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/Allura/allura/ext/user_profile/templates/sections/projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/projects.html b/Allura/allura/ext/user_profile/templates/sections/projects.html
new file mode 100644
index 0000000..4fc5eda
--- /dev/null
+++ b/Allura/allura/ext/user_profile/templates/sections/projects.html
@@ -0,0 +1,49 @@
+{#-
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-#}
+{% extends "allura.ext.user_profile:templates/profile_section_base.html" %}
+
+{% block title %}
+ Projects
+{% endblock %}
+
+{% block actions %}
+ {% if user == c.user %}
+ <a href="/{{config.get('default_neighborhood', 'p')}}/add_project">Add Project</a>
+ {% endif %}
+{% endblock %}
+
+{% block section_class %}projects{% endblock %}
+
+{% block content %}
+ <ul>
+ {% for project in user.my_projects() %}
+ <li>
+ {% if project.icon -%}
+ <img src="{{project.url()}}/icon?{{project.icon._id.generation_time}}" alt="Project Logo"/>
+ {%- else -%}
+ <img src="{{g.forge_static('images/project_default.png')}}" alt="Project Logo"/>
+ {%- endif -%}
+ <span class="project-info">
+ <a href="{{project.url()}}">{{project.name}}</a>
+ {{project.summary}}
+ </span>
+ </li>
+ {% endfor %}
+ </ul>
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/Allura/allura/ext/user_profile/templates/sections/skills.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/skills.html b/Allura/allura/ext/user_profile/templates/sections/skills.html
new file mode 100644
index 0000000..104cc7a
--- /dev/null
+++ b/Allura/allura/ext/user_profile/templates/sections/skills.html
@@ -0,0 +1,39 @@
+{#-
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-#}
+{% extends "allura.ext.user_profile:templates/profile_section_base.html" %}
+
+{% block title %}
+ Skills
+{% endblock %}
+
+{% block actions %}
+ {% if user == c.user %}
+ <a href="{{auth.account_urls['account_user_info']}}/skills">Edit Skills</a>
+ {% endif %}
+{% endblock %}
+
+{% block section_class %}skills{% endblock %}
+
+{% block content %}
+ <ul>
+ {% for skill in user.get_skills() %}
+ <li>{{ skill.skill.fullname }}</li>
+ {% endfor %}
+ </ul>
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/Allura/allura/ext/user_profile/templates/sections/tools.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/tools.html b/Allura/allura/ext/user_profile/templates/sections/tools.html
new file mode 100644
index 0000000..4427c8b
--- /dev/null
+++ b/Allura/allura/ext/user_profile/templates/sections/tools.html
@@ -0,0 +1,39 @@
+{#-
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-#}
+{% extends "allura.ext.user_profile:templates/profile_section_base.html" %}
+
+{% block title %}
+ Tools
+{% endblock %}
+
+{% block actions %}
+ {% if user == c.user %}
+ <a href="{{c.project.url()}}/admin/tools">Add Tools</a>
+ {% endif %}
+{% endblock %}
+
+{% block section_class %}tools{% endblock %}
+
+{% block content %}
+ <ul>
+ {% for tool in c.project.ordered_mounts() %}
+ <li><a href="{{tool['ac'].url()}}">{{ tool['ac'].options.mount_label }}</a></li>
+ {% endfor %}
+ </ul>
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/Allura/allura/ext/user_profile/templates/user_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/user_index.html b/Allura/allura/ext/user_profile/templates/user_index.html
index 77d8028..30e4ea3 100644
--- a/Allura/allura/ext/user_profile/templates/user_index.html
+++ b/Allura/allura/ext/user_profile/templates/user_index.html
@@ -32,260 +32,11 @@
<a href="{{c.app.url}}feed.rss" title="Follow"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}"></b></a>
{% endblock %}
-{% block content %}
- {% if user.preferences.email_address %}
- <p>{{lib.gravatar(user)}}</p>
- {% endif %}
- <div class="project-list grid-18">
- <b>Projects</b>
- <ul>
- {% for p in user.my_projects() %}
- {% if (c.user == user) or h.has_access(p, 'read') %}
- <li>
- <a class="project-name" href="{{p.url()}}">{{p.name}}</a>
- </li>
- {% endif %}
- {% endfor %}
- </ul>
- </div>
-
- <div class="grid-24">
- <div class="grid-24" style="margin:0;"><b>Personal data</b></div>
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Registration Date:</div>
- <div class="grid-8">{{reg_date}}</div>
- </div>
- {% if user.get_pref('sex') == 'Male' or user.get_pref('sex') == 'Female' %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Gender:</div>
- <div class="grid-8">{{user.get_pref('sex')}}</div>
- </div>
- {% endif %}
- {% if user.get_pref('birthdate') %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Birthdate:</div>
- <div class="grid-8">
- {{ user.get_pref('birthdate').strftime('%d %B %Y')}}
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('localization').country or user.get_pref('localization').city %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Localization:</div>
- <div class="grid-8">
- {% if user.get_pref('localization').city %}
- {{user.get_pref('localization').city}}{{ ',' if user.get_pref('localization').country else '' }}
- {% endif %}
- {% if user.get_pref('localization').country %}
- {{user.get_pref('localization').country}}
- {% endif %}
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('timezone') %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Timezone:</div>
- <div class="grid-8">
- {{user.get_pref('timezone')}}
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('socialnetworks')|length > 0 %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Social networks:</div>
- <div class="grid-18">
- {{user.get_pref('display_name')}}'s account(s):
- <ul>
- {% for i in user.get_pref('socialnetworks') %}
- <li>{{i.socialnetwork}}: <a href="{{i.accounturl}}">{{i.accounturl}}</a></li>
- {% endfor %}
- </ul>
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('webpages')|length > 0 %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Websites:</div>
- <div class="grid-18">
- {{user.get_pref('display_name')}}'s website(s):
- <ul>
- {% for i in user.get_pref('webpages') %}
- <li><a href="{{i}}">{{i}}</a></li>
- {% endfor %}
- </ul>
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('telnumbers')|length > 0 %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Telephone number(s):</div>
- <div class="grid-18">
- {{user.get_pref('display_name')}}'s telephone number(s):
- <ul>
- {% for i in user.get_pref('telnumbers') %}
- <li>{{i}}</li>
- {% endfor %}
- </ul>
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('skypeaccount') %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Skype account:</div>
- <div class="grid-8">{{user.get_pref('skypeaccount')}}</div>
- </div>
- {% endif %}
+{% block nav_menu %}{{super()}}{% endblock %}
- {% if user.get_pref('timezone') and user.get_availability_timeslots() |length > 0 %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Availability:</div>
-
- {% if c.user.get_pref('timezone') %}
- <div class="grid-18" id="timeslotsconverted" style="visibility: visible; display:none;">
- {{user.get_pref('display_name')}}'s availability time-slots.
- <div style="float:right;">
- See timeslots in:
- <a href="JavaScript:void(0);" onclick="changeTimezone('utc')">UTC</a> |
- <a href="JavaScript:void(0);" onclick="changeTimezone('local')">
- {{user.get_pref('display_name')}}'s local time
- </a> |
- <b>Your local time</b>
- </div>
- <ul>
- {% for i in user.get_localized_availability(c.user.get_pref('timezone')) %}
- <li>{{i.week_day}}: from {{i.start_time.strftime("%H:%M")}} to {{i.end_time.strftime("%H:%M")}} </li>
- {% endfor %}
- </ul>
- </div>
- {% endif %}
-
- <div class="grid-18" id="timeslotsutc" style="visibility: visible; display:block;">
- {{user.get_pref('display_name')}}'s availability time-slots.
- <div style="float:right;">
- See timeslots in:
- <b>UTC</b> |
- <a href="JavaScript:void(0);" onclick="changeTimezone('local')">
- {{user.get_pref('display_name')}}'s local time
- </a>
- {% if c.user.get_pref('timezone') %} |
- <a href="JavaScript:void(0);" onclick="changeTimezone('converted')">
- Your local time
- </a>
- {% endif %}
- </div>
- <ul>
- {% for i in user.get_localized_availability('utc') %}
- <li>{{i.week_day}}: from {{i.start_time.strftime("%H:%M")}} to {{i.end_time.strftime("%H:%M")}} </li>
- {% endfor %}
- </ul>
- </div>
-
- <div class="grid-18" id="timeslotslocal" style="visibility: visible; display:none;">
- {{user.get_pref('display_name')}}'s availability time-slots.
- <div style="float:right;">
- See timeslots in:
- <a href="JavaScript:void(0);" onclick="changeTimezone('utc')">UTC</a> |
- <b>
- {{user.get_pref('display_name')}}'s local time
- </b>
- {% if c.user.get_pref('timezone') %} |
- <a href="JavaScript:void(0);" onclick="changeTimezone('converted')">
- Your local time
- </a>
- {% endif %}
- </div>
- <ul>
- {% for i in user.get_availability_timeslots() %}
- <li>{{i.week_day}}: from {{i.start_time.strftime("%H:%M")}} to {{i.end_time.strftime("%H:%M")}} </li>
- {% endfor %}
- </ul>
- </div>
-
- </div>
- </div>
- {% endif %}
-
- {% if user.get_inactive_periods(include_past_periods=False)|length > 0 %}
- <div class="grid-24">
- <div class="grid-4">Inactive periods:</div>
- <div class="grid-18">
- This user won't be able to work on the forge in the following period(s):
- <ul>
- {% for p in user.get_inactive_periods(include_past_periods=False) %}
- <li>From {{p.start_date.strftime('%d %B %Y')}} to {{p.end_date.strftime('%d %B %Y')}}.</li>
- {% endfor %}
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('email_address') and c.user.get_pref('email_address') and not user.get_pref('disable_user_messages') %}
- <div class="grid-24">
- <b><a href="send_message">Send me a message</a></b>
- </div>
- {% endif %}
- </div><!-- end of Personal data section -->
- <div class="grid-24">
- <b>Current {{user.get_pref('display_name')}}'s skills list</b>
- <div class="grid-24">
- {% if user.get_skills()|length > 0 %}
- <table>
- <thead>
- <tr>
- <th>Skill</th>
- <th>Level</th>
- <th>Comments</th>
- </tr>
- </thead>
- <tbody>
- {% for s in user.get_skills() %}
- <tr>
- <td>{{s.skill.fullpath}}</td>
- <td>{{s.level}}</td>
- <td>{{s.comment}}</td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% else %}
- <div class="grid-24">At the moment, {{user.get_pref('display_name')}}'s skills list is empty!</div>
- {% endif %}
- </div>
- </div>
-
- {% if c.user.username == user.username %}
- <div class="address-list grid-18">
- <b>Email Addresses</b>
- <ul>
- {% for email in user.email_addresses %}
- <li>
- {{lib.email_gravatar(email, size=24)}}
- {% if email == user.preferences.email_address %}
- <span class="prime email-address">{{email}}</span>
- {% else %}
- <span class="email-address">{{email}}</span>
- {% endif %}
- </li>
- {% endfor %}
- </ul>
- </div>
- <div class="openid-list grid-18">
- <b>OpenIDs</b>
- <ul>
- {% for openid in user.open_ids %}
- <li>
- <span class="openid">{{openid}}</span>
- </li>
- {% endfor %}
- </ul>
- </div>
- {% endif %}
+{% block top_nav %}{# disabled #}{% endblock %}
+{% block content %}
{% for section in sections %}
{{ section.display() }}
{% endfor %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/Allura/allura/ext/user_profile/user_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/user_main.py b/Allura/allura/ext/user_profile/user_main.py
index 1112aa8..01bb6b8 100644
--- a/Allura/allura/ext/user_profile/user_main.py
+++ b/Allura/allura/ext/user_profile/user_main.py
@@ -27,6 +27,8 @@ from tg import expose, redirect, validate, flash
import tg
from webob import exc
from jinja2 import Markup
+from pytz import timezone
+from datetime import datetime
from allura import version
from allura.app import Application, SitemapEntry
@@ -257,5 +259,35 @@ class ProfileSectionBase(object):
if not self.check_display():
return ''
tmpl = g.jinja2_env.get_template(self.template)
- context = self.prepare_context({'h': h, 'c': c, 'g': g})
+ context = self.prepare_context({
+ 'h': h,
+ 'c': c,
+ 'g': g,
+ 'user': self.user,
+ 'config': tg.config,
+ 'auth': AuthenticationProvider.get(request),
+ })
return Markup(tmpl.render(context))
+
+
+class PersonalDataSection(ProfileSectionBase):
+ template = 'allura.ext.user_profile:templates/sections/personal-data.html'
+
+ def prepare_context(self, context):
+ context['timezone'] = self.user.get_pref('timezone')
+ if context['timezone']:
+ tz = timezone(context['timezone'])
+ context['timezone'] = tz.tzname(datetime.utcnow())
+ return context
+
+
+class ProjectsSection(ProfileSectionBase):
+ template = 'allura.ext.user_profile:templates/sections/projects.html'
+
+
+class SkillsSection(ProfileSectionBase):
+ template = 'allura.ext.user_profile:templates/sections/skills.html'
+
+
+class ToolsSection(ProfileSectionBase):
+ template = 'allura.ext.user_profile:templates/sections/tools.html'
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index ac54d13..83992aa 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -32,6 +32,7 @@ from datetime import datetime, timedelta
from collections import defaultdict
import shlex
import socket
+from functools import partial
import tg
import genshi.template
@@ -49,6 +50,7 @@ from tg.decorators import before_validate
from formencode.variabledecode import variable_decode
import formencode
from jinja2 import Markup
+from jinja2.filters import contextfilter
from paste.deploy.converters import asbool, aslist
from webhelpers import date, feedgenerator, html, number, misc, text
@@ -1154,3 +1156,27 @@ def login_overlay(exceptions=None):
if request.path.rstrip('/').endswith('/%s' % exception):
raise
c.show_login_overlay = True
+
+
+def get_filter(ctx, filter_name):
+ """
+ Gets a named Jinja2 filter, passing through
+ any context requested by the filter.
+ """
+ filter_ = ctx.environment.filters[filter_name]
+ if getattr(filter_, 'contextfilter', False):
+ return partial(filter_, ctx)
+ elif getattr(filter_, 'evalcontextfilter', False):
+ return partial(filter_, ctx.eval_ctx)
+ elif getattr(filter_, 'environmentfilter', False):
+ return partial(filter_, ctx.environment)
+
+
+@contextfilter
+def map_jinja_filter(ctx, seq, filter_name, *a, **kw):
+ """
+ A Jinja2 filter that applies the named filter with the
+ given args to the sequence this filter is applied to.
+ """
+ filter_ = get_filter(ctx, filter_name)
+ return [filter_(value, *a, **kw) for value in seq]
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index cd0ed23..084501f 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -173,7 +173,7 @@ class AuthenticationProvider(object):
'alt': 'Manage Personal Information',
},
{
- 'tabid': 'account_sfnet_beta_index',
+ 'tabid': 'account_subscriptions',
'title': 'Subscriptions',
'target': "/auth/subscriptions",
'alt': 'Manage Subscription Preferences',
@@ -186,6 +186,10 @@ class AuthenticationProvider(object):
},
]
+ @LazyProperty
+ def account_urls(self):
+ return {m['tabid']: m['target'] for m in self.account_navigation()}
+
def user_project_shortname(self, user):
'''
:param user: a :class:`User <allura.model.auth.User>`
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/Allura/allura/templates/jinja_master/nav_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/nav_menu.html b/Allura/allura/templates/jinja_master/nav_menu.html
index 4280881..b29d566 100644
--- a/Allura/allura/templates/jinja_master/nav_menu.html
+++ b/Allura/allura/templates/jinja_master/nav_menu.html
@@ -24,13 +24,21 @@
{% else %}
{{ theme_macros.breadcrumbs(c.project, c.app) }}
{{ theme_macros.project_header_right(c.project, c.app) }}
- {% if c.project.user_project_of %}
+ {% if c.project.is_user_project %}
{{lib.gravatar(c.project.user_project_of, size=48, className='project_icon')}}
{% elif c.project.icon %}
<img src="{{c.project.url()}}/icon?{{c.project.icon._id.generation_time}}" class="project_icon" alt="Project Logo">
{% endif %}
<h1 class="project_title">
- <a href="{{c.project.url()}}" class="project_link">{{ c.project.neighborhood.name if c.project.is_nbhd_project else c.project.name }}</a>
+ <a href="{{c.project.url()}}" class="project_link">
+ {%- if c.project.is_user_project -%}
+ {{ c.project.user_project_of.display_name }}
+ {%- elif c.project.is_nbhd_project -%}
+ {{ c.project.neighborhood.name }}
+ {%- else -%}
+ {{ c.project.name }}
+ {%- endif -%}
+ </a>
</h1>
{% set status = c.project.troves_by_type('developmentstatus')|sort(attribute='fullname') %}
{% set status = status[-1] %}
@@ -40,6 +48,7 @@
<h2 class="project_summary{% if c.project.icon %} with-icon{% endif %}">
{{c.project.summary}}
</h2>
+ {% if not c.project.is_user_project %}
<div class="brought-by{% if c.project.icon %} with-icon{% endif %}">
Brought to you by:
{% set admins = c.project.admins()|sort(attribute='username') %}
@@ -51,4 +60,5 @@
{% endif %}
{%- endfor -%}
</div>
+ {% endif %}
{% endif %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/Allura/setup.py
----------------------------------------------------------------------
diff --git a/Allura/setup.py b/Allura/setup.py
index cfb4649..33ca9f5 100644
--- a/Allura/setup.py
+++ b/Allura/setup.py
@@ -127,6 +127,12 @@ setup(
[allura.site_admin]
stats = allura.controllers.site_admin:StatsSiteAdminExtension
+ [allura.user_profile.sections]
+ personal-data = allura.ext.user_profile.user_main:PersonalDataSection
+ projects = allura.ext.user_profile.user_main:ProjectsSection
+ skills = allura.ext.user_profile.user_main:SkillsSection
+ tools = allura.ext.user_profile.user_main:ToolsSection
+
[paste.paster_command]
taskd = allura.command.taskd:TaskdCommand
taskd_cleanup = allura.command.taskd_cleanup:TaskdCleanupCommand
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 269dbfc..e82cca7 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -255,7 +255,6 @@ class ForgeActivityProfileSection(ProfileSectionBase):
filtered_timeline = list(islice(ifilter(perm_check(c.user), full_timeline),
0, 5))
context.update({
- 'user': self.user,
'follow_toggle': W.follow_toggle,
'following': g.director.is_connected(c.user, self.user),
'timeline': filtered_timeline,
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3726e3c0/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/templates/widgets/profile_section.html b/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
index 4e1bec2..5f2230e 100644
--- a/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
+++ b/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
@@ -16,18 +16,24 @@
specific language governing permissions and limitations
under the License.
-#}
+{% extends "allura.ext.user_profile:templates/profile_section_base.html" %}
{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
{% import 'forgeactivity:templates/macros.html' as am with context %}
-<div class="user-activity grid-8">
- <h3>
- User Activity
+{% block title %}
+ User Activity
+{% endblock %}
- {% if c.user and not c.user.is_anonymous() and c.user != user %}
- {{follow_toggle.display(following=following, action=activity_app.url+'follow')}}
- {% endif %}
- <a href="feed.rss" title="RSS"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}" title="Feed"></b></a>
- </h3>
+{% block actions %}
+ {% if c.user and not c.user.is_anonymous() and c.user != user %}
+ {{follow_toggle.display(following=following, action=activity_app.url+'follow')}}
+ {% endif %}
+ <a href="feed.rss" title="RSS"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}" title="Feed"></b></a>
+{% endblock %}
+
+{% block section_class %}user-activity{% endblock %}
+
+{% block content %}
{% if not timeline %}
<p class="empty">No activity to display.</p>
{% else %}
@@ -49,4 +55,4 @@
</ul>
<a class="view-all" href="{{activity_app.url}}">View All</a>
{% endif %}
-</div>
+{% endblock %}
[8/8] git commit: [#7097] Changes for new User Profile
Posted by jo...@apache.org.
[#7097] Changes for new User Profile
Signed-off-by: Cory Johns <cj...@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/cab098a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/cab098a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/cab098a1
Branch: refs/heads/cj/7097
Commit: cab098a1bd7903e664cff844715534c1a96aa389
Parents: 3726e3c
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Feb 12 04:01:38 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Feb 13 20:21:10 2014 +0000
----------------------------------------------------------------------
.../templates/sections/personal-data.html | 12 +-
.../templates/sections/projects.html | 2 +
.../ext/user_profile/templates/user_index.html | 23 +-
Allura/allura/model/auth.py | 2 +-
Allura/allura/model/project.py | 5 +-
Allura/allura/nf/allura/css/site_style.css | 220 +++++++++++++++----
.../allura/templates/jinja_master/master.html | 2 +
.../allura/templates/jinja_master/nav_menu.html | 2 +
.../templates/widgets/profile_section.html | 2 +-
9 files changed, 205 insertions(+), 65 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab098a1/Allura/allura/ext/user_profile/templates/sections/personal-data.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/personal-data.html b/Allura/allura/ext/user_profile/templates/sections/personal-data.html
index 94b0421..3d2f2ef 100644
--- a/Allura/allura/ext/user_profile/templates/sections/personal-data.html
+++ b/Allura/allura/ext/user_profile/templates/sections/personal-data.html
@@ -32,14 +32,16 @@
{% block content %}
<dl class="personal-data">
- <dt>Joined:</dt><dd>{{auth.user_registration_date(user)}}</dd>
+ <dt>Username:</dt><dd>
+ {{user.username}}
+ </dd>
+ <dt>Joined:</dt><dd>
+ {{auth.user_registration_date(user)}}
+ </dd>
<dt>Location:</dt><dd>
{% set loc = user.get_pref('localization') %}
{{ [loc.city, loc.country, timezone]|filter|join(' / ') }}
</dd>
- <dt>Username:</dt><dd>
- {{user.username}}
- </dd>
<dt>Gender:</dt><dd>
{{user.get_pref('sex')}}
</dd>
@@ -52,7 +54,7 @@
<dt>Web Site{% if user.get_pref('webpages')|length > 1 %}s{% endif %}:</dt><dd>
{{user.get_pref('webpages')|filter|map('urlize', 20, true)|join(', ')}}
</dd>
- <dt>Availability:</dt><dd>
+ <dt>Availability (UTC):</dt><dd>
<ol>
{% for slot in user.get_localized_availability('utc') %}
<li>{{ slot.week_day }}: {{ slot.start_time.strftime('%H:%M') }} to {{ slot.end_time.strftime('%H:%M') }}</li>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab098a1/Allura/allura/ext/user_profile/templates/sections/projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/projects.html b/Allura/allura/ext/user_profile/templates/sections/projects.html
index 4fc5eda..3f517de 100644
--- a/Allura/allura/ext/user_profile/templates/sections/projects.html
+++ b/Allura/allura/ext/user_profile/templates/sections/projects.html
@@ -33,6 +33,7 @@
{% block content %}
<ul>
{% for project in user.my_projects() %}
+ {% if project != c.project and not project.is_nbhd_project %}
<li>
{% if project.icon -%}
<img src="{{project.url()}}/icon?{{project.icon._id.generation_time}}" alt="Project Logo"/>
@@ -44,6 +45,7 @@
{{project.summary}}
</span>
</li>
+ {% endif %}
{% endfor %}
</ul>
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab098a1/Allura/allura/ext/user_profile/templates/user_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/user_index.html b/Allura/allura/ext/user_profile/templates/user_index.html
index 30e4ea3..3e4ed44 100644
--- a/Allura/allura/ext/user_profile/templates/user_index.html
+++ b/Allura/allura/ext/user_profile/templates/user_index.html
@@ -32,23 +32,20 @@
<a href="{{c.app.url}}feed.rss" title="Follow"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}"></b></a>
{% endblock %}
-{% block nav_menu %}{{super()}}{% endblock %}
+{% block nav_menu %}
+ {% if user != c.user %}
+ <a id="user-message" href="send_message" class="btn">
+ <b data-icon="{{g.icons['mail'].char}}" class="ico {{g.icons['mail'].css}}"></b>
+ <span>Send Message</span>
+ </a>
+ {% endif %}
+ {{super()}}
+{% endblock %}
{% block top_nav %}{# disabled #}{% endblock %}
-{% block content %}
+{% block content_base %}
{% for section in sections %}
{{ section.display() }}
{% endfor %}
{% endblock %}
-
-{% block extra_js %}
- <script type="text/javascript">
- function changeTimezone(opt){
- $("#timeslotslocal").hide();
- $("#timeslotsutc").hide();
- $("#timeslotsconverted").hide();
- $("#timeslots" + opt).show();
- }
- </script>
-{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab098a1/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 54dcbc3..6bd7cc1 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -513,7 +513,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
week_day = ['Monday', 'Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday', 'Sunday']
avail = self.get_availability_timeslots()
- usertimezone = timezone(self.get_pref('timezone'))
+ usertimezone = timezone(self.get_pref('timezone') or 'UTC')
chosentimezone = timezone(tz_name)
retlist = []
for t in avail:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab098a1/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 21b4792..e2707f7 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -746,7 +746,10 @@ class Project(MappedClass, ActivityNode, ActivityObject):
MappedClass.delete(self)
def breadcrumbs(self):
- entry = (self.name, self.url())
+ if self.is_user_project:
+ entry = (self.user_project_of.display_name, self.url())
+ else:
+ entry = (self.name, self.url())
if self.parent_project:
return self.parent_project.breadcrumbs() + [entry]
else:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab098a1/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 94f5d09..d018945 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -2211,6 +2211,7 @@ nav .ico {
#nav_menu_holder h2.project_summary {
line-height: 1em;
font-size: 16px;
+ height: 16px;
font-weight: normal;
margin-bottom: 0;
}
@@ -3241,56 +3242,187 @@ ul.dropdown ul li a:hover {
display: inline;
}
-.user-activity {
- position: absolute;
- top: 60px;
- right: 0px;
- border: 1px solid #ccc;
- border-radius: 4px;
+/* User Profile styles generated from _user_profile.scss */
+.profile-section {
+ width: 660px;
+ display: inline;
+ float: left;
+ overflow: hidden;
+ *zoom: 1;
+ margin: 0 10px;
+ margin: 0 0 10px 10px;
+ border: 1px solid #aaaaaa;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ -ms-border-radius: 4px;
+ -o-border-radius: 4px;
+ border-radius: 4px;
}
-.user-activity h3 {
- background-color: #555555;
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%, #666666), color-stop(100%, #555555));
- background-image: -moz-linear-gradient(top, #666666 0%, #555555 100%);
- background-image: linear-gradient(top, #666666 0%, #555555 100%);
- border: 1px solid #333333;
- color: #fff;
- padding: 10px;
- font-weight: normal;
- font-size: 14px;
-}
-.user-activity h3 a {
- float: right;
- margin-left: 8px;
-}
-.user-activity h3 b.ico {
- background-image: url('../images/neo-icon-set-ffffff-256x350.png');
+.profile-section > h3 {
+ background-color: #555555;
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #666666), color-stop(100%, #555555));
+ background-image: -webkit-linear-gradient(#666666, #555555);
+ background-image: -moz-linear-gradient(#666666, #555555);
+ background-image: -o-linear-gradient(#666666, #555555);
+ background-image: linear-gradient(#666666, #555555);
+ border: 1px solid #333333;
+ color: #fff;
+ font-weight: normal;
+ font-size: 16px;
+ padding: 10px;
}
-.user-activity .empty {
- padding: 10px;
- font-style: italic;
+.profile-section > h3 hr {
+ border: 1px solid #000;
+ background-color: #111;
+ opacity: .4;
}
-.user-activity ul {
- margin: 0px;
- list-style: none;
+.profile-section > h3 .actions {
+ float: right;
+ color: #fff;
+ font-size: 14px;
}
-.user-activity ul li {
- padding: 10px;
- border-bottom: 1px solid #ccc;
+.profile-section > h3 .actions a {
+ color: #fff;
+ text-decoration: underline;
}
-.user-activity ul li img {
- vertical-align: text-bottom;
+.profile-section > h3 .actions a.icon {
+ text-decoration: none;
}
-.user-activity ul li p {
- padding: 5px 0 0 0;
+.profile-section > h3 .actions.active {
+ color: #cccccc !important;
}
-.user-activity ul li time {
- display: block;
- text-align: right;
- font-size: 10px;
+.profile-section .section-body {
+ background-color: #fff;
}
-.user-activity a.view-all {
- display: block;
- text-align: right;
- padding: 5px 10px 5px 0;
+
+.profile-section.activity {
+ width: 260px;
+ display: inline;
+ float: left;
+ overflow: hidden;
+ *zoom: 1;
+ margin: 0 10px;
+ float: right;
+ margin: 10px 10px 0 0;
+}
+.profile-section.activity .empty {
+ padding: 10px;
+ font-style: italic;
+ margin-bottom: 0;
+}
+.profile-section.activity ul {
+ margin: 0;
+ list-style: none;
+}
+.profile-section.activity ul li {
+ padding: 10px;
+ padding-bottom: 0;
+ border-bottom: 1px solid #cccccc;
+}
+.profile-section.activity ul li img {
+ vertical-align: text-bottom;
+}
+.profile-section.activity ul li p {
+ padding: 5px 0 0 0;
+}
+.profile-section.activity ul li time {
+ display: block;
+ text-align: right;
+ font-size: 10px;
+}
+.profile-section.activity a.view-all {
+ display: block;
+ text-align: right;
+ padding: 5px 10px;
+}
+.profile-section.personal-data {
+ margin-top: 10px;
+}
+.profile-section.personal-data .section-body {
+ padding: 10px;
+}
+.profile-section.personal-data dl dt {
+ display: inline-block;
+ font-weight: bold;
+ margin-right: 4px;
+ width: 130px;
+ vertical-align: top;
+}
+.profile-section.personal-data dl dd {
+ display: inline;
+}
+.profile-section.personal-data dl dd:after {
+ content: '\A';
+ white-space: pre;
+}
+.profile-section.personal-data dl dd ol {
+ list-style: none;
+ display: inline-block;
+ margin-left: 0;
+}
+.profile-section.projects ul, .profile-section.projects ol {
+ list-style: none;
+ margin: 0;
+}
+.profile-section.projects ul li, .profile-section.projects ol li {
+ clear: both;
+ border-top: 1px solid #e5e5e5;
+ padding: 10px;
+}
+.profile-section.projects ul img, .profile-section.projects ol img {
+ vertical-align: top;
+ margin-right: 10px;
+}
+.profile-section.projects ul .project-info, .profile-section.projects ol .project-info {
+ display: inline-block;
+}
+.profile-section.projects ul .project-info a, .profile-section.projects ol .project-info a {
+ font-weight: bold;
+}
+.profile-section.projects ul .project-info a:after, .profile-section.projects ol .project-info a:after {
+ content: '\A';
+ white-space: pre;
+}
+.profile-section.skills .section-body {
+ padding: 10px 0;
+}
+
+.profile-section.tools .section-body {
+ padding: 10px 0;
+}
+#user-message {
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ -ms-border-radius: 4px;
+ -o-border-radius: 4px;
+ border-radius: 4px;
+ color: #fff;
+ text-shadow: #333333 0 1px 0 !important;
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #0099cc), color-stop(100%, #0077aa));
+ background-image: -webkit-linear-gradient(#0099cc 0%, #0077aa 100%);
+ background-image: -moz-linear-gradient(#0099cc 0%, #0077aa 100%);
+ background-image: -o-linear-gradient(#0099cc 0%, #0077aa 100%);
+ background-image: linear-gradient(#0099cc 0%, #0077aa 100%);
+ float: right;
+ display: block;
+ font-size: 15px;
+}
+#user-message b.ico {
+ font-size: 26px;
+ width: 26px;
+ height: 26px;
+}
+#user-message span {
+ display: block;
+}
+/* end of User Profile styles from _user_profile.scss */
+/* Use the right icon set for the User Activity and Send Message action buttons on User Profile */
+.profile-section.activity h3 b.ico,
+#user-message b.ico {
+ background-image: url('../images/neo-icon-set-ffffff-256x350.png');
+ width: 16px;
+ height: 16px;
+}
+#user-message {
+ top: 10px;
}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab098a1/Allura/allura/templates/jinja_master/master.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index dd9c313..0c4d188 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -99,6 +99,7 @@
{% endblock %}
</div>
<div id="content_base">
+ {% block content_base %}
{% if not hide_left_bar %}
{% block sidebar_menu %}
{% include g.theme.sidebar_menu %}
@@ -132,6 +133,7 @@
{% endif %}
{% block after_content %}{% endblock %}
</div>
+ {% endblock %}
</div>
</section>
{{theme_macros.footer(g.year(), g.theme_href(''))}}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab098a1/Allura/allura/templates/jinja_master/nav_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/nav_menu.html b/Allura/allura/templates/jinja_master/nav_menu.html
index b29d566..520267e 100644
--- a/Allura/allura/templates/jinja_master/nav_menu.html
+++ b/Allura/allura/templates/jinja_master/nav_menu.html
@@ -22,7 +22,9 @@
{% if not c.project or (n.neighborhood_project == c.project and not n.show_title) %}
<div id="nav_menu_missing"></div>
{% else %}
+ {% if not c.project.is_user_project %}
{{ theme_macros.breadcrumbs(c.project, c.app) }}
+ {% endif %}
{{ theme_macros.project_header_right(c.project, c.app) }}
{% if c.project.is_user_project %}
{{lib.gravatar(c.project.user_project_of, size=48, className='project_icon')}}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cab098a1/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/templates/widgets/profile_section.html b/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
index 5f2230e..28ba645 100644
--- a/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
+++ b/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
@@ -31,7 +31,7 @@
<a href="feed.rss" title="RSS"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}" title="Feed"></b></a>
{% endblock %}
-{% block section_class %}user-activity{% endblock %}
+{% block section_class %}activity{% endblock %}
{% block content %}
{% if not timeline %}
[5/8] git commit: Merge branch 'cj/6677'
Posted by jo...@apache.org.
Merge branch 'cj/6677'
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/63514760
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/63514760
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/63514760
Branch: refs/heads/cj/7097
Commit: 63514760cd02d037278d10a87ae0087bd523338b
Parents: cab6cfa 87259aa
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Feb 13 17:33:36 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Feb 13 17:33:36 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/auth.py | 3 ++-
Allura/allura/tests/model/test_auth.py | 20 +++++++++++++++++++-
2 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[3/8] git commit: [#6677] add comment, and positive test
Posted by jo...@apache.org.
[#6677] add comment, and positive test
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/87259aa0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/87259aa0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/87259aa0
Branch: refs/heads/cj/7097
Commit: 87259aa02afc635d8f2d41ae88a3a7ace66760df
Parents: 6939145
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Feb 13 17:33:13 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Feb 13 17:33:17 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/auth.py | 1 +
Allura/allura/tests/model/test_auth.py | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/87259aa0/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index aa8e5dc..0a68146 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -747,6 +747,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
if self.is_anonymous():
return
roles = g.credentials.user_roles(user_id=self._id)
+ # filter out projects to which the user belongs to no named groups (i.e., role['roles'] is empty)
projects = [r['project_id'] for r in roles if r['roles']]
from .project import Project
return Project.query.find({'_id': {'$in': projects}, 'deleted': False})
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/87259aa0/Allura/allura/tests/model/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_auth.py b/Allura/allura/tests/model/test_auth.py
index 606b3e2..475b74a 100644
--- a/Allura/allura/tests/model/test_auth.py
+++ b/Allura/allura/tests/model/test_auth.py
@@ -20,7 +20,7 @@
"""
Model tests for auth
"""
-from nose.tools import with_setup, assert_equal, assert_not_in
+from nose.tools import with_setup, assert_equal, assert_not_in, assert_in
from pylons import tmpl_context as c, app_globals as g
from webob import Request
from mock import patch
@@ -268,7 +268,9 @@ def test_user_projects_unnamed():
user_id=c.user._id,
project_id=sub1._id)
ThreadLocalORMSession.flush_all()
- assert_not_in('test/sub1', [p.shortname for p in c.user.my_projects()])
+ project_names = [p.shortname for p in c.user.my_projects()]
+ assert_not_in('test/sub1', project_names)
+ assert_in('test', project_names)
@patch.object(g, 'user_message_max_messages', 3)