spina-admin-journal 1.0.0.rc1 → 1.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/spina_admin_journal_manifest.js +0 -4
  3. data/app/components/spina/admin/journal/form_group_component.html.haml +4 -0
  4. data/app/components/spina/admin/journal/form_group_component.rb +17 -0
  5. data/app/components/spina/admin/journal/list_component.html.haml +11 -10
  6. data/app/controllers/spina/admin/journal/articles_controller.rb +2 -0
  7. data/app/controllers/spina/admin/journal/authors_controller.rb +3 -1
  8. data/app/controllers/spina/admin/journal/institutions_controller.rb +2 -0
  9. data/app/controllers/spina/admin/journal/issues_controller.rb +2 -0
  10. data/app/controllers/spina/admin/journal/journals_controller.rb +2 -0
  11. data/app/controllers/spina/admin/journal/licences_controller.rb +2 -0
  12. data/app/controllers/spina/admin/journal/volumes_controller.rb +2 -0
  13. data/app/models/spina/admin/journal/author.rb +1 -0
  14. data/app/models/spina/admin/journal/authorship.rb +9 -0
  15. data/app/views/spina/admin/hooks/journal/_primary_navigation.html.haml +4 -4
  16. data/app/views/spina/admin/journal/articles/_form.html.haml +2 -1
  17. data/app/views/spina/admin/journal/articles/_form_authors.html.haml +1 -0
  18. data/app/views/spina/admin/journal/articles/_form_details.html.haml +31 -21
  19. data/app/views/spina/admin/journal/authors/_form.html.haml +1 -1
  20. data/app/views/spina/admin/journal/authors/_form_affiliation.html.haml +12 -8
  21. data/app/views/spina/admin/journal/authors/_form_articles.html.haml +1 -0
  22. data/app/views/spina/admin/journal/authors/_form_details.html.haml +28 -2
  23. data/app/views/spina/admin/journal/institutions/_form.html.haml +1 -1
  24. data/app/views/spina/admin/journal/institutions/_form_details.html.haml +2 -1
  25. data/app/views/spina/admin/journal/institutions/_form_view_affiliations.html.haml +1 -0
  26. data/app/views/spina/admin/journal/issues/_form.html.haml +1 -1
  27. data/app/views/spina/admin/journal/issues/_form_articles.html.haml +1 -0
  28. data/app/views/spina/admin/journal/issues/_form_details.html.haml +8 -7
  29. data/app/views/spina/admin/journal/journals/_form.html.haml +10 -8
  30. data/app/views/spina/admin/journal/licences/_form.html.haml +12 -10
  31. data/app/views/spina/admin/journal/volumes/_form.html.haml +1 -1
  32. data/app/views/spina/admin/journal/volumes/_form_details.html.haml +3 -2
  33. data/app/views/spina/admin/journal/volumes/_form_issues.html.haml +1 -0
  34. data/app/views/spina/admin/parts/admin/journal/page_ranges/_form.html.haml +3 -4
  35. data/config/locales/en.yml +46 -6
  36. data/db/migrate/20220130171603_add_orcid_to_spina_admin_journal_author.rb +7 -0
  37. data/lib/spina/admin/journal/version.rb +1 -1
  38. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e696fd8633a8dc7ab2b57166808c7e989792307f0d3481a0eb5e73b0d05d175
4
- data.tar.gz: bb15a7e5c115a2302e95f3224d85840dcfc6f46d8ec88b1c18bd67b4d0ba02b6
3
+ metadata.gz: e9dfe8f35c6a45f02481c7259fb3a6d5eba37cae6c7725c5e82f7a5658a340a7
4
+ data.tar.gz: 4daa82dba66f3f02c473db5d8a165934b68241af3069ddae1c509b246e6ae936
5
5
  SHA512:
