spina-admin-journal 0.2.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spina/admin/journal/articles_controller.rb +1 -1
  3. data/app/controllers/spina/admin/journal/authors_controller.rb +24 -0
  4. data/app/controllers/spina/admin/journal/issues_controller.rb +1 -1
  5. data/app/controllers/spina/admin/journal/journals_controller.rb +1 -1
  6. data/app/controllers/spina/admin/journal/licences_controller.rb +95 -0
  7. data/app/models/spina/admin/journal/article.rb +16 -1
  8. data/app/models/spina/admin/journal/authorship.rb +6 -0
  9. data/app/models/spina/admin/journal/licence.rb +32 -0
  10. data/app/views/layouts/spina/admin/journal/licences.html.haml +10 -0
  11. data/app/views/spina/admin/hooks/journal/_primary_navigation.html.haml +4 -2
  12. data/app/views/spina/admin/journal/affiliations/_affiliation.html.haml +1 -1
  13. data/app/views/spina/admin/journal/articles/_form_authors.html.haml +7 -2
  14. data/app/views/spina/admin/journal/articles/_form_details.html.haml +10 -0
  15. data/app/views/spina/admin/journal/authorships/_authorship.html.haml +9 -0
  16. data/app/views/spina/admin/journal/licences/_form.html.haml +43 -0
  17. data/app/views/spina/admin/journal/licences/_licence.html.haml +11 -0
  18. data/app/views/spina/admin/journal/licences/edit.html.haml +1 -0
  19. data/app/views/spina/admin/journal/licences/index.html.haml +17 -0
  20. data/app/views/spina/admin/journal/licences/new.html.haml +1 -0
  21. data/config/locales/en.yml +31 -4
  22. data/config/routes.rb +4 -1
  23. data/db/migrate/20210512122931_add_position_to_spina_admin_journal_authorships.rb +7 -0
  24. data/db/migrate/20210521121318_add_status_to_spina_admin_journal_articles.rb +7 -0
  25. data/db/migrate/20210618090155_create_spina_admin_journal_licences.rb +13 -0
  26. data/db/migrate/20210618094533_add_licence_to_spina_admin_journal_articles.rb +8 -0
  27. data/lib/spina/admin/journal/version.rb +1 -1
  28. metadata +16 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6bcd6816e32f3ea9345061c96fb045e2ad56b4e0784dc52fa553aa57a17fac5
4
- data.tar.gz: 83dc5d60bb02ecd87b9559db4923f81b97848842bb66c04f734cbb708c3159d6
3
+ metadata.gz: c43ca7425af717514efb0bc6a142651eae11fd79446019ab19b87bb8c952f497
4
+ data.tar.gz: 3af013de932268d05fb32013c7d1f09a89166eedd43276ce73c1756819cdea75
5
5
  SHA512:
6
- metadata.gz: 94b6fa30869ad9a702b057d7dce487b8a522f9798d5d5d2897f554e19a75a9136760201b1a13d652a9e51f15aefbdf6b2cdd7bf0df3d73ae884f024cc193a37c
7
- data.tar.gz: f4acc58dcebdb7c13864cc99086376e516095658de37dcbb720127d2d65bdedb37b5dc658116b99f2a5d1f9152b17d0369ce52d3d5e6e674cf12ec5a7d0936b1
6
+ metadata.gz: d792437f01a6474b290daa7deaea9232eb78892a77e08c877abbab9ce97221785c653eca15062b2656a70e155b74ad3ed77aae3e2a3260306c153bfb9c4401fc
7
+ data.tar.gz: 1ef7f100bd6d37727916951f588d4fcad17d4c896e3fab8c136f2ac663b0290afb3293adc3c6c1cb2d1e99f463363a4c352879a09d53df624e31403d1120a111
@@ -19,7 +19,7 @@ module Spina
19
19
  CONTENT_PARAMS = Spina.config.locales.inject({}) do |params, locale|
20
20
  params.merge("#{locale}_content_attributes": [*PARTS_PARAMS])
21
21
  end
