#3612 fix commit flags showing on the commits tab
Merged 2 years ago by ryanlerch. Opened 2 years ago by ryanlerch.
ryanlerch/pagure commit-flags  into  master

@@ -185,7 +185,7 @@ 

                          username=username,

                          namespace=repo.namespace,

                          commitid=commit.hex, branch=branchname) }}"

-                         class="btn btn-outline-primary font-weight-bold">

+                         class="btn btn-outline-primary font-weight-bold commithash" id="c_{{ commit.hex }}">

                          <code>{{ commit.hex|short }}</code>

                        </a>

                        <a class="btn btn-outline-primary font-weight-bold" href="{{ url_for(
@@ -284,6 +284,7 @@ 

                            namespace=repo.namespace,

                            commitid="COMMIT_HASH") }}'

        url = url.replace("COMMIT_HASH", item.id.substring(2))

+       var commithash=

        commitUrl = commitUrl.replace("COMMIT_HASH", item.id.substring(2))

        $.ajax({

          url: url,
@@ -298,17 +299,16 @@ 

              }

              statuses[f['status']].push(f)

            }

-           var html = '<span>'

+           var html = ''

            var sortedStatuses = Object.keys(statuses).sort()

            for (var i in sortedStatuses) {

              s = sortedStatuses[i]

              numStatuses = statuses[s].length

              html += '<a href="' + commitUrl + '" title="' + numStatuses

              html += ' ' + s + ' flag' + (numStatuses > 1 ? 's' : '')

-             html += '" class="badge ' + statusesLabels[s] + '">'

+             html += '" class="btn ' + statusesLabels[s].replace('badge', 'btn-outline') + '">'

              html += statuses[s].length + '</a>\n'

            }

-           html += '</span>\n'

            $(html).insertBefore(item)

          }

        });

This makes the commit flags show on the commit tab again,
which was broken after the update to the new UI.

This basically just fixes the issue, but this could def
be make to look a little better with icons and stuff,
but as the colours for these statuses are in the config file,
decided to leave this for a later time.

Fixes: #3600

Screenshot_from_2018-09-05_21-05-13.png

One minor nit, otherwise LGTM!

rebased onto a40ba92

2 years ago

Thanks for the review @bkabrda

Removed the leftover console.log statement.

Pull-Request has been merged by ryanlerch

2 years ago