6
- metadata.gz: 0e1f1e24116d3955595ef1fc705f4e93a25028daeaac15b42a147d4cadeec0b2bb5c6176d4d9c98dbb104f66dd325a006a156eea6d8afab270cb096cb386772f
7
- data.tar.gz: d6541162de0b4e925c3c6dda25ac08d4e5292c6f3b2c8ac4306f933000aee56dfbc8cbcd2ee0704a0499a5a512e1179d429b47cbe8a17ea205a47324eaf2c382
6
+ metadata.gz: 56e6ce7ac600354e6dd0c2bfba6d7b702661ecd6da9ac6666f44890f62805f3853bfa14c81475a33cf4e84350ed20f446d7e6e3beb2833ea73e1133057acc036
7
+ data.tar.gz: f6ae39891fe012f049cfedb9517ec2a386de90b82c947db39f46e24eb783c94bee25cbc0caf37a52c0f5b9925a6d7318d79ef2aab27aecf7da23acb89872576b
@@ -1,6 +1,2 @@
1
1
  //= link spina/admin/journal/application.css
2
-
3
- //= link_directory ../javascripts/spina/admin/journal/controllers
4
- //= link_directory ../javascripts/spina/admin/journal/libraries
5
-
6
2
  //= link spina/admin/journal/application.js
@@ -0,0 +1,4 @@
1
+ .mt-6
2
+ %label.block.text-sm.leading-5.font-medium.text-gray-700= label
3
+ .text-gray-400.text-sm= description
4
+ .mt-1= content
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Admin
5
+ module Journal
6
+ # Correctly styles label, description and content of form fields.
7
+ class FormGroupComponent < ApplicationComponent
8
+ attr_reader :label, :description
9
+
10
+ def initialize(label:, description: '')
11
+ @label = label
12
+ @description = description
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,10 +1,11 @@
1
- - if sortable?
2
- .ml-8.mt-8.text-gray-600.text-sm= t 'spina.admin.journal.sort_info'
3
- .my-6.md:m-8.bg-white.md:rounded-lg.border-l-0.border-r-0.border.md:border-r.md:border-l.border-gray-200.border-b-0.shadow-sm{ data: { controller: 'sortable' } }
4
- = form_with(url: @sort_path, data: { sortable_target: 'form' }) { |f| }
5
- %ul{ data: { sortable_target: 'list' } }
6
- - if @list_items.any?
7
- - @list_items.each do |item|
8
- = render Spina::Admin::Journal::ListItemComponent.new(id: item[:id], label: item[:label], path: item[:path], sortable: sortable?)
9
- - else
10
- = render Spina::Admin::Journal::EmptyListComponent.new
1
+ .my-6.md:m-8
2
+ - if sortable?
3
+ .mb-4.text-gray-600.text-sm= t 'spina.admin.journal.sort_info'
4
+ .bg-white.md:rounded-lg.border-l-0.border-r-0.border.md:border-r.md:border-l.border-gray-200.border-b-0.shadow-sm{ data: { controller: 'sortable' } }
5
+ = form_with(url: @sort_path, data: { sortable_target: 'form' }) { |f| }
6
+ %ul{ data: { sortable_target: 'list' } }
7
+ - if @list_items.any?
8
+ - @list_items.each do |item|
9
+ = render Spina::Admin::Journal::ListItemComponent.new(id: item[:id], label: item[:label], path: item[:path], sortable: sortable?)
10
+ - else
11
+ = render Spina::Admin::Journal::EmptyListComponent.new
@@ -29,6 +29,8 @@ module Spina
29
29
  before_action :set_parts_attributes, only: %i[new edit]
30
30
  before_action :build_parts, only: %i[edit]
31
31
 
32
+ admin_section :journal
33
+
32
34
  def index
33
35
  @articles = Article.sorted_desc
34
36
  end
@@ -9,6 +9,8 @@ module Spina
9
9
  before_action :set_tabs, except: %i[index destroy]
10
10
  before_action :set_author, only: %i[edit update destroy]
11
11
 
12
+ admin_section :journal_settings
13
+
12
14
  def index
13
15
  @authors = Author.all
14
16
  end
@@ -60,7 +62,7 @@ module Spina
60
62
  private
61
63
 
62
64
  def author_params
