glib-web 8.0.0 → 8.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/concerns/glib/json/libs.rb +16 -0
- data/app/helpers/glib/app_feature_support_helper.rb +33 -8
- data/app/helpers/glib/json_ui/view_builder/fields.rb +74 -9
- data/app/helpers/glib/json_ui/view_builder/panels.rb +1 -0
- data/app/helpers/glib/json_ui/view_builder.rb +15 -0
- data/app/jobs/glib/scheduled_job.rb +581 -0
- data/app/jobs/glib/scheduled_job_tick.rb +21 -0
- data/app/models/concerns/glib/enum_symbolization.rb +41 -4
- data/app/models/glib/scheduled_job_run.rb +16 -0
- data/app/views/json_ui/garage/forms/action_text.json.jbuilder +34 -0
- data/app/views/json_ui/garage/forms/action_text_attachment.json.jbuilder +7 -0
- data/app/views/json_ui/garage/forms/action_text_library.json.jbuilder +26 -0
- data/app/views/json_ui/garage/forms/action_text_preview.json.jbuilder +9 -0
- data/app/views/json_ui/garage/forms/index.json.jbuilder +6 -0
- data/app/views/json_ui/garage/forms/pickers.json.jbuilder +7 -0
- data/app/views/json_ui/garage/panels/carousel.json.jbuilder +7 -0
- data/app/views/json_ui/garage/test_page/_header.json.jbuilder +6 -0
- data/app/views/json_ui/garage/test_page/fields_actionText.json.jbuilder +87 -0
- data/app/views/json_ui/garage/test_page/fields_sign.json.jbuilder +34 -3
- data/app/views/json_ui/garage/test_page/form_dirty_hooks.json.jbuilder +22 -0
- data/app/views/json_ui/garage/test_page/form_hidden_panels.json.jbuilder +124 -0
- data/app/views/json_ui/garage/test_page/logics_set.json.jbuilder +35 -0
- data/app/views/json_ui/garage/test_page/panels_association.json.jbuilder +42 -0
- data/app/views/layouts/json_ui/renderer.html.erb +11 -1
- data/engines/blog/README.md +172 -0
- data/engines/blog/app/assets/stylesheets/glib/blog/admin.css +855 -0
- data/engines/blog/app/assets/stylesheets/glib/blog/themes/clean.css +816 -0
- data/engines/blog/app/assets/stylesheets/glib/blog/themes/editorial.css +631 -0
- data/engines/blog/app/controllers/concerns/glib/blog/admin/media_listing.rb +27 -0
- data/engines/blog/app/controllers/concerns/glib/blog/pagination.rb +14 -0
- data/engines/blog/app/controllers/glib/blog/admin/application_controller.rb +28 -0
- data/engines/blog/app/controllers/glib/blog/admin/authors_controller.rb +55 -0
- data/engines/blog/app/controllers/glib/blog/admin/categories_controller.rb +53 -0
- data/engines/blog/app/controllers/glib/blog/admin/comment_replies_controller.rb +34 -0
- data/engines/blog/app/controllers/glib/blog/admin/comments_controller.rb +50 -0
- data/engines/blog/app/controllers/glib/blog/admin/dashboards_controller.rb +34 -0
- data/engines/blog/app/controllers/glib/blog/admin/direct_uploads_controller.rb +30 -0
- data/engines/blog/app/controllers/glib/blog/admin/editor_attachments_controller.rb +16 -0
- data/engines/blog/app/controllers/glib/blog/admin/media_item_trashes_controller.rb +43 -0
- data/engines/blog/app/controllers/glib/blog/admin/media_items_controller.rb +61 -0
- data/engines/blog/app/controllers/glib/blog/admin/media_picks_controller.rb +19 -0
- data/engines/blog/app/controllers/glib/blog/admin/post_bulk_actions_controller.rb +33 -0
- data/engines/blog/app/controllers/glib/blog/admin/posts_controller.rb +79 -0
- data/engines/blog/app/controllers/glib/blog/admin/settings_controller.rb +27 -0
- data/engines/blog/app/controllers/glib/blog/admin/tags_controller.rb +46 -0
- data/engines/blog/app/controllers/glib/blog/application_controller.rb +90 -0
- data/engines/blog/app/controllers/glib/blog/authors_controller.rb +15 -0
- data/engines/blog/app/controllers/glib/blog/categories_controller.rb +15 -0
- data/engines/blog/app/controllers/glib/blog/comments_controller.rb +41 -0
- data/engines/blog/app/controllers/glib/blog/posts_controller.rb +47 -0
- data/engines/blog/app/controllers/glib/blog/tags_controller.rb +15 -0
- data/engines/blog/app/helpers/glib/blog/admin_helper.rb +57 -0
- data/engines/blog/app/helpers/glib/blog/comments_helper.rb +16 -0
- data/engines/blog/app/helpers/glib/blog/post_list_helper.rb +26 -0
- data/engines/blog/app/helpers/glib/blog/theme_helper.rb +85 -0
- data/engines/blog/app/jobs/glib/blog/purge_trash_job.rb +13 -0
- data/engines/blog/app/models/concerns/glib/blog/sluggable.rb +72 -0
- data/engines/blog/app/models/concerns/glib/blog/uses_media.rb +35 -0
- data/engines/blog/app/models/glib/blog/application_record.rb +7 -0
- data/engines/blog/app/models/glib/blog/author.rb +47 -0
- data/engines/blog/app/models/glib/blog/category.rb +53 -0
- data/engines/blog/app/models/glib/blog/comment.rb +66 -0
- data/engines/blog/app/models/glib/blog/comment_token.rb +30 -0
- data/engines/blog/app/models/glib/blog/media_item.rb +121 -0
- data/engines/blog/app/models/glib/blog/media_upload.rb +97 -0
- data/engines/blog/app/models/glib/blog/media_usage.rb +10 -0
- data/engines/blog/app/models/glib/blog/post.rb +110 -0
- data/engines/blog/app/models/glib/blog/post_view.rb +24 -0
- data/engines/blog/app/models/glib/blog/setting.rb +55 -0
- data/engines/blog/app/models/glib/blog/slug_redirect.rb +7 -0
- data/engines/blog/app/models/glib/blog/tag.rb +15 -0
- data/engines/blog/app/models/glib/blog/tagging.rb +10 -0
- data/engines/blog/app/policies/glib/blog/admin/author_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/category_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/comment_policy.rb +16 -0
- data/engines/blog/app/policies/glib/blog/admin/comment_reply_policy.rb +12 -0
- data/engines/blog/app/policies/glib/blog/admin/dashboard_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/direct_upload_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/editor_attachment_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/media_item_policy.rb +20 -0
- data/engines/blog/app/policies/glib/blog/admin/media_item_trash_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/media_pick_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/post_bulk_action_policy.rb +12 -0
- data/engines/blog/app/policies/glib/blog/admin/post_policy.rb +16 -0
- data/engines/blog/app/policies/glib/blog/admin/setting_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/tag_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/application_policy.rb +16 -0
- data/engines/blog/app/policies/glib/blog/author_policy.rb +9 -0
- data/engines/blog/app/policies/glib/blog/category_policy.rb +9 -0
- data/engines/blog/app/policies/glib/blog/comment_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/post_policy.rb +9 -0
- data/engines/blog/app/policies/glib/blog/tag_policy.rb +9 -0
- data/engines/blog/app/views/glib/blog/admin/_delete_button.json.jbuilder +24 -0
- data/engines/blog/app/views/glib/blog/admin/_nav.json.jbuilder +45 -0
- data/engines/blog/app/views/glib/blog/admin/_status_chip.json.jbuilder +2 -0
- data/engines/blog/app/views/glib/blog/admin/authors/_form.json.jbuilder +17 -0
- data/engines/blog/app/views/glib/blog/admin/authors/edit.json.jbuilder +7 -0
- data/engines/blog/app/views/glib/blog/admin/authors/index.json.jbuilder +50 -0
- data/engines/blog/app/views/glib/blog/admin/authors/new.json.jbuilder +11 -0
- data/engines/blog/app/views/glib/blog/admin/categories/_form.json.jbuilder +13 -0
- data/engines/blog/app/views/glib/blog/admin/categories/edit.json.jbuilder +7 -0
- data/engines/blog/app/views/glib/blog/admin/categories/index.json.jbuilder +68 -0
- data/engines/blog/app/views/glib/blog/admin/categories/new.json.jbuilder +7 -0
- data/engines/blog/app/views/glib/blog/admin/comments/_moderation_buttons.json.jbuilder +35 -0
- data/engines/blog/app/views/glib/blog/admin/comments/index.json.jbuilder +59 -0
- data/engines/blog/app/views/glib/blog/admin/dashboards/show.json.jbuilder +109 -0
- data/engines/blog/app/views/glib/blog/admin/media_item_trashes/index.json.jbuilder +32 -0
- data/engines/blog/app/views/glib/blog/admin/media_items/_rows.json.jbuilder +32 -0
- data/engines/blog/app/views/glib/blog/admin/media_items/edit.json.jbuilder +68 -0
- data/engines/blog/app/views/glib/blog/admin/media_items/index.json.jbuilder +68 -0
- data/engines/blog/app/views/glib/blog/admin/media_items/new.json.jbuilder +18 -0
- data/engines/blog/app/views/glib/blog/admin/media_picks/index.json.jbuilder +29 -0
- data/engines/blog/app/views/glib/blog/admin/posts/_form.json.jbuilder +104 -0
- data/engines/blog/app/views/glib/blog/admin/posts/edit.json.jbuilder +1 -0
- data/engines/blog/app/views/glib/blog/admin/posts/index.json.jbuilder +109 -0
- data/engines/blog/app/views/glib/blog/admin/posts/new.json.jbuilder +1 -0
- data/engines/blog/app/views/glib/blog/admin/settings/edit.json.jbuilder +55 -0
- data/engines/blog/app/views/glib/blog/admin/tags/_form.json.jbuilder +6 -0
- data/engines/blog/app/views/glib/blog/admin/tags/edit.json.jbuilder +7 -0
- data/engines/blog/app/views/glib/blog/admin/tags/index.json.jbuilder +30 -0
- data/engines/blog/app/views/glib/blog/admin/tags/new.json.jbuilder +7 -0
- data/engines/blog/app/views/glib/blog/authors/show.json.jbuilder +4 -0
- data/engines/blog/app/views/glib/blog/categories/show.json.jbuilder +4 -0
- data/engines/blog/app/views/glib/blog/comments/pending.json.jbuilder +7 -0
- data/engines/blog/app/views/glib/blog/media_items/_media_item.html.erb +14 -0
- data/engines/blog/app/views/glib/blog/posts/_comment.json.jbuilder +23 -0
- data/engines/blog/app/views/glib/blog/posts/_comment_form.json.jbuilder +14 -0
- data/engines/blog/app/views/glib/blog/posts/_comments.json.jbuilder +21 -0
- data/engines/blog/app/views/glib/blog/posts/index.json.jbuilder +4 -0
- data/engines/blog/app/views/glib/blog/posts/show.json.jbuilder +5 -0
- data/engines/blog/app/views/glib/blog/shared/errors.json.jbuilder +5 -0
- data/engines/blog/app/views/glib/blog/tags/show.json.jbuilder +3 -0
- data/engines/blog/app/views/glib/blog/themes/_nav_links.json.jbuilder +12 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_brand.json.jbuilder +11 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_card.json.jbuilder +15 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_featured.json.jbuilder +23 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_footer.json.jbuilder +15 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_header.json.jbuilder +9 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_post.json.jbuilder +98 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_post_list.json.jbuilder +40 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_post_rows.json.jbuilder +10 -0
- data/engines/blog/app/views/glib/blog/themes/editorial/_footer.json.jbuilder +15 -0
- data/engines/blog/app/views/glib/blog/themes/editorial/_header.json.jbuilder +11 -0
- data/engines/blog/app/views/glib/blog/themes/editorial/_post.json.jbuilder +62 -0
- data/engines/blog/app/views/glib/blog/themes/editorial/_post_list.json.jbuilder +25 -0
- data/engines/blog/app/views/glib/blog/themes/editorial/_post_rows.json.jbuilder +18 -0
- data/engines/blog/config/locales/en.yml +500 -0
- data/engines/blog/config/routes.rb +33 -0
- data/engines/blog/db/migrate/20261103090000_create_glib_blog_tables.rb +70 -0
- data/engines/blog/db/migrate/20261104090000_create_glib_blog_media_tables.rb +44 -0
- data/engines/blog/db/migrate/20261104120000_create_glib_blog_comments.rb +23 -0
- data/engines/blog/db/migrate/20261105090000_add_glib_blog_comment_moderation.rb +16 -0
- data/engines/blog/db/migrate/20261105100000_add_deleted_at_to_glib_blog_posts.rb +6 -0
- data/engines/blog/db/migrate/20261105110000_add_parent_and_default_to_glib_blog_categories.rb +10 -0
- data/engines/blog/db/migrate/20261105120000_create_glib_blog_post_views.rb +13 -0
- data/engines/blog/db/migrate/20261105130000_create_glib_blog_settings.rb +26 -0
- data/engines/blog/db/migrate/20261106090000_add_theme_to_glib_blog_settings.rb +7 -0
- data/engines/blog/lib/tasks/glib_blog_tasks.rake +32 -0
- data/lib/generators/glib/blog/install_generator.rb +44 -0
- data/lib/generators/glib/blog/templates/initializer.rb +22 -0
- data/lib/generators/glib/scheduled_jobs_generator.rb +30 -0
- data/lib/generators/templates/scheduled_jobs/create_glib_scheduled_job_runs.rb +22 -0
- data/lib/glib/blog/engine.rb +20 -0
- data/lib/glib/blog/theme.rb +35 -0
- data/lib/glib/blog.rb +50 -0
- data/lib/glib/engine.rb +17 -0
- data/lib/glib/scheduled_jobs/config.rb +36 -0
- data/lib/glib/scheduled_jobs/loader.rb +98 -0
- data/lib/glib-web.rb +2 -0
- metadata +175 -3
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Glib::Blog
|
|
2
|
+
|
|
3
|
+
An opt-in blog engine for glib apps. It provides posts, categories, tags, authors with roles, scheduling, SEO
|
|
4
|
+
fields and slugs that keep redirecting after they change. Every page, public and admin, is glib JSON UI. Post
|
|
5
|
+
bodies use Action Text, edited with `fields_actionText` and shown with the `actionText` view.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
1. Load the engine after `Bundler.require` in `config/application.rb`, along with Action Text:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
require 'glib/blog'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. Run the generator. It writes `config/initializers/glib_blog.rb`, mounts the engine at `/blog`, and copies the
|
|
16
|
+
migrations (Action Text's too, when the app doesn't have them yet):
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
bin/rails g glib:blog:install
|
|
20
|
+
bin/rails db:migrate
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
3. Give an existing user access as the first admin:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
bin/rails glib_blog:author EMAIL=ada@example.com
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`USER_ID=` finds the user by ID instead, `ROLE=` gives `author` or `editor` instead of `admin`, and `BYLINE=`
|
|
30
|
+
sets the name shown on their posts (by default the user's `full_name` or `name`). The engine never creates
|
|
31
|
+
users: people sign up through the app, and an admin then adds them as authors from `/blog/admin/authors`.
|
|
32
|
+
|
|
33
|
+
## What the host app provides
|
|
34
|
+
|
|
35
|
+
- `current_user`, on the controller set as `Glib::Blog.parent_controller` (default `::ApplicationController`).
|
|
36
|
+
Engine controllers inherit from it.
|
|
37
|
+
- A user model, `Glib::Blog.user_class` (default `'User'`).
|
|
38
|
+
- `Glib::Blog.sign_in_url`, where guests are sent from admin pages.
|
|
39
|
+
- `gem 'image_processing'` and libvips, for the media library.
|
|
40
|
+
- A daily run of `Glib::Blog::PurgeTrashJob`, which empties the 30-day post and media trash (Solid Queue
|
|
41
|
+
recurring task, cron with `bin/rails glib_blog:purge_trash`, ...).
|
|
42
|
+
- `Glib::Blog.media_url`, when the app turns off Active Storage's routes. The default builds Rails proxy URLs,
|
|
43
|
+
which a CDN can cache.
|
|
44
|
+
|
|
45
|
+
## Admin look
|
|
46
|
+
|
|
47
|
+
The admin has its own look (a dark sidebar and IBM Plex type), scoped to its pages, so it ignores the host's
|
|
48
|
+
theme and leaves the host's pages alone. The styles are in `app/assets/stylesheets/glib/blog/admin.css`
|
|
49
|
+
and are sent with each admin page. The fonts load from Google Fonts, so a strict Content Security Policy
|
|
50
|
+
needs to allow `fonts.googleapis.com` and `fonts.gstatic.com`. The sidebar shows the blog's title and logo
|
|
51
|
+
from its settings.
|
|
52
|
+
|
|
53
|
+
## Themes
|
|
54
|
+
|
|
55
|
+
The public blog has two looks, and an admin switches between them in the settings (Appearance):
|
|
56
|
+
|
|
57
|
+
- Clean (the default): white pages, IBM Plex type and blue accents. The home page leads with the featured post
|
|
58
|
+
above a grid of cards filtered by top-level category; articles list their sections beside the text and end with
|
|
59
|
+
an author box and more posts from the same category.
|
|
60
|
+
- Editorial: warm paper tones and Cormorant Garamond headings. The home page opens on a large title over the
|
|
61
|
+
tagline, then a single column of entries dated in the margin; articles end with a link to the previous post.
|
|
62
|
+
|
|
63
|
+
Both show the newest post marked "Featured" first, and both carry the comments, tags and infinite scrolling.
|
|
64
|
+
|
|
65
|
+
A theme is a stylesheet plus a folder of partials, `app/views/glib/blog/themes/<name>`. The page carries the class
|
|
66
|
+
`blog-theme-<name>`, which scopes the stylesheet, and the stylesheet is sent with each page like the admin's. The
|
|
67
|
+
built-in themes load their fonts from Google Fonts, so a strict Content Security Policy needs to allow them.
|
|
68
|
+
|
|
69
|
+
### Adding, changing or removing themes
|
|
70
|
+
|
|
71
|
+
Themes are registered in `Glib::Blog.themes`; an app changes them in `config/initializers/glib_blog.rb`:
|
|
72
|
+
|
|
73
|
+
```ruby
|
|
74
|
+
# Add a theme. With `based_on`, every partial it lacks comes from that theme, and that theme's
|
|
75
|
+
# stylesheet loads before its own, so a theme can be nothing but a stylesheet.
|
|
76
|
+
Glib::Blog.register_theme :dark, based_on: :clean, stylesheet: Rails.root.join('app/assets/stylesheets/blog/dark.css')
|
|
77
|
+
|
|
78
|
+
# Replace a theme's stylesheet: registering a name again replaces it.
|
|
79
|
+
Glib::Blog.register_theme :clean, stylesheet: Rails.root.join('app/assets/stylesheets/blog/clean.css')
|
|
80
|
+
|
|
81
|
+
# Remove a theme.
|
|
82
|
+
Glib::Blog.themes.delete(:editorial)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- **Stylesheets** scope their rules to `.blog-theme-<name>`. A page carries the class of its theme and of every theme
|
|
86
|
+
it is based on, so `dark.css` can override `.blog-theme-clean` rules with `.blog-theme-dark` ones. Edits show
|
|
87
|
+
without a restart where the app reloads code.
|
|
88
|
+
- **Partials**: an app's own `app/views/glib/blog/themes/<name>/_footer.json.jbuilder` wins over the engine's file at
|
|
89
|
+
that path, for a built-in theme too. The partials a theme may provide are `header`, `footer`, `post_list` (a list
|
|
90
|
+
page), `post_rows` (a page of list rows) and `post` (an article), plus any its own partials render through
|
|
91
|
+
`glib_blog_theme_partial`.
|
|
92
|
+
- **Text**: the settings show `glib.blog.themes.<name>.name` and `.description` from the app's locale (the name
|
|
93
|
+
defaults to the humanized key). Strings a theme shares, such as `home`, fall back to the theme it is based on.
|
|
94
|
+
- The first registered theme is used until an admin chooses one, and whenever the chosen theme is no longer
|
|
95
|
+
registered.
|
|
96
|
+
|
|
97
|
+
## Settings
|
|
98
|
+
|
|
99
|
+
Admins change the blog's settings in `/blog/admin/settings/edit`:
|
|
100
|
+
|
|
101
|
+
- General: the blog's title (shown on the blog and in the admin; "Blog" until set), tagline and logo, a library image.
|
|
102
|
+
- Appearance: the public blog's theme.
|
|
103
|
+
- Reading: how many posts each list shows before loading more as the reader scrolls, and hiding the whole blog from
|
|
104
|
+
search engines.
|
|
105
|
+
- Comments: whether new posts allow comments, whether readers' comments wait for approval, and after how many days
|
|
106
|
+
comments close.
|
|
107
|
+
|
|
108
|
+
The two comment rules start from the app's configuration (`Glib::Blog.comments_require_approval` and
|
|
109
|
+
`Glib::Blog.comments_close_after`); once an admin saves them, the saved values win.
|
|
110
|
+
|
|
111
|
+
## Views
|
|
112
|
+
|
|
113
|
+
Each time a reader opens a live post, the post's count for that day goes up by one. Signed-in authors and obvious
|
|
114
|
+
crawlers are not counted, and nothing about the reader is stored. The dashboard shows the views of the last 30 days
|
|
115
|
+
against the 30 before, and the views of each recent post.
|
|
116
|
+
|
|
117
|
+
## Posts
|
|
118
|
+
|
|
119
|
+
Posts are drafts, published (scheduled while their publish date is still ahead) or archived. Deleting a post moves
|
|
120
|
+
it to the trash, where it drops off the blog and can be restored for 30 days; `PurgeTrashJob` deletes it after
|
|
121
|
+
that, and an editor can delete it permanently from the trash at any time. The post list publishes, unpublishes,
|
|
122
|
+
trashes or restores several posts at once.
|
|
123
|
+
|
|
124
|
+
## Media library
|
|
125
|
+
|
|
126
|
+
Every file lives once in `/blog/admin/media_items` and posts point at it, so the library knows where each file is
|
|
127
|
+
used.
|
|
128
|
+
|
|
129
|
+
- Uploads are checked by content, not by the browser's declared type: JPG, PNG, WebP, GIF, HEIC and PDF up to
|
|
130
|
+
10 MB, plus SVG for admins.
|
|
131
|
+
- Photos are rotated upright, scaled to 2560 px, converted from HEIC to JPEG and stripped of EXIF and GPS data
|
|
132
|
+
before they are stored; the original is not kept. Thumb, medium and large WebP sizes are generated in the
|
|
133
|
+
background.
|
|
134
|
+
- Uploading a file that is already in the library reuses it.
|
|
135
|
+
- Alt text, caption and credit are set once per file; posts render the current values.
|
|
136
|
+
- A file used in a post body or as a cover cannot be trashed. Trashed files can be restored for 30 days.
|
|
137
|
+
- The post editor uploads into the library and has an "Insert from library" button; covers are chosen from the
|
|
138
|
+
library.
|
|
139
|
+
|
|
140
|
+
## Comments
|
|
141
|
+
|
|
142
|
+
Readers comment on live posts as guests with a name and email; signed-in authors comment as themselves and are
|
|
143
|
+
marked "Author". Replies go one level deep, and emails are never shown.
|
|
144
|
+
|
|
145
|
+
- Comments are off until a post turns on "Allow comments" (or the settings turn them on for new posts).
|
|
146
|
+
`Glib::Blog.comments_close_after = 30` closes them everywhere 30 days after publishing.
|
|
147
|
+
- Readers' comments wait for approval; staff comments appear at once. `Glib::Blog.comments_require_approval = false`
|
|
148
|
+
publishes every comment immediately. The blog's settings can change both.
|
|
149
|
+
- Editors and admins moderate any comment in `/blog/admin/comments`; authors those on their own posts. A comment is
|
|
150
|
+
pending, approved, spam or trash, and only approved ones appear on the post and in its comment count. Replying from
|
|
151
|
+
the admin approves the comment being answered. Spam and trash are deleted permanently by hand.
|
|
152
|
+
- Spam protection stores nothing about visitors:
|
|
153
|
+
- The form carries a signed token, refused when missing, forged, older than a day or used within 3 seconds.
|
|
154
|
+
- At most 5 comments per IP address every 10 minutes, counted in the cache store. Rate limiting needs a real
|
|
155
|
+
cache store; it is inert on `:null_store`.
|
|
156
|
+
|
|
157
|
+
## Roles
|
|
158
|
+
|
|
159
|
+
| Role | Can do |
|
|
160
|
+
| --- | --- |
|
|
161
|
+
| author | Write, edit and delete their own posts |
|
|
162
|
+
| editor | Everything an author can, on everyone's posts, plus categories and tags |
|
|
163
|
+
| admin | Everything, including authors |
|
|
164
|
+
|
|
165
|
+
## URLs
|
|
166
|
+
|
|
167
|
+
| Path | Page |
|
|
168
|
+
| --- | --- |
|
|
169
|
+
| `/blog` | Live posts, newest first |
|
|
170
|
+
| `/blog/:slug` | A post. Old slugs answer with a 301; drafts, archived and scheduled posts are 404 |
|
|
171
|
+
| `/blog/categories/:slug`, `/blog/tags/:slug`, `/blog/authors/:slug` | Live posts in that category, tag or by that author |
|
|
172
|
+
| `/blog/admin` | Admin, starting at the dashboard |
|