From 4ab5bb81b21b6b434fc232df808c697999b0e84b Mon Sep 17 00:00:00 2001 From: colorfulberry Date: Mon, 1 Jun 2020 19:11:33 +0800 Subject: [PATCH] feat: migrate the report form custom explore --- custom/templates/base/head_navbar.tmpl | 3 - custom/templates/datasets/dataset_list.tmpl | 49 ---- custom/templates/datasets/dataset_search.tmpl | 14 - custom/templates/datasets/index.tmpl | 18 -- custom/templates/explore/dataset_list.tmpl | 49 ---- custom/templates/explore/dataset_search.tmpl | 14 - custom/templates/explore/datasets.tmpl | 17 -- custom/templates/explore/navbar.tmpl | 47 ---- custom/templates/explore/organizations.tmpl | 68 ----- custom/templates/explore/repo_list.tmpl | 75 ----- custom/templates/explore/repo_right.tmpl | 1 - custom/templates/explore/repo_search.tmpl | 14 - custom/templates/explore/repos.tmpl | 20 -- custom/templates/explore/search.tmpl | 13 - custom/templates/explore/users.tmpl | 63 ----- models/dataset.go | 6 + routers/dataset/dataset.go | 256 ------------------ routers/routes/routes.go | 13 - templates/base/head_navbar.tmpl | 8 +- templates/datasets/create.tmpl | 28 -- templates/datasets/dataset_list.tmpl | 24 -- templates/datasets/dataset_search.tmpl | 23 -- templates/datasets/edit.tmpl | 24 -- templates/datasets/form.tmpl | 82 ------ templates/datasets/index.tmpl | 11 - templates/datasets/show.tmpl | 70 ----- templates/explore/dataset_list.tmpl | 49 ++++ templates/explore/dataset_search.tmpl | 14 + templates/explore/datasets.tmpl | 17 ++ templates/explore/navbar.tmpl | 61 ++++- templates/explore/organizations.tmpl | 88 ++++-- templates/explore/repo_list.tmpl | 33 ++- templates/explore/repo_right.tmpl | 1 + templates/explore/repo_search.tmpl | 44 +-- templates/explore/repos.tmpl | 18 +- templates/explore/search.tmpl | 34 +-- templates/explore/users.tmpl | 76 ++++-- 37 files changed, 320 insertions(+), 1125 deletions(-) delete mode 100644 custom/templates/datasets/dataset_list.tmpl delete mode 100644 custom/templates/datasets/dataset_search.tmpl delete mode 100644 custom/templates/datasets/index.tmpl delete mode 100644 custom/templates/explore/dataset_list.tmpl delete mode 100644 custom/templates/explore/dataset_search.tmpl delete mode 100644 custom/templates/explore/datasets.tmpl delete mode 100644 custom/templates/explore/navbar.tmpl delete mode 100644 custom/templates/explore/organizations.tmpl delete mode 100644 custom/templates/explore/repo_list.tmpl delete mode 100644 custom/templates/explore/repo_right.tmpl delete mode 100644 custom/templates/explore/repo_search.tmpl delete mode 100644 custom/templates/explore/repos.tmpl delete mode 100644 custom/templates/explore/search.tmpl delete mode 100644 custom/templates/explore/users.tmpl delete mode 100644 routers/dataset/dataset.go delete mode 100644 templates/datasets/create.tmpl delete mode 100644 templates/datasets/dataset_list.tmpl delete mode 100644 templates/datasets/dataset_search.tmpl delete mode 100644 templates/datasets/edit.tmpl delete mode 100644 templates/datasets/form.tmpl delete mode 100644 templates/datasets/index.tmpl delete mode 100644 templates/datasets/show.tmpl diff --git a/custom/templates/base/head_navbar.tmpl b/custom/templates/base/head_navbar.tmpl index 2dc35b404..274604f36 100644 --- a/custom/templates/base/head_navbar.tmpl +++ b/custom/templates/base/head_navbar.tmpl @@ -107,9 +107,6 @@ {{svg "octicon-plus" 16}} {{.i18n.Tr "new_repo"}} - - {{svg "octicon-plus" 16}} {{.i18n.Tr "new_dataset"}} - {{svg "octicon-repo-clone" 16}} {{.i18n.Tr "new_migrate"}} diff --git a/custom/templates/datasets/dataset_list.tmpl b/custom/templates/datasets/dataset_list.tmpl deleted file mode 100644 index c57feeb0f..000000000 --- a/custom/templates/datasets/dataset_list.tmpl +++ /dev/null @@ -1,49 +0,0 @@ -