63
- params.require(:author).permit(:primary_affiliation_index,
65
+ params.require(:author).permit(:primary_affiliation_index, :orcid,
64
66
  affiliations_attributes: %i[id institution_id first_name
65
67
  surname])
66
68
  end
@@ -9,6 +9,8 @@ module Spina
9
9
  before_action :set_tabs, except: %i[index destroy]
10
10
  before_action :set_institution, only: %i[edit update destroy]
11
11
 
12
+ admin_section :journal_settings
13
+
12
14
  def index
13
15
  @institutions = Institution.all
14
16
  end
@@ -30,6 +30,8 @@ module Spina
30
30
  before_action :set_parts_attributes, only: %i[new edit]
31
31
  before_action :build_parts, only: %i[edit]
32
32
 
33
+ admin_section :journal
34
+
33
35
  def index
34
36
  @issues = Issue.sorted_desc
35
37
  end
@@ -27,6 +27,8 @@ module Spina
27
27
  before_action :set_parts_attributes
28
28
  before_action :build_parts, only: %i[edit]
29
29
 
30
+ admin_section :journal_settings
31
+
30
32
  def edit
31
33
  add_breadcrumb @journal.name
32
34
  end
@@ -27,6 +27,8 @@ module Spina
27
27
  before_action :set_parts_attributes, only: %i[new edit]
28
28
  before_action :build_parts, only: %i[edit]
29
29
 
30
+ admin_section :journal_settings
31
+
30
32
  def index
31
33
  @licences = Licence.sorted
32
34
  end
@@ -9,6 +9,8 @@ module Spina
9
9
  before_action :set_tabs, except: %i[index destroy]
10
10
  before_action :set_volume, only: %i[edit destroy]
11
11
 
12
+ admin_section :journal
13
+
12
14
  def index
13
15
  @volumes = Volume.sorted_asc
14
16
  end
@@ -26,6 +26,7 @@ module Spina
26
26
  has_many :articles, through: :affiliations
27
27
 
28
28
  validate :must_have_one_primary_affiliation
29
+ validates :orcid, format: { with: /\A((\d{4}-){3}\d{3}(\d|X))?\z/ }
29
30
 
30
31
  # @!attribute [r] primary_affiliation
31
32
  # @return [ActiveRecord::Relation] The author's primary affiliation.
@@ -16,9 +16,18 @@ module Spina
16
16
  # @!attribute [rw] position
17
17
  # @return [Integer] used to order the affiliations for each article
18
18
 
19
+ before_validation :set_default_position, unless: :persisted?
19
20
  validates :position, presence: true, uniqueness: { scope: :article_id }
20
21
 
21
22
  scope :sorted_within_article, -> { order(position: :asc) }
23
+
24
+ private
25
+
26
+ def set_default_position
27
+ return if article.authorships.sorted_within_article.last.nil?
28
+
29
+ self.position = article.authorships.sorted_within_article.last.position + 1
30
+ end
22
31
  end
23
32
  end
24
33
  end
@@ -1,8 +1,8 @@
1
- = render Spina::MainNavigation::SubNavComponent.new(:journal_content) do |nav|
1
+ = render Spina::MainNavigation::SubNavComponent.new(:journal) do |nav|
2
2
  - nav.icon do
3
- = heroicon 'document-add', style: :solid, class: 'w-8 h-8 text-white md:mr-3'
3
+ = heroicon 'document-duplicate', style: :solid, class: 'w-8 h-8 text-white md:mr-3'
4
4
  .text-white.font-semibold.hidden{class: 'md:block transform -translate-x-2 ease-in-out duration-300 absolute md:relative opacity-0 transition-all', 'data-navigation-target': 'label'}
5
- = Spina::Admin::Journal::Journal.instance.name
5
+ = Spina::Admin::Journal::Journal.instance.has_content?(:journal_abbreviation) ? Spina::Admin::Journal::Journal.instance.content(:journal_abbreviation) : Spina::Admin::Journal::Journal.instance.name
6
6
 
7
7
  - nav.links do
8
8
  = render Spina::MainNavigation::LinkComponent.new(Spina::Admin::Journal::Volume.model_name.human(count: :many),
@@ -18,7 +18,7 @@
18
18
 
19
19
  = render Spina::MainNavigation::SubNavComponent.new(:journal_settings) do |nav|
20
20
  - nav.icon do
21
- = heroicon 'dots-horizontal', style: :solid, class: 'w-8 h-8 text-white md:mr-3'
21
+ = heroicon 'view-grid', style: :solid, class: 'w-8 h-8 text-white md:mr-3'
22
22
  .text-white.font-semibold.hidden{class: 'md:block transform -translate-x-2 ease-in-out duration-300 absolute md:relative opacity-0 transition-all', 'data-navigation-target': 'label'}
23
23
  = t 'spina.admin.journal.navigation_title'
24
24
 
@@ -25,4 +25,5 @@
25
25
  .p-4.md:p-8
26
26
  - @tabs.each_with_index do |tab, i|
27
27
  %div{ 'data-tabs-target': 'pane', id: tab, hidden: i != 0 }
28
- = render "form_#{tab}"
28
+ .max-w-5xl= render "form_#{tab}"
29
+
@@ -1 +1,2 @@
1
+ .-mt-4.md:-mt-8
1
2
  = render Spina::Admin::Journal::AuthorshipsListComponent.new(authorships: @article.authorships.sorted_within_article, sortable: true)
@@ -1,27 +1,37 @@
1
1
  = form_with model: [spina, :admin_journal, @article], id: dom_id(@article), html: { autocomplete: 'off' } do |f|
2
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Issue.model_name.human(count: :one)) do
3
- = f.collection_select :issue_id, ::Spina::Admin::Journal::Issue.sorted_desc, :id, ->(issue) { t '.volume_issue', volume_number: issue.volume.number, issue_number: issue.number }
4
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Article.human_attribute_name(:number),
5
- description: t('.unchangeable')) do
6
- = f.number_field :number, disabled: true
7
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Article.human_attribute_name(:title)) do
2
+ .-mt-6
3
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Issue.model_name.human(count: :one)) do
4
+ = f.collection_select(:issue_id,
5
+ ::Spina::Admin::Journal::Issue.sorted_desc,
6
+ :id,
7
+ ->(issue) { t '.volume_issue', volume_number: issue.volume.number, issue_number: issue.number },
8
+ {},
9
+ class: 'form-select')
10
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Article.human_attribute_name(:number),
11
+ description: t('.unchangeable')) do
12
+ = f.number_field :number, disabled: true, class: 'form-input'
13
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Article.human_attribute_name(:title)) do
8
14
  = render Spina::Forms::TextFieldComponent.new(f, :title)
