incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [02/10] git commit: [#7097] Show only 5 projects on User Profile with Show More button
Date Fri, 21 Feb 2014 22:21:50 GMT
[#7097] Show only 5 projects on User Profile with Show More button

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/927580b3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/927580b3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/927580b3

Branch: refs/heads/master
Commit: 927580b39d13e9f61c4770deb096f0a4923271b8
Parents: 03081c2
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Thu Feb 13 23:17:35 2014 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Fri Feb 21 21:14:08 2014 +0000

----------------------------------------------------------------------
 .../templates/sections/projects.html            | 20 +++++++++++++-------
 Allura/allura/ext/user_profile/user_main.py     |  7 +++++++
 Allura/allura/nf/allura/css/site_style.css      |  6 ++++++
 3 files changed, 26 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/927580b3/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 3f517de..e690748 100644
--- a/Allura/allura/ext/user_profile/templates/sections/projects.html
+++ b/Allura/allura/ext/user_profile/templates/sections/projects.html
@@ -32,20 +32,26 @@
 
 {% block content %}
     <ul>
-        {% for project in user.my_projects() %}
-        {% if project != c.project and not project.is_nbhd_project %}
-        <li>
+    {% for project in projects %}
+        <li{% if loop.index > 5 %} class="hidden"{% endif %}>
             {% if project.icon -%}
-                <img src="{{project.url()}}/icon?{{project.icon._id.generation_time}}"
alt="Project Logo"/>
+                <img src="{{project.url()}}/icon?{{project.icon._id.generation_time}}"
alt="Project Logo" width="48" height="48"/>
             {%- else -%}
-                <img src="{{g.forge_static('images/project_default.png')}}" alt="Project
Logo"/>
+                <img src="{{g.forge_static('images/project_default.png')}}" alt="Project
Logo" width="48" height="48"/>
             {%- endif -%}
             <span class="project-info">
                 <a href="{{project.url()}}">{{project.name}}</a>
                 {{project.summary}}
             </span>
         </li>
-        {% endif %}
-        {% endfor %}
+    {% endfor %}
     </ul>
+    {% if projects|length > 5 %}
+    <div class="show-more-projects">
+        <button onclick="$(this).hide().closest('.section-body').find('li.hidden').show()">
+            Show More
+            <b data-icon="{{g.icons['plus'].char}}" class="ico {{g.icons['plus'].css}}"></b>
+        </button>
+    </div>
+    {% endif %}
 {% endblock %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/927580b3/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 01bb6b8..7065a32 100644
--- a/Allura/allura/ext/user_profile/user_main.py
+++ b/Allura/allura/ext/user_profile/user_main.py
@@ -284,6 +284,13 @@ class PersonalDataSection(ProfileSectionBase):
 class ProjectsSection(ProfileSectionBase):
     template = 'allura.ext.user_profile:templates/sections/projects.html'
 
+    def prepare_context(self, context):
+        context['projects'] = [
+            project
+            for project in self.user.my_projects()
+            if project != c.project and (self.user == c.user or h.has_access(project, 'read'))]
+        return context
+
 
 class SkillsSection(ProfileSectionBase):
     template = 'allura.ext.user_profile:templates/sections/skills.html'

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/927580b3/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 d018945..a35d4a2 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -3383,6 +3383,12 @@ ul.dropdown ul li a:hover {
   content: '\A';
   white-space: pre;
 }
+.profile-section.projects .show-more-projects {
+      text-align: center;
+  }
+.profile-section.projects .show-more-projects button {
+    float: none;
+}
 .profile-section.skills .section-body {
   padding: 10px 0;
 }


Mime
View raw message