From 31502bf78f3267a1a61193f6d9d23649ba5559db Mon Sep 17 00:00:00 2001
From: lewis <747342561@qq.com>
Date: Fri, 21 May 2021 17:10:07 +0800
Subject: [PATCH 1/3] 1
---
.../user/dashboard/repo_list_dashboard.tmpl | 52 ++++++++++++++++++-
1 file changed, 50 insertions(+), 2 deletions(-)
diff --git a/templates/user/dashboard/repo_list_dashboard.tmpl b/templates/user/dashboard/repo_list_dashboard.tmpl
index 89be6fc746..9a6b248831 100755
--- a/templates/user/dashboard/repo_list_dashboard.tmpl
+++ b/templates/user/dashboard/repo_list_dashboard.tmpl
@@ -90,7 +90,55 @@
- -
+
+ {{range .Repos}}
+
+
+
+ {{if .DescriptionHTML}}
{{.DescriptionHTML}}
{{end}}
+ {{if .Topics }}
+
+ {{end}}
+
{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}
+
+
+ {{else}}
+
+ {{$.i18n.Tr "explore.repo_no_results"}}
+
+ {{end}}
+
+ {# -
${repo.full_name}
@@ -122,7 +170,7 @@
-
+ #}
--
2.34.1
From 0d1415c9246e30f0ccbf41b2e73ec5b18d7c6644 Mon Sep 17 00:00:00 2001
From: avadesian
Date: Thu, 27 May 2021 10:39:48 +0800
Subject: [PATCH 2/3] update repo list page within user profile
---
modules/structs/repo.go | 4 +
routers/api/v1/repo/repo.go | 14 ++-
.../user/dashboard/repo_list_dashboard.tmpl | 109 +++++-------------
templates/user/profile.tmpl | 3 +-
web_src/js/index.js | 11 +-
5 files changed, 55 insertions(+), 86 deletions(-)
diff --git a/modules/structs/repo.go b/modules/structs/repo.go
index 70de9b7469..07be4aec24 100644
--- a/modules/structs/repo.go
+++ b/modules/structs/repo.go
@@ -5,6 +5,7 @@
package structs
import (
+ "html/template"
"time"
)
@@ -75,6 +76,7 @@ type Repository struct {
Created time.Time `json:"created_at"`
// swagger:strfmt date-time
Updated time.Time `json:"updated_at"`
+ TimeSinceUnixUpdatedHtml template.HTML `json:"timeSinceUnixUpdatedHtml"`
Permissions *Permission `json:"permissions,omitempty"`
HasIssues bool `json:"has_issues"`
InternalTracker *InternalTracker `json:"internal_tracker,omitempty"`
@@ -88,6 +90,8 @@ type Repository struct {
AllowRebaseMerge bool `json:"allow_rebase_explicit"`
AllowSquash bool `json:"allow_squash_merge"`
AvatarURL string `json:"avatar_url"`
+ PrimaryLanguage string `json:"primaryLanguage"`
+ PrimaryLanguageColor string `json:"primaryLanguageColor"`
}
// CreateRepoOption options when creating repository
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index a724ebcc37..0258676ad5 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -6,20 +6,20 @@
package repo
import (
- "fmt"
- "net/http"
- "strings"
-
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/validation"
"code.gitea.io/gitea/routers/api/v1/utils"
repo_service "code.gitea.io/gitea/services/repository"
+ "fmt"
+ "net/http"
+ "strings"
)
var searchOrderByMap = map[string]map[string]models.SearchOrderBy{
@@ -199,6 +199,7 @@ func Search(ctx *context.APIContext) {
}
results := make([]*api.Repository, len(repos))
+
for i, repo := range repos {
if err = repo.GetOwner(); err != nil {
ctx.JSON(http.StatusInternalServerError, api.SearchError{
@@ -215,6 +216,11 @@ func Search(ctx *context.APIContext) {
})
}
results[i] = repo.APIFormat(accessMode)
+ results[i].TimeSinceUnixUpdatedHtml = timeutil.TimeSinceUnix(repo.UpdatedUnix,ctx.Language())
+ if repo.PrimaryLanguage != nil {
+ results[i].PrimaryLanguage = repo.PrimaryLanguage.Language
+ results[i].PrimaryLanguageColor = repo.PrimaryLanguage.Color
+ }
}
ctx.SetLinkHeader(int(count), opts.PageSize)
diff --git a/templates/user/dashboard/repo_list_dashboard.tmpl b/templates/user/dashboard/repo_list_dashboard.tmpl
index 9a6b248831..2809fdd7b6 100755
--- a/templates/user/dashboard/repo_list_dashboard.tmpl
+++ b/templates/user/dashboard/repo_list_dashboard.tmpl
@@ -4,7 +4,7 @@
-
- {{range .Repos}}
-
-
-
- {{if .DescriptionHTML}}
{{.DescriptionHTML}}
{{end}}
- {{if .Topics }}
-
- {{end}}
-
{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}
+
-
+
\ No newline at end of file
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl
index 4b1619f0c8..12c35fd7c3 100755
--- a/templates/user/profile.tmpl
+++ b/templates/user/profile.tmpl
@@ -141,8 +141,7 @@
{{template "explore/dataset_list" .}}
{{template "base/paginate" .}}
{{else}}
- {{template "user/dashboard/repo_list_dashboard" .}}
- {{template "base/paginate" .}}
+ {{template "user/dashboard/repo_list_dashboard" .}}
{{end}}
diff --git a/web_src/js/index.js b/web_src/js/index.js
index ddb69f701e..e1078db4e5 100755
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -3324,7 +3324,16 @@ function initVueComponents() {
self.$refs.search.focus();
});
},
-
+ updated: function () {
+ $('.time-since').each(function () {
+ $(this)
+ .addClass('poping up')
+ .attr('data-content', $(this).attr('title'))
+ .attr('data-variation', 'inverted tiny')
+ .attr('title', '');
+ });
+ $('.poping.up').popup();
+ },
methods: {
changeTab(t) {
this.tab = t;
--
2.34.1
From 259ae2358827e17f827e8aff291f2a15e3c6a602 Mon Sep 17 00:00:00 2001
From: avadesian
Date: Thu, 27 May 2021 11:16:42 +0800
Subject: [PATCH 3/3] merge develop
---
templates/user/dashboard/repo_list_dashboard.tmpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates/user/dashboard/repo_list_dashboard.tmpl b/templates/user/dashboard/repo_list_dashboard.tmpl
index 2809fdd7b6..a4fa2e5905 100755
--- a/templates/user/dashboard/repo_list_dashboard.tmpl
+++ b/templates/user/dashboard/repo_list_dashboard.tmpl
@@ -127,4 +127,4 @@
-
\ No newline at end of file
+
--
2.34.1