9
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Article.human_attribute_name(:status)) do
10
- = f.select :status, Spina::Admin::Journal::Article.statuses.keys.map { |key| [key.humanize, key] }
11
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Article.human_attribute_name(:licence)) do
12
- = f.collection_select :licence_id, Spina::Admin::Journal::Licence.sorted, :id, :name, prompt: true
13
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Author.model_name.human(count: :many)) do
14
- %table.table{ style: 'margin: 0' }
15
- %tbody.collection-check-boxes
16
- = f.collection_check_boxes :affiliation_ids, Spina::Admin::Journal::Affiliation.sorted, :id, :name do |builder|
17
- %tr
18
- %td{ style: "padding-left: 16px" }
19
- .form-checkbox
20
- = builder.check_box
21
- = builder.label
22
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Article.human_attribute_name(:url)) do
15
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Article.human_attribute_name(:status)) do
16
+ = f.select :status, Spina::Admin::Journal::Article.statuses.keys.map { |key| [key.humanize, key] }, {}, class: 'form-select'
17
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Article.human_attribute_name(:licence)) do
18
+ = f.collection_select :licence_id, Spina::Admin::Journal::Licence.sorted, :id, :name, { prompt: true }, { class: 'form-select' }
19
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Author.model_name.human(count: :many),
20
+ description: t('.affiliation_info')) do
21
+ %ul.list-none.ml-4
22
+ = f.collection_check_boxes(:affiliation_ids,
23
+ Spina::Admin::Journal::Affiliation.sorted,
24
+ :id,
25
+ ->(affiliation) { t '.name_institution', name: affiliation.name, institution: affiliation.institution.name },
26
+ {},
27
+ class: 'form-checkbox rounded') do |builder|
28
+ %li
29
+ .form-checkbox
30
+ = builder.check_box
31
+ %span.text-sm.font-medium.text-gray-600= builder.label
32
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Article.human_attribute_name(:url)) do
23
33
  = render Spina::Forms::TextFieldComponent.new(f, :url)
