spina-admin-journal 0.6.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +36 -48
  3. data/app/assets/config/spina_admin_journal_manifest.js +1 -2
  4. data/app/assets/javascripts/spina/admin/journal/application.js +0 -0
  5. data/app/components/spina/admin/journal/affiliations_list_component.rb +32 -0
  6. data/app/components/spina/admin/journal/application_component.rb +11 -0
  7. data/app/components/spina/admin/journal/articles_list_component.rb +54 -0
  8. data/app/components/spina/admin/journal/authors_list_component.rb +37 -0
  9. data/app/components/spina/admin/journal/authorships_list_component.rb +45 -0
  10. data/app/components/spina/admin/journal/empty_list_component.html.haml +1 -0
  11. data/app/components/spina/admin/journal/empty_list_component.rb +14 -0
  12. data/app/components/spina/admin/journal/form_group_component.html.haml +4 -0
  13. data/app/components/spina/admin/journal/form_group_component.rb +17 -0
  14. data/app/components/spina/admin/journal/institutions_list_component.rb +32 -0
  15. data/app/components/spina/admin/journal/issues_list_component.rb +47 -0
  16. data/app/components/spina/admin/journal/licences_list_component.rb +32 -0
  17. data/app/components/spina/admin/journal/list_component.html.haml +11 -0
  18. data/app/components/spina/admin/journal/list_component.rb +22 -0
  19. data/app/components/spina/admin/journal/list_item_component.html.haml +17 -0
  20. data/app/components/spina/admin/journal/list_item_component.rb +23 -0
  21. data/app/components/spina/admin/journal/volumes_list_component.rb +34 -0
  22. data/app/controllers/spina/admin/journal/application_controller.rb +1 -1
  23. data/app/controllers/spina/admin/journal/articles_controller.rb +18 -24
  24. data/app/controllers/spina/admin/journal/authors_controller.rb +18 -26
  25. data/app/controllers/spina/admin/journal/institutions_controller.rb +13 -5
  26. data/app/controllers/spina/admin/journal/issues_controller.rb +20 -27
  27. data/app/controllers/spina/admin/journal/journals_controller.rb +4 -1
  28. data/app/controllers/spina/admin/journal/licences_controller.rb +8 -4
  29. data/app/controllers/spina/admin/journal/volumes_controller.rb +16 -21
  30. data/app/models/spina/admin/journal/author.rb +1 -0
  31. data/app/models/spina/admin/journal/authorship.rb +9 -0
  32. data/app/views/spina/admin/hooks/journal/_primary_navigation.html.haml +35 -26
  33. data/app/views/spina/admin/journal/articles/_form.html.haml +23 -23
  34. data/app/views/spina/admin/journal/articles/_form_authors.html.haml +3 -15
  35. data/app/views/spina/admin/journal/articles/_form_details.html.haml +37 -56
  36. data/app/views/spina/admin/journal/articles/index.html.haml +7 -17
  37. data/app/views/spina/admin/journal/articles/view_authors.html.haml +2 -0
  38. data/app/views/spina/admin/journal/authors/_form.html.haml +24 -24
  39. data/app/views/spina/admin/journal/authors/_form_affiliation.html.haml +12 -20
  40. data/app/views/spina/admin/journal/authors/_form_articles.html.haml +3 -18
  41. data/app/views/spina/admin/journal/authors/_form_details.html.haml +27 -5
  42. data/app/views/spina/admin/journal/authors/index.html.haml +7 -15
  43. data/app/views/spina/admin/journal/authors/view_articles.html.haml +2 -0
  44. data/app/views/spina/admin/journal/institutions/_form.html.haml +24 -24
  45. data/app/views/spina/admin/journal/institutions/_form_details.html.haml +3 -8
  46. data/app/views/spina/admin/journal/institutions/_form_view_affiliations.html.haml +3 -10
  47. data/app/views/spina/admin/journal/institutions/index.html.haml +7 -15
  48. data/app/views/spina/admin/journal/institutions/view_affiliations.html.haml +2 -0
  49. data/app/views/spina/admin/journal/issues/_form.html.haml +23 -23
  50. data/app/views/spina/admin/journal/issues/_form_articles.html.haml +3 -14
  51. data/app/views/spina/admin/journal/issues/_form_details.html.haml +14 -28
  52. data/app/views/spina/admin/journal/issues/index.html.haml +7 -16
  53. data/app/views/spina/admin/journal/issues/view_articles.html.haml +3 -0
  54. data/app/views/spina/admin/journal/journals/_form.html.haml +22 -30
  55. data/app/views/spina/admin/journal/licences/_form.html.haml +24 -37
  56. data/app/views/spina/admin/journal/licences/index.html.haml +7 -16
  57. data/app/views/spina/admin/journal/volumes/_form.html.haml +25 -12
  58. data/app/views/spina/admin/journal/volumes/_form_details.html.haml +5 -10
  59. data/app/views/spina/admin/journal/volumes/_form_issues.html.haml +2 -13
  60. data/app/views/spina/admin/journal/volumes/index.html.haml +7 -16
  61. data/app/views/spina/admin/journal/volumes/view_issues.html.haml +2 -0
  62. data/app/views/spina/admin/parts/admin/journal/page_ranges/_form.html.haml +3 -4
  63. data/config/locales/en.yml +70 -8
  64. data/config/routes.rb +26 -6
  65. data/db/migrate/20220130171603_add_orcid_to_spina_admin_journal_author.rb +7 -0
  66. data/lib/spina/admin/journal/engine.rb +12 -0
  67. data/lib/spina/admin/journal/version.rb +1 -1
  68. data/lib/spina/admin/journal.rb +1 -0
  69. metadata +53 -63
  70. data/app/assets/javascripts/spina/admin/journal/application.es6 +0 -72
  71. data/app/views/layouts/spina/admin/journal/articles.html.haml +0 -10
  72. data/app/views/layouts/spina/admin/journal/authors.html.haml +0 -10
  73. data/app/views/layouts/spina/admin/journal/institutions.html.haml +0 -10
  74. data/app/views/layouts/spina/admin/journal/issues.html.haml +0 -10
  75. data/app/views/layouts/spina/admin/journal/journals.html.haml +0 -10
  76. data/app/views/layouts/spina/admin/journal/licences.html.haml +0 -10
  77. data/app/views/layouts/spina/admin/journal/volumes.html.haml +0 -10
  78. data/app/views/spina/admin/journal/affiliations/_affiliation.html.haml +0 -8
  79. data/app/views/spina/admin/journal/application/_empty_list.html.haml +0 -3
  80. data/app/views/spina/admin/journal/articles/_article.html.haml +0 -10
  81. data/app/views/spina/admin/journal/authors/_author.html.haml +0 -8
  82. data/app/views/spina/admin/journal/authorships/_authorship.html.haml +0 -9
  83. data/app/views/spina/admin/journal/institutions/_institution.html.haml +0 -9
  84. data/app/views/spina/admin/journal/issues/_issue.html.haml +0 -9
  85. data/app/views/spina/admin/journal/journals/index.html.haml +0 -27
  86. data/app/views/spina/admin/journal/licences/_licence.html.haml +0 -11
  87. data/app/views/spina/admin/journal/volumes/_volume.html.haml +0 -7
  88. data/vendor/assets/javascripts/spina/admin/journal/html5sortable.js +0 -1295
