spina-conferences-primer_theme-fork 1.0.0.rc1 → 1.0.0.rc5

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +60 -12
  3. data/app/assets/builds/spina/conferences/primer_theme/application.css +4 -0
  4. data/app/assets/javascripts/spina/conferences/primer_theme/controllers/slideshow_controller.js +10 -1
  5. data/app/assets/stylesheets/spina/conferences/primer_theme/application.sass +3 -0
  6. data/app/controllers/spina/conferences/primer_theme/blog/application_controller.rb +10 -0
  7. data/app/controllers/spina/conferences/primer_theme/blog/categories_controller.rb +0 -8
  8. data/app/controllers/spina/conferences/primer_theme/blog/posts_controller.rb +0 -13
  9. data/app/controllers/spina/conferences/primer_theme/conferences/application_controller.rb +13 -0
  10. data/app/controllers/spina/conferences/primer_theme/journal/application_controller.rb +12 -0
  11. data/app/controllers/spina/conferences/primer_theme/journal/articles_controller.rb +13 -7
  12. data/app/controllers/spina/conferences/primer_theme/journal/authors_controller.rb +48 -0
  13. data/app/controllers/spina/conferences/primer_theme/journal/issues_controller.rb +11 -4
  14. data/app/helpers/spina/conferences/primer_theme/application_helper.rb +10 -1
  15. data/app/helpers/spina/conferences/primer_theme/navigations_helper.rb +13 -0
  16. data/app/views/conferences_primer_theme/pages/about.html.haml +14 -8
  17. data/app/views/conferences_primer_theme/pages/committee.html.haml +6 -4
  18. data/app/views/conferences_primer_theme/pages/events.html.haml +9 -3
  19. data/app/views/conferences_primer_theme/pages/homepage.html.haml +1 -1
  20. data/app/views/conferences_primer_theme/pages/journal_information.html.haml +10 -0
  21. data/app/views/conferences_primer_theme/pages/periodical.html.haml +5 -5
  22. data/app/views/conferences_primer_theme/partials/_event.html.haml +1 -1
  23. data/app/views/conferences_primer_theme/partials/_homepage_item.html.haml +4 -4
  24. data/app/views/layouts/conferences_primer_theme/application.html.haml +1 -1
  25. data/app/views/layouts/spina/conferences/primer_theme/journal/articles.html.haml +3 -0
  26. data/app/views/layouts/spina/conferences/primer_theme/journal/authors.html.haml +5 -0
  27. data/app/views/layouts/spina/conferences/primer_theme/journal/issues.html.haml +3 -0
  28. data/app/views/spina/application/_cookies.html.haml +8 -7
  29. data/app/views/spina/application/_cookies_footer.html.haml +15 -13
  30. data/app/views/spina/application/_footer.html.haml +2 -2
  31. data/app/views/spina/application/_journal_navigation.html.haml +17 -0
  32. data/app/views/spina/application/_mobile_navigation_items.html.haml +0 -3
  33. data/app/views/spina/application/_navigation.html.haml +1 -4
  34. data/app/views/spina/conferences/primer_theme/blog/categories/show.html.haml +5 -3
  35. data/app/views/spina/conferences/primer_theme/blog/posts/index.html.haml +5 -3
  36. data/app/views/spina/conferences/primer_theme/blog/posts/show.html.haml +5 -5
  37. data/app/views/spina/conferences/primer_theme/conferences/conferences/_conference.html.haml +2 -2
  38. data/app/views/spina/conferences/primer_theme/conferences/conferences/_event.html.haml +3 -3
  39. data/app/views/spina/conferences/primer_theme/conferences/conferences/_events.html.haml +6 -3
  40. data/app/views/spina/conferences/primer_theme/conferences/conferences/_header.html.haml +3 -3
  41. data/app/views/spina/conferences/primer_theme/conferences/conferences/_presentation.html.haml +1 -1
  42. data/app/views/spina/conferences/primer_theme/conferences/conferences/_presentations.html.haml +9 -6
  43. data/app/views/spina/conferences/primer_theme/conferences/conferences/index.html.haml +9 -6
  44. data/app/views/spina/conferences/primer_theme/conferences/conferences/show.html.haml +7 -3
  45. data/app/views/spina/conferences/primer_theme/journal/articles/_authorship.html.haml +8 -6
  46. data/app/views/spina/conferences/primer_theme/journal/articles/_metadata.html.haml +3 -3
  47. data/app/views/spina/conferences/primer_theme/journal/articles/show.html.haml +12 -14
  48. data/app/views/spina/conferences/primer_theme/journal/authors/_author.html.haml +9 -0
  49. data/app/views/spina/conferences/primer_theme/journal/authors/index.html.haml +12 -0
  50. data/app/views/spina/conferences/primer_theme/journal/authors/show.html.haml +22 -0
  51. data/app/views/spina/conferences/primer_theme/journal/issues/_article.html.haml +4 -4
  52. data/app/views/spina/conferences/primer_theme/journal/issues/_issue.html.haml +7 -6
  53. data/app/views/spina/conferences/primer_theme/journal/issues/index.html.haml +30 -24
  54. data/app/views/spina/conferences/primer_theme/journal/issues/show.html.haml +33 -21
  55. data/config/initializers/primer.rb +1 -1
  56. data/config/initializers/themes/conferences_primer_theme.rb +12 -2
  57. data/config/locales/en.yml +20 -31
  58. data/config/routes.rb +6 -2
  59. data/lib/spina/conferences/primer_theme/engine.rb +4 -4
  60. data/lib/spina/conferences/primer_theme/version.rb +1 -1
  61. metadata +17 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb05b4e1ad3a267e9271a932686234f556e7268d64b6810f0bc454013c39a6a5
