spina-conferences-primer_theme 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/spina_conferences_primer_theme_manifest.js +1 -0
  3. data/app/controllers/spina/conferences/primer_theme/conferences/application_controller.rb +16 -0
  4. data/app/controllers/spina/conferences/primer_theme/conferences/conferences_controller.rb +72 -0
  5. data/app/controllers/spina/conferences/primer_theme/conferences/presentations_controller.rb +42 -0
  6. data/app/controllers/spina/conferences/primer_theme/journal/application_controller.rb +13 -0
  7. data/app/controllers/spina/conferences/primer_theme/journal/articles_controller.rb +56 -0
  8. data/app/controllers/spina/conferences/primer_theme/journal/issues_controller.rb +48 -0
  9. data/app/helpers/spina/conferences/primer_theme/application_helper.rb +4 -4
  10. data/app/views/layouts/spina/conferences/primer_theme/application.html.haml +2 -1
  11. data/app/views/layouts/spina/conferences/primer_theme/{conferences.html.haml → conferences/conferences.html.haml} +0 -0
  12. data/app/views/layouts/spina/conferences/primer_theme/{presentations.html.haml → conferences/presentations.html.haml} +0 -0
  13. data/app/views/layouts/spina/conferences/primer_theme/journal/articles.html.haml +2 -0
  14. data/app/views/layouts/spina/conferences/primer_theme/journal/issues.html.haml +2 -0
  15. data/app/views/spina/application/_navigation.html.haml +1 -0
  16. data/app/views/spina/conferences/primer_theme/conferences/{_conference.html.haml → conferences/_conference.html.haml} +0 -0
  17. data/app/views/spina/conferences/primer_theme/conferences/{_event.html.haml → conferences/_event.html.haml} +0 -0
  18. data/app/views/spina/conferences/primer_theme/conferences/{_events.html.haml → conferences/_events.html.haml} +0 -0
  19. data/app/views/spina/conferences/primer_theme/conferences/{_header.html.haml → conferences/_header.html.haml} +0 -0
  20. data/app/views/spina/conferences/primer_theme/conferences/{_institution.html.haml → conferences/_institution.html.haml} +0 -0
  21. data/app/views/spina/conferences/primer_theme/conferences/{_institution_logo.html.haml → conferences/_institution_logo.html.haml} +0 -0
  22. data/app/views/spina/conferences/primer_theme/conferences/{_presentation.html.haml → conferences/_presentation.html.haml} +0 -0
  23. data/app/views/spina/conferences/primer_theme/conferences/{_presentation_type.html.haml → conferences/_presentation_type.html.haml} +0 -0
  24. data/app/views/spina/conferences/primer_theme/conferences/{_presentations.html.haml → conferences/_presentations.html.haml} +1 -1
  25. data/app/views/spina/conferences/primer_theme/conferences/{_submission_flash.html.haml → conferences/_submission_flash.html.haml} +0 -0
  26. data/app/views/spina/conferences/primer_theme/conferences/{index.html.haml → conferences/index.html.haml} +0 -0
  27. data/app/views/spina/conferences/primer_theme/conferences/{show.html.haml → conferences/show.html.haml} +0 -0
  28. data/app/views/spina/conferences/primer_theme/{kaminari → conferences/kaminari}/_gap.html.haml +0 -0
  29. data/app/views/spina/conferences/primer_theme/{kaminari → conferences/kaminari}/_next_page.html.haml +0 -0
  30. data/app/views/spina/conferences/primer_theme/{kaminari → conferences/kaminari}/_page.html.haml +0 -0
  31. data/app/views/spina/conferences/primer_theme/{kaminari → conferences/kaminari}/_paginator.html.haml +0 -0
  32. data/app/views/spina/conferences/primer_theme/{kaminari → conferences/kaminari}/_prev_page.html.haml +0 -0
  33. data/app/views/spina/conferences/primer_theme/{presentations → conferences/presentations}/_abstract.html.haml +0 -0
  34. data/app/views/spina/conferences/primer_theme/{presentations → conferences/presentations}/_attachment.html.haml +0 -0
  35. data/app/views/spina/conferences/primer_theme/{presentations → conferences/presentations}/_attachments.html.haml +0 -0
  36. data/app/views/spina/conferences/primer_theme/{presentations → conferences/presentations}/show.html.haml +0 -0
  37. data/app/views/spina/conferences/primer_theme/journal/articles/_authorship.html.haml +6 -0
  38. data/app/views/spina/conferences/primer_theme/journal/articles/show.html.haml +50 -0
  39. data/app/views/spina/conferences/primer_theme/journal/issues/_article.html.haml +15 -0
  40. data/app/views/spina/conferences/primer_theme/journal/issues/_issue.html.haml +17 -0
  41. data/app/views/spina/conferences/primer_theme/journal/issues/_issue_cover.html.haml +6 -0
  42. data/app/views/spina/conferences/primer_theme/journal/issues/index.html.haml +10 -0
  43. data/app/views/spina/conferences/primer_theme/journal/issues/show.html.haml +18 -0
  44. data/config/initializers/themes/conferences_primer_theme.rb +9 -1
  45. data/config/locales/en.yml +75 -54
  46. data/config/routes.rb +7 -1
  47. data/lib/spina/conferences/primer_theme.rb +3 -4
  48. data/lib/spina/conferences/primer_theme/version.rb +1 -1
  49. metadata +50 -38
  50. data/app/controllers/spina/conferences/primer_theme/application_controller.rb +0 -14
  51. data/app/controllers/spina/conferences/primer_theme/conferences_controller.rb +0 -70
  52. data/app/controllers/spina/conferences/primer_theme/presentations_controller.rb +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fee6ebf471b1278f5dbaa148407d35902b279493695ea85312c622f45300e8be