24
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Article.human_attribute_name(:doi)) do
34
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Article.human_attribute_name(:doi)) do
25
35
  = render Spina::Forms::TextFieldComponent.new(f, :doi)
26
36
 
27
37
  = f.fields_for :"#{@locale}_content", @parts do |ff|
@@ -26,4 +26,4 @@
26
26
  = form_with model: [spina, :admin_journal, @author], id: dom_id(@author), html: { autocomplete: 'off' } do |f|
27
27
  - @tabs.each_with_index do |tab, i|
28
28
  %div{ 'data-tabs-target': 'pane', id: tab, hidden: i != 0 }
29
- = render "form_#{tab}", f: f
29
+ .max-w-5xl= render "form_#{tab}", f: f
@@ -1,8 +1,12 @@
1
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Affiliation.human_attribute_name(:first_name)) do
2
- = render Spina::Forms::TextFieldComponent.new(ff, :first_name)
3
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Affiliation.human_attribute_name(:surname)) do
4
- = render Spina::Forms::TextFieldComponent.new(ff, :surname)
5
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Affiliation.human_attribute_name(:institution)) do
6
- = ff.collection_select :institution_id, Spina::Admin::Journal::Institution.sorted, :id, :name
7
- = render Spina::Forms::GroupComponent.new(label: t('.primary')) do
8
- = radio_button_tag 'author[primary_affiliation_index]', ff.index, ff.object.status == 'primary'
1
+ %div{ data: { 'part-id': "#{f.object.object_id}", 'tabs-target': 'pane' }, id: "pane_#{f.object.object_id}" }
2
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Affiliation.human_attribute_name(:first_name)) do
3
+ = render Spina::Forms::TextFieldComponent.new(f, :first_name)
4
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Affiliation.human_attribute_name(:surname)) do
5
+ = render Spina::Forms::TextFieldComponent.new(f, :surname)
6
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Affiliation.human_attribute_name(:institution)) do
7
+ = f.collection_select :institution_id, Spina::Admin::Journal::Institution.sorted, :id, :name, {}, class: 'form-select'
8
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: t('.primary'), description: t('.primary_explanation')) do
9
+ = radio_button_tag 'author[primary_affiliation_index]', f.index, f.object.status == 'primary', class: 'form-radio'
10
+
11
+ .text-right
12
+ = button_tag t('spina.ui.delete'), type: :button, class: 'btn btn-default bg-transparent hover:bg-white hover:text-red-500 h-8 px-3 inline-block mt-3', data: { action: 'repeater#removeFields', id: "pane_#{f.object.object_id}" }
@@ -1 +1,2 @@
1
+ .-mt-4.md:-mt-8
1
2
  = render Spina::Admin::Journal::ArticlesListComponent.new(articles: @author.affiliations.reduce([]) { |memo, affiliation| memo << affiliation.articles.to_a }.flatten )
