spina-conferences-primer_theme-fork 0.8.0 → 0.9.2

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.
Files changed (22) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spina/conferences/primer_theme/blog/application_controller.rb +22 -0
  3. data/app/controllers/spina/conferences/primer_theme/blog/categories_controller.rb +51 -0
  4. data/app/controllers/spina/conferences/primer_theme/blog/posts_controller.rb +90 -0
  5. data/app/controllers/spina/conferences/primer_theme/conferences/conferences_controller.rb +1 -1
  6. data/app/views/conferences_primer_theme/pages/homepage.html.haml +6 -6
  7. data/app/views/layouts/spina/conferences/primer_theme/blog/blog.html.haml +5 -0
  8. data/app/views/spina/application/_mobile_navigation_items.html.haml +1 -0
  9. data/app/views/spina/application/_navigation.html.haml +1 -0
  10. data/app/views/spina/conferences/primer_theme/blog/categories/show.html.haml +12 -0
  11. data/app/views/spina/conferences/primer_theme/blog/posts/_post.html.haml +10 -0
  12. data/app/views/spina/conferences/primer_theme/blog/posts/archive.html.haml +5 -0
  13. data/app/views/spina/conferences/primer_theme/blog/posts/index.atom.builder +19 -0
  14. data/app/views/spina/conferences/primer_theme/blog/posts/index.html.haml +11 -0
  15. data/app/views/spina/conferences/primer_theme/blog/posts/show.html.haml +17 -0
  16. data/app/views/spina/conferences/primer_theme/blog/shared/_sidebar.html.haml +10 -0
  17. data/config/initializers/themes/conferences_primer_theme.rb +1 -1
  18. data/config/locales/en.yml +14 -0
  19. data/config/routes.rb +14 -0
  20. data/lib/spina/conferences/primer_theme/version.rb +1 -1
  21. data/lib/spina/conferences/primer_theme.rb +1 -0
  22. metadata +28 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49f472da2c641da3e9b2447dcf6d4cc9d10f15a374024eead49056e0ea430a5b
4
- data.tar.gz: 5e6d9caf62a78d896a05d61199ddbf4ab39e8c1f71788880a0fdc646d9fc2a3c
3
+ metadata.gz: e6b6d06ee9207f434033dd3f7e10d6483eee02cf4ff6805173ee5e2cc9c5a3ca
4
+ data.tar.gz: 82eaa180f742952c42063ff93af5029e8c7d7f9f228a1b0fc988d5626a4229ec
5
5
  SHA512:
6
- metadata.gz: e053a5dc58adeb0a695d424441a46593c8a0eff9c387a0da1a3485616ac275cde4741ffaaa252d62a0f0d20218bbcac487a46c96fc71093df54a2bae37d9c84e
7
- data.tar.gz: 28f300ad55d0f0aa33294dcf3f7d6671e9f0536da82ec42f522439a2745ca947dccc6992164993bded4a5a56e68ac3e5535a4ba31b84e91c8c3679a6bcd3d4f9
6
+ metadata.gz: e716d4b2ac643c7b2567e35412c38972cc9bac0e0b8b0de7e98855c47fc12e431c254b796a39fd2443e85f0e26c057ef0f1a9b9178a3ea119b53053e706af015
7
+ data.tar.gz: 6bd91a854364edaab284316bb496ade61b4ecd14a644f4b01e665d13c94b4b0c3dfadbae15d7021ec41aafa5cee4eba163cd0c1e8e6ba1c4aa678c48890f1984
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Conferences
5
+ module PrimerTheme
6
+ module Blog
7
+ class ApplicationController < ::Spina::ApplicationController
8
+ include ::Spina::Frontend
9
+ def cookies_info
10
+ render partial: 'cookies'
11
+ end
12
+
13
+ protected
14
+
15
+ def theme_layout
16
+ 'layouts/spina/conferences/primer_theme/blog/blog'
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Conferences
5
+ module PrimerTheme
6
+ module Blog
7
+ # Spina::Blog::CategoriesController
8
+ class CategoriesController < ApplicationController
9
+ include ::Spina::Frontend
10
+
11
+ before_action :page
12
+ before_action :category
13
+ before_action :posts
14
+ before_action :set_breadcrumb, only: :show
15
+ before_action :set_metadata
16
+
17
+ def show
18
+ add_breadcrumb t('.category', name: @category.name)
19
+ render layout: theme_layout
20
+ end
21
+
22
+ private
23
+
24
+ def category
25
+ @category = Spina::Admin::Conferences::Blog::Category.friendly.find params[:id]
26
+ end
27
+
28
+ def posts
29
+ @posts = @category.posts.available.live.order(published_at: :desc)
30
+ .page(params[:page])
31
+ end
32
+
33
+ def page
34
+ @page = Spina::Page.find_or_create_by name: 'blog' do |page|
35
+ page.link_url = '/blog'
36
+ page.deletable = false
37
+ end
38
+ end
39
+
40
+ def set_breadcrumb
41
+ add_breadcrumb 'Blog', frontend_blog_root_path
42
+ end
43
+
44
+ def set_metadata
45
+ @title = @category.name
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Conferences
5
+ module PrimerTheme
6
+ module Blog
7
+ # Spina::Blog::PostsController
8
+ class PostsController < ApplicationController
9
+ include ::Spina::Frontend
10
+
11
+ before_action :find_posts, only: [:index]
12
+ before_action :current_spina_user_can_view_page?
13
+ before_action :set_breadcrumb, only: :show
14
+
15
+ decorates_assigned :posts, :post
16
+
17
+ def index
18
+ @posts = @posts.unscope(where: :draft) if current_spina_user&.admin?
19
+
20
+ @title = t('.blog')
21
+
22
+ respond_to do |format|
23
+ format.atom
24
+ format.html { render layout: theme_layout }
25
+ end
26
+ end
27
+
28
+ def show
29
+ @post = Spina::Admin::Conferences::Blog::Post.friendly.find params[:id]
30
+ set_metadata
31
+ add_breadcrumb @post.title
32
+ render layout: theme_layout
33
+ rescue ActiveRecord::RecordNotFound
34
+ try_redirect
35
+ end
36
+
37
+ def archive
38
+ @posts = Spina::Admin::Conferences::Blog::Post.live
39
+ .where(published_at: start_date..end_date)
40
+ .order(published_at: :desc)
41
+ .page(params[:page])
42
+
43
+ render layout: theme_layout
44
+ end
45
+
46
+ private
47
+
48
+ def start_date
49
+ Time.zone.local(params[:year].to_i, (params[:month] || 1).to_i)
50
+ end
51
+
52
+ def end_date
53
+ start_date.end_of_year
54
+ end
55
+
56
+ def page
57
+ @page ||= Spina::Page.find_or_create_by name: 'blog' do |page|
58
+ page.title = 'Blog'
59
+ page.link_url = '/blog'
60
+ page.deletable = false
61
+ end
62
+ end
63
+
64
+ def find_posts
65
+ @posts = Spina::Admin::Conferences::Blog::Post.available.live.order(published_at: :desc)
66
+ .page(params[:page])
67
+ end
68
+
69
+ def try_redirect
70
+ rule = RewriteRule.find_by!(old_path: "/blog/posts/#{params[:id]}")
71
+ redirect_to rule.new_path, status: :moved_permanently
72
+ end
73
+
74
+ def current_spina_user_can_view_page?
75
+ raise ActiveRecord::RecordNotFound unless current_spina_user.present? || page.live?
76
+ end
77
+
78
+ def set_breadcrumb
79
+ add_breadcrumb 'Blog', frontend_blog_root_path
80
+ end
81
+
82
+ def set_metadata
83
+ @title = @post.seo_title.blank? ? @post.title : @post.seo_title
84
+ @description = @post.description
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -58,7 +58,7 @@ module Spina
58
58
  end
59
59
 
60
60
  def set_breadcrumb
61
- add_breadcrumb Admin::Conferences::Conference.model_name.human.pluralize, frontend_conferences_path
61
+ add_breadcrumb 'Blog', frontend_conferences_path
62
62
  end
63
63
 
64
64
  def set_metadata
@@ -4,13 +4,13 @@
4
4
  = render Primer::BoxComponent.new(position: :absolute, top: false, left: false, right: false, bottom: false,
5
5
  style: 'background-color: #057fab; z-index: 0')
6
6
  - if content(:carousel).present?
7
- %div{data: { controller: :slideshow, slideshow_incrementer: 0, slideshow_advance: true, slideshow_delay: 20000 }}
7
+ .height-full.d-flex.flex-column.flex-justify-between{data: { controller: :slideshow, slideshow_incrementer: 0, slideshow_advance: true, slideshow_delay: 20000} }
8
8
  - content(:carousel).each_with_index do |carousel_item, index|
9
9
  = render partial: 'conferences_primer_theme/partials/homepage_item', locals: { item: carousel_item }