- {{.i18n.Tr "datasets"}} -

- - -
- -
-
- {{range .datasets}} -
-
- - {{.Title}} - -
- {{svg "octicon-tasklist" 16}} {{$.i18n.Tr (printf "dataset.task.%s" .Task)}} - {{svg "octicon-tag" 16}}{{$.i18n.Tr (printf "dataset.category.%s" .Category)}} - {{if ne .DownloadTimes 0}} - {{svg "octicon-flame" 16}} {{.DownloadTimes}} - {{end}} -
-
-
-
{{.Description}}
-

{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}

-
-
- {{else}} -
- {{$.i18n.Tr "explore.dataset_no_results"}} -
- {{end}} -
-
diff --git a/custom/templates/datasets/dataset_search.tmpl b/custom/templates/datasets/dataset_search.tmpl deleted file mode 100644 index 6c973026a..000000000 --- a/custom/templates/datasets/dataset_search.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -
-
-
-
-
- - - - -
-
-
-
-
\ No newline at end of file diff --git a/custom/templates/datasets/index.tmpl b/custom/templates/datasets/index.tmpl deleted file mode 100644 index b3342fe4a..000000000 --- a/custom/templates/datasets/index.tmpl +++ /dev/null @@ -1,18 +0,0 @@ -{{template "base/head" .}} -
- {{template "explore/repo_search" .}} -
-
- {{template "explore/navbar" .}} - -
- {{template "datasets/dataset_list" .}} - {{template "base/paginate" .}} -
-
- {{template "explore/repo_right" .}} -
-
-
-
-{{template "base/footer" .}} diff --git a/custom/templates/explore/dataset_list.tmpl b/custom/templates/explore/dataset_list.tmpl deleted file mode 100644 index ddb5ee8af..000000000 --- a/custom/templates/explore/dataset_list.tmpl +++ /dev/null @@ -1,49 +0,0 @@ -

- {{.i18n.Tr "datasets"}} -

- - -
- -
-
- {{range .Datasets}} -
-
- - {{.Title}} - -
- {{svg "octicon-tasklist" 16}} {{$.i18n.Tr (printf "dataset.task.%s" .Task)}} - {{svg "octicon-tag" 16}}{{$.i18n.Tr (printf "dataset.category.%s" .Category)}} - {{if ne .DownloadTimes 0}} - {{svg "octicon-flame" 16}} {{.DownloadTimes}} - {{end}} -
-
-
-
{{.Description}}
-

{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}

-
-
- {{else}} -
- {{$.i18n.Tr "explore.dataset_no_results"}} -
- {{end}} -
-
diff --git a/custom/templates/explore/dataset_search.tmpl b/custom/templates/explore/dataset_search.tmpl deleted file mode 100644 index 6c973026a..000000000 --- a/custom/templates/explore/dataset_search.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -
-
-
-
-
- - - - -
-
-
-
-
\ No newline at end of file diff --git a/custom/templates/explore/datasets.tmpl b/custom/templates/explore/datasets.tmpl deleted file mode 100644 index 748d51ba8..000000000 --- a/custom/templates/explore/datasets.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -{{template "base/head" .}} -
- {{template "explore/dataset_search" .}} -
-
- {{template "explore/navbar" .}} -
- {{template "explore/dataset_list" .}} - {{template "base/paginate" .}} -
-
- {{template "explore/repo_right" .}} -
-
-
-
-{{template "base/footer" .}} diff --git a/custom/templates/explore/navbar.tmpl b/custom/templates/explore/navbar.tmpl deleted file mode 100644 index 6f86a7e7c..000000000 --- a/custom/templates/explore/navbar.tmpl +++ /dev/null @@ -1,47 +0,0 @@ -
- -
- - -
- -
- \ No newline at end of file diff --git a/custom/templates/explore/organizations.tmpl b/custom/templates/explore/organizations.tmpl deleted file mode 100644 index 1151c5a94..000000000 --- a/custom/templates/explore/organizations.tmpl +++ /dev/null @@ -1,68 +0,0 @@ -{{template "base/head" .}} -
- {{template "explore/search" .}} - -
-
- {{template "explore/navbar" .}} -
-

