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,12 @@
|
|
|
1
|
+
# Locals: view, link_class. The blog's home, then its top categories; each theme names the home.
|
|
2
|
+
home = controller_name == 'posts' && action_name == 'index'
|
|
3
|
+
links = [[glib_blog_theme_t('home'), root_url, home]]
|
|
4
|
+
glib_blog_nav_categories.each do |category|
|
|
5
|
+
links << [category.name, category_url(category.slug), category == glib_blog_active_category]
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
links.each do |text, url, active|
|
|
9
|
+
view.label text: text, styleClasses: [link_class, *("#{link_class}--active" if active)], onClick: ->(action) do
|
|
10
|
+
action.windows_open url: url
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Locals: view.
|
|
2
|
+
setting = Glib::Blog::Setting.current
|
|
3
|
+
|
|
4
|
+
view.panels_vertical styleClasses: ['blog-brand'], onClick: ->(action) { action.windows_open url: root_url }, childViews: ->(brand) do
|
|
5
|
+
if (logo = setting.logo_media_item)
|
|
6
|
+
brand.image url: logo.url(:thumb), alt: '', width: 32, height: 32, styleClasses: ['blog-brand__logo']
|
|
7
|
+
else
|
|
8
|
+
brand.label text: setting.title.first, styleClasses: ['blog-brand__logo']
|
|
9
|
+
end
|
|
10
|
+
brand.label text: setting.title, styleClasses: ['blog-brand__name']
|
|
11
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Locals: view, post. A post's card in a grid; the caller makes it a link.
|
|
2
|
+
if post.cover_media_item
|
|
3
|
+
view.image url: post.cover_media_item.url(:medium), alt: post.cover_media_item.alt_text.to_s, styleClasses: ['blog-cover']
|
|
4
|
+
else
|
|
5
|
+
view.panels_vertical styleClasses: ['blog-cover', 'blog-cover--empty']
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
view.panels_vertical styleClasses: ['blog-meta'], childViews: ->(meta) do
|
|
9
|
+
meta.label text: post.category.name, styleClasses: ['blog-meta__category'] if post.category
|
|
10
|
+
meta.label text: t('.reading_time', minutes: post.reading_time)
|
|
11
|
+
end
|
|
12
|
+
view.h3 text: post.title, styleClasses: ['blog-card__title']
|
|
13
|
+
view.p text: post.excerpt, styleClasses: ['blog-card__excerpt'] if post.excerpt.present?
|
|
14
|
+
view.label text: t('.byline', author: post.author.display_name, date: l(post.published_at.to_date, format: :long)),
|
|
15
|
+
styleClasses: ['blog-card__byline']
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Locals: view, post.
|
|
2
|
+
view.panels_vertical styleClasses: ['blog-featured'], onClick: ->(action) { action.windows_open url: post_url(post.slug) }, childViews: ->(featured) do
|
|
3
|
+
if post.cover_media_item
|
|
4
|
+
featured.image url: post.cover_media_item.url(:large), alt: post.cover_media_item.alt_text.to_s, styleClasses: ['blog-cover', 'blog-featured__cover']
|
|
5
|
+
else
|
|
6
|
+
featured.panels_vertical styleClasses: ['blog-cover', 'blog-cover--empty', 'blog-featured__cover']
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
featured.panels_vertical styleClasses: ['blog-featured__text'], childViews: ->(text) do
|
|
10
|
+
text.panels_vertical styleClasses: ['blog-meta'], childViews: ->(meta) do
|
|
11
|
+
meta.label text: t('.featured'), styleClasses: ['blog-pill']
|
|
12
|
+
meta.label text: post.category.name, styleClasses: ['blog-meta__category'] if post.category
|
|
13
|
+
end
|
|
14
|
+
text.h2 text: post.title, styleClasses: ['blog-featured__title']
|
|
15
|
+
text.p text: post.excerpt, styleClasses: ['blog-featured__excerpt'] if post.excerpt.present?
|
|
16
|
+
text.panels_vertical styleClasses: ['blog-byline'], childViews: ->(byline) do
|
|
17
|
+
byline.label text: post.author.initials, styleClasses: ['blog-avatar']
|
|
18
|
+
byline.label text: t('.byline', author: post.author.display_name, date: l(post.published_at.to_date, format: :long),
|
|
19
|
+
minutes: post.reading_time)
|
|
20
|
+
end
|
|
21
|
+
text.label text: t('.read'), styleClasses: ['blog-featured__read']
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Locals: view.
|
|
2
|
+
setting = Glib::Blog::Setting.current
|
|
3
|
+
|
|
4
|
+
view.panels_vertical width: 'matchParent', styleClasses: ['blog-footer'], childViews: ->(footer) do
|
|
5
|
+
footer.panels_vertical styleClasses: ['blog-container', 'blog-footer__inner'], childViews: ->(inner) do
|
|
6
|
+
inner.panels_vertical styleClasses: ['blog-footer__about'], childViews: ->(about) do
|
|
7
|
+
render glib_blog_theme_partial('brand'), json: json, view: about
|
|
8
|
+
about.p text: setting.tagline if setting.tagline.present?
|
|
9
|
+
end
|
|
10
|
+
inner.panels_vertical styleClasses: ['blog-footer__nav'], childViews: ->(nav) do
|
|
11
|
+
render 'glib/blog/themes/nav_links', json: json, view: nav, link_class: 'blog-footer__link'
|
|
12
|
+
end
|
|
13
|
+
inner.label text: t('.copyright', year: Date.current.year, title: setting.title), styleClasses: ['blog-footer__copyright']
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Locals: view.
|
|
2
|
+
view.panels_vertical width: 'matchParent', styleClasses: ['blog-header'], childViews: ->(header) do
|
|
3
|
+
header.panels_vertical styleClasses: ['blog-container', 'blog-header__inner'], childViews: ->(bar) do
|
|
4
|
+
render glib_blog_theme_partial('brand'), json: json, view: bar
|
|
5
|
+
bar.panels_vertical styleClasses: ['blog-nav'], childViews: ->(nav) do
|
|
6
|
+
render 'glib/blog/themes/nav_links', json: json, view: nav, link_class: 'blog-nav__link'
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Locals: view.
|
|
2
|
+
post = @post
|
|
3
|
+
body_html, headings = glib_blog_post_sections(post)
|
|
4
|
+
author_link = ->(action) { action.windows_open url: author_url(post.author.slug) }
|
|
5
|
+
|
|
6
|
+
view.panels_vertical width: 'matchParent', styleClasses: ['blog-container', 'blog-article-head'], childViews: ->(head) do
|
|
7
|
+
head.panels_vertical styleClasses: ['blog-breadcrumb'], childViews: ->(crumbs) do
|
|
8
|
+
crumbs.label text: t('.all_articles'), onClick: ->(action) { action.windows_open url: root_url }
|
|
9
|
+
if post.category
|
|
10
|
+
crumbs.label text: '/', styleClasses: ['blog-breadcrumb__separator']
|
|
11
|
+
crumbs.label text: post.category.name, onClick: ->(action) { action.windows_open url: category_url(post.category.slug) }
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
head.panels_vertical styleClasses: ['blog-article-head__text'], childViews: ->(text) do
|
|
16
|
+
text.label text: post.category.name, styleClasses: ['blog-kicker'] if post.category
|
|
17
|
+
text.h1 text: post.title
|
|
18
|
+
text.p text: post.excerpt, styleClasses: ['blog-article-head__excerpt'] if post.excerpt.present?
|
|
19
|
+
|
|
20
|
+
text.panels_vertical styleClasses: ['blog-article-head__meta'], childViews: ->(meta) do
|
|
21
|
+
meta.panels_vertical styleClasses: ['blog-byline'], childViews: ->(byline) do
|
|
22
|
+
byline.label text: post.author.initials, styleClasses: ['blog-avatar', 'blog-avatar--large']
|
|
23
|
+
byline.panels_vertical childViews: ->(who) do
|
|
24
|
+
who.label text: post.author.display_name, styleClasses: ['blog-byline__name'], onClick: author_link
|
|
25
|
+
who.label text: t('.date_and_time', date: l(post.published_at.to_date, format: :long), minutes: post.reading_time)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
meta.button text: t('.copy_link'), icon: 'link', styleClasses: ['outlined', 'blog-button'], onClick: ->(action) do
|
|
29
|
+
action.commands_copy text: @post_page_url, onCopy: ->(subaction) do
|
|
30
|
+
subaction.snackbars_alert message: t('.copied')
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
if (cover = post.cover_media_item)
|
|
37
|
+
head.panels_vertical styleClasses: ['blog-figure'], childViews: ->(figure) do
|
|
38
|
+
figure.image url: cover.url(:large), alt: cover.alt_text.to_s, styleClasses: ['blog-cover', 'blog-cover--wide']
|
|
39
|
+
caption = glib_blog_media_caption(cover)
|
|
40
|
+
figure.label text: caption, styleClasses: ['blog-figure__caption'] if caption
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
view.panels_vertical width: 'matchParent', styleClasses: ['blog-container', 'blog-article-columns'], childViews: ->(columns) do
|
|
46
|
+
columns.panels_vertical styleClasses: ['blog-article'], childViews: ->(article) do
|
|
47
|
+
# Already rendered by Action Text, which sanitized it; the view only shows it.
|
|
48
|
+
article.actionText richText: body_html, styleClasses: ['blog-body']
|
|
49
|
+
|
|
50
|
+
if post.tags.any?
|
|
51
|
+
article.panels_vertical styleClasses: ['blog-tags'], childViews: ->(tags) do
|
|
52
|
+
post.tags.each do |tag|
|
|
53
|
+
tags.label text: "##{tag.slug}", styleClasses: ['blog-tag'], onClick: ->(action) { action.windows_open url: tag_url(tag.slug) }
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
article.panels_vertical styleClasses: ['blog-author-box'], childViews: ->(box) do
|
|
59
|
+
box.label text: post.author.initials, styleClasses: ['blog-avatar', 'blog-avatar--xlarge']
|
|
60
|
+
box.panels_vertical styleClasses: ['blog-author-box__text'], childViews: ->(text) do
|
|
61
|
+
text.label text: t('.written_by'), styleClasses: ['blog-author-box__label']
|
|
62
|
+
text.label text: post.author.display_name, styleClasses: ['blog-author-box__name']
|
|
63
|
+
text.p text: post.author.bio if post.author.bio.present?
|
|
64
|
+
text.label text: t('.more_from', name: post.author.display_name), styleClasses: ['blog-link'], onClick: author_link
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
columns.panels_vertical styleClasses: ['blog-toc'], childViews: ->(toc) do
|
|
70
|
+
toc.label text: t('.on_this_page'), styleClasses: ['blog-toc__title']
|
|
71
|
+
headings.each do |heading|
|
|
72
|
+
toc.label text: heading[:text], styleClasses: ['blog-toc__link'], onClick: ->(action) do
|
|
73
|
+
action.panels_scrollTo viewId: heading[:id], placement: 'top', animate: true
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
toc.label text: t('.comments', count: post.comments_count), styleClasses: ['blog-toc__link'], onClick: ->(action) do
|
|
77
|
+
action.panels_scrollTo viewId: 'comments', placement: 'top', animate: true
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
view.panels_vertical id: 'comments', width: 'matchParent', styleClasses: ['blog-container', 'blog-comments'], childViews: ->(comments) do
|
|
83
|
+
render 'glib/blog/posts/comments', json: json, view: comments
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
related = @related_posts.to_a
|
|
87
|
+
if related.any?
|
|
88
|
+
view.panels_vertical width: 'matchParent', styleClasses: ['blog-container', 'blog-related'], childViews: ->(section) do
|
|
89
|
+
section.h2 text: t('.keep_reading')
|
|
90
|
+
section.panels_vertical styleClasses: ['blog-related__grid'], childViews: ->(grid) do
|
|
91
|
+
related.each do |other|
|
|
92
|
+
grid.panels_vertical styleClasses: ['blog-card'], onClick: ->(action) { action.windows_open url: post_url(other.slug) }, childViews: ->(card) do
|
|
93
|
+
render glib_blog_theme_partial('card'), json: json, view: card, post: other
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Locals: view, posts, next_page, heading, kicker, description.
|
|
2
|
+
active = glib_blog_active_category
|
|
3
|
+
index = controller_name == 'posts'
|
|
4
|
+
|
|
5
|
+
view.panels_vertical width: 'matchParent', styleClasses: ['blog-container', 'blog-main'], childViews: ->(main) do
|
|
6
|
+
main.panels_vertical styleClasses: ['blog-intro'], childViews: ->(intro) do
|
|
7
|
+
intro.label text: kicker, styleClasses: ['blog-kicker'] if kicker
|
|
8
|
+
intro.h1 text: heading
|
|
9
|
+
intro.p text: description if description.present?
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
render glib_blog_theme_partial('featured'), json: json, view: main, post: @featured_post if @featured_post
|
|
13
|
+
|
|
14
|
+
next if posts.empty? && @featured_post
|
|
15
|
+
|
|
16
|
+
main.panels_vertical styleClasses: ['blog-latest'], childViews: ->(latest) do
|
|
17
|
+
latest.panels_vertical styleClasses: ['blog-latest__header'], childViews: ->(bar) do
|
|
18
|
+
bar.h2 text: index ? t('.latest') : t('.posts')
|
|
19
|
+
|
|
20
|
+
if glib_blog_top_categories.any?
|
|
21
|
+
bar.panels_vertical styleClasses: ['blog-topics'], childViews: ->(topics) do
|
|
22
|
+
chips = [[t('.all'), root_url, index]] + glib_blog_top_categories.map { |category| [category.name, category_url(category.slug), category == active] }
|
|
23
|
+
chips.each do |text, url, current|
|
|
24
|
+
topics.label text: text, styleClasses: ['blog-topic', *('blog-topic--active' if current)], onClick: ->(action) do
|
|
25
|
+
action.windows_open url: url
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
if posts.empty?
|
|
33
|
+
latest.label text: t('.empty'), styleClasses: ['blog-empty']
|
|
34
|
+
else
|
|
35
|
+
latest.panels_list width: 'matchParent', styleClasses: ['blog-cards'], nextPage: next_page, firstSection: ->(section) do
|
|
36
|
+
render glib_blog_theme_partial('post_rows'), json: json, section: section, posts: posts
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Locals: section, posts. Each row is a card; the list's rows are laid out as a grid.
|
|
2
|
+
section.rows builder: ->(template) do
|
|
3
|
+
posts.each do |post|
|
|
4
|
+
template.thumbnail styleClasses: ['blog-card'], onClick: ->(action) { action.windows_open url: post_url(post.slug) }, content: ->(content) do
|
|
5
|
+
content.header childViews: ->(card) do
|
|
6
|
+
render glib_blog_theme_partial('card'), json: json, view: card, post: post
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Locals: view.
|
|
2
|
+
setting = Glib::Blog::Setting.current
|
|
3
|
+
|
|
4
|
+
view.panels_vertical width: 'matchParent', styleClasses: ['blog-footer'], childViews: ->(footer) do
|
|
5
|
+
footer.panels_vertical styleClasses: ['blog-container', 'blog-footer__inner'], childViews: ->(inner) do
|
|
6
|
+
inner.panels_vertical styleClasses: ['blog-footer__about'], childViews: ->(about) do
|
|
7
|
+
about.label text: setting.title, styleClasses: ['blog-footer__title']
|
|
8
|
+
about.p text: setting.tagline if setting.tagline.present?
|
|
9
|
+
end
|
|
10
|
+
inner.panels_vertical styleClasses: ['blog-footer__nav'], childViews: ->(nav) do
|
|
11
|
+
render 'glib/blog/themes/nav_links', json: json, view: nav, link_class: 'blog-footer__link'
|
|
12
|
+
end
|
|
13
|
+
inner.label text: t('.copyright', year: Date.current.year, title: setting.title), styleClasses: ['blog-footer__copyright']
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Locals: view. On the blog's home it sits on the hero, which the stylesheet handles.
|
|
2
|
+
setting = Glib::Blog::Setting.current
|
|
3
|
+
|
|
4
|
+
view.panels_vertical width: 'matchParent', styleClasses: ['blog-header'], childViews: ->(header) do
|
|
5
|
+
header.panels_vertical styleClasses: ['blog-container', 'blog-header__inner'], childViews: ->(bar) do
|
|
6
|
+
bar.label text: setting.title, styleClasses: ['blog-brand'], onClick: ->(action) { action.windows_open url: root_url }
|
|
7
|
+
bar.panels_vertical styleClasses: ['blog-nav'], childViews: ->(nav) do
|
|
8
|
+
render 'glib/blog/themes/nav_links', json: json, view: nav, link_class: 'blog-nav__link'
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Locals: view.
|
|
2
|
+
post = @post
|
|
3
|
+
previous_post = @previous_posts.first
|
|
4
|
+
|
|
5
|
+
view.panels_vertical width: 'matchParent', styleClasses: ['blog-container', 'blog-main'], childViews: ->(main) do
|
|
6
|
+
main.panels_vertical styleClasses: ['blog-margin'], childViews: ->(margin) do
|
|
7
|
+
margin.label text: t('.journal'), styleClasses: ['blog-seal'], onClick: ->(action) { action.windows_open url: root_url }
|
|
8
|
+
if post.category
|
|
9
|
+
margin.label text: post.category.name, styleClasses: ['blog-seal__caption'], onClick: ->(action) do
|
|
10
|
+
action.windows_open url: category_url(post.category.slug)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
main.panels_vertical styleClasses: ['blog-entry__body'], childViews: ->(entry) do
|
|
16
|
+
entry.label text: l(post.published_at.to_date, format: glib_blog_theme_t('date_format')), styleClasses: ['blog-date']
|
|
17
|
+
|
|
18
|
+
entry.panels_vertical styleClasses: ['blog-entry__text', 'blog-article'], childViews: ->(article) do
|
|
19
|
+
if (cover = post.cover_media_item)
|
|
20
|
+
article.image url: cover.url(:large), alt: cover.alt_text.to_s, styleClasses: ['blog-cover']
|
|
21
|
+
caption = glib_blog_media_caption(cover)
|
|
22
|
+
article.label text: caption, styleClasses: ['blog-figure__caption'] if caption
|
|
23
|
+
end
|
|
24
|
+
article.h1 text: post.title, styleClasses: ['blog-article__title']
|
|
25
|
+
article.label text: t('.byline', author: post.author.display_name, minutes: post.reading_time), styleClasses: ['blog-article__byline'],
|
|
26
|
+
onClick: ->(action) { action.windows_open url: author_url(post.author.slug) }
|
|
27
|
+
article.actionText richText: post.body, styleClasses: ['blog-body']
|
|
28
|
+
|
|
29
|
+
if post.tags.any?
|
|
30
|
+
article.panels_vertical styleClasses: ['blog-tags'], childViews: ->(tags) do
|
|
31
|
+
post.tags.each do |tag|
|
|
32
|
+
tags.label text: tag.name, styleClasses: ['blog-tag'], onClick: ->(action) { action.windows_open url: tag_url(tag.slug) }
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
article.panels_vertical styleClasses: ['blog-share'], childViews: ->(share) do
|
|
38
|
+
share.label text: t('.share'), styleClasses: ['blog-share__label']
|
|
39
|
+
share.button text: t('.copy_link'), styleClasses: ['outlined', 'blog-button'], onClick: ->(action) do
|
|
40
|
+
action.commands_copy text: @post_page_url, onCopy: ->(subaction) do
|
|
41
|
+
subaction.snackbars_alert message: t('.copied')
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
article.panels_vertical styleClasses: ['blog-comments'], childViews: ->(comments) do
|
|
47
|
+
render 'glib/blog/posts/comments', json: json, view: comments
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
article.panels_vertical styleClasses: ['blog-pager'], childViews: ->(pager) do
|
|
51
|
+
if previous_post
|
|
52
|
+
pager.panels_vertical styleClasses: ['blog-pager__previous'], onClick: ->(action) { action.windows_open url: post_url(previous_post.slug) },
|
|
53
|
+
childViews: ->(link) do
|
|
54
|
+
link.label text: t('.previous'), styleClasses: ['blog-pager__label']
|
|
55
|
+
link.label text: previous_post.title, styleClasses: ['blog-pager__title']
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
pager.label text: t('.all_posts'), styleClasses: ['blog-pager__all'], onClick: ->(action) { action.windows_open url: root_url }
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Locals: view, posts, next_page, heading, kicker, description.
|
|
2
|
+
# The featured post leads the list instead of standing apart.
|
|
3
|
+
posts = [@featured_post, *posts] if @featured_post
|
|
4
|
+
|
|
5
|
+
view.panels_vertical width: 'matchParent', styleClasses: ['blog-hero', *('blog-hero--compact' if kicker)], childViews: ->(hero) do
|
|
6
|
+
hero.label text: kicker, styleClasses: ['blog-kicker'] if kicker
|
|
7
|
+
hero.h1 text: heading
|
|
8
|
+
hero.panels_vertical styleClasses: ['blog-hero__rule']
|
|
9
|
+
hero.p text: description if description.present?
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
view.panels_vertical width: 'matchParent', styleClasses: ['blog-container', 'blog-main'], childViews: ->(main) do
|
|
13
|
+
main.panels_vertical styleClasses: ['blog-margin'], childViews: ->(margin) do
|
|
14
|
+
margin.label text: t('.latest'), styleClasses: ['blog-seal']
|
|
15
|
+
margin.label text: t('.posts'), styleClasses: ['blog-seal__caption']
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
if posts.empty?
|
|
19
|
+
main.label text: t('.empty'), styleClasses: ['blog-empty']
|
|
20
|
+
else
|
|
21
|
+
main.panels_list width: 'matchParent', styleClasses: ['blog-entries'], nextPage: next_page, firstSection: ->(section) do
|
|
22
|
+
render glib_blog_theme_partial('post_rows'), json: json, section: section, posts: posts
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Locals: section, posts. Each row is an entry dated in the margin.
|
|
2
|
+
section.rows builder: ->(template) do
|
|
3
|
+
posts.each do |post|
|
|
4
|
+
template.thumbnail styleClasses: ['blog-entry'], onClick: ->(action) { action.windows_open url: post_url(post.slug) }, content: ->(content) do
|
|
5
|
+
content.header childViews: ->(entry) do
|
|
6
|
+
entry.label text: l(post.published_at.to_date, format: glib_blog_theme_t('date_format')), styleClasses: ['blog-date']
|
|
7
|
+
entry.panels_vertical styleClasses: ['blog-entry__text'], childViews: ->(text) do
|
|
8
|
+
if (cover = post.cover_media_item)
|
|
9
|
+
text.image url: cover.url(:large), alt: cover.alt_text.to_s, styleClasses: ['blog-cover']
|
|
10
|
+
end
|
|
11
|
+
text.h2 text: post.title, styleClasses: ['blog-entry__title']
|
|
12
|
+
text.p text: post.excerpt, styleClasses: ['blog-entry__excerpt'] if post.excerpt.present?
|
|
13
|
+
text.label text: t('.read_more'), styleClasses: ['blog-entry__more']
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|