spina-admin-journal 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spina/admin/journal/articles_controller.rb +1 -1
- data/app/models/spina/admin/journal/article.rb +13 -1
- data/app/views/spina/admin/journal/articles/_form_details.html.haml +5 -0
- data/db/migrate/20210521121318_add_status_to_spina_admin_journal_articles.rb +7 -0
- data/lib/spina/admin/journal/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9558f4aae0173062e342e21d8bc44566933b1d2f60968a1466eb7612bc28250c
|
4
|
+
data.tar.gz: 067acad98f36c578ecb367bb8a7179deebb4d0aaad61ebdf82baefb6887f8668
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f67811ae559061d1cdf6120a043f8c3a926c4744950c6db727cd97a3650e03bc4f6bb041e3d527d555e6eb13f7910d38793cb9682997154c1675ed73c858b3f2
|
7
|
+
data.tar.gz: 5a60f2a5637a28a7f7ee5ffe6a7413db3deee3a27160ab839479736d677afa00b88cd1ae052827fd613e459e742858d1ba6356eb6c5d814f1d720820ca547842
|
@@ -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, :title, :url, :doi, :status, { affiliation_ids: [], **CONTENT_PARAMS }].freeze
|
23
23
|
PARTS = %w[abstract attachment].freeze
|
24
24
|
|
25
25
|
before_action :set_breadcrumb
|
@@ -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
|
@@ -40,12 +41,23 @@ module Spina
|
|
40
41
|
# @return [ActiveRecord::Relation] The authors of the article.
|
41
42
|
has_many :affiliations, through: :authorships
|
42
43
|
|
44
|
+
# @!attribute [rw] status
|
45
|
+
# @return [Integer] th currnt status of the article
|
46
|
+
enum status: { published: 0, draft: 1 }
|
47
|
+
|
43
48
|
validates :number, presence: true, uniqueness: { scope: :issue_id }
|
44
49
|
validates :title, presence: true
|
45
50
|
validates :url, 'spina/admin/journal/uri': true
|
51
|
+
validates :status, presence: true
|
46
52
|
|
53
|
+
scope :visible, -> { where(status: :published) }
|
47
54
|
scope :sorted_asc, -> { includes(:issue).order('spina_admin_journal_issues.number ASC', number: :asc) }
|
48
55
|
scope :sorted_desc, -> { includes(:issue).order('spina_admin_journal_issues.number DESC', number: :desc) }
|
56
|
+
|
57
|
+
# Returns true if the article should be visible to end users (i.e. is not a draft).
|
58
|
+
def visible?
|
59
|
+
published?
|
60
|
+
end
|
49
61
|
end
|
50
62
|
end
|
51
63
|
end
|
@@ -15,6 +15,11 @@
|
|
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] }
|
18
23
|
.page-form-group
|
19
24
|
.page-form-label
|
20
25
|
= ::Spina::Admin::Journal::Author.model_name.human count: :many
|
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.4.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-05-
|
11
|
+
date: 2021-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: babel-transpiler
|
@@ -359,6 +359,7 @@ files:
|
|
359
359
|
- db/migrate/20210424123521_add_json_attributes_to_spina_admin_journal_issues.rb
|
360
360
|
- db/migrate/20210424123555_add_json_attributes_to_spina_admin_journal_articles.rb
|
361
361
|
- db/migrate/20210512122931_add_position_to_spina_admin_journal_authorships.rb
|
362
|
+
- db/migrate/20210521121318_add_status_to_spina_admin_journal_articles.rb
|
362
363
|
- lib/spina/admin/journal.rb
|
363
364
|
- lib/spina/admin/journal/engine.rb
|
364
365
|
- lib/spina/admin/journal/version.rb
|