22
- PARAMS = [:issue_id, :title, :url, :doi, { affiliation_ids: [], **CONTENT_PARAMS }].freeze
22
+ PARAMS = [:issue_id, :licence_id, :title, :url, :doi, :status, { affiliation_ids: [], **CONTENT_PARAMS }].freeze
23
23
  PARTS = %w[abstract attachment].freeze
24
24
 
25
25
  before_action :set_breadcrumb
@@ -46,6 +46,20 @@ module Spina
46
46
  end
47
47
  end
48
48
 
49
+ def sort
50
+ ActiveRecord::Base.transaction do
51
+ sort_params.each do |id, new_pos|
52
+ # ignore uniqueness validation for now
53
+ Authorship.find(id.to_i).update_attribute(:position, new_pos.to_i) # rubocop:disable Rails/SkipsModelValidations
54
+ end
55
+ # do validations after reordering is complete
56
+ validate_sort_order
57
+ end
58
+ render json: { success: true, message: t('.sort_success') }
59
+ rescue ActiveRecord::RecordInvalid
60
+ render json: { success: false, message: t('.sort_error') }
61
+ end
62
+
49
63
  private
50
64
 
51
65
  def author_params
@@ -65,6 +79,10 @@ module Spina
65
79
  new_params
66
80
  end
67
81
 
82
+ def sort_params
83
+ params.require(:admin_journal_authorships).require(:list).permit!
84
+ end
85
+
68
86
  def set_breadcrumb
69
87
  add_breadcrumb Author.model_name.human(count: :many), admin_journal_authors_path
70
88
  end
@@ -77,6 +95,12 @@ module Spina
77
95
  @author = Author.find(params[:id])
78
96
  add_breadcrumb @author.primary_affiliation.name
79
97
  end
98
+
99
+ def validate_sort_order
100
+ Authorship.where(article_id: params[:article_id]).each do |authorship|
101
+ raise ActiveRecord::RecordInvalid if authorship.invalid?
102
+ end
103
+ end
80
104
  end
81
105
  end
82
106
  end
@@ -20,7 +20,7 @@ module Spina
20
20
  params.merge("#{locale}_content_attributes": [*PARTS_PARAMS])
21
21
  end
22
22
  PARAMS = [:volume_id, :title, :date, { **CONTENT_PARAMS }].freeze
23
- PARTS = %w[cover_img description].freeze
23
+ PARTS = %w[cover_img description attachment].freeze
24
24
 
25
25
  before_action :set_breadcrumb
26
26
  before_action :set_tabs, except: %i[index destroy sort]
@@ -21,7 +21,7 @@ module Spina
21
21
  params.merge("#{locale}_content_attributes": [*PARTS_PARAMS])
22
22
  end
23
23
  PARAMS = [:name, { **CONTENT_PARAMS }].freeze
24
- PARTS = %w[logo description].freeze
24
+ PARTS = %w[journal_abbreviation logo description documents].freeze
25
25
 
26
26
  before_action :set_journal