10
- .position-absolute.top-0.left-0.right-0.bottom-0.container-xl.p-responsive{ style: 'z-index: 2' }
11
- - if content(:carousel).many?
12
- .d-flex.flex-justify-between.flex-items-center.height-full
13
- = render Primer::ButtonComponent.new(data: { action: :'slideshow#previous' }) do
10
+ - if content(:carousel).many?
11
+ .container-lg.height-full.d-flex.flex-column-reverse.mb-8{ style: 'z-index: 5' }
12
+ = render(Primer::ButtonGroupComponent.new) do |component|
13
+ = component.button(data: { action: :'slideshow#previous' }) do
14
14
  = render Primer::OcticonComponent.new('arrow-left')
15
- = render Primer::ButtonComponent.new(data: { action: :'slideshow#next' }) do
15
+ = component.button(data: { action: :'slideshow#next' }) do
16
16
  = render Primer::OcticonComponent.new('arrow-right')
@@ -0,0 +1,5 @@
1
+ - content_for :breadcrumbs do
2
+ = render_breadcrumbs(builder: Spina::Conferences::PrimerTheme::Breadcrumbs::Builder)
3
+
4
+ = render template: 'layouts/spina/conferences/primer_theme/application',
5
+ locals: { author: current_account.name, description: @description, title: @title, seo_title: @title }
@@ -1,4 +1,5 @@
1
1
  %nav.d-flex.flex-column.flex-self-stretch
2
2
  = render partial: 'mobile_navigation_item', collection: main_navigation_items, as: :navigation_item, cache: -> navigation_item { [navigation_item, navigation_item.children] }
3
+ .Header-item.mr-0.border-top.border-white-fade-15= link_to 'Blog', frontend_blog_root_path, class: %w[Header-link py-2 py-lg-0]
3
4
  .Header-item.mr-0.border-top.border-white-fade-15= link_to 'Journal', frontend_issues_path, class: %w[Header-link py-2 py-lg-0]
4
5
  .Header-item.mr-0.border-top.border-white-fade-15= link_to 'Conferences', frontend_conferences_path, class: %w[Header-link py-2 py-lg-0]
@@ -7,5 +7,6 @@
7
7
  .Header-item.Header-item--full.flex-column.width-full.flex-order-1.mr-0.mt-3
8
8
  = render partial: 'mobile_navigation_items'
9
9
  = render partial: 'navigation_item', collection: main_navigation_items, cache: -> navigation_item { [navigation_item, navigation_item.children] }
10
+ .Header-item.d-none.d-lg-flex= link_to 'Blog', frontend_blog_root_path, class: %w[Header-link]
10
11
  .Header-item.d-none.d-lg-flex= link_to 'Journal', frontend_issues_path, class: %w[Header-link]
11
12
  .Header-item.d-none.d-lg-flex= link_to 'Conferences', frontend_conferences_path, class: %w[Header-link]