4
- data.tar.gz: 9fdb671ab2618ea7f6cafcd516d8053cad575cc1f3b56fe19c9e86bfe0c3c339
3
+ metadata.gz: b0f415891da36813f4af78fc54b98daf3e34d1b22853995c7887944757055c05
4
+ data.tar.gz: 6f8414d707ea3695ef12e342bb514f04fa667a5fa6f427a3679e9c465992527d
5
5
  SHA512:
6
- metadata.gz: 37ace1c57074d2067673442fbe7baea80e819694999c9180d494336682a63101e7f20d81ea1d28a52ce77eebe9d608dac2ce5a971dc87f2e7b78a8285d277284
7
- data.tar.gz: 13deb15dd48fb7b1f046e3fe65d6e95f40ed305f82fff015f7188d7a8ef7a5a2aabbb3b9cadaef6f0949ca68554b5aa2a9d7ebfd5c44e13b936fd47fb4d4c5d9
6
+ metadata.gz: 62789ffa15b959d63a2a6d7cef661fcc3870d3437ca4e23de0dc55496a597a054bdab0de720ba067b59eeb7685108079717b6c7c335139298f3ddf784b03ddf2
7
+ data.tar.gz: bcbb08ea4e23752dc6bb8c7d90111701cd0c65ddd1139c549c42fae19b33b75c2391086578a9db9352fa536a4829ac3ddbf675d8b047907251dd3b5e8ee6323e
@@ -1,6 +1,7 @@
1
1
  //= link_directory ../stylesheets/spina/conferences/primer_theme .css
2
2
  //= link_directory ../javascripts/spina/conferences/primer_theme .js
3
3
  //= link spina_admin_conferences_manifest.js
4
+ //= link spina_admin_journal_manifest.js
4
5
 
5
6
  //= link @github/details-dialog-element/dist/index.js
