spina-admin-journal 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/spina/admin/journal/articles_controller.rb +2 -1
- data/app/controllers/spina/admin/journal/authors_controller.rb +1 -0
- data/app/controllers/spina/admin/journal/issues_controller.rb +7 -1
- data/app/controllers/spina/admin/journal/journals_controller.rb +1 -1
- data/app/models/spina/parts/admin/journal/page_range.rb +31 -0
- data/app/views/spina/admin/journal/issues/_form_articles.html.haml +1 -1
- data/app/views/spina/admin/parts/admin/journal/page_ranges/_form.html.haml +6 -0
- data/db/migrate/20210626153728_create_spina_parts_admin_journal_page_ranges.rb +7 -0
- data/lib/spina/admin/journal/engine.rb +4 -0
- data/lib/spina/admin/journal/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c0a0d703a86719e315f9ea84b71b62a8ca32dff43d33ba9b012dc924f550b4e
|
4
|
+
data.tar.gz: c3c548eb605e39ecd8b2bfe56c6343e9187c8bb7c8747fc8c7169240d2e160ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff8186db67c005d436664f43492133268aa44b7af675076b2e16a40764920f5c9403f236964d57040aa9388b4b1540bca5e448fb63874c06cab8f644af687db4
|
7
|
+
data.tar.gz: f66bce803e4e7269991dc0199b32eb05e33b7c11ae555a7971105dfc1f1bcb24fdec3c6eb7b1571abb27d95317d5f3165656fedf4ae7e17a00b33786de472e2c
|
@@ -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,
|
@@ -20,7 +21,7 @@ module Spina
|
|
20
21
|
params.merge("#{locale}_content_attributes": [*PARTS_PARAMS])
|
21
22
|
end
|
22
23
|
PARAMS = [:issue_id, :licence_id, :title, :url, :doi, :status, { affiliation_ids: [], **CONTENT_PARAMS }].freeze
|
23
|
-
PARTS = %w[abstract attachment].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]
|
@@ -4,7 +4,8 @@ module Spina
|
|
4
4
|
module Admin
|
5
5
|
module Journal
|
6
6
|
# Controller for {Issue} records.
|
7
|
-
|
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],
|
@@ -25,6 +26,7 @@ module Spina
|
|
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,6 +94,10 @@ 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
102
|
params.require(:admin_journal_issue).permit(PARAMS)
|
97
103
|
end
|
@@ -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[journal_abbreviation logo description documents].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
|
@@ -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
|
@@ -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 @
|
14
|
+
= render @articles && @articles.any? ? @articles : 'empty_list', message: t('.no_articles')
|
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
|
+
version: 0.6.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-
|
11
|
+
date: 2021-09-07 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:
|
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:
|
68
|
+
version: 2.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: capybara
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -293,6 +293,7 @@ files:
|
|
293
293
|
- app/models/spina/admin/journal/journal.rb
|
294
294
|
- app/models/spina/admin/journal/licence.rb
|
295
295
|
- app/models/spina/admin/journal/volume.rb
|
296
|
+
- app/models/spina/parts/admin/journal/page_range.rb
|
296
297
|
- app/validators/spina/admin/journal/uri_validator.rb
|
297
298
|
- app/views/layouts/spina/admin/journal/articles.html.haml
|
298
299
|
- app/views/layouts/spina/admin/journal/authors.html.haml
|
@@ -352,6 +353,7 @@ files:
|
|
352
353
|
- app/views/spina/admin/journal/volumes/edit.html.haml
|
353
354
|
- app/views/spina/admin/journal/volumes/index.html.haml
|
354
355
|
- app/views/spina/admin/journal/volumes/new.html.haml
|
356
|
+
- app/views/spina/admin/parts/admin/journal/page_ranges/_form.html.haml
|
355
357
|
- config/locales/en.yml
|
356
358
|
- config/routes.rb
|
357
359
|
- db/migrate/20201216152147_create_spina_admin_journal_journals.rb
|
@@ -370,6 +372,7 @@ files:
|
|
370
372
|
- db/migrate/20210521121318_add_status_to_spina_admin_journal_articles.rb
|
371
373
|
- db/migrate/20210618090155_create_spina_admin_journal_licences.rb
|
372
374
|
- db/migrate/20210618094533_add_licence_to_spina_admin_journal_articles.rb
|
375
|
+
- db/migrate/20210626153728_create_spina_parts_admin_journal_page_ranges.rb
|
373
376
|
- lib/spina/admin/journal.rb
|
374
377
|
- lib/spina/admin/journal/engine.rb
|
375
378
|
- lib/spina/admin/journal/version.rb
|