@@ -1,35 +1,27 @@
1
- - if @journal.errors.any?
2
- - content_for :notifications do
3
- .notification.notification-danger.animated.fadeInRight
4
- = icon 'exclamation'
5
- .notification-message
6
- = t 'spina.notifications.alert'
7
- %small= @journal.errors.full_messages.join('<br />').html_safe
8
- = link_to '#', data: { close_notification: true } do
9
- = icon 'cross'
1
+ = render Spina::UserInterface::HeaderComponent.new do |header|
2
+ - header.actions do
3
+ - if @journal.persisted?
4
+ = render Spina::UserInterface::DropdownComponent.new do |dropdown|
5
+ - dropdown.button(classes: "btn btn-default px-3") do
6
+ = heroicon('dots-horizontal', style: :solid, class: "w-5 h-5 text-gray-600")
7
+
8
+ - dropdown.menu do
9
+ = button_to t('spina.permanently_delete'), admin_journal_journal_path(@journal), method: :delete, class: "block w-full text-left px-4 py-2 text-sm leading-5 font-medium text-red-500 cursor-pointer bg-white hover:bg-red-100 hover:bg-opacity-50 hover:text-red-500 focus:outline-none focus:bg-gray-100 focus:text-gray-900", form: {data: { controller: 'confirm', confirm_message: t('.delete_confirmation', name: @journal.name) } }
10
+
11
+ = button_tag type: :submit, form: dom_id(@journal), class: 'btn btn-primary', data: { controller: 'button', action: 'button#loading', loading_message: t('spina.ui.saving')} do
12
+ = heroicon('check', style: :solid, class: 'w-5 h-5 mr-1 -ml-2')
13
+ = t '.save'
14
+
15
+ .p-4.md:p-8
16
+ .max-w-5xl
17
+ = form_with model: [spina, :admin_journal, @journal], id: dom_id(@journal), html: { autocomplete: 'off' } do |f|
18
+ .-mt-6
19
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Journal.human_attribute_name(:name)) do
20
+ = render Spina::Forms::TextFieldComponent.new(f, :name)
10
21
 