27
27
  before_action :set_parts_attributes
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Admin
5
+ module Journal
6
+ # Controller for {Licence} records.
7
+ class LicencesController < ApplicationController
8
+ PARTS_PARAMS = [
9
+ :name, :title, :type, :content, :filename, :signed_blob_id, :alt, :attachment_id, :image_id,
10
+ { images_attributes: %i[filename signed_blob_id image_id alt],
11
+ content_attributes: [
12
+ :name, :title,
13
+ { parts_attributes: [
14
+ :name, :title, :type, :content, :filename, :signed_blob_id, :alt, :attachment_id, :image_id,
15
+ { images_attributes: %i[filename signed_blob_id image_id alt] }
16
+ ] }
17
+ ] }
18
+ ].freeze
19
+ CONTENT_PARAMS = Spina.config.locales.inject({}) do |params, locale|
20
+ params.merge("#{locale}_content_attributes": [*PARTS_PARAMS])
21
+ end
22
+ PARAMS = [:name, :abbreviated_name, { **CONTENT_PARAMS }].freeze
23
+ PARTS = %w[text url logo].freeze
24
+
25
+ before_action :set_breadcrumb
26
+ before_action :set_licence, only: %i[edit update destroy]
27
+ before_action :set_parts_attributes, only: %i[new edit]
28
+ before_action :build_parts, only: %i[edit]
29
+
30
+ def index
31
+ @licences = Licence.sorted
32
+ end
33
+
34
+ def new
35
+ @licence = Licence.new
36
+ build_parts
37
+ add_breadcrumb t('.new')
38
+ end
39
+
40
+ def edit; end
41
+
42
+ def create
43
+ @licence = Licence.new(licence_params)
44
+ if @licence.save
45
+ redirect_to admin_journal_licences_path, success: t('.saved')
46
+ else
47
+ render :new
48
+ end
49
+ end
50
+
51
+ def update
52
+ if @licence.update(licence_params)
53
+ redirect_to admin_journal_licences_path, success: t('.saved')
54
+ else
55
+ render :edit
56
+ end
57
+ end
58
+
59
+ def destroy
60
+ @licence.destroy
61
+ respond_to do |format|
62
+ format.html do
63
+ redirect_to admin_journal_licences_path, success: t('.deleted')
64
+ end
65
+ end
66
+ end
67
+
68
+ private
69
+
70
+ def licence_params
71
+ params.require(:admin_journal_licence).permit(PARAMS)
72
+ end
73
+
74
+ def set_breadcrumb
75
+ add_breadcrumb Licence.model_name.human(count: :many), admin_journal_licences_path
76
+ end
77
+
78
+ def set_licence
79
+ @licence = Licence.find(params[:id])
80
+ add_breadcrumb @licence.name
81
+ end
82
+
83
+ def set_parts_attributes
84
+ @parts_attributes = current_theme.parts.select { |part| PARTS.include? part[:name] }
85
+ end
86
+
87
+ def build_parts
88
+ return unless @parts_attributes.is_a? Array
89
+
90
+ @parts = @parts_attributes.collect { |part_attributes| @licence.part(part_attributes) }
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -7,12 +7,13 @@ module Spina
7
7
  #
8
8
  # === Validators
9
9
  # Presence:: {#number}, {#title}
10
- # Uniqueness:: {#number} (scope: issue)
10
+ # Uniqueness:: {#number} (scope: issue) {status}
11
11
  # URI:: {#url}
12
12
  #
13
13
  # === Scopes
14
14
  # sorted_asc:: sorted in order of increasing number
15
15
  # sorted_desc:: sorted highest number first
16
+ # visible:: articles that should be visible to the public
16
17
  #
17
18
  # @see Issue
18
19
  # @see Author
@@ -33,6 +34,9 @@ module Spina
33
34
  # @!attribute [rw] issue
34
35
  # @return [Issue] The issue that contains this article.
35
36
  belongs_to :issue
37
+ # @!attribute [rw] licence
38
+ # @return [Licence] the licence under which the article is released
39
+ belongs_to :licence, optional: true
36
40
 
37
41
  # @!attribute [rw] authorships
38
42
  has_many :authorships, dependent: :destroy
@@ -40,12 +44,23 @@ module Spina
40
44
  # @return [ActiveRecord::Relation] The authors of the article.
41
45
  has_many :affiliations, through: :authorships
42
46
 
47
+ # @!attribute [rw] status
48
+ # @return [Integer] the current status of the article
49
+ enum status: { published: 0, draft: 1, meta: 2 }
50
+
43
51
  validates :number, presence: true, uniqueness: { scope: :issue_id }
44
52
  validates :title, presence: true
45
53
  validates :url, 'spina/admin/journal/uri': true
54
+ validates :status, presence: true
46
55
 
56
+ scope :visible, -> { where(status: %i[published meta]) }
47
57
  scope :sorted_asc, -> { includes(:issue).order('spina_admin_journal_issues.number ASC', number: :asc) }
48
58
  scope :sorted_desc, -> { includes(:issue).order('spina_admin_journal_issues.number DESC', number: :desc) }
59
+
60
+ # Returns true if the article should be visible to end users (i.e. is not a draft).
61
+ def visible?
62
+ published? || meta?
63
+ end
49
64
  end
