allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [4/9] git commit: [#7292] ticket:568 Proper serialization of all profile sections
Date Mon, 21 Apr 2014 17:24:03 GMT
[#7292] ticket:568 Proper serialization of all profile sections


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

Branch: refs/heads/master
Commit: 9ac1ecc829413e55179edaef319a0ea8ecd60aee
Parents: 9f47cd6
Author: Aleksey 'LXj' Alekseyev <gotletter@gmail.com>
Authored: Fri Apr 4 15:19:07 2014 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Mon Apr 21 17:21:57 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/rest.py           |  1 -
 Allura/allura/ext/user_profile/user_main.py | 30 +++++++++++++++++-------
 2 files changed, 22 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/9ac1ecc8/Allura/allura/controllers/rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/rest.py b/Allura/allura/controllers/rest.py
index ee7c9c6..7759326 100644
--- a/Allura/allura/controllers/rest.py
+++ b/Allura/allura/controllers/rest.py
@@ -322,7 +322,6 @@ class UserProfileRestController(object):
             raise exc.HTTPNotFound()
         sections = [section(user, c.project)
                     for section in c.app.profile_sections]
-        print sections
         json = {}
         for s in sections:
             if hasattr(s, '__json__'):

http://git-wip-us.apache.org/repos/asf/allura/blob/9ac1ecc8/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 44a073a..44ae741 100644
--- a/Allura/allura/ext/user_profile/user_main.py
+++ b/Allura/allura/ext/user_profile/user_main.py
@@ -321,25 +321,39 @@ class ProjectsSection(ProfileSectionBase):
 
     def __json__(self):
         projects = [
-            {
-                'name': project['name'],
-                'url': project.url(),
-            }
+            dict(
+                name=project['name'],
+                url=project.url(),
+                summary=project['summary'],
+                last_updated=project['last_updated'])
             for project in self.get_projects()]
         return dict(projects=projects)
 
+
 class SkillsSection(ProfileSectionBase):
     template = 'allura.ext.user_profile:templates/sections/skills.html'
 
     def __json__(self):
-        skills = {
-            skill['skill']['fullname']: skill['level']
-            for skill in self.user.get_skills()}
-        return dict(skills=skills)
+        return dict(skills=self.user.get_skills())
+
 
 class ToolsSection(ProfileSectionBase):
     template = 'allura.ext.user_profile:templates/sections/tools.html'
 
+    def __json__(self):
+        tools = []
+        for tool in c.project.grouped_navbar_entries():
+            tool_json = dict(
+                url=tool.url,
+                label=tool.label)
+            if tool.children:
+                tool_json['children'] = [
+                    dict(url=child.url, label=child.label)
+                    for child in tool.children
+                ]
+            tools.append(tool_json)
+        return dict(tools=tools)
+
 
 class SocialSection(ProfileSectionBase):
     template = 'allura.ext.user_profile:templates/sections/social.html'


Mime
View raw message