mods_display 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +22 -43
- data/lib/mods_display/fields/geo.rb +1 -1
- data/lib/mods_display/fields/nested_related_item.rb +17 -3
- data/lib/mods_display/fields/related_item.rb +3 -3
- data/lib/mods_display/related_item_concerns.rb +2 -2
- data/lib/mods_display/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e2d497d858d90fede285e8d03675de0c39802897a8bd2a029a369e420704fc9
|
4
|
+
data.tar.gz: 89f053e8c0d2e8ad75325fd15319113cbada0c0023079e97f91dcdc65dd3efc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8900b21680099143212fcd369df69e5321a4ae8e85b1de1708408d5a97e4fd469d4cb5ea8489debf0cc516a44baadccdedabeacd6446bc5f6d95164289bb7501
|
7
|
+
data.tar.gz: e5a85a9ead273ff102873f55424e5499138b8260ac1c1d3cd0cb0c3e55cf431ed564be1a686c44ecc37d0a9181903b72f4a080f067df893748f093888e2af83e
|
data/.rubocop_todo.yml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2023-
|
3
|
+
# on 2023-12-06 18:14:53 UTC using RuboCop version 1.58.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 2
|
10
10
|
Capybara/SpecificMatcher:
|
11
11
|
Exclude:
|
12
12
|
- 'spec/helpers/record_helper_spec.rb'
|
@@ -22,15 +22,15 @@ Lint/ShadowingOuterLocalVariable:
|
|
22
22
|
Exclude:
|
23
23
|
- 'spec/helpers/record_helper_spec.rb'
|
24
24
|
|
25
|
-
# Offense count:
|
25
|
+
# Offense count: 15
|
26
26
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
27
27
|
Metrics/AbcSize:
|
28
|
-
Max:
|
28
|
+
Max: 42
|
29
29
|
|
30
|
-
# Offense count:
|
30
|
+
# Offense count: 2
|
31
31
|
# Configuration parameters: CountComments, CountAsOne.
|
32
32
|
Metrics/ClassLength:
|
33
|
-
Max:
|
33
|
+
Max: 132
|
34
34
|
|
35
35
|
# Offense count: 1
|
36
36
|
# Configuration parameters: LengthThreshold.
|
@@ -38,43 +38,22 @@ Metrics/CollectionLiteralLength:
|
|
38
38
|
Exclude:
|
39
39
|
- 'lib/mods_display/relator_codes.rb'
|
40
40
|
|
41
|
-
# Offense count:
|
41
|
+
# Offense count: 9
|
42
42
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
43
43
|
Metrics/CyclomaticComplexity:
|
44
|
-
Max:
|
44
|
+
Max: 12
|
45
45
|
|
46
|
-
# Offense count:
|
46
|
+
# Offense count: 18
|
47
47
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
48
48
|
Metrics/MethodLength:
|
49
|
-
Max:
|
49
|
+
Max: 24
|
50
50
|
|
51
|
-
# Offense count:
|
51
|
+
# Offense count: 7
|
52
52
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
53
53
|
Metrics/PerceivedComplexity:
|
54
|
-
Max:
|
55
|
-
|
56
|
-
# Offense count: 1
|
57
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
58
|
-
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
59
|
-
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
60
|
-
Naming/MemoizedInstanceVariableName:
|
61
|
-
Exclude:
|
62
|
-
- 'lib/mods_display/fields/geo.rb'
|
54
|
+
Max: 13
|
63
55
|
|
64
|
-
# Offense count:
|
65
|
-
# Configuration parameters: EnforcedStyle, AllowedPatterns.
|
66
|
-
# SupportedStyles: snake_case, camelCase
|
67
|
-
Naming/MethodName:
|
68
|
-
Exclude:
|
69
|
-
- 'lib/mods_display/fields/abstract.rb'
|
70
|
-
- 'lib/mods_display/fields/audience.rb'
|
71
|
-
- 'lib/mods_display/fields/contents.rb'
|
72
|
-
- 'lib/mods_display/fields/field.rb'
|
73
|
-
- 'lib/mods_display/fields/genre.rb'
|
74
|
-
- 'lib/mods_display/fields/resource_type.rb'
|
75
|
-
- 'lib/mods_display/fields/subject.rb'
|
76
|
-
|
77
|
-
# Offense count: 18
|
56
|
+
# Offense count: 17
|
78
57
|
RSpec/BeforeAfterAll:
|
79
58
|
Enabled: false
|
80
59
|
|
@@ -104,13 +83,13 @@ RSpec/ExpectActual:
|
|
104
83
|
- '**/spec/routing/**/*'
|
105
84
|
- 'spec/fields/name_spec.rb'
|
106
85
|
|
107
|
-
# Offense count:
|
86
|
+
# Offense count: 39
|
108
87
|
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
|
109
88
|
# Include: **/*_spec*rb*, **/spec/**/*
|
110
89
|
RSpec/FilePath:
|
111
90
|
Enabled: false
|
112
91
|
|
113
|
-
# Offense count:
|
92
|
+
# Offense count: 96
|
114
93
|
# Configuration parameters: AssignmentOnly.
|
115
94
|
RSpec/InstanceVariable:
|
116
95
|
Enabled: false
|
@@ -121,7 +100,7 @@ RSpec/IteratedExpectation:
|
|
121
100
|
- 'spec/helpers/record_helper_spec.rb'
|
122
101
|
- 'spec/integration/html_spec.rb'
|
123
102
|
|
124
|
-
# Offense count:
|
103
|
+
# Offense count: 4
|
125
104
|
# Configuration parameters: .
|
126
105
|
# SupportedStyles: have_received, receive
|
127
106
|
RSpec/MessageSpies:
|
@@ -132,7 +111,7 @@ RSpec/MessageSpies:
|
|
132
111
|
RSpec/MultipleMemoizedHelpers:
|
133
112
|
Max: 6
|
134
113
|
|
135
|
-
# Offense count:
|
114
|
+
# Offense count: 8
|
136
115
|
# Configuration parameters: AllowedGroups.
|
137
116
|
RSpec/NestedGroups:
|
138
117
|
Max: 4
|
@@ -144,19 +123,19 @@ RSpec/Rails/InferredSpecType:
|
|
144
123
|
Exclude:
|
145
124
|
- 'spec/helpers/record_helper_spec.rb'
|
146
125
|
|
147
|
-
# Offense count:
|
126
|
+
# Offense count: 39
|
148
127
|
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
|
149
128
|
# Include: **/*_spec.rb
|
150
129
|
RSpec/SpecFilePathFormat:
|
151
130
|
Enabled: false
|
152
131
|
|
153
|
-
# Offense count:
|
132
|
+
# Offense count: 3
|
154
133
|
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
155
134
|
RSpec/VerifiedDoubles:
|
156
135
|
Exclude:
|
157
136
|
- 'spec/helpers/record_helper_spec.rb'
|
158
137
|
|
159
|
-
# Offense count:
|
138
|
+
# Offense count: 50
|
160
139
|
# Configuration parameters: AllowedConstants.
|
161
140
|
Style/Documentation:
|
162
141
|
Enabled: false
|
@@ -174,12 +153,12 @@ Style/MultilineBlockChain:
|
|
174
153
|
Exclude:
|
175
154
|
- 'lib/mods_display/fields/imprint.rb'
|
176
155
|
|
177
|
-
# Offense count:
|
156
|
+
# Offense count: 13
|
178
157
|
Style/OpenStructUse:
|
179
158
|
Exclude:
|
180
159
|
- 'spec/helpers/record_helper_spec.rb'
|
181
160
|
|
182
|
-
# Offense count:
|
161
|
+
# Offense count: 46
|
183
162
|
# This cop supports safe autocorrection (--autocorrect).
|
184
163
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
185
164
|
# URISchemes: http, https
|
@@ -25,7 +25,7 @@ module ModsDisplay
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def geo_extensions
|
28
|
-
@
|
28
|
+
@geo_extensions ||= @stanford_mods_elements.select do |extension_element|
|
29
29
|
displayLabel(extension_element) =~ /^geo:?$/
|
30
30
|
end
|
31
31
|
end
|
@@ -8,14 +8,14 @@ module ModsDisplay
|
|
8
8
|
class NestedRelatedItem < Field
|
9
9
|
include ModsDisplay::RelatedItemConcerns
|
10
10
|
|
11
|
-
def initialize(
|
12
|
-
super(
|
11
|
+
def initialize(related_item_elements, value_renderer: ValueRenderer)
|
12
|
+
super(related_item_elements)
|
13
13
|
@value_renderer = value_renderer
|
14
14
|
end
|
15
15
|
|
16
16
|
def fields
|
17
17
|
@fields ||= begin
|
18
|
-
return_fields = RelatedItemValue.
|
18
|
+
return_fields = RelatedItemValue.for_stanford_mods_elements(@stanford_mods_elements).map do |related_item_element|
|
19
19
|
next if related_item_element.collection?
|
20
20
|
next unless render_nested_related_item?(related_item_element)
|
21
21
|
|
@@ -30,6 +30,20 @@ module ModsDisplay
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
# Used by exhibits
|
34
|
+
def to_html(view_context = ApplicationController.renderer)
|
35
|
+
helpers = view_context.respond_to?(:simple_format) ? view_context : ApplicationController.new.view_context
|
36
|
+
|
37
|
+
component = ModsDisplay::ListFieldComponent.with_collection(
|
38
|
+
fields,
|
39
|
+
value_transformer: ->(value) { helpers.format_mods_html(value.to_s) },
|
40
|
+
list_html_attributes: { class: 'mods_display_nested_related_items' },
|
41
|
+
list_item_html_attributes: { class: 'mods_display_nested_related_item open' }
|
42
|
+
)
|
43
|
+
|
44
|
+
view_context.render component, layout: false
|
45
|
+
end
|
46
|
+
|
33
47
|
# this class provides html markup and is subclassed in purl application
|
34
48
|
class ValueRenderer
|
35
49
|
def initialize(related_item_element)
|
@@ -4,13 +4,13 @@ module ModsDisplay
|
|
4
4
|
class RelatedItem < Field
|
5
5
|
include ModsDisplay::RelatedItemConcerns
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
super(
|
7
|
+
def initialize(related_item_elements, value_renderer: ValueRenderer)
|
8
|
+
super(related_item_elements)
|
9
9
|
@value_renderer = value_renderer
|
10
10
|
end
|
11
11
|
|
12
12
|
def fields
|
13
|
-
return_fields = RelatedItemValue.
|
13
|
+
return_fields = RelatedItemValue.for_stanford_mods_elements(@stanford_mods_elements).map do |related_item_element|
|
14
14
|
next if related_item_element.collection?
|
15
15
|
next if render_nested_related_item?(related_item_element)
|
16
16
|
|
@@ -56,8 +56,8 @@ module ModsDisplay
|
|
56
56
|
@type_attribute ||= get_attribute('type')
|
57
57
|
end
|
58
58
|
|
59
|
-
def self.
|
60
|
-
|
59
|
+
def self.for_stanford_mods_elements(stanford_mods_elements)
|
60
|
+
stanford_mods_elements.map { |element| new(element) }
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
data/lib/mods_display/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mods_display
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jessie Keck
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stanford-mods
|