50
65
  end
51
66
  end
@@ -13,6 +13,12 @@ module Spina
13
13
  # @!attribute [rw] author_name
14
14
  # @return [ActiveRecord::Relation] the associated affiliation of an author of the article
15
15
  belongs_to :affiliation
16
+ # @!attribute [rw] position
17
+ # @return [Integer] used to order the affiliations for each article
18
+
19
+ validates :position, presence: true, uniqueness: { scope: :article_id }
20
+
21
+ scope :sorted_within_article, -> { order(position: :asc) }
16
22
  end
17
23
  end
18
24
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Admin
5
+ module Journal
6
+ # A record to hold information about copyright licences.
7
+ #
8
+ # Associated with individual articles.
9
+ #
10
+ # === Validators
11
+ # Presence:: {#name}
12
+ class Licence < ApplicationRecord
13
+ include AttrJson::Record
14
+ include AttrJson::NestedAttributes
15
+ include Spina::Partable
16
+ include Spina::TranslatedContent
17
+
18
+ # @!attribute [rw] name
19
+ # @return [String] the name of the licence
20
+ # @!attribute [rw] abbreviated_name
21
+ # @return [String] an optional abbreviated form of the licence name
22
+ # @!attribute [rw] articles
23
+ # @return [ActiveRecord::Relation] articles which use this licence
24
+ has_many :articles, dependent: :nullify
25
+
26
+ validates :name, presence: true
27
+
28
+ scope :sorted, -> { order(name: :asc) }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,10 @@
1
+ - content_for :application do
2
+ %header#header
3
+ #header_actions
4
+ = yield :header_actions
5
+
6
+ = render partial: 'spina/admin/shared/breadcrumbs'
7
+
8
+ = yield
9
+
10
+ = render template: 'layouts/spina/admin/admin'
@@ -1,7 +1,7 @@
1
1
  %li{ class: ('active' if %w[articles issues volumes].include? controller_name) }
2
2
  = link_to admin_journal_volumes_path do
3
3
  = icon 'pages'
4
- = ::Spina::Admin::Journal::Journal.instance.name
4
+ = ::Spina::Admin::Journal::Journal.instance.has_content?(:journal_abbreviation) ? ::Spina::Admin::Journal::Journal.instance.content(:journal_abbreviation) : ::Spina::Admin::Journal::Journal.instance.name
5
5
  = icon 'caret-right'
6
6
 
7
7
  %ul
@@ -12,7 +12,7 @@
12
12
  %li{ class: ('active' if %w[articles].include? controller_name) }
13
13
  = link_to ::Spina::Admin::Journal::Article.model_name.human(count: :many), admin_journal_articles_path
14
14
 
15
- %li{ class: ('active' if %w[journals authors institutions].include? controller_name) }
15
+ %li{ class: ('active' if %w[journals authors institutions licences].include? controller_name) }
16
16
  = link_to edit_admin_journal_journal_path(::Spina::Admin::Journal::Journal.instance.id) do
17
17
  = icon 'dots'
18
18
  = t 'spina.admin.journal.navigation_title'
@@ -25,3 +25,5 @@
25
25
  = link_to ::Spina::Admin::Journal::Author.model_name.human(count: :many), admin_journal_authors_path
26
26
  %li{ class: ('active' if %w[institutions].include? controller_name) }
27
27
  = link_to ::Spina::Admin::Journal::Institution.model_name.human(count: :many), admin_journal_institutions_path
28
+ %li{ class: ('active' if %w[licences].include? controller_name) }
29
+ = link_to ::Spina::Admin::Journal::Licence.model_name.human(count: :many), admin_journal_licences_path
@@ -1,4 +1,4 @@
1
- %tr
1
+ %tr{ data: { id: affiliation.id } }
2
2
  %td= affiliation.name
3
3
  %td= affiliation.institution.name
4
4
  %td= affiliation.articles.count
@@ -1,10 +1,15 @@
1
+ .sort-message
1
2
  .table-container
2
3
  %table.table
3
4
  %thead
4
5
  %tr