@@ -0,0 +1,12 @@
1
+ = render(Primer::HeadingComponent.new) do
2
+ Blog
3
+ = render(Primer::HeadingComponent.new(tag: :h2)) do
4
+ = t '.category', name: @category.name
5
+
6
+ = render(Primer::FlexComponent.new(flex: :auto, direction: [:column, nil, :row, nil])) do
7
+ = render(Primer::FlexItemComponent.new(flex_auto: true)) do
8
+ - if @posts.any?
9
+ %ul= render collection: @posts, partial: 'spina/conferences/primer_theme/blog/posts/post', layout: 'list_item', cached: true
10
+ - else
11
+ = render Primer::BlankslateComponent.new(title: t(:'.no_posts'), icon: 'mortar-board')
12
+ = render 'spina/conferences/primer_theme/blog/shared/sidebar'
@@ -0,0 +1,10 @@
1
+ -#%li{class: dom_class(post), id: dom_id(post)}
2
+
3
+ = render(Primer::HeadingComponent.new(tag: :h3, mb: 1)) do
4
+ = link_to post.title, frontend_blog_post_path(post)
5
+ = render(Primer::HeadingComponent.new(tag: :h4)) do
6
+ = time_tag post.published_at, format: :ordinal_datetime_with_year
7
+ = render(Primer::MarkdownComponent.new(color: :text_secondary)) do
8
+ = post.excerpt.html_safe
9
+ = render(Primer::TextComponent.new(tag: :div, color: :text_secondary)) do
10
+ = t '.category_html', name: link_to(post.category.name, frontend_blog_category_path(post.category))
@@ -0,0 +1,5 @@
1
+ %h1
2
+ Blog Archive
3
+ %small= formatted_date(params[:year], params[:month])
4
+
5
+ %ul.posts= render @posts
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ atom_feed language: 'en-GB', url: spina.frontend_blog_root_url do |feed|
4
+ feed.title('Blog')
5
+ feed.updated(@posts[0].created_at) unless @posts.empty?
6
+
7
+ @posts.each do |post|
8
+ feed.entry(post, published: post.published_at, url: spina.frontend_blog_post_url(post)) do |entry|
9
+ entry.title(post.title)
10
+ entry.content(post.content, type: 'html')
11
+
12
+ if post.user
13
+ entry.author do |author|
14
+ author.name(post.user.name)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ = render(Primer::HeadingComponent.new) do
2
+ Blog
3
+
4
+ = render(Primer::FlexComponent.new(flex: :auto, direction: [:column, nil, :row, nil])) do
5
+ = render(Primer::FlexItemComponent.new(flex_auto: true)) do
6
+ - if @posts.any?
7
+ %ul= render collection: @posts, partial: 'post', layout: 'list_item', cached: true
8
+ - else
9
+ = render Primer::BlankslateComponent.new(title: t(:'.no_posts'), icon: 'mortar-board')
10
+ = render 'spina/conferences/primer_theme/blog/shared/sidebar'
11
+
@@ -0,0 +1,17 @@
1
+ = render(Primer::HeadingComponent.new) do
2
+ = @post.title
3
+
4
+ %ul.list-style-none.d-flex.flex-column.flex-sm-row.my-2
5
+ = render(Primer::FlexComponent.new(tag: :li, mr: 4, align_items: :center)) do
6
+ = render(Primer::FlexItemComponent.new(mr: 2)) do
7
+ = render(Primer::OcticonComponent.new('person'))
8
+ = render(Primer::FlexComponent.new(tag: :address, direction: :column)) do
9
+ = render(Primer::TextComponent.new(tag: :div, font_weight: :bold)) { @post.user.name }
10
+
11
+ - if @post.image
12
+ = image_tag main_app.url_for(@post.image.file)
13
+
14
+ = render(Primer::FlexComponent.new(flex: :auto, direction: [:column, nil, :row, nil])) do
15
+ = render(Primer::FlexItemComponent.new(flex_auto: true)) do
16
+ = render(Primer::MarkdownComponent.new(tag: :article)) do
17
+ = @post.content.html_safe
@@ -0,0 +1,10 @@
1
+ = render(Primer::BorderBoxComponent.new(ml: [nil, nil, 4, nil], style: 'min-width: 15vw;')) do |sidebar|
2
+ - sidebar.header do
3
+ = render(Primer::HeadingComponent.new(tag: :h3)) do
4
+ = t '.categories'
5
+ - sidebar.row do
6
+ = render(Primer::MarkdownComponent.new(tag: :div, font_weight: :bold)) do
7
+ %ul
8
+ - Spina::Admin::Conferences::Blog::Category.all.each do |cat|
9
+ %li= link_to cat.name, frontend_blog_category_path(cat)
10
+
@@ -288,5 +288,5 @@
288
288
  label: 'Footer'
289
289
  }]
290
290
 
291
- theme.plugins = %w[conferences journal]
291
+ theme.plugins = %w[conferences journal conferences-blog]
292
292
  end
@@ -190,6 +190,20 @@ en:
190
190
  issue: Issue
191
191
  draft: THIS ARTICLE IS A DRAFT
192
192
  licence_logo: Licence logo
193
+ blog:
194
+ posts:
195
+ index:
196
+ blog: Blog
197
+ post:
198
+ category_html: "Category: %{name}"
199
+ categories:
200
+ show:
201
+ category: "Category: %{name}"
202
+ shared:
203
+ siebar:
204
+ categories: Categories
205
+
206
+
193
207
 
194
208
  languages:
195
209
  en-GB: British English
data/config/routes.rb CHANGED
@@ -14,4 +14,18 @@ Spina::Engine.routes.draw do
14
14
  resources :articles, only: %i[show]
15
15
  end
16
16
  end
17
+
18
+ namespace :frontend, as: 'frontend_blog', path: 'blog', module: 'conferences/primer_theme/blog' do
19
+ root to: 'posts#index'
20
+
21
+ get ':id', to: 'posts#show', as: :post
22
+
23
+ # Redirects for old sites that used the old blog path
24
+ get 'posts/', to: redirect('/blog'), as: :old_index
25
+ get 'posts/:id', to: redirect('/blog/%{id}'), as: :old_post
26
+
27
+ get 'feed.atom', to: 'posts#index', as: :rss_feed, defaults: { format: :atom }
28
+ get 'categories/:id', to: 'categories#show', as: :category
29
+ get 'archive/:year(/:month)', to: 'posts#archive', as: :archive_posts
30
+ end
17
31
  end