11
- = form_for [:admin_journal, @journal], html: { autocomplete: "off" } do |f|
12
- %header#header
13
- .breadcrumbs
14
- = render_breadcrumbs
15
- #header_actions
16
- %button.button.button-primary{ type: 'submit', style: 'margin-right: 0', data: { disable_with: t('spina.pages.saving') } }
17
- = icon 'check'
18
- = t '.save'
19
- .tab-content.active
20
- .page-form
21
- .page-form-group
22
- .page-form-label
23
- = ::Spina::Admin::Journal::Journal.human_attribute_name :name
24
- .page-form-content
25
- = f.text_field :name
26
22
  = f.fields_for :"#{@locale}_content", @parts do |ff|
27
- = ff.hidden_field :type, value: ff.object.class.name
23
+ = ff.hidden_field :type, value: ff.object.class
28
24
  = ff.hidden_field :title
29
25
  = ff.hidden_field :name
30
26
 
31
- .page-form-group.page-part{ data: { name: ff.object.name } }
32
- = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.name)}/form", f: ff
33
-
34
- - unless @journal.new_record?
35
- .pull-right= link_to t('spina.permanently_delete'), admin_journal_journal_path(@journal), method: :delete, data: { confirm: t('.delete_confirmation', name: @journal.name) }, class: 'button button-link button-danger'
27
+ = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.to_s)}/form", f: ff
@@ -1,43 +1,30 @@
1
- - if @licence.errors.any?
2
- - content_for :notifications do
3
- .notification.notification-danger.animated.fadeInRight
4
- = icon 'exclamation'
5
- .notification-message
6
- = t 'spina.notifications.alert'
7
- %small= @licence.errors.full_messages.join('<br />').html_safe
8
- = link_to '#', data: { close_notification: true } do
9
- = icon 'cross'
1
+ = render Spina::UserInterface::HeaderComponent.new do |header|
2
+ - header.actions do
3
+ - if @licence.persisted?
4
+ = render Spina::UserInterface::DropdownComponent.new do |dropdown|
5
+ - dropdown.button(classes: "btn btn-default px-3") do
6
+ = heroicon('dots-horizontal', style: :solid, class: "w-5 h-5 text-gray-600")
10
7
 
11
- = form_for [:admin_journal, @licence], html: { autocomplete: 'off' } do |f|
12
- %header#header
13
- = render partial: 'spina/admin/shared/breadcrumbs'
8
+ - dropdown.menu do
9
+ = button_to t('spina.permanently_delete'), admin_journal_licence_path(@licence), method: :delete, class: "block w-full text-left px-4 py-2 text-sm leading-5 font-medium text-red-500 cursor-pointer bg-white hover:bg-red-100 hover:bg-opacity-50 hover:text-red-500 focus:outline-none focus:bg-gray-100 focus:text-gray-900", form: {data: { controller: 'confirm', confirm_message: t('.delete_confirmation', name: @licence.name) } }
14
10
 
15
- #header_actions
16
- %button.button.button-primary{ type: 'submit', style: 'margin-right: 0', data: { disable_with: t('spina.pages.saving') } }
17
- = icon 'check'
18
- = t '.save'
11
+ = button_tag type: :submit, form: dom_id(@licence), class: 'btn btn-primary', data: { controller: 'button', action: 'button#loading', loading_message: t('spina.ui.saving')} do
12
+ = heroicon('check', style: :solid, class: 'w-5 h-5 mr-1 -ml-2')
13
+ = t '.save'
19
14
 