6
7
  //= link @github/include-fragment-element/dist/index.js
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Conferences
5
+ module PrimerTheme
6
+ module Conferences
7
+ # Base class from which controllers inherit
8
+ class ApplicationController < Spina::ApplicationController
9
+ def cookies_info
10
+ render partial: 'cookies'
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Conferences
5
+ module PrimerTheme
6
+ module Conferences
7
+ # User-facing controller for conferences, serving both html and ics
8
+ class ConferencesController < ApplicationController
9
+ before_action :set_conference, :set_tab, :set_presentation_type, :set_presentations, :set_breadcrumb, only: :show
10
+ before_action :set_metadata
11
+
12
+ def index
13
+ @conferences = Admin::Conferences::Conference.sorted.includes(institutions: [:logo])
14
+ respond_to do |format|
15
+ format.html
16
+ format.ics { render body: @conferences.to_ics }
17
+ end
18
+ end
19
+
20
+ def show
21
+ add_breadcrumb @conference.name
22
+ respond_to do |format|
23
+ format.html
24
+ format.ics { render body: @conference.to_ics }
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def set_conference
31
+ @conference = Admin::Conferences::Conference.includes(:events, :institutions,
32
+ presentation_types: [:translations],
33
+ presentations: [session: [:room], presenters: [:institution]])
34
+ .find(params[:id])
35
+ @conference.view_context = view_context
36
+ rescue ActiveRecord::RecordNotFound
37
+ send_file Rails.root.join('public/404.html'), type: 'text/html; charset=utf-8', status: 404
38
+ end
39
+
40
+ def set_tab
41
+ @tab = params[:tab] || 'information'
42
+ end
43
+
44
+ def set_presentation_type
45
+ if params[:presentation_type].present?
46
+ @presentation_type = @conference.presentation_types
47
+ .includes(presentations: [session: [:room], presenters: [:institution]])
48
+ .find(params[:presentation_type])
49
+ end
50
+ end
51
+
52
+ def set_presentations
53
+ @presentations = if @presentation_type.present?
54
+ @presentation_type.presentations.page(params[:page]).per(15)
55
+ else
56
+ @conference.presentations.page(params[:page]).per(15)
57
+ end
58
+ end
59
+
60
+ def set_breadcrumb
61
+ add_breadcrumb Admin::Conferences::Conference.model_name.human.pluralize, frontend_conferences_path
62
+ end
63
+
64
+ def set_metadata
65
+ @title = @conference.present? ? @conference.name : Admin::Conferences::Conference.model_name.human(count: 0)
66
+ @description = @conference.present? && @conference.has_content?(:text) ? helpers.strip_tags(@conference.content(:text)) : ''
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Conferences
5
+ module PrimerTheme
6
+ module Conferences
7
+ # User-facing controller for presentations, serving both html and ics
8
+ class PresentationsController < ApplicationController
9
+ before_action :set_presentation, :set_conference, :set_breadcrumb
10
+
11
+ def show
12
+ add_breadcrumb @presentation.name
13
+ respond_to do |format|
14
+ format.html
15
+ format.ics { head :not_found }
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ def set_presentation
22
+ @presentation = Admin::Conferences::Presentation.includes(:presenters, attachments: [attachment_type: [:translations]])
23
+ .find(params[:id])
24
+ rescue ActiveRecord::RecordNotFound
25
+ send_file Rails.root.join('public/404.html'), type: 'text/html; charset=utf-8', status: 404
26
+ end
27
+
28
+ def set_conference
29
+ @conference = Admin::Conferences::Conference.find(params[:conference_id]) if params[:conference_id].present?
30
+ end
31
+
32
+ def set_breadcrumb
33
+ return if @conference.blank?
34
+
35
+ add_breadcrumb Admin::Conferences::Conference.model_name.human.pluralize, frontend_conferences_path
36
+ add_breadcrumb @conference.name, frontend_conference_path(@conference)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Conferences
5
+ module PrimerTheme
6
+ module Journal
7
+ # Base class from which controllers related to the journal plugin inherit
8
+ class ApplicationController < Spina::ApplicationController
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Conferences
5
+ module PrimerTheme
6
+ module Journal
7
+ # User-facing controller for journal articles
8
+ class ArticlesController < ApplicationController
9
+ before_action :set_article, :set_issue, :set_journal, :set_breadcrumb, :set_metadata, :require_admin_for_invisible_article
10
+
11
+ def show
12
+ add_breadcrumb @article.title
13
+ end
14
+
15
+ private
16
+
17
+ def set_article
18
+ @article = Admin::Journal::Article.includes(affiliations: [:institution]).find(params[:id])
19
+ rescue ActiveRecord::RecordNotFound
20
+ send_file Rails.root.join('public/404.html'), type: 'text/html; charset=utf-8', status: 404
21
+ end
22
+
23
+ def set_issue
24
+ @issue = Admin::Journal::Issue.includes(:volume, :articles).find(params[:issue_id])
25
+ rescue ActiveRecord::RecordNotFound
26
+ send_file Rails.root.join('public/404.html'), type: 'text/html; charset=utf-8', status: 404
27
+ end
28
+
29
+ def set_journal
30
+ @journal = @issue.volume.journal
31
+ end
32
+
33
+ def set_breadcrumb
34
+ return if @issue.blank?
35
+
36
+ add_breadcrumb @journal.name, frontend_issues_path
37
+ add_breadcrumb Admin::Journal::Issue.model_name.human.pluralize, frontend_issues_path
38
+ add_breadcrumb t('spina.conferences.primer_theme.journal.volume_issue', volume_number: @issue.volume.number, issue_number: @issue.number),
39
+ frontend_issue_path(@issue.id)
40
+ end
41
+
42
+ def set_metadata
43
+ @title = @article.title
44
+ @description = @article.content(:abstract).try(:to_plain_text)
45
+ end
46
+
47
+ def require_admin_for_invisible_article
48
+ raise ActiveRecord::RecordNotFound unless current_spina_user.present? || @article.visible?
49
+ rescue ActiveRecord::RecordNotFound # TODO: proper 404 handler
50
+ send_file Rails.root.join('public/404.html'), type: 'text/html; charset=utf-8', status: 404
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -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 journal issues
8
+ class IssuesController < ApplicationController
9
+ before_action :set_journal
10
+ before_action :set_issue, :set_breadcrumb, only: :show
11
+ before_action :set_metadata
12
+
13
+ def index
14
+ # having multiple journals is not currently allowed anyway
15
+ @issues = Admin::Journal::Issue.sorted_desc
16
+ end
17
+
18
+ def show
19
+ @articles = current_spina_user.present? ? @issue.articles : @issue.articles.visible
20
+ add_breadcrumb t('spina.conferences.primer_theme.journal.volume_issue', volume_number: @issue.volume.number, issue_number: @issue.number)
21
+ end
22
+
23
+ private
24
+
25
+ def set_journal
26
+ @journal = Admin::Journal::Journal.instance
27
+ end
28
+
29
+ def set_issue
30
+ @issue = Admin::Journal::Issue.includes(:volume, :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_breadcrumb
36
+ add_breadcrumb @journal.name, frontend_issues_path
37
+ add_breadcrumb Admin::Journal::Issue.model_name.human.pluralize, frontend_issues_path
38
+ end
39
+
40
+ def set_metadata
41
+ @title = @journal.name
42
+ @description = ActionView::Base.full_sanitizer.sanitize(@journal.content(:description))
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -25,10 +25,10 @@ module Spina
25
25
 
26
26
  def calendar(name:)
27
27
  Icalendar::Calendar.new
28
- .tap { |calendar| calendar.x_wr_calname = name }
29
- .tap { |calendar| yield(calendar) }
30
- .tap(&:publish)
31
- .then(&:to_ical)
28
+ .tap { |calendar| calendar.x_wr_calname = name }
29
+ .tap { |calendar| yield(calendar) }
30
+ .tap(&:publish)
31
+ .then(&:to_ical)
32
32
  end
33
33
  end
34
34
  end
@@ -25,7 +25,8 @@
25
25
  - if current_spina_user.present?
26
26
  .admin= render 'spina/shared/admin_bar'
27
27
  %header= render 'navigation'
28
- = render 'current_conference_alert'
28
+ - unless local_assigns[:hide_alert]
29
+ = render 'current_conference_alert'
29
30
  - if content_for? :flash
30
31
  .flash-messages= yield :flash
31
32
  %main
@@ -0,0 +1,2 @@
1
+ = render template: 'layouts/spina/conferences/primer_theme/application',
2
+ locals: { author: current_account.name, description: @description, title: @title, seo_title: @title, hide_alert: true }
@@ -0,0 +1,2 @@
1
+ = render template: 'layouts/spina/conferences/primer_theme/application',
2
+ locals: { author: current_account.name, description: @description, title: @title, seo_title: @title, hide_alert: true }
@@ -7,4 +7,5 @@
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, cached: true
10
+ .Header-item.d-none.d-lg-flex= link_to 'Journal', frontend_issues_path, class: %w[Header-link]
10
11
  .Header-item.d-none.d-lg-flex= link_to 'Conferences', frontend_conferences_path, class: %w[Header-link]
@@ -22,7 +22,7 @@
22
22
  %ul{ data: { filter: { list: true } } }
23
23
  = render partial: 'presentation', collection: @presentations.sorted.reverse_order, layout: 'list_item',
24
24
  locals: { conference: @conference }, cached: -> presentation { [presentation, presentation.presenters] }
25
- = paginate @presentations.sorted, views_prefix: 'spina/conferences/primer_theme'
25
+ = paginate @presentations.sorted, views_prefix: 'spina/conferences/primer_theme/conferences'
26
26
  - else
27
27
  = render Primer::BlankslateComponent.new(title: t(:'.no_presentations'), icon: 'mortar-board')
28
28
  = render Primer::BlankslateComponent.new(title: t(:'.no_matching_presentations'), icon: 'mortar-board', hidden: true,
@@ -0,0 +1,6 @@
1
+ = render(Primer::FlexComponent.new(tag: :li, mr: 4, align_items: :center)) do
2
+ = render(Primer::FlexItemComponent.new(mr: 2)) do
3
+ = render(Primer::OcticonComponent.new('person'))
4
+ = render(Primer::FlexComponent.new(tag: :address, direction: :column)) do
5
+ = render(Primer::TextComponent.new(tag: :div, font_weight: :bold)) { authorship.affiliation.name }
6
+ = render(Primer::TextComponent.new(tag: :div, color: :text_secondary)) { authorship.affiliation.institution.name }
@@ -0,0 +1,50 @@
1
+ = render(Primer::HeadingComponent.new) { @article.title }
2
+
3
+ = render(Primer::FlexComponent.new(direction: [:column, nil, :row, nil])) do
4
+ = render(Primer::FlexItemComponent.new(flex_auto: true, mr: [nil, nil, 4, nil])) do
5
+ %ul.list-style-none.d-flex.flex-column.flex-sm-row.my-2
6
+ - @article.affiliations.each do |affiliation|
7
+ = render(Primer::FlexComponent.new(tag: :li, mr: 4, align_items: :center)) do
8
+ = render(Primer::FlexItemComponent.new(mr: 2)) do
9
+ = render(Primer::OcticonComponent.new('person'))
10
+ = render(Primer::FlexComponent.new(tag: :address, direction: :column)) do
11
+ = render(Primer::TextComponent.new(tag: :div, font_weight: :bold)) { affiliation.name }
12
+ = render(Primer::TextComponent.new(tag: :div, color: :text_secondary)) { affiliation.institution.name }
13
+
14
+ - if @article.has_content?(:abstract)
15
+ = render(Primer::HeadingComponent.new(tag: :h2, mt: 4, font_size: 3)) { t '.abstract' }
16
+ = render(Primer::MarkdownComponent.new) { @article.content.html(:abstract) }
17
+
18
+ = render(Primer::BorderBoxComponent.new(ml: [nil, nil, 4, nil])) do |sidebar|
19
+ - sidebar.body do
20
+ - if @article.issue.has_content?(:cover_img)
21
+ = render partial: 'spina/journal/primer_theme/issues/issue_cover', locals: { issue: @article.issue, cover_img: @article.issue.content(:cover_img), size: [200, 400] }
22
+ = render(Primer::BorderBoxComponent.new) do |component|
23
+ - if @article.has_content?(:attachment)
24
+ - component.row do
25
+ = render(Primer::ButtonComponent.new(tag: :a, href: main_app.url_for(@article.content(:attachment)), download: '', scheme: :primary)) do
26
+ = render Primer::OcticonComponent.new('download')
27
+ = t '.download'
28
+ - component.row do
29
+ = render(Primer::HeadingComponent.new(tag: :h2, font_size: 4, color: :text_secondary)) { t '.published' }
30
+ = render(Primer::TextComponent.new) do
31
+ = time_tag @article.issue.date, format: :long
32
+ - component.row do
33
+ = render(Primer::HeadingComponent.new(tag: :h2, font_size: 4, color: :text_secondary)) { t '.issue' }
34
+ = render(Primer::TextComponent.new) do
35
+ = link_to t('spina.journal.primer_theme.volume_issue',
36
+ volume_number: @article.issue.volume.number,
37
+ issue_number: @article.issue.number), frontend_issue_path(@article.issue)
38
+ - unless @article.doi.blank?
39
+ = component.row do
40
+ = render(Primer::HeadingComponent.new(tag: :h2, font_size: 4, color: :text_secondary)) { t '.doi' }
41
+ = render(Primer::TextComponent.new(tag: :div, color: :text_secondary, mt: 1)) do
42
+ = link_to nil, @article.doi
43
+ - unless @article.url.blank?
44
+ = component.row do
45
+ = render(Primer::HeadingComponent.new(tag: :h2, font_size: 4, color: :text_secondary)) { t '.url' }
46
+ = render(Primer::TextComponent.new(tag: :div, color: :text_secondary, mt: 1)) do
47
+ = link_to nil, @article.url
48
+ - if @article.draft?
49
+ = component.row do
50
+ = render(Primer::TextComponent.new(tag: :div, color: :text_danger, font_weight: :bold)) { t '.draft' }
@@ -0,0 +1,15 @@
1
+ = render(Primer::FlexComponent.new(direction: [:column, nil, :row, nil])) do
2
+ = render(Primer::FlexItemComponent.new(flex_auto: true)) do
3
+ = render(Primer::HeadingComponent.new(tag: :h3, mb: 1)) do
4
+ = link_to article.title, frontend_issue_article_path(article.issue, article)
5
+ = render(Primer::TextComponent.new(tag: :div, color: :text_secondary)) do
6
+ = render(Primer::OcticonComponent.new(article.affiliations.many? ? 'people' : 'person'))
7
+ = render(Primer::BaseComponent.new(tag: :address, display: :inline)) do
8
+ = article.authorships.sorted_within_article.collect { |authorship| authorship.affiliation.name }.to_sentence
9
+ - unless article.doi.blank?
10
+ = render(Primer::TextComponent.new(tag: :div, color: :text_secondary)) do
11
+ = link_to nil, article.doi
12
+ - if article.has_content?(:attachment)
13
+ = render(Primer::ButtonComponent.new(tag: :a, href: main_app.url_for(article.content(:attachment)), mt: 2, download: '')) do
14
+ = render Primer::OcticonComponent.new('download')
15
+ = t '.download'
@@ -0,0 +1,17 @@
1
+ = render(Primer::FlexComponent.new(direction: [:column, nil, :row, nil])) do
2
+ - if issue.content(:cover_img).present?
3
+ = render(Primer::FlexItemComponent.new(mr: 4)) do
4
+ = render partial: 'issue_cover', locals: { issue: issue, cover_img: issue.content(:cover_img), size: [150, 300] }
5
+ = render(Primer::FlexItemComponent.new(flex_auto: true)) do
6
+ = render(Primer::HeadingComponent.new(tag: :h2, mb: 1)) do
7
+ = link_to t('spina.conferences.primer_theme.journal.volume_issue',
8
+ volume_number: issue.volume.number,
9
+ issue_number: issue.number), frontend_issue_path(issue)
10
+ - unless issue.title.blank?
11
+ = render(Primer::HeadingComponent.new(tag: :h3, color: :text_secondary, mb: 1)) do
12
+ = issue.title
13
+ = render(Primer::TextComponent.new(tag: :div, color: :text_secondary, font_weight: :bold)) do
14
+ = time_tag issue.date, format: :long
15
+ - if issue.has_content?(:description)
16
+ = render(Primer::TextComponent.new(tag: :div, color: :text_secondary, mt: 2)) do
17
+ = issue.content.html(:description)
@@ -0,0 +1,6 @@
1
+ - cache cover_img do
2
+ = image_tag main_app.url_for(cover_img.variant(resize_to_limit: size)),
3
+ srcset: srcset(cover_img, variant: { resize_to_limit: size }),
4
+ alt_description: t('spina.conferences.primer_theme.journal.volume_issue', volume_number: issue.volume.number, issue_number: issue.number),
5
+ draggable: false,
6
+ class: 'p-1'
@@ -0,0 +1,10 @@
1
+ = render(Primer::HeadingComponent.new) { @journal.name }
2
+
3
+ - if @journal.content(:description).present?
4
+ = render(Primer::MarkdownComponent.new(mt: 4)) { @journal.content.html(:description) }
5
+
6
+ %div#journal-issues-list.border-top
7
+ - if @issues.any?
8
+ %ul= render partial: 'issue', collection: @issues, layout: 'list_item'
9
+ - else
10
+ = render Primer::BlankslateComponent.new(title: t(:'.no_issues'), icon: 'mortar-board')
@@ -0,0 +1,18 @@
1
+ = render(Primer::HeadingComponent.new) do
2
+ = t('spina.conferences.primer_theme.journal.volume_issue', volume_number: @issue.volume.number, issue_number: @issue.number)
3
+
4
+ - unless @issue.title.blank?
5
+ = render(Primer::HeadingComponent.new(tag: :h2, color: :text_secondary, mb: 2)) { @issue.title }
6
+
7
+ - if @issue.has_content?(:cover_img)
8
+ = render partial: 'issue_cover', locals: { issue: @issue, cover_img: @issue.content(:cover_img), size: [300, 600] }
9
+
10
+ - if @issue.has_content?(:description)
11
+ = render(Primer::MarkdownComponent.new(my: 4)) do
12
+ = @issue.content.html(:description)
13
+
14
+ %div#journal-articles-list.border-top
15
+ - if @articles.any?
16
+ %ul= render partial: 'article', collection: @articles.sorted_asc, layout: 'list_item'
17
+ - else
18
+ = render Primer::BlankslateComponent.new(title: t(:'.no_articles'), icon: 'mortar-board')
@@ -162,6 +162,14 @@
162
162
  name: 'embed_url',
163
163
  title: 'Form embed URL',
164
164
  part_type: 'Spina::Parts::Admin::Conferences::Url'
165
+ }, {
166
+ name: 'abstract',
167
+ title: 'Abstract',
168
+ part_type: 'Spina::Parts::Text'
169
+ }, {
170
+ name: 'cover_img',
171
+ title: 'Cover image',
172
+ part_type: 'Spina::Parts::Image'
165
173
  }]
