Merge branch 'dev' into t50_hide_project_icon_placeholder
diff --git a/Allura/allura/lib/widgets/project_list.py b/Allura/allura/lib/widgets/project_list.py
index b5e0828..c4916af 100644
--- a/Allura/allura/lib/widgets/project_list.py
+++ b/Allura/allura/lib/widgets/project_list.py
@@ -28,8 +28,6 @@
         if response['icon_url'] is None:
             if value.icon:
                 response['icon_url'] = value.url()+'icon'
-            else:
-                response['icon_url'] = g.forge_static('images/project_default.png')
         if response['accolades'] is None:
             response['accolades'] = value.accolades
 
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index bdffc75..5ca3f4c 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -358,7 +358,7 @@
     def icon_urls(cls, projects):
         '''Return a dict[project_id] = icon_url, efficiently'''
         project_index = dict((p._id, p) for p in projects)
-        result = dict((p._id, g.forge_static('images/project_default.png')) for p in projects)
+        result = dict((p._id, None) for p in projects)
         for icon in ProjectFile.query.find(dict(
                 project_id={'$in': result.keys()},
                 category='icon')):
diff --git a/Allura/allura/templates/jinja_master/nav_menu.html b/Allura/allura/templates/jinja_master/nav_menu.html
index 341703e..2203800 100644
--- a/Allura/allura/templates/jinja_master/nav_menu.html
+++ b/Allura/allura/templates/jinja_master/nav_menu.html
@@ -11,8 +11,6 @@
       {{lib.gravatar(c.project.user_project_of, size=48, className='project_icon')}}
     {% elif c.project.icon %}
       <img src="{{c.project.url()}}/icon" class="project_icon" alt="Project Logo">
-    {% else %}
-      <img src="{{g.forge_static('images/project_default.png')}}" class="project_icon" alt="Default Project Icon">
     {% endif %}
 	<h1 class="project_title">
       {% if c.project.shortname.endswith('--init--') %}
diff --git a/Allura/allura/templates/jinja_master/neigh_nav_menu.html b/Allura/allura/templates/jinja_master/neigh_nav_menu.html
index 00ef89a..cd43f13 100644
--- a/Allura/allura/templates/jinja_master/neigh_nav_menu.html
+++ b/Allura/allura/templates/jinja_master/neigh_nav_menu.html
@@ -5,8 +5,6 @@
   <a href="{{neighborhood.url()}}">
     {% if neighborhood.icon %}
       <img src="{{neighborhood.url()}}/icon" class="project_icon" alt="{{neighborhood.name}} Logo"/>
-    {% else %}
-      <img src="{{g.forge_static('images/project_default.png')}}" class="project_icon" alt="Default Neighborhood Icon"/>
     {% endif %}
 	<h1 class="project_title">{{neighborhood.name}}</h1>
 	</a>
diff --git a/Allura/allura/templates/widgets/project_summary.html b/Allura/allura/templates/widgets/project_summary.html
index 6581864..6cb9839 100644
--- a/Allura/allura/templates/widgets/project_summary.html
+++ b/Allura/allura/templates/widgets/project_summary.html
@@ -1,17 +1,17 @@
 {% if display_mode == 'list' %}
 <div class="list card{% if show_proj_icon%} proj_icon{% endif %}"
 	{%- if columns == 2 %} style="width: 330px"{% elif columns == 3 %} style="width: 220px"{% endif %}>
-  {% if show_proj_icon == True %}
-   {% if accolades and show_awards_banner == True %}
+  {% if accolades and show_awards_banner == True %}
     <div class="box notch sponsor">
       <div class="feature">{{accolades[0].award.short}}</div>
-      <img src="{{icon_url}}" alt="{{value.name}} Logo"/>
+      {% if show_proj_icon == True and icon_url %}<img src="{{icon_url}}" alt="{{value.name}} Logo"/>{% endif %}
     </div>
-   {% else %}
+  {% else %}
+    {% if show_proj_icon == True and icon_url %}
     <div class="box">
       <img src="{{icon_url}}" alt="{{value.name}} Logo"/>
     </div>