20
- .button{ style: 'margin-right: 0' }= link_to t('spina.cancel'), admin_journal_licences_path
15
+ .p-4.md:p-8
16
+ .max-w-5xl
17
+ = form_with model: [spina, :admin_journal, @licence], id: dom_id(@licence), html: { autocomplete: 'off' } do |f|
18
+ .-mt-6
19
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Licence.human_attribute_name(:name)) do
20
+ = render Spina::Forms::TextFieldComponent.new(f, :name)
21
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Licence.human_attribute_name(:abbreviated_name)) do
22
+ = render Spina::Forms::TextFieldComponent.new(f, :abbreviated_name)
21
23
 
22
- .page-form
23
- .page-form-group
24
- .page-form-label
25
- = ::Spina::Admin::Journal::Licence.human_attribute_name :name
26
- .page-form-content
27
- = f.text_field :name
28
- .page-form-group
29
- .page-form-label
30
- = ::Spina::Admin::Journal::Licence.human_attribute_name :abbreviated_name
31
- .page-form-content
32
- = f.text_field :abbreviated_name
24
+ = f.fields_for :"#{@locale}_content", @parts do |ff|
25
+ = ff.hidden_field :type, value: ff.object.class
26
+ = ff.hidden_field :title
27
+ = ff.hidden_field :name
33
28
 
34
- = f.fields_for :"#{@locale}_content", @parts do |ff|
35
- = ff.hidden_field :type, value: ff.object.class.name
36
- = ff.hidden_field :title
37
- = ff.hidden_field :name
29
+ = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.to_s)}/form", f: ff
38
30
 
39
- .page-form-group.page-part{ data: { name: ff.object.name } }
40
- = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.name)}/form", f: ff
41
-
42
- - unless @licence.new_record?
43
- .pull-right= link_to t('spina.permanently_delete'), admin_journal_licence_path(@licence), method: :delete, data: { confirm: t('.delete_confirmation', name: @licence.name) }, class: 'button button-link button-danger'
@@ -1,17 +1,8 @@
1
- - content_for(:header_actions) do
2
- = link_to new_admin_journal_licence_path, class: 'button button-primary' do
3
- = icon 'plus'
4
- = t '.new'
1
+ = render Spina::UserInterface::HeaderComponent.new do |header|
2
+ - header.actions do
3
+ .ml-3
4
+ = link_to new_admin_journal_licence_path, class: 'btn btn-primary w-full' do
5
+ = heroicon 'plus', style: :solid, class: 'w-7 h-7 -m1-2'
6
+ = t '.new'
5
7
 
6
- .well
7
- .table-container
8
- %table.table
9
- %thead
10
- %tr
11
- %th= ::Spina::Admin::Journal::Licence.human_attribute_name :name
12
- %th= ::Spina::Admin::Journal::Licence.human_attribute_name :abbreviated_name
13
- %th= t '.num_articles'
14
- %th
15
-
16
- %tbody
17
- = render @licences.any? ? @licences : 'empty_list', message: t('.empty')
8
+ = render Spina::Admin::Journal::LicencesListComponent.new(licences: @licences)
@@ -1,15 +1,28 @@
1
- = form_for [:admin_journal, @volume], html: { autocomplete: 'off' } do |f|
2
- %header#header
3
- = render partial: 'spina/admin/shared/breadcrumbs'
1
+ %div{ data: { controller: 'tabs',
2
+ tabs: { active: 'cursor-default text-gray-900 bg-spina-dark bg-opacity-10',
3
+ inactive: 'cursor-pointer bg-transparent text-gray-400 border-transparent' } } }
4
+ = render Spina::UserInterface::HeaderComponent.new do |header|
5
+ - header.actions do
6
+ - if @volume.persisted?
7
+ = render Spina::UserInterface::DropdownComponent.new do |dropdown|
8
+ - dropdown.button(classes: "btn btn-default px-3") do
9
+ = heroicon('dots-horizontal', style: :solid, class: "w-5 h-5 text-gray-600")
4
10
 
5
- #header_actions
6
- .button{ style: 'margin-right: 0' }= link_to t('spina.cancel'), admin_journal_volumes_path
11
+ - dropdown.menu do
12
+ = button_to t('spina.permanently_delete'), admin_journal_volume_path(@volume), method: :delete, class: "block w-full text-left px-4 py-2 text-sm leading-5 font-medium text-red-500 cursor-pointer bg-white hover:bg-red-100 hover:bg-opacity-50 hover:text-red-500 focus:outline-none focus:bg-gray-100 focus:text-gray-900", form: {data: { controller: 'confirm', confirm_message: t('.delete_confirmation', number: @volume.number) } }
7
13
 
