spina-admin-journal 0.4.1 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spina/admin/journal/application_controller.rb +2 -0
  3. data/app/controllers/spina/admin/journal/articles_controller.rb +4 -3
  4. data/app/controllers/spina/admin/journal/authors_controller.rb +5 -4
  5. data/app/controllers/spina/admin/journal/institutions_controller.rb +1 -1
  6. data/app/controllers/spina/admin/journal/issues_controller.rb +9 -3
  7. data/app/controllers/spina/admin/journal/journals_controller.rb +2 -2
  8. data/app/controllers/spina/admin/journal/licences_controller.rb +95 -0
  9. data/app/models/spina/admin/journal/article.rb +3 -0
  10. data/app/models/spina/admin/journal/licence.rb +32 -0
  11. data/app/models/spina/parts/admin/journal/page_range.rb +31 -0
  12. data/app/views/layouts/spina/admin/journal/licences.html.haml +10 -0
  13. data/app/views/spina/admin/hooks/journal/_primary_navigation.html.haml +4 -2
  14. data/app/views/spina/admin/journal/articles/_form.html.haml +1 -1
  15. data/app/views/spina/admin/journal/articles/_form_details.html.haml +5 -0
  16. data/app/views/spina/admin/journal/authors/_form.html.haml +1 -1
  17. data/app/views/spina/admin/journal/authors/_form_affiliation.html.haml +1 -1
  18. data/app/views/spina/admin/journal/institutions/_form.html.haml +1 -1
  19. data/app/views/spina/admin/journal/issues/_form.html.haml +1 -1
  20. data/app/views/spina/admin/journal/issues/_form_articles.html.haml +1 -1
  21. data/app/views/spina/admin/journal/journals/_form.html.haml +1 -1
  22. data/app/views/spina/admin/journal/licences/_form.html.haml +43 -0
  23. data/app/views/spina/admin/journal/licences/_licence.html.haml +11 -0
  24. data/app/views/spina/admin/journal/licences/edit.html.haml +1 -0
  25. data/app/views/spina/admin/journal/licences/index.html.haml +17 -0
  26. data/app/views/spina/admin/journal/licences/new.html.haml +1 -0
  27. data/app/views/spina/admin/journal/volumes/_form.html.haml +1 -1
  28. data/app/views/spina/admin/parts/admin/journal/page_ranges/_form.html.haml +6 -0
  29. data/config/locales/en.yml +20 -0
  30. data/config/routes.rb +1 -0
  31. data/db/migrate/20210618090155_create_spina_admin_journal_licences.rb +13 -0
  32. data/db/migrate/20210618094533_add_licence_to_spina_admin_journal_articles.rb +8 -0
  33. data/db/migrate/20210626153728_create_spina_parts_admin_journal_page_ranges.rb +7 -0
  34. data/lib/spina/admin/journal/engine.rb +6 -0
  35. data/lib/spina/admin/journal/version.rb +1 -1
  36. metadata +18 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40f92e9ff8032770be4faf4bd6c32eaffde2c9bbaca6189f361c876e50ae9975
4
- data.tar.gz: ce515e0d66666f5568664285290ec48d5595334603355bdf6d44161c4ab1024f
3
+ metadata.gz: d17b7c3f700ab8ee1935120ec11f228117c6db7085a7960c8382f0d54d81e508
4
+ data.tar.gz: f711f066d315fe44115e50420eeade827aaf83a2451cc0c6dd29cc4aec290b89
5
5
  SHA512:
6
- metadata.gz: 8fb91af1b4b6bf4755a469b4a968ae00a5a180563b35b35ee7129119fb735f592803de12bf75583d0f2c9a3afa914c3c2131f8a43299fc98bff22d19eed839b8
7
- data.tar.gz: 474f142ef4e0948f22643959c93420d947821030bf16acd05017ee2bbc1bdf14d5fe740cc9ec9326ef52d69c99f9332e9032e65cb7b14b0074c14a46672d0a1a
6
+ metadata.gz: d8964198f6c9c720f9678acb9fb227a32812c2bc4d3de17f3761b77ae59789d386711b9285a658a5a2cc15237b922e75a28eac9b344835e6c3772021b64c4bc8
7
+ data.tar.gz: aea65ca8967a73a0b9a0c83964bc19445ea668eed7964681e19625d242a3ff11c8e290d7ef2564130d6caae4a2dbb16c9054c25867c3be1f8bd413c7c4f40118
@@ -5,6 +5,8 @@ module Spina
5
5
  module Journal