- {{.i18n.Tr "explore.organizations"}} -

- - -
- -
- {{range .Users}} -
- -
- - {{.Name}} {{.FullName}} - {{if .Visibility.IsPrivate}} - {{svg "octicon-lock" 16}} - {{end}} - -
- {{if .Location}} - {{svg "octicon-location" 16}} {{.Location}} - {{end}} - {{if and .Website}} - {{svg "octicon-link" 16}} - {{.Website}} - {{end}} - {{svg "octicon-clock" 16}} {{$.i18n.Tr "user.join_on"}} {{.CreatedUnix.FormatShort}} -
-
-
- {{else}} -
{{$.i18n.Tr "explore.org_no_results"}}
- {{end}} -
- - {{template "base/paginate" .}} -
-
- {{template "explore/repo_right" .}} -
-
-
-
-{{template "base/footer" .}} diff --git a/custom/templates/explore/repo_list.tmpl b/custom/templates/explore/repo_list.tmpl deleted file mode 100644 index b10a860ae..000000000 --- a/custom/templates/explore/repo_list.tmpl +++ /dev/null @@ -1,75 +0,0 @@ -

- {{.i18n.Tr "explore.repos"}} -

- - -
- -
- {{range .Repos}} -
-
- {{if .RelAvatarLink}} - - {{end}} - - {{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}} / {{end}}{{end}}{{.Name}} - {{if .IsArchived}}{{end}} - - {{if .IsPrivate}} - {{svg "octicon-lock" 16}} - {{else if .IsFork}} - {{svg "octicon-repo-forked" 16}} - {{else if .IsMirror}} - {{svg "octicon-repo-clone" 16}} - {{else if .Owner}} - {{if .Owner.Visibility.IsPrivate}} - {{svg "octicon-lock" 16}} - {{end}} - {{end}} -
- {{if .PrimaryLanguage }} - {{ .PrimaryLanguage.Language }} - {{end}} - {{svg "octicon-star" 16}} {{.NumStars}} - {{svg "octicon-git-branch" 16}} {{.NumForks}} -
-
-
- {{if .DescriptionHTML}}

{{.DescriptionHTML}}

{{end}} - {{if .Topics }} -
- {{range .Topics}} - {{if ne . "" }}
{{.}}
{{end}} - {{end}} -
- {{end}} -

{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}

-
-
- {{else}} -
- {{$.i18n.Tr "explore.repo_no_results"}} -
- {{end}} -
diff --git a/custom/templates/explore/repo_right.tmpl b/custom/templates/explore/repo_right.tmpl deleted file mode 100644 index 0ba8ebfb1..000000000 --- a/custom/templates/explore/repo_right.tmpl +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/custom/templates/explore/repo_search.tmpl b/custom/templates/explore/repo_search.tmpl deleted file mode 100644 index 6c973026a..000000000 --- a/custom/templates/explore/repo_search.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -
-
-
-
-
- - - - -
-
-
-
-
\ No newline at end of file diff --git a/custom/templates/explore/repos.tmpl b/custom/templates/explore/repos.tmpl deleted file mode 100644 index 32a0093af..000000000 --- a/custom/templates/explore/repos.tmpl +++ /dev/null @@ -1,20 +0,0 @@ -{{template "base/head" .}} -
- - {{template "explore/repo_search" .}} - -
-
- {{template "explore/navbar" .}} - -
- {{template "explore/repo_list" .}} - {{template "base/paginate" .}} -
-
- {{template "explore/repo_right" .}} -
-
-
-
-{{template "base/footer" .}} diff --git a/custom/templates/explore/search.tmpl b/custom/templates/explore/search.tmpl deleted file mode 100644 index 11e89d50a..000000000 --- a/custom/templates/explore/search.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -
-
-
-
-
- - - -
-
-
-
-
\ No newline at end of file diff --git a/custom/templates/explore/users.tmpl b/custom/templates/explore/users.tmpl deleted file mode 100644 index 39f118a58..000000000 --- a/custom/templates/explore/users.tmpl +++ /dev/null @@ -1,63 +0,0 @@ -{{template "base/head" .}} -
- {{template "explore/search" .}} -
-
- {{template "explore/navbar" .}} -
- -

- {{.i18n.Tr "explore.users"}} -