8
- %nav#secondary.tabs
9
- %ul
10
- - @tabs.each_with_index do |tab, i|
11
- %li{ class: ('active' if i == 0) }
12
- = link_to t(".#{tab}"), "##{tab}"
14
+ = button_tag type: :submit, form: dom_id(@volume), class: 'btn btn-primary', data: { controller: 'button', action: 'button#loading', loading_message: t('spina.ui.saving')} do
15
+ = heroicon('check', style: :solid, class: 'w-5 h-5 mr-1 -ml-2')
16
+ = t '.save'
13
17
 
14
- #details.tab-content.active= render 'form_details', f: f
15
- #issues.tab-content= render 'form_issues', f: f
18
+ - header.navigation do
19
+ %nav.-mb-3.mt-4
20
+ %ul.inline-flex.w-auto.rounded-md.bg-white
21
+ - @tabs.each do |tab|
22
+ %button.block.px-3.leading-relaxed.py-1.hover:text-gray-800.rounded-md.text-gray-400.font-medium.text-sm.flex.items-center.whitespace-nowrap{ type: 'button', data: { action: 'tabs#show', 'tabs-target': 'button', 'pane-id': "#{tab}" } }
23
+ = t ".#{tab}"
24
+
25
+ .p-4.md:p-8
26
+ - @tabs.each_with_index do |tab, i|
27
+ %div{ 'data-tabs-target': 'pane', id: tab, hidden: i != 0 }
28
+ .max-w-5xl= render "form_#{tab}"
@@ -1,10 +1,5 @@
1
- .page-form
2
- .page-form-group
3
- .page-form-label
4
- = ::Spina::Admin::Journal::Volume.human_attribute_name :number
5
- %small= t '.unchangeable'
6
- .page-form-content
7
- = f.number_field :number, disabled: true
8
-
9
- - unless @volume.new_record?
10
- .pull-right= link_to t('spina.permanently_delete'), admin_journal_volume_path(@volume), method: :delete, data: { confirm: t('.delete_confirmation', number: @volume.number) }, class: 'button button-link button-danger'
1
+ = form_with model: [spina, :admin_journal, @volume], id: dom_id(@volume), html: { autocomplete: 'off' } do |f|
2
+ .-mt-6
3
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Volume.human_attribute_name(:number),
4
+ description: t('.unchangeable')) do
5
+ = f.number_field :number, disabled: true, class: 'form-input'
@@ -1,13 +1,2 @@
1
- .sort-message
2
- .well
3
- .table-container
4
- %table.table
5
- %thead
6
- %tr
7
- %th= ::Spina::Admin::Journal::Volume.human_attribute_name :number
8
- %th= ::Spina::Admin::Journal::Issue.human_attribute_name :number
9
- %th= ::Spina::Admin::Journal::Issue.human_attribute_name :title
10
- %th= ::Spina::Admin::Journal::Issue.human_attribute_name :date
11
- %th
12
- %tbody.html5sortable{ data: { id: @volume.id, sorted_collection: 'admin_journal_issues', sort_url: sort_admin_journal_issues_url(@volume) } }
13
- = render @volume.issues.any? ? @volume.issues.sorted_asc : 'empty_list', message: t('.no_issues')
1
+ .-mt-4.md:-mt-8
2
+ %turbo-frame#volume_issues{ src: spina.view_issues_admin_journal_volume_path(@volume), loading: 'lazy', target: '_top' }
@@ -1,17 +1,8 @@
1
- - content_for(:header_actions) do
2
- = link_to admin_journal_volumes_path, method: :post, class: 'button button-primary' do
3
- = icon 'plus'
4
- = t '.new'
1
+ = render Spina::UserInterface::HeaderComponent.new do |header|
2
+ - header.actions do
3
+ .ml-3
4
+ = link_to new_admin_journal_volume_path, class: 'btn btn-primary w-full' do
5
+ = heroicon 'plus', style: :solid, class: 'w-7 h-7 -m1-2'
6
+ = t '.new'
5
7
 