166
174
 
167
175
  theme.view_templates = [{
@@ -221,5 +229,5 @@
221
229
  label: 'Footer'
222
230
  }]
223
231
 
224
- theme.plugins = ['conferences']
232
+ theme.plugins = %w[conferences journal]
225
233
  end
@@ -99,66 +99,87 @@ en:
99
99
  conferences:
100
100
  primer_theme:
101
101
  conferences:
102
- index:
103
- subscribe: Subscribe
104
- no_conferences: No conferences have been added.
105
- search: Search
106
- no_matching_conferences: No matching conferences.
107
- show:
108
- information: Information
109
- presentations: Presentations
110
- events: Events
111
- subscribe: Subscribe
112
- tabs:
102
+ conferences:
103
+ index:
104
+ subscribe: Subscribe
105
+ no_conferences: No conferences have been added.
106
+ search: Search
107
+ no_matching_conferences: No matching conferences.
108
+ show:
113
109
  information: Information
114
110
  presentations: Presentations
115
111
  events: Events
116
- no_tab: No tab.
117
- tab_does_not_exist: "The tab '%{tab}' does not exist."
118
- no_information: No information.
119
- conference_navigation: Conference content
112
+ subscribe: Subscribe
113
+ tabs:
114
+ information: Information
115
+ presentations: Presentations
116
+ events: Events
117
+ no_tab: No tab.
118
+ tab_does_not_exist: "The tab '%{tab}' does not exist."
119
+ no_information: No information.
120
+ conference_navigation: Conference content
121
+ presentations:
122
+ all_presentation_types: All
123
+ results: Results
124
+ search: Search
125
+ no_matching_presentations: No matching presentations.
126
+ no_presentations: No presentations.
127
+ presentation_type:
128
+ results: Results
129
+ events:
130
+ search: Search
131
+ no_matching_events: No matching events.
132
+ no_events: No events.
133
+ event:
134
+ times_html: "%{start_time}–%{finish_time}"
135
+ conference:
136
+ dates_html: "%{start_date}–%{finish_date}"
137
+ locations: "%{institutions}, %{cities}"
138
+ submission_flash:
139
+ submit_by_html: Submit abstracts by %{date}
140
+ submit_abstract: Submit an abstract
141
+ header:
142
+ dates_html: "%{start_date}–%{finish_date}"
143
+ locations: "%{institutions}, %{cities}"
144
+ gallery:
145
+ previous: Previous
146
+ next: Next
147
+ sponsors:
148
+ title: Sponsors
149
+
120
150
  presentations:
121
- all_presentation_types: All
122
- results: Results
123
- search: Search
124
- no_matching_presentations: No matching presentations.
125
- no_presentations: No presentations.
126
- presentation_type:
127
- results: Results
128
- events:
129
- search: Search
130
- no_matching_events: No matching events.
131
- no_events: No events.
132
- event:
133
- times_html: "%{start_time}–%{finish_time}"
134
- conference:
135
- dates_html: "%{start_date}–%{finish_date}"
136
- locations: "%{institutions}, %{cities}"
137
- submission_flash:
138
- submit_by_html: Submit abstracts by %{date}
139
- submit_abstract: Submit an abstract
140
- header:
141
- dates_html: "%{start_date}–%{finish_date}"
142
- locations: "%{institutions}, %{cities}"
143
- gallery:
144
- previous: Previous
145
- next: Next
146
- sponsors:
147
- title: Sponsors
151
+ show:
152
+ room_and_institution: "%{room}, %{institution}"
148
153
 
149
- presentations:
150
- show:
151
- room_and_institution: "%{room}, %{institution}"
154
+ kaminari:
155
+ next_page:
156
+ next: Next
157
+ next_page: Next page
158
+ prev_page:
159
+ previous: Previous
160
+ previous_page: Previous page
161
+ page:
162
+ page: Page %{number}
152
163
 