-   {% endif %}
+    {% endif %}
   {% endif %}
   <h2><a href="{{value.url()}}">{{value.name}}</a></h2>
   <p class="desc">{% if value.summary %}{{value.summary}}{% else %}{{h.text.truncate(value.short_description, 50)}}{% endif %}</p>
@@ -19,17 +19,17 @@
 </div>
 {% else %}
   <div class="border card">
-    {% if show_proj_icon == True %}
-     {% if accolades and show_awards_banner == True %}
+    {% if accolades and show_awards_banner == True %}
       <div class="box notch sponsor">
         <div class="feature">{{accolades[0].award.short}}</div>
-        <img src="{{icon_url}}" alt="{{value.name}} Logo"/>
+        {% if show_proj_icon == True and icon_url %}<img src="{{icon_url}}" alt="{{value.name}} Logo"/>{% endif %}
       </div>
-     {% else %}
+    {% else %}
+      {% if show_proj_icon == True and icon_url %}
       <div class="box">
         <img src="{{icon_url}}" alt="{{value.name}} Logo"/>
       </div>
-     {% endif %}
+      {% endif %}
     {% endif %}
     <h2><a href="{{value.url()}}">{{value.name}}</a></h2>
     <p class="desc">{% if value.summary %}{{value.summary}}{% else %}{{h.text.truncate(value.short_description, 50)}}{% endif %}</p>
diff --git a/Allura/allura/tests/functional/test_root.py b/Allura/allura/tests/functional/test_root.py
index 6d89187..411d998 100644
--- a/Allura/allura/tests/functional/test_root.py
+++ b/Allura/allura/tests/functional/test_root.py
@@ -33,7 +33,6 @@
         assert_equal(response.html.find('h2',{'class':'dark title'}).contents[0].strip(), 'All Projects')
         projects = response.html.findAll('div',{'class':'border card'})
         assert projects[0].find('a').get('href') == '/adobe/adobe-1/'
-        assert projects[0].find('img').get('alt') == 'adobe-1 Logo'
         cat_links = response.html.find('div',{'id':'sidebar'}).findAll('li')
         assert len(cat_links) == 4
         assert cat_links[0].find('a').get('href') == '/browse/clustering'
@@ -52,20 +51,19 @@
         fax_cat = M.ProjectCategory.query.find(dict(label='Fax')).first()
         M.Project.query.find(dict(name='adobe-1')).first().category_id = com_cat._id
         response = self.app.get('/browse')
-        assert len(response.html.findAll('img',{'alt':'adobe-1 Logo'})) == 1
-        assert len(response.html.findAll('img',{'alt':'adobe-2 Logo'})) == 1
+        assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 1
+        assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 1
         response = self.app.get('/browse/communications')
-        assert len(response.html.findAll('img',{'alt':'adobe-1 Logo'})) == 1
-        assert len(response.html.findAll('img',{'alt':'adobe-2 Logo'})) == 0
+        assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 1
+        assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 0
         response = self.app.get('/browse/communications/fax')
-        assert len(response.html.findAll('img',{'alt':'adobe-1 Logo'})) == 0
-        assert len(response.html.findAll('img',{'alt':'adobe-2 Logo'})) == 0
+        assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 0
+        assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 0
 
     def test_neighborhood_index(self):
         response = self.app.get('/adobe/')
         projects = response.html.findAll('div',{'class':'border card'})
         assert len(projects) == 2
-        assert projects[0].find('img').get('alt') == 'adobe-1 Logo'
         cat_links = response.html.find('div',{'id':'sidebar'}).findAll('ul')[1].findAll('li')
         assert len(cat_links) == 3, cat_links
         assert cat_links[0].find('a').get('href') == '/adobe/browse/clustering'
@@ -77,14 +75,14 @@
         M.Project.query.find(dict(name='adobe-1')).first().category_id = com_cat._id
         M.Project.query.find(dict(name='adobe-2')).first().category_id = fax_cat._id
         response = self.app.get('/adobe/browse')