@@ -3,7 +3,7 @@
3
3
  module Spina
4
4
  module Conferences
5
5
  module PrimerTheme
6
- VERSION = '0.8.0'
6
+ VERSION = '0.9.2'
7
7
  end
8
8
  end
9
9
  end
@@ -5,6 +5,7 @@ require 'spina/conferences/primer_theme/engine'
5
5
  require 'spina/conferences/primer_theme/breadcrumbs/builder'
6
6
  require 'spina/admin/conferences'
7
7
  require 'spina/admin/journal'
8
+ require 'spina/admin/conferences/blog'
8
9
  require 'octicons_helper'
9
10
  require 'view_component'
10
11
  require 'primer/view_components'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spina-conferences-primer_theme-fork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Malčić
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-11-06 00:00:00.000000000 Z
12
+ date: 2021-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: babel-transpiler
@@ -96,7 +96,7 @@ dependencies:
96
96
  - !ruby/object:Gem::Version
97
97
  version: 2.0.0
98
98
  - !ruby/object:Gem::Dependency
99
- name: spina-admin-conferences
99
+ name: spina-admin-conferences-fork
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - "~>"
@@ -123,6 +123,20 @@ dependencies:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
125
  version: 0.6.0
126
+ - !ruby/object:Gem::Dependency
127
+ name: spina-admin-conferences-blog
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: 0.1.4
133
+ type: :runtime
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: 0.1.4
126
140
  - !ruby/object:Gem::Dependency
127
141
  name: capybara
128
142
  requirement: !ruby/object:Gem::Requirement
@@ -294,6 +308,9 @@ files:
294
308
  - app/assets/stylesheets/spina/conferences/primer_theme/_custom.sass
295
309
  - app/assets/stylesheets/spina/conferences/primer_theme/_custom_variables.sass
296
310
  - app/assets/stylesheets/spina/conferences/primer_theme/application.sass
311
+ - app/controllers/spina/conferences/primer_theme/blog/application_controller.rb
312
+ - app/controllers/spina/conferences/primer_theme/blog/categories_controller.rb
313
+ - app/controllers/spina/conferences/primer_theme/blog/posts_controller.rb
297
314
  - app/controllers/spina/conferences/primer_theme/conferences/application_controller.rb
298
315
  - app/controllers/spina/conferences/primer_theme/conferences/conferences_controller.rb
299
316
  - app/controllers/spina/conferences/primer_theme/conferences/presentations_controller.rb
@@ -317,6 +334,7 @@ files:
317
334
  - app/views/conferences_primer_theme/partials/_homepage_item.html.haml
318
335
  - app/views/layouts/conferences_primer_theme/application.html.haml
319
336
  - app/views/layouts/spina/conferences/primer_theme/application.html.haml
337
+ - app/views/layouts/spina/conferences/primer_theme/blog/blog.html.haml
320
338
  - app/views/layouts/spina/conferences/primer_theme/conferences/conferences.html.haml
321
339
  - app/views/layouts/spina/conferences/primer_theme/conferences/presentations.html.haml
322
340
  - app/views/layouts/spina/conferences/primer_theme/journal/articles.html.haml
@@ -334,6 +352,13 @@ files:
334
352
  - app/views/spina/application/_navigation.html.haml
335
353
  - app/views/spina/application/_navigation_item.html.haml
336
354
  - app/views/spina/application/_text.html.haml
355
+ - app/views/spina/conferences/primer_theme/blog/categories/show.html.haml
356
+ - app/views/spina/conferences/primer_theme/blog/posts/_post.html.haml
357
+ - app/views/spina/conferences/primer_theme/blog/posts/archive.html.haml
358
+ - app/views/spina/conferences/primer_theme/blog/posts/index.atom.builder
359
+ - app/views/spina/conferences/primer_theme/blog/posts/index.html.haml
360
+ - app/views/spina/conferences/primer_theme/blog/posts/show.html.haml
361
+ - app/views/spina/conferences/primer_theme/blog/shared/_sidebar.html.haml
337
362
  - app/views/spina/conferences/primer_theme/conferences/conferences/_conference.html.haml
338
363
  - app/views/spina/conferences/primer_theme/conferences/conferences/_event.html.haml
339
364
  - app/views/spina/conferences/primer_theme/conferences/conferences/_events.html.haml