153
- kaminari:
154
- next_page:
155
- next: Next
156
- next_page: Next page
157
- prev_page:
158
- previous: Previous
159
- previous_page: Previous page
160
- page:
161
- page: Page %{number}
164
+ journal:
165
+ volume_issue: "Volume %{volume_number} (Issue %{issue_number})"
166
+ issues:
167
+ index:
168
+ no_issues: This journal has no issues.
169
+ logo: Journal logo
170
+ show:
171
+ no_articles: This issue has no articles.
172
+ article:
173
+ download: PDF
174
+ articles:
175
+ show:
176
+ download: PDF
177
+ doi: DOI
178
+ url: URL
179
+ abstract: Abstract
180
+ published: Published
181
+ issue: Issue
182
+ draft: THIS ARTICLE IS A DRAFT
162
183
 
163
184
  languages:
164
185
  en-GB: British English
data/config/routes.rb CHANGED
@@ -1,11 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Spina::Engine.routes.draw do
4
- namespace :frontend, path: 'conferences', module: 'conferences/primer_theme' do
4
+ namespace :frontend, path: 'conferences', module: 'conferences/primer_theme/conferences' do
5
5
  resources :conferences, only: %i[index show] do
6
6
  resources :presentations, only: [:show]
7
7
  end
8
8
  resources :presentations, only: [:show]
9
9
  get 'cookies-info', controller: 'application'
10
10
  end
11
+
12
+ namespace :frontend, path: 'journal', module: 'conferences/primer_theme/journal' do
13
+ resources :issues, only: %i[index show] do
14
+ resources :articles, only: %i[show]
15
+ end
16
+ end
11
17
  end
@@ -4,15 +4,14 @@ require 'spina'
4
4
  require 'spina/conferences/primer_theme/engine'
5
5
  require 'spina/conferences/primer_theme/breadcrumbs/builder'
6
6
  require 'spina/admin/conferences'
7
+ require 'spina/admin/journal'
7
8
  require 'octicons_helper'
8
9
  require 'view_component'
9
10
  require 'primer/view_components'
10
11
  require 'icalendar'
11
12
 
12
13
  module Spina
13
- module Conferences
14
- module PrimerTheme
15
- # Your code goes here...
16
- end
14
+ module PrimerTheme
15
+ # Your code goes here...
17
16
  end
18
17
  end
@@ -3,7 +3,7 @@
3
3
  module Spina
4
4
  module Conferences
5
5
  module PrimerTheme
6
- VERSION = '0.4.2'
6
+ VERSION = '0.5.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spina-conferences-primer_theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Malčić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-06 00:00:00.000000000 Z
11
+ date: 2021-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: babel-transpiler
@@ -109,47 +109,47 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: 2.1.0
111
111
  - !ruby/object:Gem::Dependency
112
- name: capybara
112
+ name: spina-admin-journal
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '3.33'
118
- type: :development
117
+ version: 0.4.0
118
+ type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '3.33'
124
+ version: 0.4.0
125
125
  - !ruby/object:Gem::Dependency
