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/14 00:19:48 UTC

[3/3] git commit: [#7097] Show only 5 projects on User Profile with Show More button

[#7097] Show only 5 projects on User Profile with Show More button

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

Branch: refs/heads/cj/7097
Commit: 1c10ec4969862bbb23f1ae8e9646a4676f1ae020
Parents: f1db054
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Feb 13 23:17:35 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Feb 13 23:17:35 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/1c10ec49/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/1c10ec49/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/1c10ec49/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;
 }