@@ -1,2 +1,28 @@
1
- = f.fields_for :affiliations, @author.affiliations do |ff|
2
- .well= render 'form_affiliation', ff: ff
1
+ .text-gray-700.text-sm.font-light= t '.explanation'
2
+ .mt-6{ 'data-controller': 'repeater' }
3
+ %label.block.text-sm.leading-5.font-medium.text-gray-700= Spina::Admin::Journal::Author.human_attribute_name :affiliations
4
+ .-mt-4.flex.flex-col.md:flex-row{ data: { 'controller': 'tabs', 'tabs-active': 'bg-spina-dark bg-opacity-10 text-gray-900', 'tabs-inactive': 'text-gray-500' } }
5
+ .md:w-64.md:pr-6
6
+
7
+ -# Fields for new affiliation
8
+ - new_affiliation = Spina::Admin::Journal::Affiliation.new
9
+ - fields = f.fields_for(:affiliations, [new_affiliation], child_index: new_affiliation.object_id) { |ff| render('form_affiliation', f: ff) }.gsub('\n', '')
10
+
11
+ -# Tabs
12
+ .pt-6.-ml-3
13
+ %div{ data: { action: 'exists->tabs#added', 'repeater-target' => 'list', 'tabs-target' => 'list' } }
14
+ - (f.object.affiliations || []).each.with_index do |affiliation, index|
15
+ %button.text-gray-500.hover:text-gray-900.rounded-md.px-3.truncate.text-sm.font-medium.flex.items-center.w-full.h-9{ data: { 'action': 'tabs#show', 'pane-id': "pane_#{affiliation.object_id}", 'repeater-target': 'listItem', 'tabs-target': 'button' }, type: 'button' }
16
+ = affiliation&.name
17
+ %button.text-gray-400.pl-2.hover:text-gray-900.rounded-md.truncate.text-sm.font-medium.flex.items-center.w-full.h-10{ data: { 'action': 'repeater#addFields', 'child-index': "#{new_affiliation.object_id}", 'fields': fields }, type: 'button' }
18
+ = heroicon 'plus', style: :solid, class: 'w-6 h-6 mr-1'
19
+ = t 'spina.ui.new_entry'
20
+
21
+ -# Content
22
+ .flex-1.pl-6.md:pl-0{ 'data-repeater-target': 'content' }
23
+ = f.fields_for :affiliations do |affiliation_fields|
24
+ = render 'form_affiliation', f: affiliation_fields
25
+
26
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Author.human_attribute_name(:orcid),
27
+ description: t('.orcid_info')) do
28
+ = render Spina::Forms::TextFieldComponent.new(f, :orcid)
@@ -26,4 +26,4 @@
26
26
  = form_with model: [spina, :admin_journal, @institution], id: dom_id(@institution), html: { autocomplete: 'off' } do |f|
27
27
  - @tabs.each_with_index do |tab, i|
28
28
  %div{ 'data-tabs-target': 'pane', id: tab, hidden: i != 0 }
29
- = render "form_#{tab}", f: f
29
+ .max-w-5xl= render "form_#{tab}", f: f
@@ -1,3 +1,4 @@
1
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Institution.human_attribute_name(:name)) do
1
+ .-mt-6
2
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Institution.human_attribute_name(:name)) do
2
3
  = render Spina::Forms::TextFieldComponent.new(f, :name)
3
4
 
@@ -1 +1,2 @@
1
+ .-mt-4.md:-mt-8
1
2
  = render Spina::Admin::Journal::AffiliationsListComponent.new(affiliations: @institution.affiliations.sorted)
@@ -25,5 +25,5 @@
25
25
  .p-4.md:p-8
26
26
  - @tabs.each_with_index do |tab, i|
27
27
  %div{ 'data-tabs-target': 'pane', id: tab, hidden: i != 0 }
28
- = render "form_#{tab}"
28
+ .max-w-5xl.max-w-5xl= render "form_#{tab}"
29
29
 
@@ -1 +1,2 @@
1
+ .-mt-4.md:-mt-8
1
2
  = render Spina::Admin::Journal::ArticlesListComponent.new(articles: @issue.articles, sortable: true)
@@ -1,13 +1,14 @@
1
1
  = form_with model: [spina, :admin_journal, @issue], id: dom_id(@issue), html: { autocomplete: 'off' } do |f|
2
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Volume.human_attribute_name(:number)) do
3
- = f.collection_select :volume_id, ::Spina::Admin::Journal::Volume.sorted_desc, :id, :number
4
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Issue.human_attribute_name(:number),
2
+ .-mt-6
3
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Volume.human_attribute_name(:number)) do
4
+ = f.collection_select :volume_id, ::Spina::Admin::Journal::Volume.sorted_desc, :id, :number, {}, class: 'form-select'
5
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Issue.human_attribute_name(:number),
5
6
  description: t('.issue_unchangeable')) do
6
- = f.number_field :number, disabled: true
7
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Issue.human_attribute_name(:title)) do
7
+ = f.number_field :number, disabled: true, class: 'form-input'
8
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Issue.human_attribute_name(:title)) do
8
9
  = render Spina::Forms::TextFieldComponent.new(f, :title)