6
6
  # Custom controller for journal plugin. Sets the layout and adds a flash type.
7
7
  class ApplicationController < AdminController
8
+ helper ::Spina::Engine.routes.url_helpers
9
+
8
10
  add_flash_types :success
9
11
 
10
12
  layout :admin_layout, only: %i[new edit]
@@ -7,6 +7,7 @@ module Spina
7
7
  class ArticlesController < ApplicationController
8
8
  PARTS_PARAMS = [
9
9
  :name, :title, :type, :content, :filename, :signed_blob_id, :alt, :attachment_id, :image_id,
10
+ :first_page, :last_page,
10
11
  { images_attributes: %i[filename signed_blob_id image_id alt],
11
12
  content_attributes: [
12
13
  :name, :title,
@@ -19,8 +20,8 @@ module Spina
19
20
  CONTENT_PARAMS = Spina.config.locales.inject({}) do |params, locale|
20
21
  params.merge("#{locale}_content_attributes": [*PARTS_PARAMS])
21
22
  end
22
- PARAMS = [:issue_id, :title, :url, :doi, :status, { affiliation_ids: [], **CONTENT_PARAMS }].freeze
23
- PARTS = %w[abstract attachment].freeze
23
+ PARAMS = [:issue_id, :licence_id, :title, :url, :doi, :status, { affiliation_ids: [], **CONTENT_PARAMS }].freeze
24
+ PARTS = %w[abstract attachment page_range].freeze
24
25
 
25
26
  before_action :set_breadcrumb
26
27
  before_action :set_tabs, except: %i[index destroy sort]
@@ -84,7 +85,7 @@ module Spina
84
85
  private
85
86
 
86
87
  def article_params
87
- params.require(:admin_journal_article).permit(PARAMS)
88
+ params.require(:article).permit(PARAMS)
88
89
  end
89
90
 
90
91
  def sort_params
@@ -16,6 +16,7 @@ module Spina
16
16
  def new
17
17
  @author = Author.new
18
18
  @author.affiliations << Affiliation.new(status: :primary)
19
+ add_breadcrumb t('.new')
19
20
  end
20
21
 
21
22
  def edit; end
@@ -63,13 +64,13 @@ module Spina
63
64
  private
64
65
 
65
66
  def author_params
66
- params.require(:admin_journal_author).permit(:primary_affiliation_index,
67
- affiliations_attributes: %i[id institution_id first_name
68
- surname])
67
+ params.require(:author).permit(:primary_affiliation_index,
68
+ affiliations_attributes: %i[id institution_id first_name
69
+ surname])
69
70
  end
70
71
 
71
72
  def modified_params
72
- primary_affiliation_index = params[:admin_journal_author][:primary_affiliation_index]
73
+ primary_affiliation_index = params[:author][:primary_affiliation_index]
73
74
  new_params = author_params.except :primary_affiliation_index
74
75
  unless new_params[:affiliations_attributes].nil? || primary_affiliation_index.nil?
75
76
  new_params[:affiliations_attributes].each_key do |index|
@@ -50,7 +50,7 @@ module Spina
50
50
  private
51
51
 
52
52
  def institution_params
53
- params.require(:admin_journal_institution).permit(:name)
53
+ params.require(:institution).permit(:name)
54
54
  end
55
55
 
56
56
  def set_breadcrumb
@@ -4,7 +4,8 @@ module Spina
4
4
  module Admin
5
5
  module Journal
6
6
  # Controller for {Issue} records.
7
- class IssuesController < ApplicationController
7
+ # TODO: extract methods to helpers to reduce class length
8
+ class IssuesController < ApplicationController # rubocop:disable Metrics/ClassLength
8
9
  PARTS_PARAMS = [
9
10
  :name, :title, :type, :content, :filename, :signed_blob_id, :alt, :attachment_id, :image_id,
10
11
  { images_attributes: %i[filename signed_blob_id image_id alt],
@@ -20,11 +21,12 @@ module Spina
20
21
  params.merge("#{locale}_content_attributes": [*PARTS_PARAMS])
21
22
  end
22
23
  PARAMS = [:volume_id, :title, :date, { **CONTENT_PARAMS }].freeze
23
- PARTS = %w[cover_img description].freeze
24
+ PARTS = %w[cover_img description attachment].freeze
24
25
 
25
26
  before_action :set_breadcrumb
26
27
  before_action :set_tabs, except: %i[index destroy sort]
27
28
  before_action :set_issue, only: %i[edit update destroy]
29
+ before_action :set_articles, only: %i[edit update]
28
30
  before_action :set_parts_attributes, only: %i[new edit]
29
31
  before_action :build_parts, only: %i[edit]
30
32
 
@@ -92,8 +94,12 @@ module Spina
92
94
  @issue = Issue.find(params[:id])
93
95
  end
94
96
 
97
+ def set_articles
98
+ @articles = @issue.articles.sorted_asc
99
+ end
100
+
95
101
  def issue_params
96
- params.require(:admin_journal_issue).permit(PARAMS)
102
+ params.require(:issue).permit(PARAMS)
97
103
  end
98
104
 
99
105
  def sort_params
@@ -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 issn].freeze
25
25
 
26
26
  before_action :set_journal
27
27
  before_action :set_parts_attributes
@@ -65,7 +65,7 @@ module Spina
65
65
  end
66
66
 
67
67
  def journal_params
68
- params.require(:admin_journal_journal).permit(PARAMS)
68
+ params.require(:journal).permit(PARAMS)
69
69
  end
70
70
  end
71
71
  end
@@ -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(: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
@@ -34,6 +34,9 @@ module Spina
34
34
  # @!attribute [rw] issue
35
35
  # @return [Issue] The issue that contains this article.
36
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
37
40
 
38
41
  # @!attribute [rw] authorships
39
42
  has_many :authorships, dependent: :destroy
@@ -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,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spina
4
+ module Parts
5
+ module Admin
6
+ module Journal
7
+ # Part representing a range of pages
8
+ class PageRange < Spina::Parts::Base
9
+ attr_json :first_page, :integer
10
+ attr_json :last_page, :integer
11
+
12
+ validate :valid_range
13
+
14
+ def content
15
+ self
16
+ end
17
+
18
+ def valid_range
19
+ return if first_page.nil? && last_page.nil?
20
+
21
+ if last_page.nil?
22
+ errors.add :last_page, 'must be present'
23
+ elsif last_page < first_page
24
+ errors.add :last_page, 'must be larger than the first page'
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ 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
@@ -8,7 +8,7 @@
8
8
  = link_to '#', data: { close_notification: true } do
9
9
  = icon 'cross'
10
10
 
11
- = form_for @article, html: { autocomplete: "off" } do |f|
11
+ = form_for [:admin_journal, @article], html: { autocomplete: "off" } do |f|
12
12
  %header#header
13
13
  = render partial: 'spina/admin/shared/breadcrumbs'
14
14
 
@@ -20,6 +20,11 @@
20
20
  = Spina::Admin::Journal::Article.human_attribute_name :status
21
21
  .page-form-content
22
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
23
28
  .page-form-group
24
29
  .page-form-label
25
30
  = ::Spina::Admin::Journal::Author.model_name.human count: :many
@@ -8,7 +8,7 @@
8
8
  = link_to '#', data: {close_notification: true} do
9
9
  = icon 'cross'
10
10
 
11
- = form_for @author, html: {autocomplete: "off"} do |f|
11
+ = form_for [:admin_journal, @author], html: {autocomplete: "off"} do |f|
12
12
  %header#header
13
13
  = render partial: 'spina/admin/shared/breadcrumbs'
14
14
 
@@ -17,4 +17,4 @@
17
17
  .page-form-label
18
18
  = t '.primary'
19
19
  .page-form-content
20
- = radio_button_tag 'admin_journal_author[primary_affiliation_index]', ff.index, ff.object.status == 'primary'
20
+ = radio_button_tag 'author[primary_affiliation_index]', ff.index, ff.object.status == 'primary'
@@ -8,7 +8,7 @@
8
8
  = link_to '#', data: { close_notification: true } do
9
9
  = icon 'cross'
10
10
 
11
- = form_for @institution, html: {autocomplete: "off"} do |f|
11
+ = form_for [:admin_journal, @institution], html: {autocomplete: "off"} do |f|
12
12
  %header#header
13
13
  = render partial: 'spina/admin/shared/breadcrumbs'
14
14
 
@@ -8,7 +8,7 @@
8
8
  = link_to '#', data: { close_notification: true } do
9
9
  = icon 'cross'
10
10
 
11
- = form_for @issue, html: { autocomplete: 'off' } do |f|
11
+ = form_for [:admin_journal, @issue], html: { autocomplete: 'off' } do |f|
12
12
  %header#header
13
13
  = render partial: 'spina/admin/shared/breadcrumbs'
14
14
 
@@ -11,4 +11,4 @@
11
11
  %th= ::Spina::Admin::Journal::Article.human_attribute_name :title
12
12
  %th
13
13
  %tbody.html5sortable{ data: { id: @issue.id, sorted_collection: 'admin_journal_articles', sort_url: !@issue.id.nil? && sort_admin_journal_articles_url(@issue) } }
14
- = render @issue.articles.any? ? @issue.articles : 'empty_list', message: t('.no_articles')
14
+ = render @articles && @articles.any? ? @articles : 'empty_list', message: t('.no_articles')
@@ -8,7 +8,7 @@
8
8
  = link_to '#', data: { close_notification: true } do
9
9
  = icon 'cross'
10
10
 
11
- = form_for @journal, html: { autocomplete: "off" } do |f|
11
+ = form_for [:admin_journal, @journal], html: { autocomplete: "off" } do |f|
12
12
  %header#header
13
13
  .breadcrumbs
14
14
  = render_breadcrumbs
@@ -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 [:admin_journal, @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'
@@ -1,4 +1,4 @@
1
- = form_for @volume, html: { autocomplete: 'off' } do |f|
1
+ = form_for [:admin_journal, @volume], html: { autocomplete: 'off' } do |f|
2
2
  %header#header
3
3
  = render partial: 'spina/admin/shared/breadcrumbs'
4
4
 
@@ -0,0 +1,6 @@
1
+ .page-form-label= f.object.title
2
+ .page-form-control
3
+ = f.number_field :first_page, style: 'width: 10%;'
4
+ &ndash;
5
+ = f.number_field :last_page, style: 'width: 10%;'
6
+
@@ -134,6 +134,20 @@ en:
134
134
  delete_confirmation:
135
135
  "Are you sure you want to delete the institution <strong>%{name}</strong>?
136
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
+
137
151
  activerecord:
138
152
  models:
139
153
  spina/admin/journal/journal:
@@ -160,6 +174,9 @@ en:
160
174
  spina/admin/journal/institution:
161
175
  one: Institution
162
176
  other: Institutions
177
+ spina/admin/journal/licence:
178
+ one: Licence
179
+ other: Licences
163
180
  attributes:
164
181
  spina/admin/journal/journal:
165
182
  name: Name
@@ -180,6 +197,9 @@ en:
180
197
  spina/admin/journal/author:
181
198
  spina/admin/journal/institution:
182
199
  name: Institution Name
200
+ spina/admin/journal/licence:
201
+ name: Licence Name
202
+ abbreviated_name: Short Name
183
203
 
184
204
  date:
185
205
  formats:
data/config/routes.rb CHANGED
@@ -18,6 +18,7 @@ Spina::Engine.routes.draw do
18
18
  end
19
19
 
20
20
  resources :institutions, except: %i[show]
21
+ resources :licences, except: %i[show]
21
22
  end
22
23
  end
23
24
  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
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateSpinaPartsAdminJournalPageRanges < ActiveRecord::Migration[6.1] # :nodoc:
4
+ def change
5
+ create_table :spina_parts_admin_journal_page_ranges, &:timestamps
6
+ end
7
+ end
@@ -5,12 +5,18 @@ module Spina
5
5
  module Journal
6
6
  # Registers the plugin with Spina.
7
7
  class Engine < ::Rails::Engine
8
+ isolate_namespace Spina::Admin::Journal
9
+
8
10
  config.before_initialize do
9
11
  ::Spina::Plugin.register do |plugin|
10
12
  plugin.name = 'journal'
11
13
  plugin.namespace = 'journal'
12
14
  end
13
15
  end
16
+
17
+ config.after_initialize do
18
+ Spina::Part.register Spina::Parts::Admin::Journal::PageRange
19
+ end
14
20
  end
15
21
  end
16
22
  end
@@ -3,7 +3,7 @@
3
3
  module Spina
4
4
  module Admin
5
5
  module Journal
6
- VERSION = '0.4.1'
6
+ VERSION = '0.6.1'
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.4.1
4
+ version: 0.6.1
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-05-24 00:00:00.000000000 Z
11
+ date: 2021-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: babel-transpiler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.0'
61
+ version: 2.0.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.0'
68
+ version: 2.0.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: capybara
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -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,13 +291,16 @@ 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
296
+ - app/models/spina/parts/admin/journal/page_range.rb
294
297
  - app/validators/spina/admin/journal/uri_validator.rb
295
298
  - app/views/layouts/spina/admin/journal/articles.html.haml
296
299
  - app/views/layouts/spina/admin/journal/authors.html.haml
297
300
  - app/views/layouts/spina/admin/journal/institutions.html.haml
298
301
  - app/views/layouts/spina/admin/journal/issues.html.haml
299
302
  - app/views/layouts/spina/admin/journal/journals.html.haml
303
+ - app/views/layouts/spina/admin/journal/licences.html.haml
300
304
  - app/views/layouts/spina/admin/journal/volumes.html.haml
301
305
  - app/views/spina/admin/hooks/journal/_head.html.haml
302
306
  - app/views/spina/admin/hooks/journal/_primary_navigation.html.haml
@@ -337,6 +341,11 @@ files:
337
341
  - app/views/spina/admin/journal/journals/edit.html.haml
338
342
  - app/views/spina/admin/journal/journals/index.html.haml
339
343
  - app/views/spina/admin/journal/journals/new.html.haml
344
+ - app/views/spina/admin/journal/licences/_form.html.haml
345
+ - app/views/spina/admin/journal/licences/_licence.html.haml
346
+ - app/views/spina/admin/journal/licences/edit.html.haml
347
+ - app/views/spina/admin/journal/licences/index.html.haml
348
+ - app/views/spina/admin/journal/licences/new.html.haml
340
349
  - app/views/spina/admin/journal/volumes/_form.html.haml
341
350
  - app/views/spina/admin/journal/volumes/_form_details.html.haml
342
351
  - app/views/spina/admin/journal/volumes/_form_issues.html.haml
@@ -344,6 +353,7 @@ files:
344
353
  - app/views/spina/admin/journal/volumes/edit.html.haml
345
354
  - app/views/spina/admin/journal/volumes/index.html.haml
346
355
  - app/views/spina/admin/journal/volumes/new.html.haml
356
+ - app/views/spina/admin/parts/admin/journal/page_ranges/_form.html.haml
347
357
  - config/locales/en.yml
348
358
  - config/routes.rb
349
359
  - db/migrate/20201216152147_create_spina_admin_journal_journals.rb
@@ -360,6 +370,9 @@ files:
360
370
  - db/migrate/20210424123555_add_json_attributes_to_spina_admin_journal_articles.rb
361
371
  - db/migrate/20210512122931_add_position_to_spina_admin_journal_authorships.rb
362
372
  - db/migrate/20210521121318_add_status_to_spina_admin_journal_articles.rb
373
+ - db/migrate/20210618090155_create_spina_admin_journal_licences.rb
374
+ - db/migrate/20210618094533_add_licence_to_spina_admin_journal_articles.rb
375
+ - db/migrate/20210626153728_create_spina_parts_admin_journal_page_ranges.rb
363
376
  - lib/spina/admin/journal.rb
364
377
  - lib/spina/admin/journal/engine.rb
365
378
  - lib/spina/admin/journal/version.rb
@@ -384,7 +397,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
384
397
  - !ruby/object:Gem::Version
385
398
  version: '0'
386
399
  requirements: []
387
- rubygems_version: 3.1.4
400
+ rubygems_version: 3.1.6
388
401
  signing_key:
389
402
  specification_version: 4
390
403
  summary: Academic journal plugin for Spina.