-        assert len(response.html.findAll('img',{'alt':'adobe-1 Logo'})) == 1
-        assert len(response.html.findAll('img',{'alt':'adobe-2 Logo'})) == 1
+        assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 1
+        assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 1
         response = self.app.get('/adobe/browse/communications')
-        assert len(response.html.findAll('img',{'alt':'adobe-1 Logo'})) == 1
-        assert len(response.html.findAll('img',{'alt':'adobe-2 Logo'})) == 1
+        assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 1
+        assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 1
         response = self.app.get('/adobe/browse/communications/fax')
-        assert len(response.html.findAll('img',{'alt':'adobe-1 Logo'})) == 0
-        assert len(response.html.findAll('img',{'alt':'adobe-2 Logo'})) == 1
+        assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 0
+        assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 1
 
     @td.with_wiki
     def test_markdown_to_html(self):
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 0557672..ccc673c 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -1,4 +1,5 @@
 import re
+import os, allura
 from urllib import quote
 
 from bson import ObjectId
@@ -37,10 +38,35 @@
 
 @with_setup(setUp)
 def test_macros():
+    file_name = 'neo-icon-set-454545-256x350.png'
+    file_path = os.path.join(allura.__path__[0],'nf','allura','images',file_name)
+    curr_project = c.project
+
     p_nbhd = M.Neighborhood.query.get(name='Projects')
     p_test = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
+    c.project = p_test
+    icon_file = open(file_path)
+    M.ProjectFile.save_image(
+                file_name, icon_file, content_type='image/png',
+                square=True, thumbnail_size=(48,48),
+                thumbnail_meta=dict(project_id=c.project._id,category='icon'))
+    icon_file.close()
     p_test2 = M.Project.query.get(shortname='test2', neighborhood_id=p_nbhd._id)
+    c.project = p_test2
+    icon_file = open(file_path)
+    M.ProjectFile.save_image(
+                file_name, icon_file, content_type='image/png',
+                square=True, thumbnail_size=(48,48),
+                thumbnail_meta=dict(project_id=c.project._id,category='icon'))
+    icon_file.close()
     p_sub1 =  M.Project.query.get(shortname='test/sub1', neighborhood_id=p_nbhd._id)
+    c.project = p_sub1
+    icon_file = open(file_path)
+    M.ProjectFile.save_image(
+                file_name, icon_file, content_type='image/png',
+                square=True, thumbnail_size=(48,48),
+                thumbnail_meta=dict(project_id=c.project._id,category='icon'))
+    icon_file.close()
     p_test.labels = [ 'test', 'root' ]
     p_sub1.labels = [ 'test', 'sub1' ]
     # Make one project private
@@ -85,7 +111,12 @@
         assert '<img alt="test2 Logo"' in r, r
         assert '<img alt="test Logo"' not in r, r
         assert '<img alt="sub1 Logo"' not in r, r
+        r = g.markdown_wiki.convert('[[projects show_proj_icon=True]]')
+        assert '<img alt="test Logo"' in r
+        r = g.markdown_wiki.convert('[[projects show_proj_icon=False]]')
+        assert '<img alt="test Logo"' not in r
 
+    c.project = curr_project
     r = g.markdown_wiki.convert('[[project_admins]]')
     assert r == '<div class="markdown_content"><p><a href="/u/test-admin/">Test Admin</a><br /></p></div>'
     r = g.markdown_wiki.convert('[[download_button]]')
@@ -215,12 +246,6 @@
         r = g.markdown_wiki.convert('[[projects display_mode=list columns=3]]')
         assert two_column_style not in r
 
-        # test project icon
-        r = g.markdown_wiki.convert('[[projects display_mode=list show_proj_icon=True]]')
-        assert 'test Logo' in r
-        r = g.markdown_wiki.convert('[[projects display_mode=list show_proj_icon=False]]')
-        assert 'test Logo' not in r
-
         # test project download button
         r = g.markdown_wiki.convert('[[projects display_mode=list show_download_button=True]]')
         assert 'download-button' in r