126
- name: dotenv-rails
126
+ name: capybara
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '2.7'
131
+ version: '3.33'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '2.7'
138
+ version: '3.33'
139
139
  - !ruby/object:Gem::Dependency
140
- name: minitest-reporters
140
+ name: dotenv-rails
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '1.4'
145
+ version: '2.7'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '1.4'
152
+ version: '2.7'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: puma
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -292,9 +292,12 @@ files:
292
292
  - app/assets/stylesheets/spina/conferences/primer_theme/_custom.sass
293
293
  - app/assets/stylesheets/spina/conferences/primer_theme/_custom_variables.sass
294
294
  - app/assets/stylesheets/spina/conferences/primer_theme/application.sass
295
- - app/controllers/spina/conferences/primer_theme/application_controller.rb
296
- - app/controllers/spina/conferences/primer_theme/conferences_controller.rb
297
- - app/controllers/spina/conferences/primer_theme/presentations_controller.rb
295
+ - app/controllers/spina/conferences/primer_theme/conferences/application_controller.rb
296
+ - app/controllers/spina/conferences/primer_theme/conferences/conferences_controller.rb
297
+ - app/controllers/spina/conferences/primer_theme/conferences/presentations_controller.rb
298
+ - app/controllers/spina/conferences/primer_theme/journal/application_controller.rb
299
+ - app/controllers/spina/conferences/primer_theme/journal/articles_controller.rb
300
+ - app/controllers/spina/conferences/primer_theme/journal/issues_controller.rb
298
301
  - app/helpers/spina/conferences/primer_theme/application_helper.rb
299
302
  - app/helpers/spina/conferences/primer_theme/asset_helper.rb
300
303
  - app/helpers/spina/conferences/primer_theme/navigations_helper.rb
@@ -307,8 +310,10 @@ files:
307
310
  - app/views/conferences_primer_theme/pages/show.html.haml
308
311
  - app/views/layouts/conferences_primer_theme/application.html.haml
309
312
  - app/views/layouts/spina/conferences/primer_theme/application.html.haml
310
- - app/views/layouts/spina/conferences/primer_theme/conferences.html.haml
311
- - app/views/layouts/spina/conferences/primer_theme/presentations.html.haml
313
+ - app/views/layouts/spina/conferences/primer_theme/conferences/conferences.html.haml
314
+ - app/views/layouts/spina/conferences/primer_theme/conferences/presentations.html.haml
315
+ - app/views/layouts/spina/conferences/primer_theme/journal/articles.html.haml
316
+ - app/views/layouts/spina/conferences/primer_theme/journal/issues.html.haml
312
317
  - app/views/spina/admin/layout_partables/texts/_form.html.haml
313
318
  - app/views/spina/application/_cookies.html.haml
314
319
  - app/views/spina/application/_current_conference_alert.html.haml
@@ -321,27 +326,34 @@ files:
321
326
  - app/views/spina/application/_navigation.html.haml
322
327
  - app/views/spina/application/_navigation_item.html.haml
323
328
  - app/views/spina/application/_text.html.haml
324
- - app/views/spina/conferences/primer_theme/conferences/_conference.html.haml
325
- - app/views/spina/conferences/primer_theme/conferences/_event.html.haml
326
- - app/views/spina/conferences/primer_theme/conferences/_events.html.haml
327
- - app/views/spina/conferences/primer_theme/conferences/_header.html.haml
328
- - app/views/spina/conferences/primer_theme/conferences/_institution.html.haml
329
- - app/views/spina/conferences/primer_theme/conferences/_institution_logo.html.haml
330
- - app/views/spina/conferences/primer_theme/conferences/_presentation.html.haml
331
- - app/views/spina/conferences/primer_theme/conferences/_presentation_type.html.haml
332
- - app/views/spina/conferences/primer_theme/conferences/_presentations.html.haml
333
- - app/views/spina/conferences/primer_theme/conferences/_submission_flash.html.haml
334
- - app/views/spina/conferences/primer_theme/conferences/index.html.haml
335
- - app/views/spina/conferences/primer_theme/conferences/show.html.haml
336
- - app/views/spina/conferences/primer_theme/kaminari/_gap.html.haml
337
- - app/views/spina/conferences/primer_theme/kaminari/_next_page.html.haml
338
- - app/views/spina/conferences/primer_theme/kaminari/_page.html.haml
339
- - app/views/spina/conferences/primer_theme/kaminari/_paginator.html.haml
340
- - app/views/spina/conferences/primer_theme/kaminari/_prev_page.html.haml
341
- - app/views/spina/conferences/primer_theme/presentations/_abstract.html.haml
342
- - app/views/spina/conferences/primer_theme/presentations/_attachment.html.haml
343
- - app/views/spina/conferences/primer_theme/presentations/_attachments.html.haml
344
- - app/views/spina/conferences/primer_theme/presentations/show.html.haml
329
+ - app/views/spina/conferences/primer_theme/conferences/conferences/_conference.html.haml
330
+ - app/views/spina/conferences/primer_theme/conferences/conferences/_event.html.haml
331
+ - app/views/spina/conferences/primer_theme/conferences/conferences/_events.html.haml
332
+ - app/views/spina/conferences/primer_theme/conferences/conferences/_header.html.haml
333
+ - app/views/spina/conferences/primer_theme/conferences/conferences/_institution.html.haml
334
+ - app/views/spina/conferences/primer_theme/conferences/conferences/_institution_logo.html.haml
335
+ - app/views/spina/conferences/primer_theme/conferences/conferences/_presentation.html.haml
336
+ - app/views/spina/conferences/primer_theme/conferences/conferences/_presentation_type.html.haml
337
+ - app/views/spina/conferences/primer_theme/conferences/conferences/_presentations.html.haml
338
+ - app/views/spina/conferences/primer_theme/conferences/conferences/_submission_flash.html.haml
339
+ - app/views/spina/conferences/primer_theme/conferences/conferences/index.html.haml
340
+ - app/views/spina/conferences/primer_theme/conferences/conferences/show.html.haml
341
+ - app/views/spina/conferences/primer_theme/conferences/kaminari/_gap.html.haml
342
+ - app/views/spina/conferences/primer_theme/conferences/kaminari/_next_page.html.haml
343
+ - app/views/spina/conferences/primer_theme/conferences/kaminari/_page.html.haml
344
+ - app/views/spina/conferences/primer_theme/conferences/kaminari/_paginator.html.haml
345
+ - app/views/spina/conferences/primer_theme/conferences/kaminari/_prev_page.html.haml
346
+ - app/views/spina/conferences/primer_theme/conferences/presentations/_abstract.html.haml
347
+ - app/views/spina/conferences/primer_theme/conferences/presentations/_attachment.html.haml
348
+ - app/views/spina/conferences/primer_theme/conferences/presentations/_attachments.html.haml
349
+ - app/views/spina/conferences/primer_theme/conferences/presentations/show.html.haml
350
+ - app/views/spina/conferences/primer_theme/journal/articles/_authorship.html.haml
351
+ - app/views/spina/conferences/primer_theme/journal/articles/show.html.haml
352
+ - app/views/spina/conferences/primer_theme/journal/issues/_article.html.haml
353
+ - app/views/spina/conferences/primer_theme/journal/issues/_issue.html.haml
354
+ - app/views/spina/conferences/primer_theme/journal/issues/_issue_cover.html.haml
355
+ - app/views/spina/conferences/primer_theme/journal/issues/index.html.haml
356
+ - app/views/spina/conferences/primer_theme/journal/issues/show.html.haml
345
357
  - config/initializers/assets.rb
