feat: add custom publish time and last updated time display

- Add custom publish time field to article create/edit forms
  - Support datetime-local input for manual time setting
  - Auto-set on first publish if left blank
  - Works for both admin and user article forms

- Display last updated time on article detail page
  - Show both published time and last updated time
  - Auto-maintained by GORM on each update
  - Format: YYYY-MM-DD HH:MM

- Add i18n support for new fields
  - article_published_at: Published Time / 发布时间
  - article_published_at_hint: Leave blank to auto-set on publish / 留空则在发布时自动设置
  - article_last_updated: Last Updated / 最后更新

- Update handlers and templates
  - handlers/article.go: Add parsePublishedAt/formatPublishedAt functions
  - handlers/home.go: Add formatUpdateTime function
  - handlers/my_articles.go: Support custom publish time in user articles
  - templates: Add datetime-local inputs and time display

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 20:20:19 +08:00
co-authored by Claude Fable 5
parent b600eac21c
commit b0ca76e8dc
9 changed files with 315 additions and 52 deletions
+6
View File
@@ -122,6 +122,8 @@ var translations = map[Lang]map[string]string{
"article_published": "Published",
"article_field_is_top": "Pin to top",
"article_is_top": "Pin to top",
"article_published_at": "Published Time",
"article_published_at_hint": "Leave blank to auto-set on publish",
"article_save_draft": "Save Draft",
"article_save": "Save",
"article_cancel": "Cancel",
@@ -160,6 +162,7 @@ var translations = map[Lang]map[string]string{
"article_col_status": "Status",
"article_col_published": "Published",
"article_col_actions": "Actions",
"article_last_updated": "Last Updated",
// Settings (platform configuration)
"settings_nav": "Platform Settings",
@@ -475,6 +478,8 @@ var translations = map[Lang]map[string]string{
"article_published": "已发布",
"article_field_is_top": "置顶",
"article_is_top": "置顶",
"article_published_at": "发布时间",
"article_published_at_hint": "留空则在发布时自动设置",
"article_save_draft": "保存草稿",
"article_save": "保存",
"article_cancel": "取消",
@@ -513,6 +518,7 @@ var translations = map[Lang]map[string]string{
"article_col_status": "状态",
"article_col_published": "发布时间",
"article_col_actions": "操作",
"article_last_updated": "最后更新",
// 平台设置
"settings_nav": "平台设置",