Skip to contentSkip to conversation

editlayer: allow selecting web interface type

PATCH New Paul Eggleton 1 participant 3 messages Oct 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 editlayer: allow selecting web interface type

For some repo URLs we can automatically determine the values of all of the other fields - e.g. for github or git.openembedded.org, and we've been doing that for a while. However if someone submits a URL for some other site we don't know what type of interface it uses, and usually the submitter leaves the fields blank so it falls to the layer index maintainer to set the values, and then you have to remember what the correct URL format is which is awkward especially for gitweb.

In order to fix this, add a select field to the form which allows specifying which type of interface is being used. At the moment only cgit, gitweb, gitlab and "(custom)" (i.e. the current behaviour) are supported. This is not a real field but activates javascript code that sets the other fields and enables/disables the controls.

---
 layerindex/static/css/additional.css |   6 ++
 templates/layerindex/editlayer.html  | 117 +++++++++++++++++++++++++++++++----
 2 files changed, 112 insertions(+), 11 deletions(-)
layerindex/static/css/additional.css +6 -0
index e6cf526..2a27712 100644
@@ -88,6 +88,12 @@ padding: 8px;
     width: 50%;
 }
 
+.formfield-div {
+    width: 50%;
+    display: inline-block;
+    margin-right: 13px;
+}
+
 .checkboxtd input {
     width: 25px;
 }
templates/layerindex/editlayer.html +106 -11

179 lines not on this page · raw message

Signature · 1 line
2.5.5
#2 lore raw

PATCH 3/3 recipedetail: don't show homepage as link if not URL

Sometimes people put values that aren't URLs into the HOMEPAGE variable. If that's the case, then we should not turn that value into a link which will be invalid.

---
 layerindex/models.py                   | 6 ++++++
 templates/layerindex/recipedetail.html | 8 +++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
layerindex/models.py +6 -0
index 869d4a3..746fad4 100644
@@ -292,6 +292,12 @@ class Recipe(models.Model):
         else:
             return self.filename.split('_')[0]
 
+    def homepage_url_only(self):
+        if '://' in self.homepage:
+            return self.homepage
+        else:
+            return None
+
     def __str__(self):
         return os.path.join(self.filepath, self.filename)
 
templates/layerindex/recipedetail.html +7 -1
index c0199a1..5b83886 100644
@@ -72,7 +72,13 @@
                         </tr>
                         <tr>
                             <th>Homepage</th>
-                            <td>{% if recipe.homepage %}<a href="{{ recipe.homepage }}">{{ recipe.homepage }}</a>{% endif %}</td>
+                            <td>
+                                {% if recipe.homepage_url_only %}
+                                    <a href="{{ recipe.homepage }}">{{ recipe.homepage }}</a>
+                                {% elif recipe.homepage %}
+                                    {{ recipe.homepage }}
+                                {% endif %}
+                            </td>
                         </tr>
                         {% if recipe.bugtracker %}
                         <tr>
Signature · 1 line
2.5.5
#1 lore raw

PATCH 2/3 about: update contributors list

In reply to Paul Eggleton

Ensure recent contributions from Mark and Liam are reflected in the authors list.

---
 templates/layerindex/about.html | 2 ++
 1 file changed, 2 insertions(+)
templates/layerindex/about.html +2 -0
index 3e98825..a290344 100644
@@ -43,6 +43,8 @@
 <li>Belen Barros Pena</li>
 <li>Alexandru Damian</li>
 <li>Michael Halstead</li>
+<li>Liam R. Howlett</li>
+<li>Mark Hatle</li>
 </ul>
 
 <p>The code is Open Source and can be found on <a href="http://git.yoctoproject.org/cgit/cgit.cgi/layerindex-web/">git.yoctoproject.org</a>. Patches welcome!</p>
Signature · 1 line
2.5.5