diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index ca44a8685..aba21c11d 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -632,8 +632,11 @@ show_dataset= Dataset edit_dataset= Edit Dataset update_dataset= Update Dataset category = Category +no_category = No Category task = Task +no_task = No Task license = License +no_license = No License file = Dataset File download = download edit = edit diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index eaedc0e9b..0eaf888e3 100644 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -632,8 +632,11 @@ show_dataset=数据集 edit_dataset=编辑数据集 update_dataset=更新数据集 category=分类 -task=针对的具体任务 +no_category=未设置分类 +task=研究方向/应用领域 +no_task=未设置研究方向/应用领域 license=license +no_license=没有设置license file=数据集文件 download=下载附件 edit=编辑 diff --git a/routers/repo/dataset.go b/routers/repo/dataset.go index 90cc80b6a..11ee247bc 100644 --- a/routers/repo/dataset.go +++ b/routers/repo/dataset.go @@ -15,7 +15,7 @@ const ( func DatasetIndex(ctx *context.Context) { ctx.Data["PageIsDataset"] = true ctx.Data["Title"] = ctx.Tr("dataset.show_dataset") - ctx.Data["Link"] = ctx.Repo.RepoLink + "/datasets/5/edit" + ctx.Data["Link"] = ctx.Repo.RepoLink + "/datasets" user := ctx.User dataset, err := models.GetDatasetByID(5) if err != nil { @@ -38,13 +38,14 @@ func DatasetIndex(ctx *context.Context) { } func EditDatasetPost(ctx *context.Context, form auth.EditDatasetForm) { + ctx.Data["PageIsDataset"] = true + ctx.Data["Title"] = ctx.Tr("dataset.edit_dataset") - rel, err := models.GetDatasetByID(ctx.ParamsInt64(":id")) + rel, err := models.GetDatasetByID(5) ctx.Data["dataset"] = rel if err != nil { - ctx.Data["Error"] = true ctx.ServerError("GetDataset", err) return } @@ -61,7 +62,9 @@ func EditDatasetPost(ctx *context.Context, form auth.EditDatasetForm) { rel.Task = form.Task rel.License = form.License if err = models.UpdateDataset(models.DefaultDBContext(), rel); err != nil { + ctx.Data["Error"] = true + ctx.HTML(200, tplIndex) log.Error("%v", err) } - ctx.HTML(200, tplIndex) + ctx.Redirect(ctx.Repo.RepoLink + "/datasets") } diff --git a/routers/routes/routes.go b/routers/routes/routes.go index adad35804..c48011ca9 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -764,7 +764,7 @@ func RegisterRoutes(m *macaron.Macaron) { }, context.RepoMustNotBeArchived()) m.Group("/datasets", func() { m.Get("", repo.DatasetIndex) - m.Post("/:id/edit", bindIgnErr(auth.EditDatasetForm{}), repo.EditDatasetPost) + m.Post("", bindIgnErr(auth.EditDatasetForm{}), repo.EditDatasetPost) }, context.RepoMustNotBeArchived()) m.Group("/comments/:id", func() { m.Post("", repo.UpdateCommentContent) diff --git a/templates/repo/datasets/index.tmpl b/templates/repo/datasets/index.tmpl index b5ebc90ba..4235e3f28 100644 --- a/templates/repo/datasets/index.tmpl +++ b/templates/repo/datasets/index.tmpl @@ -29,7 +29,7 @@
diff --git a/templates/repo/datasets/right_side.tmpl b/templates/repo/datasets/right_side.tmpl index 1ec0b734b..8ee7fc716 100644 --- a/templates/repo/datasets/right_side.tmpl +++ b/templates/repo/datasets/right_side.tmpl @@ -9,18 +9,23 @@ {{svg "octicon-gear" 16}}