6
- .sort-message
7
- .well
8
- .table-container
9
- %table.table
10
- %thead
11
- %tr
12
- %th= ::Spina::Admin::Journal::Volume.human_attribute_name :number
13
- %th= t '.date'
14
- %th
15
-
16
- %tbody.html5sortable{ data: { id: ::Spina::Admin::Journal::Journal.instance.id, sorted_collection: 'admin_journal_volumes', sort_url: sort_admin_journal_volumes_url(::Spina::Admin::Journal::Journal.instance.id) } }
17
- = render @volumes.any? ? @volumes : 'empty_list', message: t('.empty')
8
+ = render Spina::Admin::Journal::VolumesListComponent.new(volumes: @volumes)
@@ -0,0 +1,2 @@
1
+ %turbo-frame#volume_issues
2
+ = render Spina::Admin::Journal::IssuesListComponent.new(issues: @volume.issues, sortable: true)
@@ -1,6 +1,5 @@
1
- .page-form-label= f.object.title
2
- .page-form-control
3
- = f.number_field :first_page, style: 'width: 10%;'
1
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: f.object.title) do
2
+ = f.number_field :first_page, style: 'width: 10%;', class: 'form-input'
4
3
  &ndash;
5
- = f.number_field :last_page, style: 'width: 10%;'
4
+ = f.number_field :last_page, style: 'width: 10%;', class: 'form-input'
6
5
 
@@ -1,15 +1,23 @@
1
1
  en:
2
2
  spina:
3
+ languages:
4
+ en-GB: British English
3
5
  admin:
4
6
  journal:
5
7
  navigation_title: Journal settings
6
8
  unnamed_journal: Unnamed journal
9
+ edit: Edit
10
+ sort_info:
11
+ "Click and drag items by the handles to reorder. NB: item names will only update after
12
+ you refresh the page."
13
+ empty_list: There are no items.
7
14
  journals:
8
15
  index:
9
16
  new: New journal
10
17
  no_journals: There are currently no journals saved.
11
18
  update:
12
19
  saved: Journal saved.
20
+ failed: Failed to save journal.
13
21
  destroy:
14
22
  deleted: Journal deleted.
15
23
  form:
@@ -26,13 +34,19 @@ en:
26
34
  date: Year
27
35
  view: View
28
36
  empty: There are no volumes.
37
+ new:
38
+ created: Volume %{number} created.
29
39
  create:
30
40
  created: Volume <strong>%{number}</strong> created.
31
41
  update:
32
42
  saved: Volume saved.
43
+ form:
44
+ save: Save
45
+ details: Details
46
+ issues: Issues
47
+ delete_confirmation: "Are you sure you want to delete Volume <strong>#%{number}</strong>?"
33
48
  form_details:
34
49
  unchangeable: The volume number can be changed by clicking 'Change Order' in the index view.
35
- delete_confirmation: "Are you sure you want to delete Volume <strong>#%{number}</strong>?"
36
50
  form_issues:
37
51
  volume_number: "Volume #"
38
52
  issue_number: "Issue #"
@@ -42,6 +56,7 @@ en:
42
56
  sort_success: Sorted successfully!
43
57
  sort_error: There was an error when sorting. Check the server logs for more information.
44
58
  issues:
59
+ volume_issue: "Volume %{volume_number} Issue %{issue_number}"
45
60
  issue_number: "Issue #%{number}"
46
61
  index:
47
62
  new: New issue
@@ -50,19 +65,25 @@ en:
50
65
  new: New issue
51
66
  create:
52
67
  saved: Issue saved.
68
+ failed: Failed to create issue.
53
69
  update:
54
70
  saved: Issue saved.
71
+ failed: Failed to save issue.
55
72
  destroy:
56
73
  deleted: Issue deleted.
57
74
  form:
58
75
  save: Save issue
76
+ details: Details
77
+ articles: Articles
78
+ delete_confirmation: "Are you sure you want to delete Issue <strong>#%{number}</strong>?"
59
79
  form_details:
60
80
  issue_unchangeable: The issue order can be changed in the 'Volumes' tab.
61
- delete_confirmation: "Are you sure you want to delete Issue <strong>#%{number}</strong>?"
62
81
  sort:
63
82
  sort_success: Sorted successfully!
64
83
  sort_error: There was an error when sorting. Check the server logs for more information.
65
84
  articles:
85
+ article_number: "Vol. %{volume_number}(%{issue_number}) Article #%{article_number}"
86
+ title_author: "%{title} (%{author})"
66
87
  index:
67
88
  new: New article