6
+ %th= ::Spina::Admin::Journal::Affiliation.human_attribute_name :position
5
7
  %th= ::Spina::Admin::Journal::Affiliation.human_attribute_name :name
6
8
  %th= ::Spina::Admin::Journal::Affiliation.human_attribute_name :institution
7
9
  %th= t '.number_of_articles'
8
10
  %th
9
- %tbody
10
- = render @article.affiliations.any? ? @article.affiliations : 'empty_list', message: t('.no_authors')
11
+ %tbody.html5sortable{ data: { id: @article.id, sorted_collection: 'admin_journal_authorships', sort_url: !@article.id.nil? && sort_admin_journal_authors_url(@article) } }
12
+ - if @article.authorships.any?
13
+ = render @article.authorships.sorted_within_article
14
+ - else
15
+ = render 'empty_list', message: t('.no_authors')
@@ -15,6 +15,16 @@
15
15
  = ::Spina::Admin::Journal::Article.human_attribute_name :title
16
16
  .page-form-content
17
17
  = f.text_field :title
18
+ .page-form-group
19
+ .page-form-label
20
+ = Spina::Admin::Journal::Article.human_attribute_name :status
21
+ .page-form-content
22
+ = f.select :status, Spina::Admin::Journal::Article.statuses.keys.map { |key| [key.humanize, key] }
23
+ .page-form-group
24
+ .page-form-label
25
+ = Spina::Admin::Journal::Article.human_attribute_name :licence
26
+ .page-form-content
27
+ = f.collection_select :licence_id, Spina::Admin::Journal::Licence.sorted, :id, :name, prompt: true
18
28
  .page-form-group
19
29
  .page-form-label
20
30
  = ::Spina::Admin::Journal::Author.model_name.human count: :many
@@ -0,0 +1,9 @@
1
+ %tr{ data: { id: authorship.id } }
2
+ %td.position-display= authorship.position
3
+ %td= authorship.affiliation.name
4
+ %td= authorship.affiliation.institution.name
5
+ %td= authorship.affiliation.articles.count
6
+ %td.nowrap.align-right
7
+ = link_to edit_admin_journal_author_path(authorship.affiliation.author.id), class: 'button button-link' do
8
+ = icon 'pencil-outline'
9
+ = t '.view'
@@ -0,0 +1,43 @@
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'
10
+
11
+ = form_for @licence, html: { autocomplete: 'off' } do |f|
12
+ %header#header
13
+ = render partial: 'spina/admin/shared/breadcrumbs'
14
+
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
+
20
+ .button{ style: 'margin-right: 0' }= link_to t('spina.cancel'), admin_journal_licences_path
21
+
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
33
+
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
38
+
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'
@@ -0,0 +1,11 @@
1
+ %tr{ data: { id: licence.id } }
2
+ %td
3
+ = link_to licence.name, edit_admin_journal_licence_path(licence)
4
+ %td
5
+ = licence.abbreviated_name
6
+ %td
7
+ = licence.articles.count
8
+ %td.nowrap.align-right
9
+ = link_to edit_admin_journal_licence_path(licence), class: 'button button-link' do
10
+ = icon 'pencil-outline'
11
+ = t '.edit'
@@ -0,0 +1 @@
1
+ = render 'form'
@@ -0,0 +1,17 @@
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'
5
+
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')
@@ -0,0 +1 @@
1
+ = render 'form'
@@ -100,6 +100,9 @@ en:
100
100
  saved: Author saved.
101
101
  destroy:
102
102
  deleted: Author deleted.
103
+ sort:
104
+ sort_success: Sorted successfully!
105
+ sort_error: There was an error when sorting. Check the server logs for more information.
103
106
  form:
104
107
  save: Save author
105
108
  form_details:
@@ -131,6 +134,20 @@ en:
131
134
  delete_confirmation:
132
135
  "Are you sure you want to delete the institution <strong>%{name}</strong>?
133
136
  This action is irreversible, and will delete all associated affiliations. Authors will not be deleted."
