glib-web 8.1.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.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/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/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/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 +174 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
content = params.dig(:post, :content).to_s
|
|
2
|
+
|
|
3
|
+
json_ui_response json do |action|
|
|
4
|
+
action.components_replace targetId: 'preview', newView: ->(update) do
|
|
5
|
+
update.panels_vertical childViews: ->(vertical) do
|
|
6
|
+
vertical.actionText richText: ActionText::Content.new(content)
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -121,6 +121,12 @@ page.list sections: [
|
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
end
|
|
124
|
+
|
|
125
|
+
section.rows builder: ->(template) do
|
|
126
|
+
template.thumbnail title: 'Action Text Editor', onClick: ->(action) do
|
|
127
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/action_text')
|
|
128
|
+
end
|
|
129
|
+
end
|
|
124
130
|
end, ->(section) do
|
|
125
131
|
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
|
126
132
|
header.h2 text: 'Experimental (not required yet)'
|
|
@@ -69,6 +69,13 @@ page.form \
|
|
|
69
69
|
max: '2018-06-17T00:00',
|
|
70
70
|
value: '2025-01-26T13:49:00.000+05:00',
|
|
71
71
|
time_zone: 'Asia/Taipei' # +8
|
|
72
|
+
form.fields_datetime \
|
|
73
|
+
name: 'user[date_time]',
|
|
74
|
+
width: 'matchParent',
|
|
75
|
+
label: 'Date Time (offset only)',
|
|
76
|
+
min: '2018-06-09T00:00',
|
|
77
|
+
max: '2018-06-17T00:00',
|
|
78
|
+
value: '2025-01-26T13:49:00.000+05:00' # no time_zone: the device-zone fallback
|
|
72
79
|
form.fields_date \
|
|
73
80
|
name: 'user[month]',
|
|
74
81
|
width: 'matchParent',
|
|
@@ -22,6 +22,11 @@ nav_groups = {
|
|
|
22
22
|
'Forms' => [
|
|
23
23
|
'auto_validate',
|
|
24
24
|
'dirty_state',
|
|
25
|
+
'form_dirty_hooks',
|
|
26
|
+
'form_dirty_fields',
|
|
27
|
+
'form_dynamic_dirty',
|
|
28
|
+
'form_removed_field',
|
|
29
|
+
'form_removed_field_onload',
|
|
25
30
|
'fields_text',
|
|
26
31
|
'fields_select',
|
|
27
32
|
'fields_dynamicSelect',
|
|
@@ -32,6 +37,7 @@ nav_groups = {
|
|
|
32
37
|
'fields_radio',
|
|
33
38
|
'fields_rating',
|
|
34
39
|
'fields_richText',
|
|
40
|
+
'fields_actionText',
|
|
35
41
|
'fields_sign',
|
|
36
42
|
'fields_stripeToken',
|
|
37
43
|
'fields_stripeExternalAccount',
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
json.title 'Test Page (Fields ActionText)'
|
|
2
|
+
|
|
3
|
+
page = json_ui_page json
|
|
4
|
+
|
|
5
|
+
render 'json_ui/garage/test_page/header', json: json, page: page
|
|
6
|
+
|
|
7
|
+
page.body(
|
|
8
|
+
childViews: ->(body) do
|
|
9
|
+
body.panels_responsive(
|
|
10
|
+
padding: glib_json_padding_body,
|
|
11
|
+
childViews: ->(res) do
|
|
12
|
+
res.h2 text: 'Fields ActionText'
|
|
13
|
+
res.spacer height: 8
|
|
14
|
+
res.label text: 'Trix editor that submits Action Text HTML, with direct-uploaded attachments.'
|
|
15
|
+
res.spacer height: 12
|
|
16
|
+
|
|
17
|
+
res.panels_form(
|
|
18
|
+
url: json_ui_garage_url(path: 'forms/action_text_preview'),
|
|
19
|
+
method: 'post',
|
|
20
|
+
childViews: ->(form) do
|
|
21
|
+
form.fields_actionText(
|
|
22
|
+
id: 'action_text_main',
|
|
23
|
+
width: 'matchParent',
|
|
24
|
+
label: 'Content',
|
|
25
|
+
name: 'post[content]',
|
|
26
|
+
value: '<div>Initial <strong>content</strong>.</div>',
|
|
27
|
+
directUploadUrl: glib_direct_uploads_url,
|
|
28
|
+
blobUrlGenerator: glib_blob_url_generators_url,
|
|
29
|
+
accepts: { fileType: ['image'], maxFileSize: 5000 },
|
|
30
|
+
onChange: ->(action) do
|
|
31
|
+
action.logics_set targetId: 'action_text_status', data: { text: 'Status: content changed' }
|
|
32
|
+
end
|
|
33
|
+
)
|
|
34
|
+
form.spacer height: 8
|
|
35
|
+
form.label id: 'action_text_status', text: 'Status: idle'
|
|
36
|
+
|
|
37
|
+
form.spacer height: 12
|
|
38
|
+
form.h2 text: 'App attachments and library'
|
|
39
|
+
form.spacer height: 8
|
|
40
|
+
form.fields_actionText(
|
|
41
|
+
id: 'action_text_library',
|
|
42
|
+
width: 'matchParent',
|
|
43
|
+
label: 'Story',
|
|
44
|
+
name: 'post[story]',
|
|
45
|
+
directUploadUrl: glib_direct_uploads_url,
|
|
46
|
+
attachmentUrl: json_ui_garage_url(path: 'forms/action_text_attachment'),
|
|
47
|
+
libraryUrl: json_ui_garage_url(path: 'forms/action_text_library', target: 'action_text_library'),
|
|
48
|
+
accepts: { fileType: ['image'], maxFileSize: 5000 }
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
form.spacer height: 12
|
|
52
|
+
form.h2 text: 'Without uploads'
|
|
53
|
+
form.spacer height: 8
|
|
54
|
+
form.fields_actionText(
|
|
55
|
+
id: 'action_text_no_upload',
|
|
56
|
+
width: 'matchParent',
|
|
57
|
+
label: 'Notes',
|
|
58
|
+
name: 'post[notes]'
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
form.spacer height: 12
|
|
62
|
+
form.h2 text: 'Read only'
|
|
63
|
+
form.spacer height: 8
|
|
64
|
+
form.fields_actionText(
|
|
65
|
+
id: 'action_text_read_only',
|
|
66
|
+
width: 'matchParent',
|
|
67
|
+
label: 'Locked',
|
|
68
|
+
name: 'post[locked]',
|
|
69
|
+
value: '<div>Cannot be edited.</div>',
|
|
70
|
+
readOnly: true
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
form.spacer height: 12
|
|
74
|
+
form.fields_submit text: 'Submit'
|
|
75
|
+
end
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
res.spacer height: 12
|
|
79
|
+
res.h2 text: 'Rendered'
|
|
80
|
+
res.spacer height: 8
|
|
81
|
+
res.panels_vertical id: 'preview', childViews: ->(vertical) do
|
|
82
|
+
vertical.actionText richText: ActionText::Content.new('<div>Initial <strong>content</strong>.</div>')
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
)
|
|
86
|
+
end
|
|
87
|
+
)
|
|
@@ -182,7 +182,7 @@ page.body(
|
|
|
182
182
|
|
|
183
183
|
form.h2 text: 'Offered saved signature'
|
|
184
184
|
form.spacer height: 8
|
|
185
|
-
form.label text: 'onClick composes a menu on the empty box (popovers_show at the pointer): use the kept signature (
|
|
185
|
+
form.label text: 'onClick composes a menu on the empty box (popovers_show at the pointer): use the kept signature (components_invoke action_setSignature) or open the dialog (components_invoke action_open); draw.saveOption asks whether a fresh drawing should be saved.'
|
|
186
186
|
form.spacer height: 8
|
|
187
187
|
form.fields_sign(
|
|
188
188
|
id: 'signature_offered',
|
|
@@ -200,7 +200,7 @@ page.body(
|
|
|
200
200
|
row.label text: 'Use my saved signature'
|
|
201
201
|
end, onClick: ->(sub) do
|
|
202
202
|
sub.runMultiple childActions: ->(m) do
|
|
203
|
-
m.
|
|
203
|
+
m.components_invoke targetId: 'signature_offered', name: 'action_setSignature', arguments: { value: 'saved-signed-id', fileUrl: preview_data_uri }
|
|
204
204
|
m.popovers_close key: 'menu'
|
|
205
205
|
end
|
|
206
206
|
end
|
|
@@ -221,7 +221,6 @@ page.body(
|
|
|
221
221
|
hint: 'Draw it once. We keep it for next time.',
|
|
222
222
|
placeholder: 'Sign inside the box',
|
|
223
223
|
confirmedHint: 'Keep it, or clear it and sign again.',
|
|
224
|
-
savedSignature: { value: 'saved-signed-id', fileUrl: preview_data_uri },
|
|
225
224
|
saveOption: {
|
|
226
225
|
name: 'user[save_signature_offered]',
|
|
227
226
|
label: 'Save this signature for next time',
|
|
@@ -254,6 +253,38 @@ page.body(
|
|
|
254
253
|
form.hr width: 'matchParent'
|
|
255
254
|
form.spacer height: 12
|
|
256
255
|
|
|
256
|
+
form.h2 text: 'Externally offered saved signature'
|
|
257
|
+
form.spacer height: 8
|
|
258
|
+
form.label text: 'Optional draw.savedSignature: a logics_set write of that id previews its image on the box with no dialog and no upload (distinct from the action, which takes its signature as arguments).'
|
|
259
|
+
form.spacer height: 8
|
|
260
|
+
form.fields_sign(
|
|
261
|
+
id: 'signature_external',
|
|
262
|
+
name: 'user[signature_external]',
|
|
263
|
+
directUploadUrl: glib_direct_uploads_url,
|
|
264
|
+
width: 320,
|
|
265
|
+
height: 160,
|
|
266
|
+
draw: {
|
|
267
|
+
savedSignature: { value: 'external-saved-id', fileUrl: preview_data_uri }
|
|
268
|
+
}
|
|
269
|
+
)
|
|
270
|
+
form.spacer height: 8
|
|
271
|
+
form.panels_flow(
|
|
272
|
+
innerPadding: { bottom: 0 },
|
|
273
|
+
width: 'matchParent',
|
|
274
|
+
childViews: ->(flow) do
|
|
275
|
+
flow.button(
|
|
276
|
+
text: 'Fill external saved signature',
|
|
277
|
+
onClick: ->(action) do
|
|
278
|
+
action.logics_set targetId: 'signature_external', data: { value: 'external-saved-id' }
|
|
279
|
+
end
|
|
280
|
+
)
|
|
281
|
+
end
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
form.spacer height: 12
|
|
285
|
+
form.hr width: 'matchParent'
|
|
286
|
+
form.spacer height: 12
|
|
287
|
+
|
|
257
288
|
form.h2 text: 'Hints on a blank canvas'
|
|
258
289
|
form.spacer height: 8
|
|
259
290
|
form.fields_sign(
|
|
@@ -4,6 +4,10 @@ page = json_ui_page json
|
|
|
4
4
|
|
|
5
5
|
render 'json_ui/garage/test_page/header', json: json, page: page
|
|
6
6
|
|
|
7
|
+
# 60x20 ink stand-in for the sign field's offered saved signature (the same
|
|
8
|
+
# fixture image the fields_sign page uses).
|
|
9
|
+
dirty_hooks_signature_uri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAAUCAYAAADRA14pAAAAoklEQVR4nO2XUQrAIAxDcwjvf9WNfQzG1NFqUt1mwL8a8hBtxfYzYXSAaC1glVJK2RohOXAJdCS4FNgCGw0tA7YAjQCXAHsBoqAPbzpwa3A19OkLpjkjsAL66gmWOTOo0gtvOJXe/VcP9JpH3DvmewBLkdeUKfaLD09xqSaid7bkqilrS57pKHJCYmWq9uFZQD2ZLLkeB49ZQO/qybX+w1/XDujJvn2bufeCAAAAAElFTkSuQmCC'
|
|
10
|
+
|
|
7
11
|
page.body childViews: ->(body) do
|
|
8
12
|
body.panels_form \
|
|
9
13
|
padding: glib_json_padding_body,
|
|
@@ -37,6 +41,24 @@ page.body childViews: ->(body) do
|
|
|
37
41
|
multiProgressView: { files: [] }
|
|
38
42
|
form.spacer height: 14
|
|
39
43
|
|
|
44
|
+
# The sign field's saved-signature action: applying an offered
|
|
45
|
+
# signature (components_invoke action_setSignature) is a user
|
|
46
|
+
# gesture, so it must turn the form dirty and enable the submit -- a
|
|
47
|
+
# logics_set fill of the same id would not (deliberate non-trigger).
|
|
48
|
+
# The signature comes in as action arguments; the field carries no
|
|
49
|
+
# saved signature of its own.
|
|
50
|
+
form.fields_sign \
|
|
51
|
+
name: 'user[saved_signature]',
|
|
52
|
+
id: 'dirty_hooks_sign',
|
|
53
|
+
width: 320,
|
|
54
|
+
height: 160,
|
|
55
|
+
directUploadUrl: glib_direct_uploads_url
|
|
56
|
+
form.spacer height: 8
|
|
57
|
+
form.button text: 'Use saved signature', onClick: ->(action) do
|
|
58
|
+
action.components_invoke targetId: 'dirty_hooks_sign', name: 'action_setSignature', arguments: { value: 'saved-signed-id', fileUrl: dirty_hooks_signature_uri }
|
|
59
|
+
end
|
|
60
|
+
form.spacer height: 14
|
|
61
|
+
|
|
40
62
|
form.fields_submit id: 'dirty_hooks_submit', text: 'Save'
|
|
41
63
|
end
|
|
42
64
|
end
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
json.title 'Test Page (Form Hidden Panels)'
|
|
2
|
+
|
|
3
|
+
page = json_ui_page json
|
|
4
|
+
|
|
5
|
+
render 'json_ui/garage/test_page/header', json: json, page: page
|
|
6
|
+
|
|
7
|
+
# Probes panels that are hidden and shown with ONE `logics_set` per panel
|
|
8
|
+
# while their fields keep what the user typed or attached. Every panel and
|
|
9
|
+
# field here is declared `submitWhenNotDisplayed: true`, so hiding keeps it
|
|
10
|
+
# mounted (display: none) and its value still submits. Siblings:
|
|
11
|
+
# form_removed_field (fields WITHOUT the flag unmount when hidden).
|
|
12
|
+
panel_ids = %w[hidden_panel_a hidden_panel_b hidden_panel_c]
|
|
13
|
+
|
|
14
|
+
show_panel = ->(action, shown_id) do
|
|
15
|
+
action.runMultiple childActions: ->(multiple) do
|
|
16
|
+
panel_ids.each do |panel_id|
|
|
17
|
+
multiple.logics_set targetId: panel_id, data: { displayed: panel_id == shown_id, submitWhenNotDisplayed: true }
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
page.body childViews: ->(body) do
|
|
23
|
+
body.panels_responsive padding: glib_json_padding_body, childViews: ->(res) do
|
|
24
|
+
res.h2 text: 'Hidden panels keep their fields'
|
|
25
|
+
res.spacer height: 8
|
|
26
|
+
# Dirty state, observable: `onDirty`/`onPristine` fire on transitions, and
|
|
27
|
+
# `hidden_ever_dirty` never resets, so a transient dirty blip shows too.
|
|
28
|
+
res.label id: 'hidden_dirty_state', text: 'Form: pristine'
|
|
29
|
+
res.label id: 'hidden_ever_dirty', text: 'Ever dirty: no'
|
|
30
|
+
res.spacer height: 8
|
|
31
|
+
res.panels_form \
|
|
32
|
+
url: json_ui_garage_url(path: 'forms/generic_post'),
|
|
33
|
+
method: 'post',
|
|
34
|
+
onDirty: ->(action) do
|
|
35
|
+
action.runMultiple childActions: ->(multiple) do
|
|
36
|
+
multiple.logics_set targetId: 'hidden_dirty_state', data: { text: 'Form: dirty' }
|
|
37
|
+
multiple.logics_set targetId: 'hidden_ever_dirty', data: { text: 'Ever dirty: yes' }
|
|
38
|
+
end
|
|
39
|
+
end,
|
|
40
|
+
onPristine: ->(action) do
|
|
41
|
+
action.logics_set targetId: 'hidden_dirty_state', data: { text: 'Form: pristine' }
|
|
42
|
+
end,
|
|
43
|
+
childViews: ->(form) do
|
|
44
|
+
form.panels_flow innerPadding: { bottom: 0 }, width: 'matchParent', childViews: ->(flow) do
|
|
45
|
+
flow.button text: 'Show A', onClick: ->(action) { show_panel.call(action, 'hidden_panel_a') }
|
|
46
|
+
flow.spacer width: 8
|
|
47
|
+
flow.button text: 'Show B', onClick: ->(action) { show_panel.call(action, 'hidden_panel_b') }
|
|
48
|
+
flow.spacer width: 8
|
|
49
|
+
flow.button text: 'Show C', onClick: ->(action) { show_panel.call(action, 'hidden_panel_c') }
|
|
50
|
+
end
|
|
51
|
+
form.spacer height: 8
|
|
52
|
+
|
|
53
|
+
form.panels_vertical width: 'matchParent', id: 'hidden_panel_a', submitWhenNotDisplayed: true, childViews: ->(panel) do
|
|
54
|
+
panel.label text: 'Panel A'
|
|
55
|
+
panel.fields_richText id: 'hidden_text_a', width: 'matchParent', name: 'user[text_a]', value: 'Alpha start', submitWhenNotDisplayed: true
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
form.panels_vertical width: 'matchParent', id: 'hidden_panel_b', displayed: false, submitWhenNotDisplayed: true, childViews: ->(panel) do
|
|
59
|
+
panel.label text: 'Panel B'
|
|
60
|
+
panel.fields_richText id: 'hidden_text_b', width: 'matchParent', name: 'user[text_b]', value: 'Bravo start', submitWhenNotDisplayed: true
|
|
61
|
+
panel.fields_upload \
|
|
62
|
+
id: 'hidden_upload_b',
|
|
63
|
+
name: 'user[file_b]',
|
|
64
|
+
label: 'Attach a file',
|
|
65
|
+
width: 320,
|
|
66
|
+
directUploadUrl: glib_direct_uploads_url,
|
|
67
|
+
accepts: { fileType: 'image' },
|
|
68
|
+
inputView: {},
|
|
69
|
+
submitWhenNotDisplayed: true
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
form.panels_vertical width: 'matchParent', id: 'hidden_panel_c', displayed: false, submitWhenNotDisplayed: true, childViews: ->(panel) do
|
|
73
|
+
panel.label text: 'Panel C'
|
|
74
|
+
panel.fields_richText id: 'hidden_text_c', width: 'matchParent', name: 'user[text_c]', value: 'Charlie start', submitWhenNotDisplayed: true
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
form.spacer height: 12
|
|
78
|
+
form.hr width: 'matchParent'
|
|
79
|
+
form.spacer height: 12
|
|
80
|
+
|
|
81
|
+
# A `logics_set` aimed straight at the upload (not its panel).
|
|
82
|
+
form.panels_flow innerPadding: { bottom: 0 }, width: 'matchParent', childViews: ->(flow) do
|
|
83
|
+
flow.button text: 'Hide upload', onClick: ->(action) do
|
|
84
|
+
action.logics_set targetId: 'hidden_upload_b', data: { displayed: false }
|
|
85
|
+
end
|
|
86
|
+
flow.spacer width: 8
|
|
87
|
+
flow.button text: 'Show upload', onClick: ->(action) do
|
|
88
|
+
action.logics_set targetId: 'hidden_upload_b', data: { displayed: true }
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
form.spacer height: 12
|
|
92
|
+
|
|
93
|
+
# A field declared with the flag, hidden by a `logics_set` that does
|
|
94
|
+
# not mention the flag: it must keep it, so it stays submitted.
|
|
95
|
+
form.fields_text id: 'hidden_lone_text', width: 'matchParent', name: 'user[lone]', label: 'Lone', value: 'Lone value', submitWhenNotDisplayed: true
|
|
96
|
+
form.button text: 'Hide lone', onClick: ->(action) do
|
|
97
|
+
action.logics_set targetId: 'hidden_lone_text', data: { displayed: false }
|
|
98
|
+
end
|
|
99
|
+
form.spacer height: 12
|
|
100
|
+
|
|
101
|
+
# An editor replaced in place by new content at the same position:
|
|
102
|
+
# the replacement's value must show, not the old value or old typing.
|
|
103
|
+
form.panels_vertical width: 'matchParent', id: 'hidden_swap_panel', childViews: ->(panel) do
|
|
104
|
+
panel.fields_richText width: 'matchParent', name: 'user[swap]', value: 'Before swap',
|
|
105
|
+
placeholder: 'Before placeholder', mentionList: ['Alice Before']
|
|
106
|
+
end
|
|
107
|
+
form.button text: 'Swap to new value', onClick: ->(action) do
|
|
108
|
+
action.components_replaceChildren targetId: 'hidden_swap_panel', childViews: ->(panel) do
|
|
109
|
+
panel.fields_richText width: 'matchParent', name: 'user[swap]', value: 'After swap',
|
|
110
|
+
placeholder: 'After placeholder', mentionList: ['Bob After']
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
form.button text: 'Swap to same value', onClick: ->(action) do
|
|
114
|
+
action.components_replaceChildren targetId: 'hidden_swap_panel', childViews: ->(panel) do
|
|
115
|
+
panel.fields_richText width: 'matchParent', name: 'user[swap]', value: 'Before swap',
|
|
116
|
+
placeholder: 'Before placeholder', mentionList: ['Alice Before']
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
form.spacer height: 20
|
|
121
|
+
form.fields_submit text: 'Submit'
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
@@ -16,7 +16,17 @@
|
|
|
16
16
|
`crossorigin` is required on the font origin because fonts are fetched
|
|
17
17
|
CORS-anonymously, and without it the preconnected socket is discarded.
|
|
18
18
|
Note the icons themselves are held blank until this font resolves -- see
|
|
19
|
-
Dom.hideIconsUntilFontReady in the npm package.
|
|
19
|
+
Dom.hideIconsUntilFontReady in the npm package.
|
|
20
|
+
|
|
21
|
+
The stylesheet URL deliberately has no `&display=swap`. Icons here are
|
|
22
|
+
LIGATURE TEXT, so `swap` paints the icon's NAME ("menu", "close") as
|
|
23
|
+
fallback immediately, while the default `auto`/`block` does the same
|
|
24
|
+
once its ~3s block period lapses -- neither keeps the icons correct
|
|
25
|
+
while the font is in flight. Instead we preconnect (above) to shorten
|
|
26
|
+
the handshake and let Dom.hideIconsUntilFontReady keep the icons BLANK
|
|
27
|
+
until the face actually resolves. Preconnect and font-display are
|
|
28
|
+
orthogonal: preconnect is connection setup, font-display is the
|
|
29
|
+
render-fallback policy. %>
|
|
20
30
|
<link href="//fonts.googleapis.com" rel="preconnect">
|
|
21
31
|
<link href="//fonts.gstatic.com" rel="preconnect" crossorigin>
|
|
22
32
|
<link href="//fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet">
|
|
@@ -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 |
|