diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 265e7ed36..7288f2ce8 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2946,6 +2946,7 @@ raw_minutes = minutes [dropzone] default_message = Drop files or click here to upload. +default_dataset_message = Click to add files or directly drag and drop files here invalid_input_type = You can not upload files of this type. file_too_big = File size ({{filesize}} MB) exceeds the maximum size of ({{maxFilesize}} MB). remove_file = Remove file diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 1b26a930c..9a89d194a 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2956,6 +2956,7 @@ raw_minutes=分钟 [dropzone] default_message=拖动文件或者点击此处上传。 +default_dataset_message=点击添加文件或直接拖拽文件到此处。 invalid_input_type=您不能上传该类型的文件 file_too_big=文件体积({{filesize}} MB)超过了最大允许体积({{maxFilesize}} MB) remove_file=移除文件 diff --git a/routers/repo/dataset.go b/routers/repo/dataset.go index 73036a2cc..0e57fe1a0 100755 --- a/routers/repo/dataset.go +++ b/routers/repo/dataset.go @@ -106,6 +106,8 @@ func DatasetIndex(ctx *context.Context) { MustEnableDataset(ctx) ctx.Data["PageIsDataset"] = true + ctx.Data["SortType"] = ctx.Query("sort") + repo := ctx.Repo.Repository dataset, err := models.GetDatasetByRepo(repo) @@ -128,9 +130,31 @@ func DatasetIndex(ctx *context.Context) { attachments := newFilterPrivateAttachments(ctx, dataset.Attachments, repo) - sort.Slice(attachments, func(i, j int) bool { - return attachments[i].CreatedUnix > attachments[j].CreatedUnix - }) + if ctx.Data["SortType"] == "nameAsc" { + sort.Slice(attachments, func(i, j int) bool { + return strings.ToLower(attachments[i].Name) < strings.ToLower(attachments[j].Name) + }) + } else if ctx.Data["SortType"] == "nameDesc" { + sort.Slice(attachments, func(i, j int) bool { + return strings.ToLower(attachments[i].Name) > strings.ToLower(attachments[j].Name) + }) + } else if ctx.Data["SortType"] == "sizeAsc" { + sort.Slice(attachments, func(i, j int) bool { + return attachments[i].Size < attachments[j].Size + }) + } else if ctx.Data["SortType"] == "sizeDesc" { + sort.Slice(attachments, func(i, j int) bool { + return attachments[i].Size > attachments[j].Size + }) + } else if ctx.Data["SortType"] == "timeAsc" { + sort.Slice(attachments, func(i, j int) bool { + return attachments[i].CreatedUnix < attachments[j].CreatedUnix + }) + } else { + sort.Slice(attachments, func(i, j int) bool { + return attachments[i].CreatedUnix > attachments[j].CreatedUnix + }) + } page := ctx.QueryInt("page") if page <= 0 { diff --git a/templates/repo/attachment/upload.tmpl b/templates/repo/attachment/upload.tmpl index 56dc52417..a78931b13 100644 --- a/templates/repo/attachment/upload.tmpl +++ b/templates/repo/attachment/upload.tmpl @@ -1,60 +1,58 @@ - {{template "base/head" .}}
{{$.i18n.Tr "dataset.illustrate"}}:
-{{$.i18n.Tr "dataset.illustrate.only"}} {{$.i18n.Tr "dataset.illustrate.zip"}} {{$.i18n.Tr "dataset.illustrate.fisrt_end"}}; +
{{$.i18n.Tr "dataset.illustrate.only"}} {{$.i18n.Tr "dataset.illustrate.zip"}} {{$.i18n.Tr "dataset.illustrate.fisrt_end"}}; {{$.i18n.Tr "dataset.dataset_explain"}}