Files
trpic/web/templates/gallery/artworks.tmpl
Hubert Chen 85cf0aedf8 refactor
migrate sql:
```
ALTER TABLE posts ADD COLUMN `time` datetime NULL;
ALTER TABLE posts ADD COLUMN `title` text NULL;
ALTER TABLE posts ADD COLUMN `text` text NULL;

UPDATE posts SET
  time = (SELECT a.time FROM artworks a WHERE a.id = posts.artwork_posts),
  title = (SELECT a.title FROM artworks a WHERE a.id = posts.artwork_posts),
  text = (SELECT a.text FROM artworks a WHERE a.id = posts.artwork_posts)
WHERE EXISTS (SELECT 1 FROM artworks a WHERE a.id = posts.artwork_posts);

ALTER TABLE artworks DROP COLUMN time;
ALTER TABLE artworks DROP COLUMN title;
ALTER TABLE artworks DROP COLUMN text;
```

configs:
    add `CheckArtworkIntervalInSeconds` flag to set  check artwork task interval
database:
    add `migrate.sql` file
    artwork:
        move `time`, `title` and `text` fields to `post` schema
    file:
        set `id_str` and `filename` fields immutable
        add `source_url` optional field
    post:
        set `platform` field immutable
        add `time`, `title` and `text` optional from `artwork` schema
    social:
        set `platform` field immutable
    tag:
        set `text` field immutable
action(new):
    add action package to create and update `file`, `post`, `social` and `tag` info
api:
    artworks:
        adjust GET method order option to match the database
    files:
        adjust GET method with `artwork/tags` edge
        rename GET method respond `images` field to `files`
    collect:
        refactor to work with new action package
task:
    artwork(new):
        create `CheckArtworks` function to check and update artwork info
    social:
        refactor `CheckSocials` to work with new action package
router:
    add `/api/task/artworks/check` endpoint for `CheckArtworks` task
src/web:
    artwork noscript:
        adjust order option to match the database
    file noscript:
        rename execute template struct `Images` field to `Files`
web:
    scripts:
        refactor to work with new database schema
    styles:
        adjust some style
        use `<button>` to replace `<span>` to allow keyboard control
    templates:
        adjust to work with new database schema
        use `<button>` to replace `<span>` to allow keyboard control
2026-03-27 13:37:59 +08:00

37 lines
1.2 KiB
Cheetah

{{ define "artworks" }}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>trpic</title>
<link rel="manifest" href="/manifest.json"/>
{{ "base" | .RenderStyle }}
{{ "gallery" | .RenderStyle }}
{{ "base" | .RenderScript }}
{{ "load_artwork" | .RenderScript }}
</head>
<body>
<div id="gallery">
<div id="info-box">
<p style="font-size: 1.2em; font-weight: bold;">trpic</p>
<p>共 <b id="artwork-count">....</b> 个作品</p>
<p>以 <select id="sort-select">
<option value="time">时间</option>
<option value="time-down">时间倒序</option>
<option value="publish">发布时间</option>
<option value="publish-down">发布时间倒序</option>
</select> 排序</p>
{{ template "submit_url" . }}
<noscript>
<p>当前未启用 JavaScript</p>
<p>您可以前往 <a href="/artworks/noscript">noscript</a> 页面</p>
</noscript>
</div>
</div>
<div id="sentinel"></div>
{{ template "preview" . }}
</body>
</html>
{{ end }}