+
{{template "user/overview/header" .}}
diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl
index 49a0b445b..7fec88cb7 100644
--- a/templates/repo/commit_page.tmpl
+++ b/templates/repo/commit_page.tmpl
@@ -18,10 +18,10 @@
{{end}}
{{end}}
-
+
{{RenderCommitMessage $.Context .Commit.Message ($.Repository.ComposeMetas ctx)}}{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}
{{if not $.PageIsWiki}} -
+
{{ctx.Locale.Tr "repo.diff.browse_source"}}
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index 9ede83dcb..6b343e4ee 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -111,7 +111,7 @@
{{$isReviewFile := and $.IsSigned $.PageIsPullFiles (not $.IsArchived) $.IsShowingAllCommits}}
-
-
+
- {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}}
-
- {{if $file.IsGenerated}}
- {{ctx.Locale.Tr "repo.diff.generated"}}
- {{end}}
- {{if $file.IsVendored}}
- {{ctx.Locale.Tr "repo.diff.vendored"}}
- {{end}}
- {{if and $file.Mode $file.OldMode}}
- {{$old := ctx.Locale.Tr ($file.ModeTranslationKey $file.OldMode)}}
- {{$new := ctx.Locale.Tr ($file.ModeTranslationKey $file.Mode)}}
- {{ctx.Locale.Tr "git.filemode.changed_filemode" $old $new}}
- {{else if $file.Mode}}
- {{ctx.Locale.Tr ($file.ModeTranslationKey $file.Mode)}}
- {{end}}
+ {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}
+ {{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}}
+
+ {{if $file.IsGenerated}}
+ {{ctx.Locale.Tr "repo.diff.generated"}}
+ {{end}}
+ {{if $file.IsVendored}}
+ {{ctx.Locale.Tr "repo.diff.vendored"}}
+ {{end}}
+ {{if and $file.Mode $file.OldMode}}
+ {{$old := ctx.Locale.Tr ($file.ModeTranslationKey $file.OldMode)}}
+ {{$new := ctx.Locale.Tr ($file.ModeTranslationKey $file.Mode)}}
+ {{ctx.Locale.Tr "git.filemode.changed_filemode" $old $new}}
+ {{else if $file.Mode}}
+ {{ctx.Locale.Tr ($file.ModeTranslationKey $file.Mode)}}
+ {{end}}
+
{{if $showFileViewToggle}}
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl
index d02eb7d7a..3c994af19 100644
--- a/templates/repo/home.tmpl
+++ b/templates/repo/home.tmpl
@@ -58,8 +58,11 @@
{{end}}
{{template "repo/sub_menu" .}}
+ {{$n := len .TreeNames}}
+ {{$l := Eval $n "-" 1}}
+ {{$isHomepage := (eq $n 0)}}
-
+
{{template "repo/branch_dropdown" dict "root" . "ContainerClasses" "tw-mr-1"}}
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
{{$cmpBranch := ""}}
@@ -74,9 +77,7 @@
{{end}}
- {{$n := len .TreeNames}}
- {{$l := Eval $n "-" 1}}
- {{if eq $n 0}}
+ {{if $isHomepage}}
{{ctx.Locale.Tr "repo.find_file.go_to_file"}}
{{end}}
@@ -100,20 +101,20 @@
{{end}}
- {{if and (eq $n 0) (.Repository.IsTemplate)}}
+ {{if and $isHomepage (.Repository.IsTemplate)}}
{{ctx.Locale.Tr "repo.use_template"}}
{{end}}
- {{if ne $n 0}}
+ {{if (not $isHomepage)}}
{{StringUtils.EllipsisString .Repository.Name 30}}
{{- range $i, $v := .TreeNames -}}
/
{{- if eq $i $l -}}
- {{StringUtils.EllipsisString $v 30}}
+ {{$v}}
{{- else -}}
- {{$p := index $.Paths $i}}{{StringUtils.EllipsisString $v 30}}
+ {{$p := index $.Paths $i}}{{$v}}
{{- end -}}
{{- end -}}
@@ -121,7 +122,7 @@
- {{if eq $n 0}}
+ {{if $isHomepage}}
{{template "repo/clone_buttons" .}}
{{template "repo/cite/cite_modal" .}}
{{end}}
- {{if and (ne $n 0) (not .IsViewFile) (not .IsBlame)}}
+ {{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}
{{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}}
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index 8b73afe6d..1d1fdb36e 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -156,7 +156,7 @@
- {{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName false}}
+ {{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName}}
diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl
index 2680b374c..333121c20 100644
--- a/templates/repo/view_file.tmpl
+++ b/templates/repo/view_file.tmpl
@@ -11,13 +11,13 @@
{{end}}
{{if not .ReadmeInList}}
-
-
+
+
{{template "repo/latest_commit" .}}
{{if .LatestCommit}}
{{if .LatestCommit.Committer}}
-
+
{{TimeSince .LatestCommit.Committer.When ctx.Locale}}
{{end}}
diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl
index 7c463c50a..fb257bd47 100644
--- a/templates/repo/view_list.tmpl
+++ b/templates/repo/view_list.tmpl
@@ -1,8 +1,12 @@
-
- {{template "repo/latest_commit" .}}
+
+
+
+ {{template "repo/latest_commit" .}}
+
+
{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When ctx.Locale}}{{end}}{{end}}
diff --git a/templates/user/notification/notification_div.tmpl b/templates/user/notification/notification_div.tmpl
index 04e79ba74..bf3b51ee3 100644
--- a/templates/user/notification/notification_div.tmpl
+++ b/templates/user/notification/notification_div.tmpl
@@ -1,7 +1,7 @@
{{$notificationUnreadCount := call .NotificationUnreadCount}}
-
+
diff --git a/templates/user/overview/packages.tmpl b/templates/user/overview/packages.tmpl
index 95cb506e5..bb2238b91 100644
--- a/templates/user/overview/packages.tmpl
+++ b/templates/user/overview/packages.tmpl
@@ -13,11 +13,9 @@
{{template "shared/user/profile_big_avatar" .}}
-
-
+
{{template "user/overview/header" .}}
-
- {{template "package/shared/list" .}}
+ {{template "package/shared/list" .}}
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl
index 5880c80cc..51b7a4f0e 100644
--- a/templates/user/profile.tmpl
+++ b/templates/user/profile.tmpl
@@ -6,11 +6,8 @@
{{template "shared/user/profile_big_avatar" .}}
-
-
- {{template "user/overview/header" .}}
-
-
+
+ {{template "user/overview/header" .}}
{{if eq .TabName "activity"}}
{{if .ContextUser.KeepActivityPrivate}}
diff --git a/tests/integration/integration_test.go b/tests/integration/integration_test.go
index 8fd55d7fa..adba52fee 100644
--- a/tests/integration/integration_test.go
+++ b/tests/integration/integration_test.go
@@ -621,7 +621,7 @@ func VerifyJSONSchema(t testing.TB, resp *httptest.ResponseRecorder, schemaFile
schema, err := jsonschema.Compile(schemaFilePath)
assert.NoError(t, err)
- var data interface{}
+ var data any
err = json.Unmarshal(resp.Body.Bytes(), &data)
assert.NoError(t, err)
diff --git a/web_src/css/actions.css b/web_src/css/actions.css
index e7b9a3855..1d5bea239 100644
--- a/web_src/css/actions.css
+++ b/web_src/css/actions.css
@@ -44,7 +44,7 @@
}
.run-list-item-right {
- flex: 0 0 15%;
+ flex: 0 0 min(20%, 130px);
display: flex;
flex-direction: column;
gap: 3px;
diff --git a/web_src/css/base.css b/web_src/css/base.css
index 17c3f2ee6..d7ef9598b 100644
--- a/web_src/css/base.css
+++ b/web_src/css/base.css
@@ -24,7 +24,21 @@
--repo-header-issue-min-height: 41px;
--min-height-textarea: 132px; /* padding + 6 lines + border = calc(1.57142em + 6lh + 2px), but lh is not fully supported */
--tab-size: 4;
- --checkbox-size: 16px; /* height and width of checkbox and radio inputs */
+ --checkbox-size: 15px; /* height and width of checkbox and radio inputs */
+ --page-spacing: 16px; /* space between page elements */
+ --page-margin-x: 32px; /* minimum space on left and right side of page */
+}
+
+@media (min-width: 768px) and (max-width: 1200px) {
+ :root {
+ --page-margin-x: 16px;
+ }
+}
+
+@media (max-width: 767.98px) {
+ :root {
+ --page-margin-x: 8px;
+ }
}
:root * {
@@ -594,11 +608,14 @@ img.ui.avatar,
margin-bottom: 14px;
}
-/* add padding to all content when there is no .secondary.nav. this uses padding instead of
- margin because with the negative margin on .ui.grid we would have to set margin-top: 0,
- but that does not work universally for all pages */
+/* add margin to all pages when there is no .secondary.nav */
.page-content > :first-child:not(.secondary-nav) {
- padding-top: 14px;
+ margin-top: var(--page-spacing);
+}
+/* if .ui.grid is the first child the first grid-column has 'padding-top: 1rem' which we need
+ to compensate here */
+.page-content > :first-child.ui.grid {
+ margin-top: calc(var(--page-spacing) - 1rem);
}
.ui.pagination.menu .active.item {
@@ -1256,6 +1273,7 @@ overflow-menu .ui.label {
white-space: pre-wrap;
word-break: break-all;
overflow-wrap: anywhere;
+ line-height: inherit; /* needed for inline code preview in markup */
}
.blame .code-inner {
diff --git a/web_src/css/form.css b/web_src/css/form.css
index 2a976c056..a8f73b6b6 100644
--- a/web_src/css/form.css
+++ b/web_src/css/form.css
@@ -249,21 +249,6 @@ textarea:focus,
.user.signup form .optional .title {
margin-left: 250px !important;
}
- .user.activate form .inline.field > input,
- .user.forgot.password form .inline.field > input,
- .user.reset.password form .inline.field > input,
- .user.link-account form .inline.field > input,
- .user.signin form .inline.field > input,
- .user.signup form .inline.field > input,
- .user.activate form .inline.field > textarea,
- .user.forgot.password form .inline.field > textarea,
- .user.reset.password form .inline.field > textarea,
- .user.link-account form .inline.field > textarea,
- .user.signin form .inline.field > textarea,
- .user.signup form .inline.field > textarea,
- .oauth-login-link {
- width: 50%;
- }
}
@media (max-width: 767.98px) {
@@ -310,14 +295,7 @@ textarea:focus,
.user.reset.password form .inline.field > label,
.user.link-account form .inline.field > label,
.user.signin form .inline.field > label,
- .user.signup form .inline.field > label,
- .user.activate form input,
- .user.forgot.password form input,
- .user.reset.password form input,
- .user.link-account form input,
- .user.signin form input,
- .user.signup form input,
- .oauth-login-link {
+ .user.signup form .inline.field > label {
width: 100% !important;
}
}
@@ -435,9 +413,9 @@ textarea:focus,
.repository.new.repo form label,
.repository.new.migrate form label,
.repository.new.fork form label,
- .repository.new.repo form input,
- .repository.new.migrate form input,
- .repository.new.fork form input,
+ .repository.new.repo form .inline.field > input,
+ .repository.new.migrate form .inline.field > input,
+ .repository.new.fork form .inline.field > input,
.repository.new.fork form .field a,
.repository.new.repo form .selection.dropdown,
.repository.new.migrate form .selection.dropdown,
diff --git a/web_src/css/modules/checkbox.css b/web_src/css/modules/checkbox.css
index 9238e0b3f..d3e45714a 100644
--- a/web_src/css/modules/checkbox.css
+++ b/web_src/css/modules/checkbox.css
@@ -20,7 +20,7 @@ input[type="radio"] {
.ui.checkbox input[type="checkbox"],
.ui.checkbox input[type="radio"] {
position: absolute;
- top: 0;
+ top: 1px;
left: 0;
width: var(--checkbox-size);
height: var(--checkbox-size);
diff --git a/web_src/css/modules/container.css b/web_src/css/modules/container.css
index dc854f89d..f394d6c06 100644
--- a/web_src/css/modules/container.css
+++ b/web_src/css/modules/container.css
@@ -49,30 +49,11 @@
/* overwrite width of containers inside the main page content div (div with class "page-content") */
.page-content .ui.ui.ui.container:not(.fluid) {
width: 1280px;
- max-width: calc(100% - 64px);
+ max-width: calc(100% - calc(2 * var(--page-margin-x)));
margin-left: auto;
margin-right: auto;
}
.ui.container.fluid.padded {
- padding: 0 32px;
-}
-
-/* enable fluid page widths for medium size viewports */
-@media (min-width: 768px) and (max-width: 1200px) {
- .page-content .ui.ui.ui.container:not(.fluid) {
- max-width: calc(100% - 32px);
- }
- .ui.container.fluid.padded {
- padding: 0 16px;
- }
-}
-
-@media (max-width: 767.98px) {
- .page-content .ui.ui.ui.container:not(.fluid) {
- max-width: calc(100% - 16px);
- }
- .ui.container.fluid.padded {
- padding: 0 8px;
- }
+ padding: 0 var(--page-margin-x);
}
diff --git a/web_src/css/modules/flexcontainer.css b/web_src/css/modules/flexcontainer.css
index 0b559f1e7..1ca513687 100644
--- a/web_src/css/modules/flexcontainer.css
+++ b/web_src/css/modules/flexcontainer.css
@@ -2,7 +2,8 @@
.flex-container {
display: flex !important;
- gap: 16px;
+ gap: var(--page-spacing);
+ margin-top: var(--page-spacing);
}
.flex-container-nav {
diff --git a/web_src/css/modules/list.css b/web_src/css/modules/list.css
index 73760390d..32c71e802 100644
--- a/web_src/css/modules/list.css
+++ b/web_src/css/modules/list.css
@@ -126,6 +126,12 @@
cursor: pointer;
}
+.ui.list .list > .item [class*="right floated"],
+.ui.list > .item [class*="right floated"] {
+ float: right;
+ margin: 0 0 0 1em;
+}
+
.ui.menu .ui.list > .item,
.ui.menu .ui.list .list > .item {
display: list-item;
diff --git a/web_src/css/repo.css b/web_src/css/repo.css
index 66555cad2..bd2d2fdcf 100644
--- a/web_src/css/repo.css
+++ b/web_src/css/repo.css
@@ -177,12 +177,44 @@
}
}
-.repository.file.list .repo-path {
- word-break: break-word;
+.commit-summary {
+ flex: 1;
+ overflow-wrap: anywhere;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
}
-.repository.file.list #repo-files-table {
- table-layout: fixed;
+.commit-header .commit-summary,
+td .commit-summary {
+ white-space: normal;
+}
+
+.latest-commit {
+ display: flex;
+ flex: 1;
+ align-items: center;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+@media (max-width: 767.98px) {
+ .latest-commit .sha {
+ display: none;
+ }
+ .latest-commit .commit-summary {
+ margin-left: 8px;
+ }
+}
+
+.repo-path {
+ display: flex;
+ overflow-wrap: anywhere;
+}
+
+/* this is what limits the commit table width to a value that works on all viewport sizes */
+#repo-files-table th:first-of-type {
+ max-width: calc(calc(min(100vw, 1280px)) - 145px - calc(2 * var(--page-margin-x)));
}
.repository.file.list #repo-files-table thead th {
@@ -262,7 +294,6 @@
}
.repository.file.list #repo-files-table td.age {
- width: 120px;
color: var(--color-text-light-1);
}
@@ -1223,10 +1254,6 @@
margin: 0;
}
-.repository #commits-table td.message {
- text-overflow: unset;
-}
-
.repository #commits-table.ui.basic.striped.table tbody tr:nth-child(2n) {
background-color: var(--color-light) !important;
}
@@ -2153,6 +2180,20 @@
display: inline-block !important;
}
+.commit-header-buttons {
+ display: flex;
+ gap: 4px;
+ align-items: flex-start;
+ white-space: nowrap;
+}
+
+@media (max-width: 767.98px) {
+ .commit-header-buttons {
+ flex-direction: column;
+ align-items: stretch;
+ }
+}
+
.settings.webhooks .list > .item:not(:first-child),
.settings.githooks .list > .item:not(:first-child),
.settings.actions .list > .item:not(:first-child) {
@@ -2384,7 +2425,7 @@ tbody.commit-list {
.author-wrapper {
overflow: hidden;
text-overflow: ellipsis;
- max-width: calc(100% - 50px);
+ max-width: 100%;
display: inline-block;
vertical-align: middle;
}
@@ -2409,10 +2450,6 @@ tbody.commit-list {
tr.commit-list {
width: 100%;
}
- th .message-wrapper {
- display: block;
- max-width: calc(100vw - 70px);
- }
.author-wrapper {
max-width: 80px;
}
@@ -2422,27 +2459,18 @@ tbody.commit-list {
tr.commit-list {
width: 723px;
}
- th .message-wrapper {
- max-width: 120px;
- }
}
@media (min-width: 992px) and (max-width: 1200px) {
tr.commit-list {
width: 933px;
}
- th .message-wrapper {
- max-width: 350px;
- }
}
@media (min-width: 1201px) {
tr.commit-list {
width: 1127px;
}
- th .message-wrapper {
- max-width: 525px;
- }
}
.commit-list .commit-status-link {
@@ -2770,7 +2798,7 @@ tbody.commit-list {
.repository.file.list #repo-files-table .entry td.message,
.repository.file.list #repo-files-table .commit-list td.message,
.repository.file.list #repo-files-table .entry span.commit-summary,
- .repository.file.list #repo-files-table .commit-list span.commit-summary {
+ .repository.file.list #repo-files-table .commit-list tr span.commit-summary {
display: none !important;
}
.repository.view.issue .comment-list .timeline,
diff --git a/web_src/css/themes/theme-gitea-dark.css b/web_src/css/themes/theme-gitea-dark.css
index b98b1e638..c74f334c2 100644
--- a/web_src/css/themes/theme-gitea-dark.css
+++ b/web_src/css/themes/theme-gitea-dark.css
@@ -65,7 +65,7 @@
--color-console-fg-subtle: #bec4c8;
--color-console-bg: #171b1e;
--color-console-border: #2e353b;
- --color-console-hover-bg: #e8e8ff16;
+ --color-console-hover-bg: #292d31;
--color-console-active-bg: #2e353b;
--color-console-menu-bg: #252b30;
--color-console-menu-border: #424b51;
diff --git a/web_src/css/themes/theme-gitea-light.css b/web_src/css/themes/theme-gitea-light.css
index 75fece1dd..01dd8ba4f 100644
--- a/web_src/css/themes/theme-gitea-light.css
+++ b/web_src/css/themes/theme-gitea-light.css
@@ -63,12 +63,12 @@
/* console colors - used for actions console and console files */
--color-console-fg: #f8f8f9;
--color-console-fg-subtle: #bec4c8;
- --color-console-bg: #181b1d;
- --color-console-border: #313538;
- --color-console-hover-bg: #ffffff16;
- --color-console-active-bg: #313538;
- --color-console-menu-bg: #272b2e;
- --color-console-menu-border: #464a4d;
+ --color-console-bg: #171b1e;
+ --color-console-border: #2e353b;
+ --color-console-hover-bg: #292d31;
+ --color-console-active-bg: #2e353b;
+ --color-console-menu-bg: #252b30;
+ --color-console-menu-border: #424b51;
/* named colors */
--color-red: #db2828;
--color-orange: #f2711c;
diff --git a/web_src/js/components/RepoActionView.vue b/web_src/js/components/RepoActionView.vue
index f10694cde..378f72668 100644
--- a/web_src/js/components/RepoActionView.vue
+++ b/web_src/js/components/RepoActionView.vue
@@ -526,8 +526,16 @@ export function initRepositoryActionView() {
.action-summary {
display: flex;
+ flex-wrap: wrap;
gap: 5px;
- margin: 0 0 0 28px;
+ margin-left: 28px;
+}
+
+@media (max-width: 767.98px) {
+ .action-commit-summary {
+ margin-left: 0;
+ margin-top: 8px;
+ }
}
/* ================ */
@@ -540,6 +548,14 @@ export function initRepositoryActionView() {
top: 12px;
max-height: 100vh;
overflow-y: auto;
+ background: var(--color-body);
+ z-index: 2; /* above .job-info-header */
+}
+
+@media (max-width: 767.98px) {
+ .action-view-left {
+ position: static; /* can not sticky because multiple jobs would overlap into right view */
+ }
}
.job-artifacts-title {
@@ -701,7 +717,9 @@ export function initRepositoryActionView() {
position: sticky;
top: 0;
height: 60px;
- z-index: 1;
+ z-index: 1; /* above .job-step-container */
+ background: var(--color-console-bg);
+ border-radius: 3px;
}
.job-info-header:has(+ .job-step-container) {
@@ -739,7 +757,7 @@ export function initRepositoryActionView() {
.job-step-container .job-step-summary.step-expandable:hover {
color: var(--color-console-fg);
- background-color: var(--color-console-hover-bg);
+ background: var(--color-console-hover-bg);
}
.job-step-container .job-step-summary .step-summary-msg {
@@ -757,17 +775,15 @@ export function initRepositoryActionView() {
top: 60px;
}
-@media (max-width: 768px) {
+@media (max-width: 767.98px) {
.action-view-body {
flex-direction: column;
}
.action-view-left, .action-view-right {
width: 100%;
}
-
.action-view-left {
max-width: none;
- overflow-y: hidden;
}
}
diff --git a/web_src/js/features/admin/common.js b/web_src/js/features/admin/common.js
index f388b1122..b35502d52 100644
--- a/web_src/js/features/admin/common.js
+++ b/web_src/js/features/admin/common.js
@@ -207,13 +207,13 @@ export function initAdminCommon() {
// Notice
if (document.querySelector('.admin.notice')) {
- const $detailModal = document.getElementById('detail-modal');
+ const detailModal = document.getElementById('detail-modal');
// Attach view detail modals
$('.view-detail').on('click', function () {
- $detailModal.find('.content pre').text($(this).parents('tr').find('.notice-description').text());
- $detailModal.find('.sub.header').text(this.closest('tr')?.querySelector('relative-time')?.getAttribute('title'));
- $detailModal.modal('show');
+ const description = this.closest('tr').querySelector('.notice-description').textContent;
+ detailModal.querySelector('.content pre').textContent = description;
+ $(detailModal).modal('show');
return false;
});
diff --git a/web_src/js/features/repo-graph.js b/web_src/js/features/repo-graph.js
index a5b61bff5..0086b9202 100644
--- a/web_src/js/features/repo-graph.js
+++ b/web_src/js/features/repo-graph.js
@@ -1,14 +1,16 @@
import $ from 'jquery';
+import {hideElem, showElem} from '../utils/dom.js';
import {GET} from '../modules/fetch.js';
export function initRepoGraphGit() {
const graphContainer = document.getElementById('git-graph-container');
if (!graphContainer) return;
- $('#flow-color-monochrome').on('click', () => {
- $('#flow-color-monochrome').addClass('active');
- $('#flow-color-colored').removeClass('active');
- $('#git-graph-container').removeClass('colored').addClass('monochrome');
+ document.getElementById('flow-color-monochrome')?.addEventListener('click', () => {
+ document.getElementById('flow-color-monochrome').classList.add('active');
+ document.getElementById('flow-color-colored')?.classList.remove('active');
+ graphContainer.classList.remove('colored');
+ graphContainer.classList.add('monochrome');
const params = new URLSearchParams(window.location.search);
params.set('mode', 'monochrome');
const queryString = params.toString();
@@ -17,29 +19,31 @@ export function initRepoGraphGit() {
} else {
window.history.replaceState({}, '', window.location.pathname);
}
- $('.pagination a').each((_, that) => {
- const href = that.getAttribute('href');
- if (!href) return;
+ for (const link of document.querySelectorAll('.pagination a')) {
+ const href = link.getAttribute('href');
+ if (!href) continue;
const url = new URL(href, window.location);
const params = url.searchParams;
params.set('mode', 'monochrome');
url.search = `?${params.toString()}`;
- that.setAttribute('href', url.href);
- });
+ link.setAttribute('href', url.href);
+ }
});
- $('#flow-color-colored').on('click', () => {
- $('#flow-color-colored').addClass('active');
- $('#flow-color-monochrome').removeClass('active');
- $('#git-graph-container').addClass('colored').removeClass('monochrome');
- $('.pagination a').each((_, that) => {
- const href = that.getAttribute('href');
- if (!href) return;
+
+ document.getElementById('flow-color-colored')?.addEventListener('click', () => {
+ document.getElementById('flow-color-colored').classList.add('active');
+ document.getElementById('flow-color-monochrome')?.classList.remove('active');
+ graphContainer.classList.add('colored');
+ graphContainer.classList.remove('monochrome');
+ for (const link of document.querySelectorAll('.pagination a')) {
+ const href = link.getAttribute('href');
+ if (!href) continue;
const url = new URL(href, window.location);
const params = url.searchParams;
params.delete('mode');
url.search = `?${params.toString()}`;
- that.setAttribute('href', url.href);
- });
+ link.setAttribute('href', url.href);
+ }
const params = new URLSearchParams(window.location.search);
params.delete('mode');
const queryString = params.toString();
@@ -56,20 +60,21 @@ export function initRepoGraphGit() {
const ajaxUrl = new URL(url);
ajaxUrl.searchParams.set('div-only', 'true');
window.history.replaceState({}, '', queryString ? `?${queryString}` : window.location.pathname);
- $('#pagination').empty();
- $('#rel-container').addClass('tw-hidden');
- $('#rev-container').addClass('tw-hidden');
- $('#loading-indicator').removeClass('tw-hidden');
+ document.getElementById('pagination').innerHTML = '';
+ hideElem('#rel-container');
+ hideElem('#rev-container');
+ showElem('#loading-indicator');
(async () => {
const response = await GET(String(ajaxUrl));
const html = await response.text();
- const $div = $(html);
- $('#pagination').html($div.find('#pagination').html());
- $('#rel-container').html($div.find('#rel-container').html());
- $('#rev-container').html($div.find('#rev-container').html());
- $('#loading-indicator').addClass('tw-hidden');
- $('#rel-container').removeClass('tw-hidden');
- $('#rev-container').removeClass('tw-hidden');
+ const div = document.createElement('div');
+ div.innerHTML = html;
+ document.getElementById('pagination').innerHTML = div.getElementById('pagination').innerHTML;
+ document.getElementById('rel-container').innerHTML = div.getElementById('rel-container').innerHTML;
+ document.getElementById('rev-container').innerHTML = div.getElementById('rev-container').innerHTML;
+ hideElem('#loading-indicator');
+ showElem('#rel-container');
+ showElem('#rev-container');
})();
};
const dropdownSelected = params.getAll('branch');
@@ -77,8 +82,9 @@ export function initRepoGraphGit() {
dropdownSelected.splice(0, 0, '...flow-hide-pr-refs');
}
- $('#flow-select-refs-dropdown').dropdown('set selected', dropdownSelected);
- $('#flow-select-refs-dropdown').dropdown({
+ const flowSelectRefsDropdown = document.getElementById('flow-select-refs-dropdown');
+ $(flowSelectRefsDropdown).dropdown('set selected', dropdownSelected);
+ $(flowSelectRefsDropdown).dropdown({
clearable: true,
fullTextSeach: 'exact',
onRemove(toRemove) {
@@ -104,36 +110,46 @@ export function initRepoGraphGit() {
updateGraph();
},
});
- $('#git-graph-container').on('mouseenter', '#rev-list li', (e) => {
- const flow = $(e.currentTarget).data('flow');
- if (flow === 0) return;
- $(`#flow-${flow}`).addClass('highlight');
- $(e.currentTarget).addClass('hover');
- $(`#rev-list li[data-flow='${flow}']`).addClass('highlight');
+
+ graphContainer.addEventListener('mouseenter', (e) => {
+ if (e.target.matches('#rev-list li')) {
+ const flow = e.target.getAttribute('data-flow');
+ if (flow === '0') return;
+ document.getElementById(`flow-${flow}`)?.classList.add('highlight');
+ e.target.classList.add('hover');
+ for (const item of document.querySelectorAll(`#rev-list li[data-flow='${flow}']`)) {
+ item.classList.add('highlight');
+ }
+ } else if (e.target.matches('#rel-container .flow-group')) {
+ e.target.classList.add('highlight');
+ const flow = e.target.getAttribute('data-flow');
+ for (const item of document.querySelectorAll(`#rev-list li[data-flow='${flow}']`)) {
+ item.classList.add('highlight');
+ }
+ } else if (e.target.matches('#rel-container .flow-commit')) {
+ const rev = e.target.getAttribute('data-rev');
+ document.querySelector(`#rev-list li#commit-${rev}`)?.classList.add('hover');
+ }
});
- $('#git-graph-container').on('mouseleave', '#rev-list li', (e) => {
- const flow = $(e.currentTarget).data('flow');
- if (flow === 0) return;
- $(`#flow-${flow}`).removeClass('highlight');
- $(e.currentTarget).removeClass('hover');
- $(`#rev-list li[data-flow='${flow}']`).removeClass('highlight');
- });
- $('#git-graph-container').on('mouseenter', '#rel-container .flow-group', (e) => {
- $(e.currentTarget).addClass('highlight');
- const flow = $(e.currentTarget).data('flow');
- $(`#rev-list li[data-flow='${flow}']`).addClass('highlight');
- });
- $('#git-graph-container').on('mouseleave', '#rel-container .flow-group', (e) => {
- $(e.currentTarget).removeClass('highlight');
- const flow = $(e.currentTarget).data('flow');
- $(`#rev-list li[data-flow='${flow}']`).removeClass('highlight');
- });
- $('#git-graph-container').on('mouseenter', '#rel-container .flow-commit', (e) => {
- const rev = $(e.currentTarget).data('rev');
- $(`#rev-list li#commit-${rev}`).addClass('hover');
- });
- $('#git-graph-container').on('mouseleave', '#rel-container .flow-commit', (e) => {
- const rev = $(e.currentTarget).data('rev');
- $(`#rev-list li#commit-${rev}`).removeClass('hover');
+
+ graphContainer.addEventListener('mouseleave', (e) => {
+ if (e.target.matches('#rev-list li')) {
+ const flow = e.target.getAttribute('data-flow');
+ if (flow === '0') return;
+ document.getElementById(`flow-${flow}`)?.classList.remove('highlight');
+ e.target.classList.remove('hover');
+ for (const item of document.querySelectorAll(`#rev-list li[data-flow='${flow}']`)) {
+ item.classList.remove('highlight');
+ }
+ } else if (e.target.matches('#rel-container .flow-group')) {
+ e.target.classList.remove('highlight');
+ const flow = e.target.getAttribute('data-flow');
+ for (const item of document.querySelectorAll(`#rev-list li[data-flow='${flow}']`)) {
+ item.classList.remove('highlight');
+ }
+ } else if (e.target.matches('#rel-container .flow-commit')) {
+ const rev = e.target.getAttribute('data-rev');
+ document.querySelector(`#rev-list li#commit-${rev}`)?.classList.remove('hover');
+ }
});
}
diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js
index 0d326aae5..2b2eed58b 100644
--- a/web_src/js/features/repo-issue.js
+++ b/web_src/js/features/repo-issue.js
@@ -449,12 +449,10 @@ export function initRepoPullRequestReview() {
offset += $('.diff-detail-box').outerHeight() + $(diffHeader).outerHeight();
}
- document.getElementById(`show-outdated-${id}`).classList.add('tw-hidden');
- document.getElementById(`code-comments-${id}`).classList.remove('tw-hidden');
- document.getElementById(`code-preview-${id}`).classList.remove('tw-hidden');
- document.getElementById(`hide-outdated-${id}`).classList.remove('tw-hidden');
+ hideElem(`#show-outdated-${id}`);
+ showElem(`#code-comments-${id}, #code-preview-${id}, #hide-outdated-${id}`);
// if the comment box is folded, expand it
- if (ancestorDiffBox.getAttribute('data-folded') === 'true') {
+ if (ancestorDiffBox?.getAttribute('data-folded') === 'true') {
setFileFolding(ancestorDiffBox, ancestorDiffBox.querySelector('.fold-file'), false);
}
+
{{template "repo/branch_dropdown" dict "root" . "ContainerClasses" "tw-mr-1"}}
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
{{$cmpBranch := ""}}
@@ -74,9 +77,7 @@
{{end}}
- {{$n := len .TreeNames}}
- {{$l := Eval $n "-" 1}}
- {{if eq $n 0}}
+ {{if $isHomepage}}
{{ctx.Locale.Tr "repo.find_file.go_to_file"}}
{{end}}
@@ -100,20 +101,20 @@
{{end}}
- {{if and (eq $n 0) (.Repository.IsTemplate)}}
+ {{if and $isHomepage (.Repository.IsTemplate)}}
{{ctx.Locale.Tr "repo.use_template"}}
{{end}}
- {{if ne $n 0}}
+ {{if (not $isHomepage)}}
{{StringUtils.EllipsisString .Repository.Name 30}}
{{- range $i, $v := .TreeNames -}}
/
{{- if eq $i $l -}}
- {{StringUtils.EllipsisString $v 30}}
+ {{$v}}
{{- else -}}
- {{$p := index $.Paths $i}}{{StringUtils.EllipsisString $v 30}}
+ {{$p := index $.Paths $i}}{{$v}}
{{- end -}}
{{- end -}}
@@ -121,7 +122,7 @@
- {{if eq $n 0}}
+ {{if $isHomepage}}
- {{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName false}}
+ {{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName}}
{{template "repo/clone_buttons" .}}
{{template "repo/cite/cite_modal" .}}
{{end}}
- {{if and (ne $n 0) (not .IsViewFile) (not .IsBlame)}}
+ {{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}
{{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}}
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index 8b73afe6d..1d1fdb36e 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -156,7 +156,7 @@
diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl
index 2680b374c..333121c20 100644
--- a/templates/repo/view_file.tmpl
+++ b/templates/repo/view_file.tmpl
@@ -11,13 +11,13 @@
{{end}}
{{if not .ReadmeInList}}
-
-
+
+
{{template "repo/latest_commit" .}}
{{if .LatestCommit}}
{{if .LatestCommit.Committer}}
-
+
{{TimeSince .LatestCommit.Committer.When ctx.Locale}}
{{end}}
diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl
index 7c463c50a..fb257bd47 100644
--- a/templates/repo/view_list.tmpl
+++ b/templates/repo/view_list.tmpl
@@ -1,8 +1,12 @@
- {{template "repo/latest_commit" .}} + |
+
+
+ {{template "repo/latest_commit" .}}
+
+ |
{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When ctx.Locale}}{{end}}{{end}} |
---|