Browse Source

Show the default branch in the project overview page

Fixes https://pagure.io/pagure/issue/4715

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Pierre-Yves Chibon 3 years ago
parent
commit
b7b0f1e86c

+ 6 - 1
pagure/static/pagure.css

@@ -501,6 +501,11 @@ th[data-sort] {
   background: #ddd;
 }
 
+.commit_branch {
+  font-size: 1em;
+  background: #ababab;
+}
+
 .light_gray_bg {
   background-color:#ccc;
 }
@@ -549,4 +554,4 @@ th[data-sort] {
 
 .api-doc .card-body h2.title {
   display: none;
-}
+}

+ 2 - 1
pagure/templates/repo_info.html

@@ -279,7 +279,8 @@
                           namespace=repo.namespace,
                           commitid=commit.hex, branch=branchname) }}"
                           class="notblue">
-                          <code class="py-1 px-2 font-weight-bold commit_hash">{{ commit.hex|short }}</code>
+                          <code class="py-1 px-2 font-weight-bold commit_branch">{{ branchname }}</code><code
+                           class="py-1 px-2 font-weight-bold commit_hash">{{ commit.hex|short }}</code>
                           <span class="font-weight-bold">{{ commit.message.split('\n')[0] }}</span>
                         </a>
                       </div>

+ 2 - 1
pagure/themes/srcfpo/templates/repo_info.html

@@ -418,7 +418,8 @@
                 namespace=repo.namespace,
                 commitid=commit.hex, branch=branchname) }}"
                 class="notblue">
-                <code class="py-1 px-2 font-weight-bold commit_hash">{{ commit.hex|short }}</code>
+                <code class="py-1 px-2 font-weight-bold commit_branch">{{ branchname }}</code><code
+                class="py-1 px-2 font-weight-bold commit_hash">{{ commit.hex|short }}</code>
                 <span class="font-weight-bold">{{ commit.message.split('\n')[0] }}</span>
               </a>
             </div>

+ 10 - 0
tests/test_pagure_flask_ui_app.py

@@ -2324,6 +2324,11 @@ class PagureFlaskAppNewProjecttests(tests.Modeltests):
                 '<a href="/testproject"><strong>testproject</strong></a>',
                 output_text,
             )
+            self.assertIn(
+                '<code class="py-1 px-2 font-weight-bold '
+                'commit_branch">master</code>',
+                output_text,
+            )
 
         # After
         projects = pagure.lib.query.search_projects(self.session)
@@ -2492,6 +2497,11 @@ class PagureFlaskAppNewProjecttests(tests.Modeltests):
                 '<a href="/project_main"><strong>project_main</strong></a>',
                 output_text,
             )
+            self.assertIn(
+                '<code class="py-1 px-2 font-weight-bold '
+                'commit_branch">main</code>',
+                output_text,
+            )
 
         # After
         projects = pagure.lib.query.search_projects(self.session)