9
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Issue.human_attribute_name(:date)) do
10
- = f.date_field :date
10
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Issue.human_attribute_name(:date)) do
11
+ = f.date_field :date, class: 'form-input'
11
12
 
12
13
  = f.fields_for :"#{@locale}_content", @parts do |ff|
13
14
  = ff.hidden_field :type, value: ff.object.class
@@ -13,13 +13,15 @@
13
13
  = t '.save'
14
14
 
15
15
  .p-4.md:p-8
16
- = form_with model: [spina, :admin_journal, @journal], id: dom_id(@journal), html: { autocomplete: 'off' } do |f|
17
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Journal.human_attribute_name(:name)) do
18
- = render Spina::Forms::TextFieldComponent.new(f, :name)
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)
19
21
 
20
- = f.fields_for :"#{@locale}_content", @parts do |ff|
21
- = ff.hidden_field :type, value: ff.object.class
22
- = ff.hidden_field :title
23
- = ff.hidden_field :name
22
+ = f.fields_for :"#{@locale}_content", @parts do |ff|
23
+ = ff.hidden_field :type, value: ff.object.class
24
+ = ff.hidden_field :title
25
+ = ff.hidden_field :name
24
26
 
25
- = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.to_s)}/form", f: ff
27
+ = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.to_s)}/form", f: ff
@@ -13,16 +13,18 @@
13
13
  = t '.save'
14
14
 
15
15
  .p-4.md:p-8
16
- = form_with model: [spina, :admin_journal, @licence], id: dom_id(@licence), html: { autocomplete: 'off' } do |f|
17
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Licence.human_attribute_name(:name)) do
18
- = render Spina::Forms::TextFieldComponent.new(f, :name)
19
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Licence.human_attribute_name(:abbreviated_name)) do
20
- = render Spina::Forms::TextFieldComponent.new(f, :abbreviated_name)
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
- = f.fields_for :"#{@locale}_content", @parts do |ff|
23
- = ff.hidden_field :type, value: ff.object.class
24
- = ff.hidden_field :title
25
- = ff.hidden_field :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
26
28
 
27
- = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.to_s)}/form", f: ff
29
+ = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.to_s)}/form", f: ff
28
30
 
@@ -25,4 +25,4 @@
25
25
  .p-4.md:p-8
26
26
  - @tabs.each_with_index do |tab, i|
27
27
  %div{ 'data-tabs-target': 'pane', id: tab, hidden: i != 0 }
28
- = render "form_#{tab}"
28
+ .max-w-5xl= render "form_#{tab}"
@@ -1,4 +1,5 @@
1
1
  = form_with model: [spina, :admin_journal, @volume], id: dom_id(@volume), html: { autocomplete: 'off' } do |f|