137
+ licences:
138
+ new:
139
+ new: New licence
140
+ create:
141
+ saved: Licence saved.
142
+ update:
143
+ saved: Licence saved.
144
+ destroy:
145
+ deleted: Licence deleted.
146
+ form:
147
+ save: Save licence
148
+ delete_confirmation:
149
+ "Are you sure you want to delete the licence <strong>%{name}</strong>?"
150
+
134
151
  activerecord:
135
152
  models:
136
153
  spina/admin/journal/journal:
@@ -145,15 +162,21 @@ en:
145
162
  spina/admin/journal/article:
146
163
  one: Article
147
164
  other: Articles
165
+ spina/admin/journal/authorship:
166
+ one: Authorship
167
+ other: Authorships
168
+ spina/admin/journal/affiliation:
169
+ one: Affiliation
170
+ other: Affiliations
148
171
  spina/admin/journal/author:
149
172
  one: Author
150
173
  other: Authors
151
- spina/admin/journal/author_name:
152
- one: Author name
153
- other: Author names
154
174
  spina/admin/journal/institution:
155
175
  one: Institution
156
176
  other: Institutions
177
+ spina/admin/journal/licence:
178
+ one: Licence
179
+ other: Licences
157
180
  attributes:
158
181
  spina/admin/journal/journal:
159
182
  name: Name
@@ -169,10 +192,14 @@ en:
169
192
  title: Title
170
193
  url: URL
171
194
  doi: DOI
195
+ spina/admin/journal/authorship:
196
+ position: Position
172
197
  spina/admin/journal/author:
173
- spina/admin/journal/author_name:
174
198
  spina/admin/journal/institution:
175
199
  name: Institution Name
200
+ spina/admin/journal/licence:
201
+ name: Licence Name
202
+ abbreviated_name: Short Name
176
203
 
177
204
  date:
178
205
  formats:
data/config/routes.rb CHANGED
@@ -13,9 +13,12 @@ Spina::Engine.routes.draw do
13
13
  resources :articles, except: %i[show] do
14
14
  patch 'sort/:issue_id' => 'articles#sort', as: :sort, on: :collection
15
15
  end
16
+ resources :authors, except: %i[show] do
17
+ patch 'sort/:article_id' => 'authors#sort', as: :sort, on: :collection
18
+ end
16
19
 
17
20
  resources :institutions, except: %i[show]
18
- resources :authors, except: %i[show]
21
+ resources :licences, except: %i[show]
19
22
  end
20
23
  end
21
24
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddPositionToSpinaAdminJournalAuthorships < ActiveRecord::Migration[6.1] # :nodoc:
4
+ def change
5
+ add_column :spina_admin_journal_authorships, :position, :integer, null: false, default: 0
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddStatusToSpinaAdminJournalArticles < ActiveRecord::Migration[6.1] # :nodoc:
4
+ def change
5
+ add_column :spina_admin_journal_articles, :status, :integer, null: false, default: 0
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateSpinaAdminJournalLicences < ActiveRecord::Migration[6.1] # :nodoc:
4
+ def change
5
+ create_table :spina_admin_journal_licences do |t|
6
+ t.string :name, null: false, default: 'Unnamed Licence'
7
+ t.string :abbreviated_name, null: false, default: ''
8
+ t.jsonb :json_attributes
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddLicenceToSpinaAdminJournalArticles < ActiveRecord::Migration[6.1] # :nodoc:
4
+ def change
5
+ add_reference :spina_admin_journal_articles, :licence, null: true,
6
+ foreign_key: { to_table: :spina_admin_journal_licences }
7
+ end
8
+ end
@@ -3,7 +3,7 @@
3
3
  module Spina
4
4
  module Admin
5
5
  module Journal
6
- VERSION = '0.2.0'
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-admin-journal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.5.0
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: 2021-04-25 00:00:00.000000000 Z
11
+ date: 2021-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: babel-transpiler
@@ -281,6 +281,7 @@ files:
281
281
  - app/controllers/spina/admin/journal/institutions_controller.rb
282
282
  - app/controllers/spina/admin/journal/issues_controller.rb
283
283
  - app/controllers/spina/admin/journal/journals_controller.rb