4
- data.tar.gz: 88b725abc9beccc27a5879779be534fa8c3e1aef4443e8f3d33ab01224e03fcb
3
+ metadata.gz: 00467bcdd3c545ab2e4a2d7a92e019b05cfc7cae8f8bbb22cd991147cc6a6a7f
4
+ data.tar.gz: 97da422f5db0d66a21b96a5c7c415420550d8b52d14cae671d359cc970085796
5
5
  SHA512:
6
- metadata.gz: 8f6f147dfc7855f2c9e67227455cda78baf867d13806a10178d2e279a1122398736d56ab0b3028f22395bd93ec769c4e9b6003c82dcc89aa1faafb66c4bd0b02
7
- data.tar.gz: eef7ec098e81d0df97978634a9acaf2918f6fa14a3b9d17523a4b50f5c98d56c59575e0f9e03a38c1edaa5c8f5763337b3f39510532c1cb11042065ff39e861b
6
+ metadata.gz: 12ffc1d3642b707ab69d7a8e0f6618d3f99f8e426cfc47919b1a1a1eb78104c5693cf5db0f0ec03e386df221fe16f80a9a41a3ab2ffa0a7835be90d0404f8096
7
+ data.tar.gz: 8870974d0ad0f62f879fde375536cda65122e35dad473eed2fc6f2ef22d12354e31e63a6628feb7dd99a37c49140e722a40c861f9f7b55cef987bef09847e489
data/README.md CHANGED
@@ -1,24 +1,39 @@
1
- # PrimerTheme: frontend for Spina
1
+ # PrimerTheme for Spina
2
+
3
+ PrimerTheme is a theme for Spina that uses [GitHub's Primer design system](https://primer.style/). It provides frontends for Spina pages, as well as for the following Spina plugins:
4
+
5
+ - [Conferences](https://github.com/louis-vs/spina-admin-conferences-fork/)
6
+ - [Journal](https://github.com/louis-vs/spina-admin-journal)
7
+ - [Blog (fork)](https://github.com/louis-vs/spina-admin-conferences-blog)
8
+
9
+ All of these plugins will be automatically installed with PrimerTheme, but you can use any selection of them that you wish. PrimerTheme provides you with an easy-to-setup Spina theme with a wide array of options, extending the core Spina setup.
10
+
11
+ PrimerTheme was originally designed for the Undergraduate Linguistics Association of Britain's website, which you can [view here](https://www.ulab.org.uk/) if you want to see the theme in action.
12
+
13
+ **NB:** Please use this fork, rather than the original. This fork provides a stable, updated release, whilst the old repo is no longer maintained.
2
14
 
3
15
  ![Rails tests](https://github.com/louis-vs/spina-conferences-primer_theme-fork/workflows/Verify/badge.svg?branch=master&event=push)
4
16
  [![codecov](https://codecov.io/gh/louis-vs/spina-conferences-primer_theme-fork/branch/master/graph/badge.svg?token=9TZ9QGGLAH)](https://codecov.io/gh/louis-vs/spina-conferences-primer_theme-fork)
5
17
  [![CodeFactor](https://www.codefactor.io/repository/github/louis-vs/spina-conferences-primer_theme-fork/badge)](https://www.codefactor.io/repository/github/louis-vs/spina-conferences-primer_theme-fork)
6
18
  [![Inline docs](http://inch-ci.org/github/louis-vs/spina-conferences-primer_theme-fork.svg?branch=master)](http://inch-ci.org/github/louis-vs/spina-conferences-primer_theme-fork)
7
19
 
8
- A plugin for `Spina` that provides a frontend for `Spina::Admin::Conferences`, `Spina::Admin::Journal`, and `Spina::Admin::Conferences::Blog` using components from `Primer::ViewComponents`.
20
+ ## Features
9
21
 
10
- This fork provides an updated version of the plugin, as the main repo is currently badly outdated.
22
+ The plugin's main goal is to provide frontends for Spina core and the three plugins listed above, using Primer. It also provides a number of useful page templates for use with Spina.
11
23
 
12
24
  ## Usage
13
- See the READMEs for the conference plugin, the journal plugin, and the bog plugin, respectively, for more information on what kind of content this frontend allows you to create and how to do so within the admin interface. Also make sure to ensure compilation of the assets for this gem by adding the following line to your
14
- `manifest.js` file.
15
25
 
16
- ```js
17
- //= link spina_conferences_primer_theme_manifest.js
18
- ```
26
+ See the READMEs for the conference plugin, the journal plugin, and the blog plugin, respectively, for more information on what kind of content this frontend allows you to create and how to do so within the admin interface.
27
+
28
+ You can customise Primer by overriding the `_custom.sass` and `_custom_variables.sass` files. See the [ULAB Website](https://github.com/ulab-committee/ulab-website) repo for an example.
19
29
 
20
30
  ## Installation
21
- Add this line to your application's Gemfile:
31
+
32
+ Make sure you have a working installation of Ruby on Rails 7. You can find a setup guide [here](https://guides.rubyonrails.org/getting_started.html).
33
+
34
+ You then need to install Spina, following the guide [on the Spina website](https://spinacms.com/docs).
35
+
36
+ To install the plugin, add this line to your application's Gemfile:
22
37
 
23
38
  ```ruby
24
39
  gem 'spina-conferences-primer_theme-fork', require: 'spina/conferences/primer_theme'
@@ -29,13 +44,46 @@ And then execute:
29
44
  $ bundle
30
45
  ```
31
46
 
32
- Or install it yourself as:
47
+ You will also need to configure Yarn. Add this repo as a dependency, so that your `package.json` resembles the following:
48
+
49
+ ```json
50
+ {
51
+ "name": "website_name",
52
+ "private": true,
53
+ "dependencies": {
54
+ "spina-conferences-primer-theme-fork": "louis-vs/spina-conferences-primer_theme-fork"
55
+ }
56
+ }
57
+ ```
58
+
59
+ You will then need to install and run the migrations from all of the plugins that come bundled with PrimerTheme:
60
+
61
+ ```bash
62
+ $ bin/rails spina_admin_journal:install:migrations
63
+ $ bin/rails spina_admin_conferences:install:migrations
64
+ $ bin/rails spina_admin_conferences_blog:install:migrations
65
+ $ bin/rails spina_conferences_primer_theme:install:migrations
66
+ $ bin/rails db:migrate
67
+ ```
68
+
69
+ Also make sure to ensure compilation of the assets for this gem by adding the following line to your `manifest.js` file.
70
+
71
+ ```js
72
+ //= link spina_conferences_primer_theme_manifest.js
73
+ ```
74
+
75
+ Finally, start the server with:
76
+
33
77
  ```bash
34
- $ gem install spina-conferences-primer_theme-fork
78
+ $ bin/rails s
35
79
  ```
36
80
 
81
+ If you want to customise Primer, you will need to add `_custom.sass` and/or `_custom_variables.sass` into `app/assets/stylesheets/spina/conferences/primer_theme`. You will also need to override the CSS build rake task so that it finds your new files - an example of this can be found in the ULAB website [here](https://github.com/ulab-committee/ulab-website/blob/master/lib/tasks/ulab_website_tasks.rake).
82
+
37
83
  ## Contributing
38
- Contributions welcome, open an issue first please.
84
+
85
+ Bug reports and feature requests are welcome in the [Issues](https://github.com/louis-vs/spina-conferences-primer_theme-fork/issues) section. Translations are also very welcome!
39
86
 
40
87
  ## License
88
+
41
89
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -25962,3 +25962,7 @@ address {
25962
25962
  width: 100%;
25963
25963
  height: 70vh;
25964
25964
  }
25965
+
25966
+ img {
25967
+ background-color: white !important;
25968
+ }
@@ -56,8 +56,15 @@ export default class SlideshowController extends Controller {
56
56
  */
57
57
  connect() {
58
58
  this.showSlide()
59
+ this.resetInterval()
60
+ }
61
+
62
+ resetInterval() {
59
63
  if (this.data.has('advance')) {
60
- setInterval(() => this.next(), this.delay)
64
+ if (this.intervalId) {
65
+ clearInterval(this.intervalId)
66
+ }
67
+ this.intervalId = setInterval(() => this.next(), this.delay)
61
68
  }
62
69
  }
63
70
 
@@ -74,6 +81,7 @@ export default class SlideshowController extends Controller {
74
81
  * @private
75
82
  */
76
83
  next() {
84
+ this.resetInterval()
77
85
  const incrementer = this.incrementer
78
86
  this.incrementer = incrementer === this.slideTargets.length - 1 ? 0 : incrementer + 1
79
87
  }
@@ -83,6 +91,7 @@ export default class SlideshowController extends Controller {
83
91
  * @private
84
92
  */
85
93
  previous() {
94
+ this.resetInterval()
86
95
  const incrementer = this.incrementer
87
96
  this.incrementer = incrementer === 0 ? this.slideTargets.length - 1 : incrementer - 1
88
97
  }
@@ -42,3 +42,6 @@ address
42
42
  border: none
43
43
  width: 100%
44
44
  height: 70vh
45
+
46
+ img
47
+ background-color: white !important
@@ -8,6 +8,8 @@ module Spina
8
8
  class ApplicationController < ::Spina::ApplicationController
9
9
  include ::Spina::Frontend
10
10
 
11
+ before_action :page
12
+
11
13
  def cookies_info
12
14
  render partial: 'cookies'
13
15
  end
@@ -17,6 +19,14 @@ module Spina
17
19
  def theme_layout
18
20
  'layouts/spina/conferences/primer_theme/blog/blog'
19
21
  end
22
+
23
+ def page
24
+ @page = Spina::Page.find_or_create_by name: 'blog' do |page|
25
+ page.title = 'Blog'
26
+ page.link_url = '/blog'
27
+ page.deletable = false
28
+ end
29
+ end
20
30
  end
21
31
  end
22
32
  end
@@ -6,7 +6,6 @@ module Spina
6
6
  module Blog
7
7
  # Spina::Blog::CategoriesController
8
8
  class CategoriesController < ApplicationController
9
- before_action :page
10
9
  before_action :category
11
10
  before_action :posts
12
11
  before_action :set_breadcrumb, only: :show
@@ -28,13 +27,6 @@ module Spina
28
27
  .page(params[:page])
29
28
  end
30
29
 
31
- def page
32
- @page = Spina::Page.find_or_create_by name: 'blog' do |page|
33
- page.link_url = '/blog'
34
- page.deletable = false
35
- end
36
- end
37
-
38
30
  def set_breadcrumb
39
31
  add_breadcrumb 'Blog', frontend_blog_root_path
40
32
  end
@@ -7,7 +7,6 @@ module Spina
7
7
  # Spina::Blog::PostsController
8
8
  class PostsController < ApplicationController
9
9
  before_action :find_posts, only: [:index]
10
- before_action :current_spina_user_can_view_page?
11
10
  before_action :set_breadcrumb, only: :show
12
11
 
13
12
  decorates_assigned :posts, :post
@@ -51,14 +50,6 @@ module Spina
51
50
  start_date.end_of_year
52
51
  end
53
52
 
54
- def page
55
- @page ||= Spina::Page.find_or_create_by name: 'blog' do |page|
56
- page.title = 'Blog'
57
- page.link_url = '/blog'
58
- page.deletable = false
59
- end
60
- end
61
-
62
53
  def find_posts
63
54
  @posts = Spina::Admin::Conferences::Blog::Post.available.live.order(published_at: :desc)
64
55
  .page(params[:page])
@@ -69,10 +60,6 @@ module Spina
69
60
  redirect_to rule.new_path, status: :moved_permanently
70
61
  end
71
62
 
72
- def current_spina_user_can_view_page?
73
- raise ActiveRecord::RecordNotFound unless current_spina_user.present? || page.live?
74
- end
75
-
76
63
  def set_breadcrumb
77
64
  add_breadcrumb 'Blog', frontend_blog_root_path
78
65
  end
@@ -6,9 +6,22 @@ module Spina
6
6
  module Conferences
7
7
  # Base class from which controllers inherit
8
8
  class ApplicationController < Spina::ApplicationController
9
+ before_action :page
10
+
9
11
  def cookies_info
10
12
  render partial: 'cookies'
11
13
  end
14
+
15
+ private
16
+
17
+ def page
18
+ @page ||= Spina::Page.find_or_create_by name: 'conferences' do |page|
19
+ page.title = 'Conferences'
20
+ page.link_url = '/conferences/conferences'
21
+ page.deletable = false
22
+ page.active = true
23
+ end
24
+ end
12
25
  end
13
26
  end
14
27
  end
@@ -6,6 +6,18 @@ module Spina
6
6
  module Journal
7
7
  # Base class from which controllers related to the journal plugin inherit
8
8
  class ApplicationController < Spina::ApplicationController
9
+ before_action :page
10
+
11
+ private
12
+
13
+ def page
14
+ @page ||= Spina::Page.find_or_create_by name: 'journal' do |page|
15
+ page.title = 'Journal'
16
+ page.link_url = '/journal/issues'
17
+ page.deletable = false
18
+ page.active = true
19
+ end
20
+ end
9
21
  end
10
22
  end
11
23
  end
@@ -6,8 +6,8 @@ module Spina
6
6
  module Journal
7
7
  # User-facing controller for journal articles
8
8
  class ArticlesController < ApplicationController
9
- before_action :set_article, :set_issue, :set_journal, :set_licence, :set_breadcrumb, :set_metadata,
10
- :require_admin_for_invisible_article
9
+ before_action :set_volume, :set_issue, :set_article, :set_journal, :set_licence,
10
+ :set_breadcrumb, :set_metadata, :require_admin_for_invisible_article
11
11
 
12
12
  def show
13
13
  respond_to do |format|
@@ -25,13 +25,19 @@ module Spina
25
25
  private
26
26
 
27
27
  def set_article
28
- @article = Admin::Journal::Article.includes(affiliations: [:institution]).find(params[:id])
28
+ @article = @issue.articles.includes(affiliations: [:institution]).find_by!(number: params[:number])
29
29
  rescue ActiveRecord::RecordNotFound
30
30
  send_file Rails.root.join('public/404.html'), type: 'text/html; charset=utf-8', status: 404
31
31
  end
32
32
 
33
33
  def set_issue
34
- @issue = Admin::Journal::Issue.includes(:volume, :articles).find(params[:issue_id])
34
+ @issue = @volume.issues.includes(:volume, :articles).find_by!(number: params[:issue_number])
35
+ rescue ActiveRecord::RecordNotFound
36
+ send_file Rails.root.join('public/404.html'), type: 'text/html; charset=utf-8', status: 404
37
+ end
38
+
39
+ def set_volume
40
+ @volume = Admin::Journal::Volume.includes(:issues).find_by!(number: params[:volume_number])
35
41
  rescue ActiveRecord::RecordNotFound
36
42
  send_file Rails.root.join('public/404.html'), type: 'text/html; charset=utf-8', status: 404
37
43
  end
@@ -47,11 +53,11 @@ module Spina
47
53
  def set_breadcrumb
48
54
  return if @issue.blank?
49
55
 
50
- add_breadcrumb @journal.name, frontend_issues_path
51
- add_breadcrumb Admin::Journal::Issue.model_name.human.pluralize, frontend_issues_path
56
+ add_breadcrumb helpers.journal_abbreviation_or_name(@journal), frontend_issues_path
57
+ # add_breadcrumb Admin::Journal::Issue.model_name.human.pluralize, frontend_issues_path
52
58
  add_breadcrumb t('spina.conferences.primer_theme.journal.volume_issue', volume_number: @issue.volume.number,
53
59
  issue_number: @issue.number),
54
- frontend_issue_path(@issue.id)
60
+ frontend_volume_issue_path(@issue.volume.number, @issue.number)
55
61
  end
56
62
 
57
63
  def set_metadata
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Conferences
5
+ module PrimerTheme
6
+ module Journal
7
+ # User-facing controller for authors
8
+ class AuthorsController < ApplicationController
9
+ before_action :set_journal, :set_breadcrumb
10
+ before_action :set_author, only: :show
11
+ before_action :set_metadata
12
+
13
+ def index
14
+ @authors = Admin::Journal::Author.all.sort do |a, b|
15
+ a.primary_affiliation.name <=> b.primary_affiliation.name
16
+ end
17
+ end
18
+
19
+ def show
20
+ add_breadcrumb @author.primary_affiliation.name
21
+ end
22
+
23
+ private
24
+
25
+ def set_journal
26
+ @journal = Admin::Journal::Journal.instance
27
+ end
28
+
29
+ def set_author
30
+ @author = Admin::Journal::Author.includes(:affiliations, :articles).find(params[:id])
31
+ rescue ActiveRecord::RecordNotFound
32
+ send_file Rails.root.join('public/404.html'), type: 'text/html; charset=utf-8', status: 404
33
+ end
34
+
35
+ def set_metadata
36
+ @title = @journal.name
37
+ @description = ActionView::Base.full_sanitizer.sanitize(@journal.content(:description))
38
+ end
39
+
40
+ def set_breadcrumb
41
+ add_breadcrumb helpers.journal_abbreviation_or_name(@journal), frontend_issues_path
42
+ add_breadcrumb Admin::Journal::Author.model_name.human(count: :many), frontend_authors_path
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -7,7 +7,7 @@ module Spina
7
7
  # User-facing controller for journal issues
8
8
  class IssuesController < ApplicationController
9
9
  before_action :set_journal
10
- before_action :set_issue, :set_breadcrumb, only: :show
10
+ before_action :set_volume, :set_issue, only: :show
11
11
  before_action :set_metadata
12
12
 
13
13
  def index
@@ -22,6 +22,7 @@ module Spina
22
22
 
23
23
  def show
24
24
  @articles = current_spina_user.present? ? @issue.articles : @issue.articles.visible
25
+ add_breadcrumb helpers.journal_abbreviation_or_name(@journal), frontend_issues_path
25
26
  add_breadcrumb t('spina.conferences.primer_theme.journal.volume_issue',
26
27
  volume_number: @issue.volume.number, issue_number: @issue.number)
27
28
  end
@@ -33,14 +34,20 @@ module Spina
33
34
  end
34
35
 
35
36
  def set_issue
36
- @issue = Admin::Journal::Issue.includes(:volume, :articles).find(params[:id])
37
+ @issue = @volume.issues.includes(:volume, :articles).find_by!(number: params[:number])
38
+ rescue ActiveRecord::RecordNotFound
39
+ send_file Rails.root.join('public/404.html'), type: 'text/html; charset=utf-8', status: 404
40
+ end
41
+
42
+ def set_volume
43
+ @volume = Admin::Journal::Volume.includes(:issues).find_by!(number: params[:volume_number])
37
44
  rescue ActiveRecord::RecordNotFound
38
45
  send_file Rails.root.join('public/404.html'), type: 'text/html; charset=utf-8', status: 404
39
46
  end
40
47
 
41
48
  def set_breadcrumb
42
- add_breadcrumb @journal.name, frontend_issues_path
43
- add_breadcrumb Admin::Journal::Issue.model_name.human.pluralize, frontend_issues_path
49
+ add_breadcrumb helpers.journal_abbreviation_or_name(@journal), frontend_issues_path
50
+ # add_breadcrumb Admin::Journal::Issue.model_name.human.pluralize, frontend_issues_path
44
51
  end
45
52
 
46
53
  def set_metadata
@@ -12,10 +12,19 @@ module Spina
12
12
  Spina::Admin::Conferences::Conference.order(dates: :asc).find_by('upper(dates) >= ?', Time.zone.today)
13
13
  end
14
14
 
15
- def ancestors
15
+ def journal_abbreviation_or_name(journal)
16
+ journal.content(:journal_abbreviation).nil? || journal.content(:journal_abbreviation).blank? ? journal.name : journal.content(:journal_abbreviation) # rubocop:disable Layout/LineLength
17
+ end
18
+
19
+ def ancestors # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
16
20
  return [] if current_page.blank?
17
21
 
18
22
  render Primer::Beta::Breadcrumbs.new(mb: 4) do |component|
23
+ if current_page.resource&.name = 'journal'
24
+ component.item(href: frontend_issues_path) do
25
+ journal_abbreviation_or_name(Spina::Admin::Journal::Journal.instance)
26
+ end
27
+ end
19
28
  current_page.ancestors.each do |ancestor|
20
29
  component.item(href: ancestor.materialized_path) { ancestor.menu_title }
21
30
  end
@@ -13,6 +13,15 @@ module Spina
13
13
  @footer_navigation_items ||= live_navigation_items('footer')
14
14
  end
15
15
 
16
+ def journal_navigation_items
17
+ @journal_navigation_items ||= live_resource_navigation_items('journal')
18
+ end
19
+
20
+ # Use this for caching, since pages are not touched when navigation position is updated.
21
+ def all_navigation_items
22
+ @all_navigation_items ||= ::Spina::NavigationItem.all
23
+ end
24
+
16
25
  private
17
26
 
18
27
  def live_navigation_items(name)
@@ -20,6 +29,10 @@ module Spina
20
29
  .where(spina_navigations: { name: name })
21
30
  .roots.regular_pages.in_menu.live.sorted
22
31
  end
32
+
33
+ def live_resource_navigation_items(name)
34
+ ::Spina::Resource.find_by(name: name)&.pages&.roots&.in_menu&.live&.sorted || []
35
+ end
23
36
  end
24
37
  end
25
38
  end
@@ -13,15 +13,17 @@
13
13
  = render Primer::SubheadComponent.new do |component|
14
14
  = component.heading { t :'.constitution.title' }
15
15
  - if content(:constitution).present?
16
- = render Primer::FlexComponent.new(align_items: :center, py: 1) do
17
- = render Primer::FlexItemComponent.new(flex_auto: true, pr: 1) do
16
+ = render Primer::BoxComponent.new(display: :flex, align_items: :center, py: 1) do
17
+ = render Primer::BoxComponent.new(flex: :auto, pr: 1) do
18
18
  = t :'.constitution.uploaded',
19
19
  date: l(Spina::Attachment.find(content(:constitution).attachment_id).created_at.to_date, format: :long)
20
20
  = render Primer::ButtonComponent.new(tag: :a, href: content.attachment_url(:constitution), ml: 2, download: '') do
21
21
  = render Primer::OcticonComponent.new('desktop-download')
22
22
  = t :'.constitution.download'
23
23
  - else
24
- = render Primer::BlankslateComponent.new(title: t(:'.constitution.no_constitution'), icon: 'law')
24
+ = render Primer::Beta::Blankslate.new do |blankslate|
25
+ - blankslate.visual_icon(icon: 'law')
26
+ - blankslate.heading(tag: :h3).with_content(t(:'.constitution.no_constitution'))
25
27
 
26
28
  = render Primer::BoxComponent.new(mt: 4, col: [12, nil, 6, nil], float: [nil, nil, :left, nil]) do
27
29
  = render Primer::SubheadComponent.new do |component|
@@ -30,7 +32,7 @@
30
32
  %ul
31
33
  - repeater :minutes do |minutes_entry|
32
34
  %li.list-style-none.py-1.d-flex.flex-items-center
33
- = render Primer::FlexItemComponent.new(flex_auto: true) do
35
+ = render Primer::BoxComponent.new(flex: :auto) do
34
36
  - if minutes_entry.content(:date).present?
35
37
  = t(:'.minutes.minutes_for_html', date: time_tag(minutes_entry.content(:date)))
36
38
  - else
@@ -43,7 +45,9 @@
43
45
  - else
44
46
  = render(Primer::Beta::Text.new(color: :muted, font_size: 6)) { t :'.minutes.no_file' }
45
47
  - else
46
- = render Primer::BlankslateComponent.new(title: t(:'.minutes.no_minutes'), icon: 'file')
48
+ = render Primer::Beta::Blankslate.new do |blankslate|
49
+ - blankslate.visual_icon(icon: 'file')
50
+ - blankslate.heading(tag: :h3).with_content(t(:'.minutes.no_minutes'))
47
51
 
48
52
  = render Primer::BoxComponent.new(mt: 4, col: [12, nil, 6, nil], float: [nil, nil, :left, nil]) do
49
53
  - if content(:documents).present?
@@ -66,10 +70,10 @@
66
70
  %ul
67
71
  - repeater :partner_societies do |partner_society|
68
72
  %li.list-style-none.py-4.border-bottom
69
- = render Primer::FlexComponent.new(direction: [:column, nil, :row_reverse, nil], align_items: :start) do
73
+ = render Primer::BoxComponent.new(display: :flex, direction: [:column, nil, :row_reverse, nil], align_items: :flex_start) do
70
74
  = render Primer::BaseComponent.new(tag: :div, flex: :auto) do
71
75
  = render Primer::HeadingComponent.new(tag: :h3, mb: 1) do
72
- = render Primer::FlexComponent.new(flex_wrap: true, justify_content: :space_between) do
76
+ = render Primer::BoxComponent.new(display: :flex, flex_wrap: :wrap, justify_content: :space_between) do
73
77
  - if partner_society.content(:name).present?
74
78
  = render(Primer::Beta::Text.new(tag: :div)) { partner_society.content(:name) }
75
79
  = render Primer::ButtonGroup.new(aria: { label: t(:'.partner_societies.contact_buttons') }) do |component|
@@ -89,4 +93,6 @@
89
93
  srcset: srcset(partner_society.content(:logo), variant: { resize_to_limit: [200, 150] }),
90
94
  class: %w[mt-4 mt-md-0 mr-md-4])
91
95
  - else
92
- = render Primer::BlankslateComponent.new(title: t(:'.partner_societies.no_societies'), icon: 'organization')
96
+ = render Primer::Beta::Blankslate.new do |blankslate|
97
+ - blankslate.visual_icon(icon: 'organization')
98
+ - blankslate.heading(tag: :h3).with_content(t(:'.partner_societies.no_societies'))
@@ -8,7 +8,7 @@
8
8
  %ul.mt-4
9
9
  - repeater(:committee_bios) do |committee_bio|
10
10
  %li.list-style-none.py-4.border-bottom
11
- = render Primer::FlexComponent.new(direction: [:column, nil, :row, nil], align_items: :start) do
11
+ = render Primer::BoxComponent.new(display: :flex, direction: [:column, nil, :row, nil], align_items: :flex_start) do
12
12
  - if committee_bio.content(:profile_picture).present?
13
13
  -# TODO: create helper to replace this, because Primer::Beta::Avatar limits size to 80 sadly
14
14
  %img.avatar.circle.mr-md-3.mb-3.mb-md-0.flex-shrink-0{src: committee_bio.content.image_url(:profile_picture, resize_to_fill: [150, 150]),
@@ -16,8 +16,8 @@
16
16
  variant: { resize_to_fill: [150, 150] }),
17
17
  draggable: false,
18
18
  alt: committee_bio.content(:profile_picture).alt}
19
- = render Primer::FlexItemComponent.new(flex_auto: true) do
20
- = render Primer::FlexComponent.new(direction: [:column, nil, :row, nil], mb: 1) do
19
+ = render Primer::BoxComponent.new(flex: :auto) do
20
+ = render Primer::BoxComponent.new(display: :flex, direction: [:column, nil, :row, nil], mb: 1) do
21
21
  = render Primer::BoxComponent.new do
22
22
  - if committee_bio.content(:name).present?
23
23
  = render(Primer::HeadingComponent.new(tag: :h3)) do
@@ -40,4 +40,6 @@
40
40
  - if committee_bio.content(:bio).present?
41
41
  = render(Primer::Beta::Text.new(tag: :div, color: :muted)) { committee_bio.content.html(:bio).to_s }
42
42
  - else
43
- = render Primer::BlankslateComponent.new(title: t(:'.no_bios'), icon: 'file')
43
+ = render Primer::Beta::Blankslate.new do |blankslate|
44
+ - blankslate.visual_icon(icon: 'file')
45
+ - blankslate.heading(tag: :h3).with_content(t(:'.no_bios'))
@@ -20,7 +20,9 @@
20
20
  - repeater(events) do |event|
21
21
  = render 'conferences_primer_theme/partials/event', event: event
22
22
  - else
23
- = render Primer::BlankslateComponent.new(title: t(:'.no_events'), icon: 'calendar')
23
+ = render Primer::Beta::Blankslate.new do |blankslate|
24
+ - blankslate.visual_icon(icon: 'calendar')
25
+ - blankslate.heading(tag: :h3).with_content(t(:'.no_events'))
24
26
 
25
27
 
26
28
  = render Primer::SubheadComponent.new(mt: 4) do |component|
@@ -38,6 +40,10 @@
38
40
  - repeater(events) do |event|
39
41
  = render 'conferences_primer_theme/partials/event', event: event
40
42
  - else
41
- = render Primer::BlankslateComponent.new(title: t(:'.no_events'), icon: 'calendar')
43
+ = render Primer::Beta::Blankslate.new do |blankslate|
44
+ - blankslate.visual_icon(icon: 'calendar')
45
+ - blankslate.heading(tag: :h3).with_content(t(:'.no_events'))
42
46
  - else
43
- = render Primer::BlankslateComponent.new(title: t(:'.no_events'), icon: 'calendar')
47
+ = render Primer::Beta::Blankslate.new do |blankslate|
48
+ - blankslate.visual_icon(icon: 'calendar')
49
+ - blankslate.heading(tag: :h3).with_content(t(:'.no_events'))
@@ -6,7 +6,7 @@
6
6
  - if content(:carousel).present?
7
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
- = render partial: 'conferences_primer_theme/partials/homepage_item', locals: { item: carousel_item }
9
+ = render partial: 'conferences_primer_theme/partials/homepage_item', locals: { item: carousel_item, index: index }
10
10
  - if content(:carousel).many?
11
11
  .container-lg.height-full.d-flex.flex-column-reverse.mb-8{ style: 'z-index: 5' }
12
12
  = render(Primer::ButtonGroup.new) do |component|
@@ -0,0 +1,10 @@
1
+ - cache [current_page, journal_navigation_items] do
2
+ = render Primer::BoxComponent.new(display: :flex, direction: [:column, nil, nil, :row]) do
3
+ - cache current_page do
4
+ = render Primer::BoxComponent.new(col: [nil, nil, nil, 9]) do
5
+ = render(Primer::HeadingComponent.new(tag: :h1)) { current_page.title }
6
+
7
+ - if content(:text).present?
8
+ = render(Primer::Markdown.new(mt: 4)) { content.html(:text).to_s }
9
+
10
+ = render 'journal_navigation'
@@ -8,16 +8,16 @@
8
8
  %ul.mt-4
9
9
  - repeater(:periodical_issues) do |issue|
10
10
  %li.list-style-none.py-4.border-bottom
11
- = render Primer::FlexComponent.new(direction: [:column, nil, :row, nil], align_items: :start) do
11
+ = render Primer::BoxComponent.new(display: :flex, direction: [:column, nil, :row, nil], align_items: :flex_start) do
12
12
  - if issue.content(:cover_img).present?
13
- = render Primer::FlexItemComponent.new(mr: [nil, nil, 3, nil], mb: [3, nil, 0, nil], flex_shrink: 0) do
13
+ = render Primer::BoxComponent.new(mr: [nil, nil, 3, nil], mb: [3, nil, 0, nil], flex_shrink: 0) do
14
14
  = render Primer::LinkComponent.new(href: issue.content(:url)) do
15
15
  = image_tag(issue.content.image_url(:cover_img, resize_to_limit: [300, 300]),
16
16
  srcset: srcset_string(issue.content(:cover_img),
17
17
  variant: { resize_to_limit: [300, 300] }),
18
18
  alt: issue.content(:cover_img).alt)
19
- = render Primer::FlexItemComponent.new(flex_auto: true) do
20
- = render Primer::FlexComponent.new(direction: [:column, nil, :row, nil], mb: 1) do
19
+ = render Primer::BoxComponent.new(flex: :auto) do
20
+ = render Primer::BoxComponent.new(display: :flex, direction: [:column, nil, :row, nil], mb: 1) do
21
21
  = render Primer::BoxComponent.new do
22
22
  - if issue.content(:name).present?
23
23
  = render Primer::HeadingComponent.new(tag: :h2) do
@@ -28,7 +28,7 @@
28
28
  - if issue.content(:description).present?
29
29
  = render Primer::Markdown.new(tag: :div, color: :muted) do
30
30
  = issue.content.html(:description).to_s
31
- = render Primer::FlexComponent.new(direction: [:column, nil, :row, nil], align_items: :start) do
31
+ = render Primer::BoxComponent.new(display: :flex, direction: [:column, nil, :row, nil], align_items: :flex_start) do
32
32
  - if issue.content(:url).present?
33
33
  = render Primer::ButtonComponent.new(scheme: :primary, tag: :a, href: issue.content(:url), mt: 2, mr: 2) do
34
34
  = render Primer::OcticonComponent.new('link-external')