68
89
  empty: There are no articles.
@@ -70,16 +91,24 @@ en:
70
91
  new: New article
71
92
  create:
72
93
  saved: Article saved.
94
+ failed: Failed to create article.
73
95
  update:
74
96
  saved: Article saved.
97
+ failed: Failed to save article.
75
98
  destroy:
76
99
  deleted: Article deleted.
77
100
  form:
78
101
  save: Save article
102
+ details: Details
103
+ authors: Authors
104
+ delete_confirmation: "Are you sure you want to delete '<strong>%{title}</strong>'?"
79
105
  form_details:
80
106
  volume_issue: "Volume %{volume_number} Issue %{issue_number}"
107
+ name_institution: "%{name} (%{institution})"
81
108
  unchangeable: Article order can be changed in the issue.
82
- delete_confirmation: "Are you sure you want to delete '<strong>%{title}</strong>'?"
109
+ affiliation_info:
110
+ All affiliations are listed here. You can select multiple affiliations for co-authored
111
+ articles, but these must be from different authors.
83
112
  form_authors:
84
113
  no_authors: There are no authors.
85
114
  number_of_articles: "# Articles"
@@ -89,6 +118,7 @@ en:
89
118
  sort_success: Sorted successfully!
90
119
  sort_error: There was an error when sorting. Check the server logs for more information.
91
120
  authors:
121
+ name_institution: "%{name} (%{institution})"
92
122
  index:
93
123
  new: New author
94
124
  number_of_articles: "# Articles"
@@ -96,8 +126,10 @@ en:
96
126
  new: New author
97
127
  create:
98
128
  saved: Author saved.
129
+ failed: Failed to create author.
99
130
  update:
100
131
  saved: Author saved.
132
+ failed: Failed to save author.
101
133
  destroy:
102
134
  deleted: Author deleted.
103
135
  sort:
@@ -105,10 +137,24 @@ en:
105
137
  sort_error: There was an error when sorting. Check the server logs for more information.
106
138
  form:
107
139
  save: Save author
108
- form_details:
140
+ details: Details
141
+ articles: Articles
109
142
  delete_confirmation: "Are you sure you want to delete the author %{name}?"
143
+ form_details:
144
+ explanation:
145
+ "An author represents an individual person. A person may change names and/or
146
+ institutions over time. This is represented in Journal with
147
+ 'affiliations'. An affiliation consists of an author's name and institution at a
148
+ particular time, or generally within a particular context."
149
+ orcid_info:
150
+ It is strongly recommended to provide an ORCID iD for each author. Find out more at
151
+ orcid.org.
110
152
  form_affiliation:
111
153
  primary: Primary?
154
+ primary_explanation:
155
+ If checked, this affiliation will be marked as the author's primary affiliation. An
156
+ author can only have one primary affiliation. It is the primary affiliation that will
157
+ be shown most prominently on the author's page.
112
158
  form_articles:
113
159
  no_articles: There are no articles.
114
160
  institutions:
@@ -121,26 +167,34 @@ en:
121
167
  new: New institution
122
168
  create:
123
169
  saved: Institution saved.
170
+ failed: Failed to create institution.
124
171
  update:
125
172
  saved: Institution saved.
173
+ failed: Failed to save institution.
126
174
  destroy:
127
175
  deleted: Institution deleted.
128
176
  form:
129
177
  save: Save institution
178
+ details: Details
179
+ view_affiliations: Affiliations
180
+ delete_confirmation:
181
+ "Are you sure you want to delete the institution <strong>%{name}</strong>?
182
+ This action is irreversible, and will delete all associated affiliations. Authors
183
+ will not be deleted."
130
184
  form_view_affiliations:
131
185
  no_affiliations: This institution has no associated affiliations.
132
186
  number_of_articles: "# articles"
133
- form_details:
134
- delete_confirmation:
135
- "Are you sure you want to delete the institution <strong>%{name}</strong>?
136
- This action is irreversible, and will delete all associated affiliations. Authors will not be deleted."
137
187
  licences:
188
+ index:
189
+ new: New licence
138
190
  new:
139
191
  new: New licence
140
192
  create:
141
193
  saved: Licence saved.
194
+ failed: Failed to create licence.
142
195
  update:
143
196
  saved: Licence saved.
197
+ failed: Failed to save licence.
144
198
  destroy:
145
199
  deleted: Licence deleted.