284
+ - app/controllers/spina/admin/journal/licences_controller.rb
284
285
  - app/controllers/spina/admin/journal/volumes_controller.rb
285
286
  - app/models/spina/admin/journal.rb
286
287
  - app/models/spina/admin/journal/affiliation.rb
@@ -290,6 +291,7 @@ files:
290
291
  - app/models/spina/admin/journal/institution.rb
291
292
  - app/models/spina/admin/journal/issue.rb
292
293
  - app/models/spina/admin/journal/journal.rb
294
+ - app/models/spina/admin/journal/licence.rb
293
295
  - app/models/spina/admin/journal/volume.rb
294
296
  - app/validators/spina/admin/journal/uri_validator.rb
295
297
  - app/views/layouts/spina/admin/journal/articles.html.haml
@@ -297,6 +299,7 @@ files:
297
299
  - app/views/layouts/spina/admin/journal/institutions.html.haml
298
300
  - app/views/layouts/spina/admin/journal/issues.html.haml
299
301
  - app/views/layouts/spina/admin/journal/journals.html.haml
302
+ - app/views/layouts/spina/admin/journal/licences.html.haml
300
303
  - app/views/layouts/spina/admin/journal/volumes.html.haml
301
304
  - app/views/spina/admin/hooks/journal/_head.html.haml
302
305
  - app/views/spina/admin/hooks/journal/_primary_navigation.html.haml
@@ -318,6 +321,7 @@ files:
318
321
  - app/views/spina/admin/journal/authors/edit.html.haml
319
322
  - app/views/spina/admin/journal/authors/index.html.haml
320
323
  - app/views/spina/admin/journal/authors/new.html.haml
324
+ - app/views/spina/admin/journal/authorships/_authorship.html.haml
321
325
  - app/views/spina/admin/journal/institutions/_form.html.haml
322
326
  - app/views/spina/admin/journal/institutions/_form_details.html.haml
323
327
  - app/views/spina/admin/journal/institutions/_form_view_affiliations.html.haml
@@ -336,6 +340,11 @@ files:
336
340
  - app/views/spina/admin/journal/journals/edit.html.haml
337
341
  - app/views/spina/admin/journal/journals/index.html.haml
338
342
  - app/views/spina/admin/journal/journals/new.html.haml
343
+ - app/views/spina/admin/journal/licences/_form.html.haml
344
+ - app/views/spina/admin/journal/licences/_licence.html.haml
345
+ - app/views/spina/admin/journal/licences/edit.html.haml
346
+ - app/views/spina/admin/journal/licences/index.html.haml
347
+ - app/views/spina/admin/journal/licences/new.html.haml
339
348
  - app/views/spina/admin/journal/volumes/_form.html.haml
340
349
  - app/views/spina/admin/journal/volumes/_form_details.html.haml
341
350
  - app/views/spina/admin/journal/volumes/_form_issues.html.haml
@@ -357,6 +366,10 @@ files:
357
366
  - db/migrate/20210424123450_add_json_attributes_to_spina_admin_journal_journals.rb
358
367
  - db/migrate/20210424123521_add_json_attributes_to_spina_admin_journal_issues.rb
359
368
  - db/migrate/20210424123555_add_json_attributes_to_spina_admin_journal_articles.rb
369
+ - db/migrate/20210512122931_add_position_to_spina_admin_journal_authorships.rb
370
+ - db/migrate/20210521121318_add_status_to_spina_admin_journal_articles.rb
371
+ - db/migrate/20210618090155_create_spina_admin_journal_licences.rb
372
+ - db/migrate/20210618094533_add_licence_to_spina_admin_journal_articles.rb
360
373
  - lib/spina/admin/journal.rb
361
374
  - lib/spina/admin/journal/engine.rb
362
375
  - lib/spina/admin/journal/version.rb
@@ -381,7 +394,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
381
394
  - !ruby/object:Gem::Version
382
395
  version: '0'
383
396
  requirements: []
384
- rubygems_version: 3.1.4
397
+ rubygems_version: 3.1.6
385
398
  signing_key:
386
399
  specification_version: 4
387
400
  summary: Academic journal plugin for Spina.