← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/code-hide-languages into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/code-hide-languages into lp:launchpad.

Commit message:
Hide the Product Code portlet if it would show nothing or just languages.

Requested reviews:
  William Grant (wgrant): code

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/code-hide-languages/+merge/290016

Hide the Product Code portlet if it would show nothing or just languages.
-- 
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/registry/stories/product/xx-product-index.txt'
--- lib/lp/registry/stories/product/xx-product-index.txt	2016-03-23 12:16:54 +0000
+++ lib/lp/registry/stories/product/xx-product-index.txt	2016-03-24 09:54:48 +0000
@@ -27,11 +27,13 @@
 
     >>> import transaction
     >>> from lp.services.database.sqlbase import flush_database_updates
+    >>> from lp.registry.enums import VCSType
     >>> from lp.registry.model.product import Product
     >>> from lp.testing import ANONYMOUS, login, logout
     >>> login(ANONYMOUS)
 
     >>> tomcat = Product.selectOneBy(name="tomcat")
+    >>> tomcat.vcs = VCSType.GIT
     >>> tomcat.homepageurl = "http://home.page/";
     >>> tomcat.sourceforgeproject = "sf-tomcat"
     >>> tomcat.wikiurl = "http://wiki.url/";

=== modified file 'lib/lp/registry/templates/product-index.pt'
--- lib/lp/registry/templates/product-index.pt	2016-03-24 02:58:05 +0000
+++ lib/lp/registry/templates/product-index.pt	2016-03-24 09:54:48 +0000
@@ -187,7 +187,16 @@
       </div>
 
       <div class="yui-g">
-        <div class="yui-u first">
+        <tal:comment replace="nothing">
+          The Code section could show something if the project had
+          programming languages set or settable, but that field on its
+          own is so boring that it's not sufficient to reveal the
+          section.
+        </tal:comment>
+        <div class="yui-u first"
+             tal:define="trunk context/development_focus/branch;
+                         trunk_visible trunk/required:launchpad.View|nothing"
+             tal:condition="python: trunk_visible or context.inferred_vcs">
           <div id="code-info" class="portlet">
             <h2>
               <span class="see-all"><a
@@ -196,10 +205,7 @@
               Code
             </h2>
 
-            <dl id="dev-focus"
-                tal:define="trunk context/development_focus/branch;
-                            trunk_visible trunk/required:launchpad.View|nothing"
-                tal:condition="trunk_visible">
+            <dl id="dev-focus" tal:condition="trunk_visible">
               <dt>Development focus:</dt>
               <dd>
                 <p>


References