146
200
  form:
@@ -195,11 +249,19 @@ en:
195
249
  spina/admin/journal/authorship:
196
250
  position: Position
197
251
  spina/admin/journal/author:
252
+ affiliations: Affiliations
253
+ orcid: ORCID iD
198
254
  spina/admin/journal/institution:
199
255
  name: Institution Name
200
256
  spina/admin/journal/licence:
201
257
  name: Licence Name
202
258
  abbreviated_name: Short Name
259
+ errors:
260
+ models:
261
+ author:
262
+ attributes:
263
+ orcid:
264
+ invalid: Invalid format for ORCID iD
203
265
 
204
266
  date:
205
267
  formats:
data/config/routes.rb CHANGED
@@ -4,20 +4,40 @@ Spina::Engine.routes.draw do
4
4
  namespace :admin, path: Spina.config.backend_path do
5
5
  namespace :journal do
6
6
  resources :journals, only: %i[edit update destroy]
7
- resources :volumes, except: %i[show new update] do
8
- patch 'sort/:journal_id' => 'volumes#sort', as: :sort, on: :collection
7
+ resources :volumes, except: %i[show update] do
8
+ post 'sort/:journal_id' => 'volumes#sort', as: :sort, on: :collection
9
+
10
+ member do
11
+ get :view_issues
12
+ end
9
13
  end
10
14
  resources :issues, except: %i[show] do
11
- patch 'sort/:volume_id' => 'issues#sort', as: :sort, on: :collection
15
+ post 'sort/:volume_id' => 'issues#sort', as: :sort, on: :collection
16
+
17
+ member do
18
+ get :view_articles
19
+ end
12
20
  end
13
21
  resources :articles, except: %i[show] do
14
- patch 'sort/:issue_id' => 'articles#sort', as: :sort, on: :collection
22
+ post 'sort/:issue_id' => 'articles#sort', as: :sort, on: :collection
23
+
24
+ member do
25
+ get :view_authors
26
+ end
15
27
  end
16
28
  resources :authors, except: %i[show] do
17
- patch 'sort/:article_id' => 'authors#sort', as: :sort, on: :collection
29
+ post 'sort/:article_id' => 'authors#sort', as: :sort, on: :collection
30
+
31
+ member do
32
+ get :view_articles
33
+ end
18
34
  end
19
35
 
20
- resources :institutions, except: %i[show]
36
+ resources :institutions, except: %i[show] do
37
+ member do
38
+ get :view_affiliations
39
+ end
40
+ end
21
41
  resources :licences, except: %i[show]
22
42
  end
23
43
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddOrcidToSpinaAdminJournalAuthor < ActiveRecord::Migration[7.0] # :nodoc:
4
+ def change
5
+ add_column :spina_admin_journal_authors, :orcid, :string, null: false, default: ''
6
+ end
7
+ end
@@ -7,6 +7,18 @@ module Spina
7
7
  class Engine < ::Rails::Engine
8
8
  isolate_namespace Spina::Admin::Journal
9
9
 
10
+ initializer 'spina.admin.journal.assets' do
11
+ Spina.config.importmap.draw do
12
+ pin_all_from Spina::Admin::Journal::Engine.root.join('app/assets/javascripts/spina/admin/journal/controllers'), # rubocop:disable Layout/LineLength
13
+ under: 'controllers', to: 'spina/admin/journal/controllers'
14
+ end
15
+
16
+ Spina.config.tailwind_content.concat(["#{Spina::Admin::Journal::Engine.root}/app/views/**/*.*",
17
+ "#{Spina::Admin::Journal::Engine.root}/app/components/**/*.*",
18
+ "#{Spina::Admin::Journal::Engine.root}/app/helpers/**/*.*",
19
+ "#{Spina::Admin::Journal::Engine.root}/app/assets/javascripts/**/*.js"])
20
+ end
21
+
10
22
  config.before_initialize do
11
23
  ::Spina::Plugin.register do |plugin|
12
24
  plugin.name = 'journal'
@@ -3,7 +3,7 @@
3
3
  module Spina
4
4
  module Admin
5
5
  module Journal
6
- VERSION = '0.6.2'
6
+ VERSION = '1.0.0'
7
7
  end
8
8
  end
9
9
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'haml-rails'
3
4
  require 'spina'
4
5
  require 'spina/admin/journal/engine'
5
6
  require 'rails-i18n'