346
358
  - config/initializers/primer.rb
347
359
  - config/initializers/themes/conferences_primer_theme.rb
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spina
4
- module Conferences
5
- module PrimerTheme
6
- # Base class from which controllers inherit
7
- class ApplicationController < Spina::ApplicationController
8
- def cookies_info
9
- render partial: 'cookies'
10
- end
11
- end
12
- end
13
- end
14
- end
@@ -1,70 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spina
4
- module Conferences
5
- module PrimerTheme
6
- # User-facing controller for conferences, serving both html and ics
7
- class ConferencesController < ApplicationController
8
- before_action :set_conference, :set_tab, :set_presentation_type, :set_presentations, :set_breadcrumb, only: :show
9
- before_action :set_metadata
10
-
11
- def index
12
- @conferences = Admin::Conferences::Conference.sorted.includes(institutions: [:logo])
13
- respond_to do |format|
14
- format.html
15
- format.ics { render body: @conferences.to_ics }
16
- end
17
- end
18
-
19
- def show
20
- add_breadcrumb @conference.name
21
- respond_to do |format|
22
- format.html
23
- format.ics { render body: @conference.to_ics }
24
- end
25
- end
26
-
27
- private
28
-
29
- def set_conference
30
- @conference = Admin::Conferences::Conference.includes(:events, :institutions,
31
- presentation_types: [:translations],
32
- presentations: [session: [:room], presenters: [:institution]])
33
- .find(params[:id])
34
- @conference.view_context = view_context
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_tab
40
- @tab = params[:tab] || 'information'
41
- end
42
-
43
- def set_presentation_type
44
- if params[:presentation_type].present?
45
- @presentation_type = @conference.presentation_types
46
- .includes(presentations: [session: [:room], presenters: [:institution]])
47
- .find(params[:presentation_type])
48
- end
49
- end
50
-
51
- def set_presentations
52
- @presentations = if @presentation_type.present?
53
- @presentation_type.presentations.page(params[:page]).per(15)
54
- else
55
- @conference.presentations.page(params[:page]).per(15)
56
- end
57
- end
58
-
59
- def set_breadcrumb
60
- add_breadcrumb Admin::Conferences::Conference.model_name.human.pluralize, frontend_conferences_path
61
- end
62
-
63
- def set_metadata
64
- @title = @conference.present? ? @conference.name : Admin::Conferences::Conference.model_name.human(count: 0)
65
- @description = @conference.present? && @conference.has_content?(:text) ? helpers.strip_tags(@conference.content(:text)) : ''
66
- end
67
- end
68
- end
69
- end
70
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spina
4
- module Conferences
5
- module PrimerTheme
6
- # User-facing controller for presentations, serving both html and ics
7
- class PresentationsController < ApplicationController
8
- before_action :set_presentation, :set_conference, :set_breadcrumb
9
-
10
- def show
11
- add_breadcrumb @presentation.name
12
- respond_to do |format|
13
- format.html
14
- format.ics { head :not_found }
15
- end
16
- end
17
-
18
- private
19
-
20
- def set_presentation
21
- @presentation = Admin::Conferences::Presentation.includes(:presenters, attachments: [attachment_type: [:translations]])
22
- .find(params[:id])
23
- rescue ActiveRecord::RecordNotFound
24
- send_file Rails.root.join('public/404.html'), type: 'text/html; charset=utf-8', status: 404
25
- end
26
-
27
- def set_conference
28
- @conference = Admin::Conferences::Conference.find(params[:conference_id]) if params[:conference_id].present?
29
- end
30
-
31
- def set_breadcrumb
32
- return if @conference.blank?
33
-
34
- add_breadcrumb Admin::Conferences::Conference.model_name.human.pluralize, frontend_conferences_path
35
- add_breadcrumb @conference.name, frontend_conference_path(@conference)
36
- end
37
- end
38
- end
39
- end
40
- end