- - -
- -
- {{range .Users}} -
- -
- {{.Name}} {{.FullName}} -
- {{if .Location}} - {{svg "octicon-location" 16}} {{.Location}} - {{end}} - {{if and $.ShowUserEmail .Email $.IsSigned (not .KeepEmailPrivate)}} - {{svg "octicon-mail" 16}} - {{.Email}} - {{end}} - {{svg "octicon-clock" 16}} {{$.i18n.Tr "user.join_on"}} {{.CreatedUnix.FormatShort}} -
-
-
- {{else}} -
{{$.i18n.Tr "explore.user_no_results"}}
- {{end}} -
- {{template "base/paginate" .}} -
-
- {{template "explore/repo_right" .}} -
- -
-
-
-{{template "base/footer" .}} diff --git a/models/dataset.go b/models/dataset.go index d1b3d2c32..fa7e779f8 100644 --- a/models/dataset.go +++ b/models/dataset.go @@ -5,6 +5,7 @@ import ( "fmt" "sort" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/timeutil" "xorm.io/builder" ) @@ -27,6 +28,7 @@ type Dataset struct { ReleaseID int64 `xorm:"INDEX"` UserID int64 `xorm:"INDEX"` RepoID int64 `xorm:"INDEX"` + Repo *Repository `xorm:"-"` CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` @@ -329,6 +331,10 @@ func GetOwnerDatasetByID(id int64, user *User) (*Dataset, error) { return nil, errors.New("dataset not fount") } +func (dataset *Dataset) Link() string { + return setting.AppSubURL + "/" + dataset.Repo.FullName() +} + func IncreaseDownloadCount(datasetID int64) error { // Update download count. if _, err := x.Exec("UPDATE `dataset` SET download_times=download_times+1 WHERE id=?", datasetID); err != nil { diff --git a/routers/dataset/dataset.go b/routers/dataset/dataset.go deleted file mode 100644 index bccda7f27..000000000 --- a/routers/dataset/dataset.go +++ /dev/null @@ -1,256 +0,0 @@ -package dataset - -import ( - "errors" - "strings" - - "code.gitea.io/gitea/models" - "code.gitea.io/gitea/modules/auth" - "code.gitea.io/gitea/modules/base" - "code.gitea.io/gitea/modules/context" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/routers/repo" - "github.com/unknwon/com" -) - -const ( - tplDataSet base.TplName = "datasets/index" - tplShow base.TplName = "datasets/show" - tplCreate base.TplName = "datasets/create" - tplEdit base.TplName = "datasets/edit" -) - -type ListOptions struct { - PageSize int - Page int // start from 1 -} - -func List(ctx *context.Context) { - ctx.Data["PageIsDatasets"] = true - - var ( - datasets []*models.Dataset - count int64 - err error - orderBy models.SearchOrderBy - ) - - page := ctx.QueryInt("page") - if page <= 0 { - page = 1 - } - ctx.Data["SortType"] = ctx.Query("sort") - switch ctx.Query("sort") { - case "newest": - orderBy = models.SearchOrderByNewest - case "oldest": - orderBy = models.SearchOrderByOldest - case "recentupdate": - orderBy = models.SearchOrderByRecentUpdated - case "leastupdate": - orderBy = models.SearchOrderByLeastUpdated - case "reversealphabetically": - orderBy = models.SearchOrderByAlphabeticallyReverse - case "alphabetically": - orderBy = models.SearchOrderByAlphabetically - case "reversesize": - orderBy = models.SearchOrderBySizeReverse - default: - ctx.Data["SortType"] = "recentupdate" - orderBy = models.SearchOrderByRecentUpdated - } - keyword := strings.Trim(ctx.Query("q"), " ") - var userID int64 - if ctx.User != nil { - userID = ctx.User.ID - } - opts := &models.SearchDatasetOptions{ - Keyword: keyword, - IncludePublic: true, - SearchOrderBy: orderBy, - OwnerID: userID, - ListOptions: models.ListOptions{ - Page: page, - PageSize: setting.UI.ExplorePagingNum, - }, - } - - if len(opts.SearchOrderBy) == 0 { - opts.SearchOrderBy = models.SearchOrderByAlphabetically - } - - datasets, count, err = models.SearchDataset(opts) - if err != nil { - ctx.ServerError("SearchDatasets", err) - return - } - - pager := context.NewPagination(int(count), opts.PageSize, page, 5) - pager.SetDefaultParams(ctx) - ctx.Data["Page"] = pager - - ctx.Data["datasets"] = datasets - ctx.Data["datasetsCount"] = count - ctx.HTML(200, tplDataSet) -} - -func Create(ctx *context.Context) { - ctx.HTML(200, tplCreate) -} - -func CreatePost(ctx *context.Context, form auth.CreateDatasetForm) { - ctx.Data["Title"] = ctx.Tr("new_dataset") - - ctxUser := ctx.User - - if ctx.HasError() { - ctx.HTML(200, tplCreate) - return - } - - status := models.DatasetStatusPublic - if form.Private { - status = models.DatasetStatusPrivate - } - - var err error - opts := models.Dataset{ - Title: form.Title, - Category: form.Category, - Description: form.Description, - License: form.License, - Task: form.Task, - ReleaseID: form.ReleaseID, - UserID: ctxUser.ID, - Status: status, - } - - if err = models.CreateDataset(&opts); err != nil { - log.Error("%v", err) - } - - var attachmentUUIDs []string - if setting.Attachment.Enabled { - attachmentUUIDs = form.Files - } - - if err = models.AddDatasetAttachments(opts.ID, attachmentUUIDs); err != nil { - log.Error("%v", err) - } - - if err == nil { - log.Trace("Dataset created [%d]: %s/%s", opts.ID, ctxUser.Name, opts.Title) - ctx.Redirect(setting.AppSubURL + "/datasets/" + com.ToStr(opts.ID)) - return - } -} - -func Show(ctx *context.Context) { - ctx.Data["Title"] = ctx.Tr("dataset.show_dataset") - - user := ctx.User - dataset, err := models.GetOwnerDatasetByID(ctx.ParamsInt64((":id")), user) - if err != nil { - ctx.NotFound("GetDataset", err) - return - } - - err = models.GetDatasetAttachments(dataset) - if err != nil { - ctx.ServerError("GetDatasetAttachments", err) - return - } - - isOwner := (ctx.User != nil && dataset.UserID == user.ID) - - ctx.Data["dataset"] = dataset - ctx.Data["IsOwner"] = isOwner - - ctx.HTML(200, tplShow) -} - -// EditDataset render release edit page -func EditDataset(ctx *context.Context) { - ctx.Data["Title"] = ctx.Tr("dataset.edit_dataset") - ctx.Data["PageIsEditDataset"] = true - repo.RenderAttachmentSettings(ctx) - rel, err := models.GetOwnerDatasetByID(ctx.ParamsInt64(":id"), ctx.User) - if err != nil { - ctx.NotFound("GetDataset", err) - return - } - isOwner := (ctx.User != nil && rel.UserID == ctx.User.ID) - if !isOwner { - ctx.NotFound("403", errors.New("not owner")) - return - } - - ctx.Data["ID"] = rel.ID - ctx.Data["title"] = rel.Title - ctx.Data["private"] = rel.IsPrivate() - ctx.Data["description"] = rel.Description - ctx.Data["category"] = rel.Category - ctx.Data["task"] = rel.Task - ctx.Data["license"] = rel.License - - ctx.HTML(200, tplEdit) -} - -func EditDatasetPost(ctx *context.Context, form auth.EditDatasetForm) { - ctx.Data["Title"] = ctx.Tr("dataset.edit_dataset") - - rel, err := models.GetDatasetByID(ctx.ParamsInt64(":id")) - if err != nil { - ctx.ServerError("GetDataset", err) - return - } - isOwner := (ctx.User != nil && rel.UserID == ctx.User.ID) - if !isOwner { - ctx.NotFound("403", errors.New("not owner")) - return - } - ctx.Data["ID"] = rel.ID - ctx.Data["title"] = rel.Title - ctx.Data["description"] = rel.Description - ctx.Data["category"] = rel.Category - ctx.Data["task"] = rel.Task - ctx.Data["license"] = rel.License - ctx.Data["private"] = rel.IsPrivate() - - if ctx.HasError() { - ctx.HTML(200, tplCreate) - return - } - - var attachmentUUIDs []string - if setting.Attachment.Enabled { - attachmentUUIDs = form.Files - } - - status := models.DatasetStatusPublic - if form.Private { - status = models.DatasetStatusPrivate - } - - rel.Title = form.Title - rel.Status = status - rel.Description = form.Description - rel.Category = form.Category - rel.Task = form.Task - rel.License = form.License - if err = models.UpdateDataset(models.DefaultDBContext(), rel); err != nil { - log.Error("%v", err) - } - - if err = models.AddDatasetAttachments(rel.ID, attachmentUUIDs); err != nil { - log.Error("%v", err) - } - log.Trace("Dataset updated: %d", rel.ID) - - ctx.Redirect(setting.AppSubURL + "/datasets/" + com.ToStr(rel.ID)) -} - -func Delete(ctx *context.Context) { - log.Debug("[dataset] Delete...\n") -} diff --git a/routers/routes/routes.go b/routers/routes/routes.go index aaa5757b1..74fd5135a 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -26,7 +26,6 @@ import ( "code.gitea.io/gitea/routers" "code.gitea.io/gitea/routers/admin" apiv1 "code.gitea.io/gitea/routers/api/v1" - "code.gitea.io/gitea/routers/dataset" "code.gitea.io/gitea/routers/dev" "code.gitea.io/gitea/routers/events" "code.gitea.io/gitea/routers/org" @@ -1012,18 +1011,6 @@ func RegisterRoutes(m *macaron.Macaron) { }) }) // ***** END: Repository ***** - - // DataSet - m.Group("/datasets", func() { - // m.Get("", dataset.List) - m.Get("/create", dataset.Create) - m.Post("/create", bindIgnErr(auth.CreateDatasetForm{}), dataset.CreatePost) - m.Post("/delete", dataset.Delete) - m.Get("/:id", dataset.Show) - m.Get("/edit/:id", dataset.EditDataset) - m.Post("/edit/:id", bindIgnErr(auth.EditDatasetForm{}), dataset.EditDatasetPost) - }, ignSignIn) - // ***** END: DataSet***** m.Group("/notifications", func() { m.Get("", user.Notifications) m.Post("/status", user.NotificationStatusPost) diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index d87ce4c43..c02fb6fb2 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -10,7 +10,7 @@ {{if .IsSigned}} {{.i18n.Tr "dashboard"}} - {{.i18n.Tr "datasets"}} + {{.i18n.Tr "datasets"}} {{if not .UnitIssuesGlobalDisabled}} {{.i18n.Tr "issues"}} {{end}} @@ -23,14 +23,14 @@ {{.i18n.Tr "explore"}} {{else if .IsLandingPageHome}} {{.i18n.Tr "home"}} - {{.i18n.Tr "datasets"}} + {{.i18n.Tr "datasets"}} {{.i18n.Tr "explore"}} {{else if .IsLandingPageExplore}} {{.i18n.Tr "home"}} - {{.i18n.Tr "datasets"}} + {{.i18n.Tr "datasets"}} {{else if .IsLandingPageOrganizations}} {{.i18n.Tr "home"}} - {{.i18n.Tr "datasets"}} + {{.i18n.Tr "datasets"}} {{end}} {{template "custom/extra_links" .}} diff --git a/templates/datasets/create.tmpl b/templates/datasets/create.tmpl deleted file mode 100644 index 362a53043..000000000 --- a/templates/datasets/create.tmpl +++ /dev/null @@ -1,28 +0,0 @@ -{{template "base/head" .}} -
-
-
-
- {{.CsrfTokenHtml}} -

- {{if .PageIsEditDataset}} - {{.i18n.Tr "dataset.edit_dataset"}} - {{else}} - {{.i18n.Tr "new_dataset"}} - {{end}} -

-
- {{template "datasets/form" .}} -
- - - {{.i18n.Tr "cancel"}} -
-
-
-
-
-
-{{template "base/footer" .}} diff --git a/templates/datasets/dataset_list.tmpl b/templates/datasets/dataset_list.tmpl deleted file mode 100644 index 3c99e3e4a..000000000 --- a/templates/datasets/dataset_list.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -
- {{range .datasets}} -
-
- - {{.Title}} - -
- {{svg "octicon-tasklist" 16}}{{$.i18n.Tr (printf "dataset.task.%s" .Task)}} - {{svg "octicon-tag" 16}}{{$.i18n.Tr (printf "dataset.category.%s" .Category)}} - {{svg "octicon-flame" 16}} 24 -
-
-
-
{{.Description}}
-

{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}

-
-
- {{else}} -
- {{$.i18n.Tr "explore.dataset_no_results"}} -
- {{end}} -
diff --git a/templates/datasets/dataset_search.tmpl b/templates/datasets/dataset_search.tmpl deleted file mode 100644 index ef057f1e4..000000000 --- a/templates/datasets/dataset_search.tmpl +++ /dev/null @@ -1,23 +0,0 @@ - -
- - -
- - -
-
-
diff --git a/templates/datasets/edit.tmpl b/templates/datasets/edit.tmpl deleted file mode 100644 index 7d5a63929..000000000 --- a/templates/datasets/edit.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -{{template "base/head" .}} -
-
-
-
- {{.CsrfTokenHtml}} -

- {{.i18n.Tr "edit_dataset"}} -

-
- {{template "datasets/form" .}} -
- - - {{.i18n.Tr "cancel"}} -
-
-
-
-
-
-{{template "base/footer" .}} diff --git a/templates/datasets/form.tmpl b/templates/datasets/form.tmpl deleted file mode 100644 index 7b6d0c70f..000000000 --- a/templates/datasets/form.tmpl +++ /dev/null @@ -1,82 +0,0 @@ -{{template "base/alert" .}} -
- - -
- -
- -
- {{if .IsForcedPrivate}} - - - {{else}} - - - {{end}} -
- -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
- -
-
-
-
-
diff --git a/templates/datasets/index.tmpl b/templates/datasets/index.tmpl deleted file mode 100644 index 59bab3bc7..000000000 --- a/templates/datasets/index.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -{{template "base/head" .}} -
-
- {{template "datasets/dataset_search" .}} -
- {{template "datasets/dataset_list" .}} - {{template "base/paginate" .}} -
-
-
-{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/datasets/show.tmpl b/templates/datasets/show.tmpl deleted file mode 100644 index c87ec5ec4..000000000 --- a/templates/datasets/show.tmpl +++ /dev/null @@ -1,70 +0,0 @@ -{{template "base/head" .}} -
-
-

- {{$.i18n.Tr "dataset.dataset"}} - -

- -
-
-{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/explore/dataset_list.tmpl b/templates/explore/dataset_list.tmpl index e69de29bb..ddb5ee8af 100644 --- a/templates/explore/dataset_list.tmpl +++ b/templates/explore/dataset_list.tmpl @@ -0,0 +1,49 @@ +

+ {{.i18n.Tr "datasets"}} +

+ + +
+ +
+
+ {{range .Datasets}} +
+
+ + {{.Title}} + +
+ {{svg "octicon-tasklist" 16}} {{$.i18n.Tr (printf "dataset.task.%s" .Task)}} + {{svg "octicon-tag" 16}}{{$.i18n.Tr (printf "dataset.category.%s" .Category)}} + {{if ne .DownloadTimes 0}} + {{svg "octicon-flame" 16}} {{.DownloadTimes}} + {{end}} +
+
+
+
{{.Description}}
+

{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}

+
+
+ {{else}} +
+ {{$.i18n.Tr "explore.dataset_no_results"}} +
+ {{end}} +
+
diff --git a/templates/explore/dataset_search.tmpl b/templates/explore/dataset_search.tmpl index e69de29bb..6c973026a 100644 --- a/templates/explore/dataset_search.tmpl +++ b/templates/explore/dataset_search.tmpl @@ -0,0 +1,14 @@ +
+
+
+
+
+ + + + +
+
+
+
+
\ No newline at end of file diff --git a/templates/explore/datasets.tmpl b/templates/explore/datasets.tmpl index e69de29bb..748d51ba8 100644 --- a/templates/explore/datasets.tmpl +++ b/templates/explore/datasets.tmpl @@ -0,0 +1,17 @@ +{{template "base/head" .}} +
+ {{template "explore/dataset_search" .}} +
+
+ {{template "explore/navbar" .}} +
+ {{template "explore/dataset_list" .}} + {{template "base/paginate" .}} +
+
+ {{template "explore/repo_right" .}} +
+
+
+
+{{template "base/footer" .}} diff --git a/templates/explore/navbar.tmpl b/templates/explore/navbar.tmpl index 543342597..6f86a7e7c 100644 --- a/templates/explore/navbar.tmpl +++ b/templates/explore/navbar.tmpl @@ -1,16 +1,47 @@ -