2
- = render Spina::Forms::GroupComponent.new(label: Spina::Admin::Journal::Volume.human_attribute_name(:number),
2
+ .-mt-6
3
+ = render Spina::Admin::Journal::FormGroupComponent.new(label: Spina::Admin::Journal::Volume.human_attribute_name(:number),
3
4
  description: t('.unchangeable')) do
4
- = f.number_field :number, disabled: true
5
+ = f.number_field :number, disabled: true, class: 'form-input'
@@ -1 +1,2 @@
1
+ .-mt-4.md:-mt-8
1
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,11 +1,15 @@
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
7
9
  edit: Edit
8
- sort_info: "NB: item numbers will only update after you refresh the page."
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."
9
13
  empty_list: There are no items.
10
14
  journals:
11
15
  index:
@@ -38,6 +42,8 @@ en:
38
42
  saved: Volume saved.
39
43
  form:
40
44
  save: Save
45
+ details: Details
46
+ issues: Issues
41
47
  delete_confirmation: "Are you sure you want to delete Volume <strong>#%{number}</strong>?"
42
48
  form_details:
43
49
  unchangeable: The volume number can be changed by clicking 'Change Order' in the index view.
@@ -67,6 +73,8 @@ en:
67
73
  deleted: Issue deleted.
68
74
  form:
69
75
  save: Save issue
76
+ details: Details
77
+ articles: Articles
70
78
  delete_confirmation: "Are you sure you want to delete Issue <strong>#%{number}</strong>?"
71
79
  form_details:
72
80
  issue_unchangeable: The issue order can be changed in the 'Volumes' tab.
@@ -91,10 +99,16 @@ en:
91
99
  deleted: Article deleted.
92
100
  form:
93
101
  save: Save article
102
+ details: Details
103
+ authors: Authors
94
104
  delete_confirmation: "Are you sure you want to delete '<strong>%{title}</strong>'?"
95
105
  form_details:
96
106
  volume_issue: "Volume %{volume_number} Issue %{issue_number}"
107
+ name_institution: "%{name} (%{institution})"
97
108
  unchangeable: Article order can be changed in the issue.
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.
98
112
  form_authors:
99
113
  no_authors: There are no authors.
100
114
  number_of_articles: "# Articles"
@@ -123,10 +137,24 @@ en:
123
137
  sort_error: There was an error when sorting. Check the server logs for more information.
124
138
  form:
125
139
  save: Save author
126
- form_details:
140
+ details: Details
141
+ articles: Articles
127
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 highly recommended to provide an ORCID iD for each author. Find out more at
151
+ orcid.org.
128
152
  form_affiliation:
129
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.
130
158
  form_articles:
131
159
  no_articles: There are no articles.
132
160
  institutions:
@@ -147,14 +175,18 @@ en:
147
175
  deleted: Institution deleted.
148
176
  form:
149
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."
150
184
  form_view_affiliations:
151
185
  no_affiliations: This institution has no associated affiliations.
152
186
  number_of_articles: "# articles"
153
- form_details:
154
- delete_confirmation:
155
- "Are you sure you want to delete the institution <strong>%{name}</strong>?
156
- This action is irreversible, and will delete all associated affiliations. Authors will not be deleted."
157
187
  licences:
188
+ index:
189
+ new: New licence
158
190
  new:
159
191
  new: New licence
160
192
  create:
@@ -217,11 +249,19 @@ en:
217
249
  spina/admin/journal/authorship:
218
250
  position: Position
219
251
  spina/admin/journal/author:
252
+ affiliations: Affiliations
253
+ orcid: ORCID iD
220
254
  spina/admin/journal/institution:
221
255
  name: Institution Name
222
256
  spina/admin/journal/licence:
223
257
  name: Licence Name
224
258
  abbreviated_name: Short Name
259
+ errors:
260
+ models:
261
+ author:
262
+ attributes:
263
+ orcid:
264
+ invalid: Invalid format for ORCID iD
225
265
 
226
266
  date:
227
267
  formats:
@@ -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
@@ -3,7 +3,7 @@
3
3
  module Spina
4
4
  module Admin
5
5
  module Journal
6
- VERSION = '1.0.0.rc1'
6
+ VERSION = '1.0.0.rc2'
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-admin-journal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc1
4
+ version: 1.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis Van Steene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-26 00:00:00.000000000 Z
11
+ date: 2022-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml-rails
@@ -266,6 +266,8 @@ files:
266
266
  - app/components/spina/admin/journal/authorships_list_component.rb
267
267
  - app/components/spina/admin/journal/empty_list_component.html.haml
268
268
  - app/components/spina/admin/journal/empty_list_component.rb
269
+ - app/components/spina/admin/journal/form_group_component.html.haml
270
+ - app/components/spina/admin/journal/form_group_component.rb
269
271
  - app/components/spina/admin/journal/institutions_list_component.rb
270
272
  - app/components/spina/admin/journal/issues_list_component.rb
271
273
  - app/components/spina/admin/journal/licences_list_component.rb
@@ -355,6 +357,7 @@ files:
355
357
  - db/migrate/20210618090155_create_spina_admin_journal_licences.rb
356
358
  - db/migrate/20210618094533_add_licence_to_spina_admin_journal_articles.rb
357
359
  - db/migrate/20210626153728_create_spina_parts_admin_journal_page_ranges.rb
360
+ - db/migrate/20220130171603_add_orcid_to_spina_admin_journal_author.rb
358
361
  - lib/spina/admin/journal.rb
359
362
  - lib/spina/admin/journal/engine.rb
360
363
  - lib/spina/admin/journal/version.rb