From a73a35e0b2f1b5fae45db81c4148feb2190f047f Mon Sep 17 00:00:00 2001 From: yan Date: Sat, 23 May 2020 14:25:58 +0800 Subject: [PATCH] improved profile dataset --- routers/user/profile.go | 21 ++++++++++++++++++ templates/datasets/dataset_list.tmpl | 2 +- templates/user/profile.tmpl | 2 ++ web_src/less/_dataset.less | 43 ++++++++++++++++++++++++++++++++++++ web_src/less/index.less | 1 + 5 files changed, 68 insertions(+), 1 deletion(-) diff --git a/routers/user/profile.go b/routers/user/profile.go index 215dff008..dc1d0a113 100644 --- a/routers/user/profile.go +++ b/routers/user/profile.go @@ -209,6 +209,27 @@ func Profile(ctx *context.Context) { } total = int(count) + case "datasets": + datasetSearchOptions := &models.SearchDatasetOptions{ + Keyword: keyword, + OwnerID: ctxUser.ID, + SearchOrderBy: orderBy, + ListOptions: models.ListOptions{ + Page: page, + PageSize: setting.UI.ExplorePagingNum, + }, + } + + if len(datasetSearchOptions.SearchOrderBy) == 0 { + datasetSearchOptions.SearchOrderBy = models.SearchOrderByAlphabetically + } + + datasets, count, err := models.SearchDataset(datasetSearchOptions) + if err != nil { + ctx.ServerError("SearchDatasets", err) + } + total = int(count) + ctx.Data["datasets"] = datasets default: repos, count, err = models.SearchRepository(&models.SearchRepoOptions{ ListOptions: models.ListOptions{ diff --git a/templates/datasets/dataset_list.tmpl b/templates/datasets/dataset_list.tmpl index aa1006a7b..2d334ef3c 100644 --- a/templates/datasets/dataset_list.tmpl +++ b/templates/datasets/dataset_list.tmpl @@ -1,4 +1,4 @@ -
+
{{range .datasets}}
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 364bd63fe..e9b84e1b1 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -131,7 +131,9 @@ {{else if eq .TabName "followers"}} {{template "repo/user_cards" .}} {{else if eq .TabName "datasets"}} + {{template "datasets/dataset_search" .}} {{template "datasets/dataset_list" .}} + {{template "base/paginate" .}} {{else}} {{template "explore/repo_search" .}} {{template "explore/repo_list" .}} diff --git a/web_src/less/_dataset.less b/web_src/less/_dataset.less index 23bcb056b..8687b9b09 100644 --- a/web_src/less/_dataset.less +++ b/web_src/less/_dataset.less @@ -53,4 +53,47 @@ } } } +} +.ui.dataset.list { + .item { + padding-bottom: 25px; + + &:not(:first-child) { + border-top: 1px solid #eeeeee; + padding-top: 25px; + } + + .ui.header { + font-size: 1.5rem; + padding-bottom: 10px; + + .name { + word-break: break-all; + } + + .metas { + color: #888888; + font-size: 14px; + font-weight: normal; + + span:not(:last-child) { + margin-right: 5px; + } + } + } + + .time { + font-size: 12px; + color: #808080; + } + + .ui.tags { + margin-bottom: 1em; + } + + .ui.avatar.image { + width: 24px; + height: 24px; + } + } } \ No newline at end of file diff --git a/web_src/less/index.less b/web_src/less/index.less index 7ff44d090..10af0bff1 100644 --- a/web_src/less/index.less +++ b/web_src/less/index.less @@ -17,3 +17,4 @@ @import "_admin"; @import "_explore"; @import "_review"; +@import "_dataset";