Remove row clicking from notification table (#22695)

Resolves #22692

I don't think there's a need for this entire row to be clickable (and
even different links depending on which segment you click)
The links still point to the same spot, so no information is lost here.

---------

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
John Olheiser 2023-03-25 14:37:34 -05:00 committed by GitHub
parent de5b368bca
commit 73b4010fcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 39 deletions

View File

@ -35,7 +35,7 @@
{{$issue := .Issue}} {{$issue := .Issue}}
{{$repo := .Repository}} {{$repo := .Repository}}
<tr id="notification_{{.ID}}"> <tr id="notification_{{.ID}}">
<td class="collapsing gt-pl-4" data-href="{{.Link}}"> <td class="collapsing gt-pl-4">
{{if eq .Status 3}} {{if eq .Status 3}}
{{svg "octicon-pin" 16 "text blue"}} {{svg "octicon-pin" 16 "text blue"}}
{{else if not $issue}} {{else if not $issue}}
@ -58,7 +58,7 @@
{{end}} {{end}}
{{end}} {{end}}
</td> </td>
<td class="eleven wide" data-href="{{.Link}}"> <td class="eleven wide">
<a class="item" href="{{.Link}}"> <a class="item" href="{{.Link}}">
{{if $issue}} {{if $issue}}
#{{$issue.Index}} - {{$issue.Title}} #{{$issue.Index}} - {{$issue.Title}}
@ -67,7 +67,7 @@
{{end}} {{end}}
</a> </a>
</td> </td>
<td data-href="{{$repo.Link}}"> <td>
<a class="item" href="{{$repo.Link}}">{{$repo.FullName}}</a> <a class="item" href="{{$repo.Link}}">{{$repo.FullName}}</a>
</td> </td>
<td class="collapsing"> <td class="collapsing">

View File

@ -90,23 +90,6 @@
padding: 8px 15px; padding: 8px 15px;
} }
.user.notification .content {
float: left;
margin-left: 7px;
}
.user.notification table form {
display: inline-block;
}
.user.notification table button {
padding: 3px 3px 3px 5px;
}
.user.notification table tr {
cursor: pointer;
}
.user .button.adopt, .user .button.adopt,
.user .button.delete { .user .button.delete {
margin-top: -15px; margin-top: -15px;
@ -152,15 +135,27 @@
object-fit: contain; object-fit: contain;
} }
#notification_div .tab.segment { .user.notification table button {
overflow-x: auto; padding: 3px 3px 3px 5px;
padding: 0;
} }
#notification_div .menu .active.item { #notification_div .tab.segment {
overflow-x: auto;
}
#notification_div .tabular.menu .active.item {
background: var(--color-box-body); background: var(--color-box-body);
} }
#notification_table { #notification_table {
border: none; border: none;
} }
#notification_table tr {
cursor: default;
}
#notification_table td a {
width: 100%;
display: inline-block;
}

View File

@ -124,21 +124,6 @@ export function initGlobalCommon() {
toggleElem($($(this).data('target'))); toggleElem($($(this).data('target')));
}); });
// make table <tr> and <td> elements clickable like a link
$('tr[data-href], td[data-href]').on('click', function (e) {
const href = $(this).data('href');
if (e.target.nodeName === 'A') {
// if a user clicks on <a>, then the <tr> or <td> should not act as a link.
return;
}
if (e.ctrlKey || e.metaKey) {
// ctrl+click or meta+click opens a new window in modern browsers
window.open(href);
} else {
window.location = href;
}
});
// prevent multiple form submissions on forms containing .loading-button // prevent multiple form submissions on forms containing .loading-button
document.addEventListener('submit', (e) => { document.addEventListener('submit', (e) => {
const btn = e.target.querySelector('.loading-button'); const btn = e.target.querySelector('.loading-button');