mods_display 0.10.1 → 1.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -1
  3. data/.rubocop_todo.yml +433 -35
  4. data/README.md +0 -95
  5. data/app/components/mods_display/field_component.html.erb +13 -0
  6. data/app/components/mods_display/field_component.rb +27 -0
  7. data/app/components/mods_display/list_field_component.html.erb +11 -0
  8. data/app/components/mods_display/list_field_component.rb +10 -0
  9. data/app/components/mods_display/record_component.html.erb +5 -0
  10. data/app/components/mods_display/record_component.rb +39 -0
  11. data/app/helpers/mods_display/record_helper.rb +106 -0
  12. data/app/models/mods_display/record.rb +26 -0
  13. data/config/locales/en.yml +1 -1
  14. data/config.ru +9 -0
  15. data/lib/mods_display/engine.rb +13 -0
  16. data/lib/mods_display/fields/access_condition.rb +4 -0
  17. data/lib/mods_display/fields/contents.rb +14 -15
  18. data/lib/mods_display/fields/field.rb +13 -149
  19. data/lib/mods_display/fields/genre.rb +4 -0
  20. data/lib/mods_display/fields/imprint.rb +52 -3
  21. data/lib/mods_display/fields/name.rb +11 -20
  22. data/lib/mods_display/fields/nested_related_item.rb +7 -18
  23. data/lib/mods_display/fields/note.rb +4 -0
  24. data/lib/mods_display/fields/related_item.rb +4 -0
  25. data/lib/mods_display/fields/sub_title.rb +3 -3
  26. data/lib/mods_display/fields/subject.rb +13 -39
  27. data/lib/mods_display/fields/title.rb +4 -0
  28. data/lib/mods_display/fields/values.rb +4 -4
  29. data/lib/mods_display/html.rb +54 -107
  30. data/lib/mods_display/version.rb +1 -1
  31. data/lib/mods_display.rb +2 -23
  32. data/mods_display.gemspec +15 -9
  33. metadata +45 -105
  34. data/.github/workflows/ruby.yml +0 -24
  35. data/.gitignore +0 -21
  36. data/lib/mods_display/configuration/access_condition.rb +0 -21
  37. data/lib/mods_display/configuration/base.rb +0 -34
  38. data/lib/mods_display/configuration/genre.rb +0 -9
  39. data/lib/mods_display/configuration/imprint.rb +0 -13
  40. data/lib/mods_display/configuration/name.rb +0 -9
  41. data/lib/mods_display/configuration/note.rb +0 -9
  42. data/lib/mods_display/configuration/related_item.rb +0 -9
  43. data/lib/mods_display/configuration/subject.rb +0 -13
  44. data/lib/mods_display/configuration/title.rb +0 -9
  45. data/lib/mods_display/configuration.rb +0 -93
  46. data/lib/mods_display/controller_extension.rb +0 -32
  47. data/lib/mods_display/helpers/record_helper.rb +0 -131
  48. data/lib/mods_display/model_extension.rb +0 -22
  49. data/lib/mods_display/railtie.rb +0 -10
  50. data/spec/configuration/access_condition_spec.rb +0 -10
  51. data/spec/configuration/base_spec.rb +0 -39
  52. data/spec/fake_app.rb +0 -18
  53. data/spec/fields/abstract_spec.rb +0 -39
  54. data/spec/fields/access_condition_spec.rb +0 -107
  55. data/spec/fields/audience_spec.rb +0 -24
  56. data/spec/fields/cartographics_spec.rb +0 -38
  57. data/spec/fields/collection_spec.rb +0 -77
  58. data/spec/fields/contact_spec.rb +0 -23
  59. data/spec/fields/contents_spec.rb +0 -39
  60. data/spec/fields/description_spec.rb +0 -55
  61. data/spec/fields/extent_spec.rb +0 -31
  62. data/spec/fields/form_spec.rb +0 -49
  63. data/spec/fields/genre_spec.rb +0 -34
  64. data/spec/fields/geo_spec.rb +0 -40
  65. data/spec/fields/identifier_spec.rb +0 -61
  66. data/spec/fields/imprint_spec.rb +0 -289
  67. data/spec/fields/language_spec.rb +0 -51
  68. data/spec/fields/location_spec.rb +0 -81
  69. data/spec/fields/name_spec.rb +0 -166
  70. data/spec/fields/nested_related_item_spec.rb +0 -89
  71. data/spec/fields/note_spec.rb +0 -72
  72. data/spec/fields/related_item_spec.rb +0 -72
  73. data/spec/fields/resource_type_spec.rb +0 -34
  74. data/spec/fields/sub_title_spec.rb +0 -20
  75. data/spec/fields/subject_spec.rb +0 -113
  76. data/spec/fields/title_spec.rb +0 -82
  77. data/spec/fixtures/access_condition_fixtures.rb +0 -58
  78. data/spec/fixtures/cartographics_fixtures.rb +0 -52
  79. data/spec/fixtures/imprint_fixtures.rb +0 -349
  80. data/spec/fixtures/name_fixtures.rb +0 -398
  81. data/spec/fixtures/nested_realted_items_fixtures.rb +0 -64
  82. data/spec/fixtures/related_item_fixtures.rb +0 -107
  83. data/spec/fixtures/subjects_fixtures.rb +0 -115
  84. data/spec/fixtures/title_fixtures.rb +0 -115
  85. data/spec/helpers/record_helper_spec.rb +0 -241
  86. data/spec/integration/configuration_spec.rb +0 -57
  87. data/spec/integration/html_spec.rb +0 -87
  88. data/spec/integration/installation_spec.rb +0 -26
  89. data/spec/spec_helper.rb +0 -46
  90. data/spec/test_fr.yml +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a054cc690de903702f63e057298f6c8af87c1bc7baf4d1a84626ccdf7dafd866
4
- data.tar.gz: 5b817d141a6c40af29e0ebc04240e9b8b3d2230b601a09ff8328bfa061889010
3
+ metadata.gz: 29d0b62ee677df5874f71c15c9da893a400992064ff2636bce46c9b1b2058e75
4
+ data.tar.gz: e90d7f860b9be00ffdd3c3570b8846d73eccdd7d176a6af76fa5a3dc597fa07a
5
5
  SHA512:
6
- metadata.gz: a5d6c3dc3b45b6a0b1f683aa5f5a63553789b518effadc46e79b63f23d8d6aef8249a06a660311bd5a0d560e741abd8f61c745072b5ef7b1c889e1452b02b768
7
- data.tar.gz: 8dbe33bda66156f40532863328af008f232c25e1ed56bafa0e98881b2da2b2f9056cdbeaa1cc228a9f15c0f719b34e295a48c0d931a355690a5d3bb889632984
6
+ metadata.gz: 0756633e1fd4a7be5246939e60b3c080933fd1308faf9b70c85f8d1c590557209eaef4c84157a7e0352f287bcd8b4f1729f67cd0ed399bac91c0a05f5c736bd8
7
+ data.tar.gz: 4df2f37443d07c938b09323db91a23878a4aec9704a71fc02092dba89c78e9921f1e1b1c68c5da058d88a0445f0ace30ecb08474c46db5fd935566929727ba7b
data/.rubocop.yml CHANGED
@@ -7,8 +7,9 @@ AllCops:
7
7
  - 'db/**/*'
8
8
  - 'spec/fixtures/**/*'
9
9
  - 'vendor/**/*'
10
+ TargetRubyVersion: 2.7
10
11
 
11
- Metrics/LineLength:
12
+ Layout/LineLength:
12
13
  Max: 120
13
14
 
14
15
  Style/StringLiterals:
data/.rubocop_todo.yml CHANGED
@@ -1,111 +1,502 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-02-17 16:15:37 -0800 using RuboCop version 0.37.2.
3
+ # on 2022-01-06 19:25:06 UTC using RuboCop version 1.24.1.
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: 5
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
12
+ # SupportedStyles: case, end
13
+ Layout/CaseIndentation:
14
+ Exclude:
15
+ - 'lib/mods_display/fields/title.rb'
16
+
17
+ # Offense count: 43
18
+ # Cop supports --auto-correct.
19
+ Layout/EmptyLineAfterGuardClause:
20
+ Enabled: false
21
+
22
+ # Offense count: 3
23
+ # Cop supports --auto-correct.
24
+ Layout/EmptyLineAfterMagicComment:
25
+ Exclude:
26
+ - 'lib/mods_display/country_codes.rb'
27
+ - 'lib/mods_display/fields/field.rb'
28
+ - 'spec/integration/html_spec.rb'
29
+
30
+ # Offense count: 1
31
+ # Cop supports --auto-correct.
32
+ # Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
33
+ Layout/EmptyLineBetweenDefs:
34
+ Exclude:
35
+ - 'spec/fake_app.rb'
36
+
37
+ # Offense count: 2
38
+ # Cop supports --auto-correct.
39
+ # Configuration parameters: AllowAliasSyntax, AllowedMethods.
40
+ # AllowedMethods: alias_method, public, protected, private
41
+ Layout/EmptyLinesAroundAttributeAccessor:
42
+ Exclude:
43
+ - 'lib/mods_display/fields/name.rb'
44
+ - 'spec/spec_helper.rb'
45
+
46
+ # Offense count: 1
47
+ # Cop supports --auto-correct.
48
+ # Configuration parameters: EnforcedStyle.
49
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
50
+ Layout/EmptyLinesAroundModuleBody:
51
+ Exclude:
52
+ - 'app/helpers/mods_display/record_helper.rb'
53
+
54
+ # Offense count: 1
55
+ # Cop supports --auto-correct.
56
+ # Configuration parameters: EnforcedStyleAlignWith, Severity.
57
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
58
+ Layout/EndAlignment:
59
+ Exclude:
60
+ - 'lib/mods_display/fields/title.rb'
61
+
62
+ # Offense count: 1
63
+ # Cop supports --auto-correct.
64
+ # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
65
+ Layout/ExtraSpacing:
66
+ Exclude:
67
+ - 'lib/mods_display/fields/name.rb'
68
+
69
+ # Offense count: 1
70
+ # Cop supports --auto-correct.
71
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
72
+ # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
73
+ Layout/FirstArgumentIndentation:
74
+ Exclude:
75
+ - 'spec/fields/contents_spec.rb'
76
+
77
+ # Offense count: 28
78
+ # Cop supports --auto-correct.
79
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
80
+ # SupportedHashRocketStyles: key, separator, table
81
+ # SupportedColonStyles: key, separator, table
82
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
83
+ Layout/HashAlignment:
84
+ Exclude:
85
+ - 'lib/mods_display/fields/access_condition.rb'
86
+ - 'lib/mods_display/fields/identifier.rb'
87
+ - 'lib/mods_display/fields/note.rb'
88
+ - 'lib/mods_display/fields/title.rb'
89
+
90
+ # Offense count: 1
91
+ # Cop supports --auto-correct.
92
+ # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
93
+ Layout/LeadingCommentSpace:
94
+ Exclude:
95
+ - 'lib/mods_display.rb'
96
+
97
+ # Offense count: 9
98
+ # Cop supports --auto-correct.
99
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
100
+ # URISchemes: http, https
101
+ Layout/LineLength:
102
+ Max: 255
103
+
104
+ # Offense count: 1
105
+ # Cop supports --auto-correct.
106
+ # Configuration parameters: EnforcedStyle.
107
+ # SupportedStyles: symmetrical, new_line, same_line
108
+ Layout/MultilineArrayBraceLayout:
109
+ Exclude:
110
+ - 'lib/mods_display/html.rb'
111
+
112
+ # Offense count: 5
113
+ # Cop supports --auto-correct.
114
+ # Configuration parameters: EnforcedStyle.
115
+ # SupportedStyles: symmetrical, new_line, same_line
116
+ Layout/MultilineHashBraceLayout:
117
+ Exclude:
118
+ - 'lib/mods_display/fields/access_condition.rb'
119
+ - 'lib/mods_display/fields/description.rb'
120
+ - 'lib/mods_display/fields/imprint.rb'
121
+ - 'lib/mods_display/fields/note.rb'
122
+ - 'lib/mods_display/html.rb'
123
+
124
+ # Offense count: 3
125
+ # Cop supports --auto-correct.
126
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
127
+ # SupportedStyles: aligned, indented
128
+ Layout/MultilineOperationIndentation:
129
+ Exclude:
130
+ - 'lib/mods_display/fields/name.rb'
131
+ - 'lib/mods_display/related_item_concerns.rb'
132
+
133
+ # Offense count: 1
134
+ # Cop supports --auto-correct.
135
+ # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
136
+ # SupportedStylesForExponentOperator: space, no_space
137
+ Layout/SpaceAroundOperators:
138
+ Exclude:
139
+ - 'lib/mods_display/fields/name.rb'
140
+
141
+ # Offense count: 1
142
+ # Cop supports --auto-correct.
143
+ # Configuration parameters: EnforcedStyle.
144
+ # SupportedStyles: final_newline, final_blank_line
145
+ Layout/TrailingEmptyLines:
146
+ Exclude:
147
+ - 'Gemfile'
148
+
149
+ # Offense count: 15
150
+ # Cop supports --auto-correct.
151
+ Lint/AmbiguousRegexpLiteral:
152
+ Exclude:
153
+ - 'spec/helpers/record_helper_spec.rb'
154
+
155
+ # Offense count: 1
156
+ Lint/MissingSuper:
157
+ Exclude:
158
+ - 'app/components/mods_display/field_component.rb'
159
+
9
160
  # Offense count: 1
161
+ # Cop supports --auto-correct.
162
+ Lint/NonDeterministicRequireOrder:
163
+ Exclude:
164
+ - 'spec/spec_helper.rb'
165
+
166
+ # Offense count: 2
167
+ # Cop supports --auto-correct.
168
+ Lint/SendWithMixinArgument:
169
+ Exclude:
170
+ - 'lib/mods_display.rb'
171
+ - 'lib/mods_display/railtie.rb'
172
+
173
+ # Offense count: 1
174
+ Lint/ShadowingOuterLocalVariable:
175
+ Exclude:
176
+ - 'spec/helpers/record_helper_spec.rb'
177
+
178
+ # Offense count: 3
179
+ # Cop supports --auto-correct.
180
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
181
+ Lint/UnusedMethodArgument:
182
+ Exclude:
183
+ - 'app/components/mods_display/field_component.rb'
184
+ - 'app/helpers/mods_display/record_helper.rb'
185
+
186
+ # Offense count: 1
187
+ # Cop supports --auto-correct.
188
+ # Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
10
189
  Lint/UselessAccessModifier:
11
190
  Exclude:
12
191
  - 'lib/mods_display/controller_extension.rb'
13
192
 
14
- # Offense count: 28
193
+ # Offense count: 26
194
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
15
195
  Metrics/AbcSize:
16
- Max: 55
196
+ Max: 48
17
197
 
18
- # Offense count: 5
19
- # Configuration parameters: CountComments.
198
+ # Offense count: 40
199
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
200
+ # IgnoredMethods: refine
201
+ Metrics/BlockLength:
202
+ Max: 261
203
+
204
+ # Offense count: 6
205
+ # Configuration parameters: CountComments, CountAsOne.
20
206
  Metrics/ClassLength:
21
- Max: 263
207
+ Max: 277
22
208
 
23
- # Offense count: 11
209
+ # Offense count: 15
210
+ # Configuration parameters: IgnoredMethods.
24
211
  Metrics/CyclomaticComplexity:
25
- Max: 11
212
+ Max: 14
26
213
 
27
- # Offense count: 29
28
- # Configuration parameters: CountComments.
214
+ # Offense count: 31
215
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
29
216
  Metrics/MethodLength:
30
217
  Max: 378
31
218
 
32
219
  # Offense count: 2
33
- # Configuration parameters: CountComments.
220
+ # Configuration parameters: CountComments, CountAsOne.
34
221
  Metrics/ModuleLength:
35
222
  Max: 380
36
223
 
37
- # Offense count: 11
224
+ # Offense count: 14
225
+ # Configuration parameters: IgnoredMethods.
38
226
  Metrics/PerceivedComplexity:
39
- Max: 15
227
+ Max: 16
40
228
 
41
229
  # Offense count: 3
230
+ # Configuration parameters: EnforcedStyleForLeadingUnderscores.
231
+ # SupportedStylesForLeadingUnderscores: disallowed, required, optional
232
+ Naming/MemoizedInstanceVariableName:
233
+ Exclude:
234
+ - 'app/models/mods_display/model.rb'
235
+ - 'lib/mods_display/configuration.rb'
236
+ - 'lib/mods_display/fields/geo.rb'
237
+
238
+ # Offense count: 8
239
+ # Configuration parameters: EnforcedStyle, IgnoredPatterns.
240
+ # SupportedStyles: snake_case, camelCase
241
+ Naming/MethodName:
242
+ Exclude:
243
+ - 'lib/mods_display/fields/abstract.rb'
244
+ - 'lib/mods_display/fields/audience.rb'
245
+ - 'lib/mods_display/fields/contents.rb'
246
+ - 'lib/mods_display/fields/field.rb'
247
+ - 'lib/mods_display/fields/genre.rb'
248
+ - 'lib/mods_display/fields/resource_type.rb'
249
+ - 'lib/mods_display/fields/subject.rb'
250
+
251
+ # Offense count: 2
42
252
  # Cop supports --auto-correct.
43
- Performance/Casecmp:
253
+ Style/CaseLikeIf:
44
254
  Exclude:
45
- - 'lib/mods_display/fields/contact.rb'
46
255
  - 'lib/mods_display/fields/field.rb'
47
- - 'lib/mods_display/fields/note.rb'
256
+ - 'lib/mods_display/fields/imprint.rb'
48
257
 
49
- # Offense count: 4
258
+ # Offense count: 6
50
259
  # Cop supports --auto-correct.
51
- # Configuration parameters: SingleLineConditionsOnly.
260
+ # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
261
+ # SupportedStyles: assign_to_condition, assign_inside_condition
52
262
  Style/ConditionalAssignment:
53
263
  Exclude:
54
264
  - 'lib/mods_display/fields/field.rb'
55
265
  - 'lib/mods_display/fields/subject.rb'
56
266
 
57
- # Offense count: 42
267
+ # Offense count: 47
268
+ # Configuration parameters: AllowedConstants.
58
269
  Style/Documentation:
59
270
  Enabled: false
60
271
 
272
+ # Offense count: 3
273
+ # Cop supports --auto-correct.
274
+ Style/EmptyCaseCondition:
275
+ Exclude:
276
+ - 'lib/mods_display/fields/field.rb'
277
+ - 'lib/mods_display/fields/related_item.rb'
278
+ - 'lib/mods_display/fields/title.rb'
279
+
280
+ # Offense count: 3
281
+ # Cop supports --auto-correct.
282
+ Style/Encoding:
283
+ Exclude:
284
+ - 'lib/mods_display/country_codes.rb'
285
+ - 'lib/mods_display/fields/field.rb'
286
+ - 'spec/integration/html_spec.rb'
287
+
288
+ # Offense count: 3
289
+ # Cop supports --auto-correct.
290
+ Style/ExpandPathArguments:
291
+ Exclude:
292
+ - 'lib/mods_display.rb'
293
+ - 'spec/spec_helper.rb'
294
+
295
+ # Offense count: 78
296
+ # Cop supports --auto-correct.
297
+ # Configuration parameters: EnforcedStyle.
298
+ # SupportedStyles: always, always_true, never
299
+ Style/FrozenStringLiteralComment:
300
+ Enabled: false
301
+
61
302
  # Offense count: 1
62
303
  # Configuration parameters: MinBodyLength.
63
304
  Style/GuardClause:
64
305
  Exclude:
65
306
  - 'lib/mods_display/fields/related_item.rb'
66
307
 
308
+ # Offense count: 2
309
+ # Cop supports --auto-correct.
310
+ # Configuration parameters: AllowedReceivers.
311
+ Style/HashEachMethods:
312
+ Exclude:
313
+ - 'lib/mods_display/fields/subject.rb'
314
+ - 'spec/fields/name_spec.rb'
315
+
67
316
  # Offense count: 1
317
+ # Cop supports --auto-correct.
318
+ # Configuration parameters: AllowIfModifier.
68
319
  Style/IfInsideElse:
69
320
  Exclude:
70
321
  - 'lib/mods_display/fields/subject.rb'
71
322
 
72
- # Offense count: 8
73
- # Configuration parameters: EnforcedStyle, SupportedStyles.
74
- # SupportedStyles: snake_case, camelCase
75
- Style/MethodName:
76
- Enabled: false
323
+ # Offense count: 7
324
+ # Cop supports --auto-correct.
325
+ Style/IfUnlessModifier:
326
+ Exclude:
327
+ - 'app/helpers/mods_display/record_helper.rb'
328
+ - 'lib/mods_display.rb'
329
+ - 'lib/mods_display/controller_extension.rb'
330
+ - 'lib/mods_display/fields/imprint.rb'
331
+ - 'lib/mods_display/fields/name.rb'
332
+ - 'lib/mods_display/fields/subject.rb'
333
+ - 'lib/mods_display/html.rb'
334
+
335
+ # Offense count: 3
336
+ # Cop supports --auto-correct.
337
+ # Configuration parameters: InverseMethods, InverseBlocks.
338
+ Style/InverseMethods:
339
+ Exclude:
340
+ - 'lib/mods_display/fields/imprint.rb'
341
+ - 'lib/mods_display/fields/subject.rb'
342
+
343
+ # Offense count: 1
344
+ Style/MissingRespondToMissing:
345
+ Exclude:
346
+ - 'lib/mods_display/html.rb'
347
+
348
+ # Offense count: 4
349
+ Style/MixinUsage:
350
+ Exclude:
351
+ - 'spec/fields/cartographics_spec.rb'
352
+ - 'spec/fields/imprint_spec.rb'
353
+ - 'spec/fields/name_spec.rb'
354
+ - 'spec/fields/subject_spec.rb'
77
355
 
78
356
  # Offense count: 1
79
357
  Style/MultilineBlockChain:
80
358
  Exclude:
81
359
  - 'lib/mods_display/fields/imprint.rb'
82
360
 
83
- # Offense count: 1
361
+ # Offense count: 2
84
362
  # Cop supports --auto-correct.
85
- # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
86
- # SupportedStyles: aligned, indented
87
- Style/MultilineOperationIndentation:
88
- Enabled: false
363
+ Style/MultilineIfModifier:
364
+ Exclude:
365
+ - 'lib/mods_display/fields/imprint.rb'
366
+ - 'lib/mods_display/fields/name.rb'
89
367
 
90
368
  # Offense count: 1
91
369
  # Cop supports --auto-correct.
370
+ # Configuration parameters: EnforcedStyle.
371
+ # SupportedStyles: literals, strict
92
372
  Style/MutableConstant:
93
373
  Exclude:
94
374
  - 'lib/mods_display/version.rb'
95
375
 
376
+ # Offense count: 10
377
+ # Cop supports --auto-correct.
378
+ # Configuration parameters: EnforcedStyle, IgnoredMethods.
379
+ # SupportedStyles: predicate, comparison
380
+ Style/NumericPredicate:
381
+ Exclude:
382
+ - 'spec/**/*'
383
+ - 'lib/mods_display/fields/cartographics.rb'
384
+ - 'lib/mods_display/fields/collection.rb'
385
+ - 'lib/mods_display/fields/imprint.rb'
386
+ - 'lib/mods_display/fields/name.rb'
387
+ - 'lib/mods_display/fields/related_item.rb'
388
+
389
+ # Offense count: 1
390
+ # Configuration parameters: AllowedMethods.
391
+ # AllowedMethods: respond_to_missing?
392
+ Style/OptionalBooleanParameter:
393
+ Exclude:
394
+ - 'lib/mods_display/configuration/subject.rb'
395
+
396
+ # Offense count: 1
397
+ # Cop supports --auto-correct.
398
+ # Configuration parameters: AllowSafeAssignment, AllowInMultilineConditions.
399
+ Style/ParenthesesAroundCondition:
400
+ Exclude:
401
+ - 'lib/mods_display/html.rb'
402
+
403
+ # Offense count: 11
404
+ # Cop supports --auto-correct.
405
+ # Configuration parameters: PreferredDelimiters.
406
+ Style/PercentLiteralDelimiters:
407
+ Exclude:
408
+ - 'lib/mods_display/fields/imprint.rb'
409
+ - 'lib/mods_display/fields/name.rb'
410
+ - 'spec/fields/identifier_spec.rb'
411
+ - 'spec/fields/language_spec.rb'
412
+ - 'spec/helpers/record_helper_spec.rb'
413
+
414
+ # Offense count: 1
415
+ # Cop supports --auto-correct.
416
+ Style/RedundantParentheses:
417
+ Exclude:
418
+ - 'lib/mods_display/html.rb'
419
+
420
+ # Offense count: 5
421
+ # Cop supports --auto-correct.
422
+ Style/RedundantRegexpEscape:
423
+ Exclude:
424
+ - 'lib/mods_display/fields/field.rb'
425
+ - 'spec/helpers/record_helper_spec.rb'
426
+
427
+ # Offense count: 1
428
+ # Cop supports --auto-correct.
429
+ # Configuration parameters: AllowMultipleReturnValues.
430
+ Style/RedundantReturn:
431
+ Exclude:
432
+ - 'lib/mods_display/fields/related_item.rb'
433
+
96
434
  # Offense count: 1
97
435
  # Cop supports --auto-correct.
98
436
  Style/RedundantSelf:
99
437
  Exclude:
100
438
  - 'lib/mods_display/fields/subject.rb'
101
439
 
102
- # Offense count: 8
103
- # Configuration parameters: EnforcedStyle, SupportedStyles.
104
- # SupportedStyles: snake_case, camelCase
105
- Style/VariableName:
106
- Enabled: false
440
+ # Offense count: 12
441
+ # Cop supports --auto-correct.
442
+ # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
443
+ # SupportedStyles: slashes, percent_r, mixed
444
+ Style/RegexpLiteral:
445
+ Exclude:
446
+ - 'spec/helpers/record_helper_spec.rb'
447
+
448
+ # Offense count: 3
449
+ # Cop supports --auto-correct.
450
+ # Configuration parameters: EnforcedStyle.
451
+ # SupportedStyles: implicit, explicit
452
+ Style/RescueStandardError:
453
+ Exclude:
454
+ - 'lib/mods_display/fields/imprint.rb'
455
+ - 'lib/mods_display/html.rb'
456
+
457
+ # Offense count: 7
458
+ # Cop supports --auto-correct.
459
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
460
+ # AllowedMethods: present?, blank?, presence, try, try!
461
+ Style/SafeNavigation:
462
+ Exclude:
463
+ - 'lib/mods_display/fields/field.rb'
464
+ - 'lib/mods_display/fields/imprint.rb'
465
+ - 'lib/mods_display/fields/subject.rb'
466
+ - 'lib/mods_display/fields/title.rb'
467
+
468
+ # Offense count: 1
469
+ # Cop supports --auto-correct.
470
+ # Configuration parameters: Mode.
471
+ Style/StringConcatenation:
472
+ Exclude:
473
+ - 'lib/mods_display/fields/name.rb'
107
474
 
108
- # Offense count: 13
475
+ # Offense count: 1
476
+ # Cop supports --auto-correct.
477
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
478
+ # SupportedStyles: single_quotes, double_quotes
479
+ Style/StringLiterals:
480
+ Exclude:
481
+ - 'spec/fields/name_spec.rb'
482
+
483
+ # Offense count: 6
484
+ # Cop supports --auto-correct.
485
+ # Configuration parameters: MinSize.
486
+ # SupportedStyles: percent, brackets
487
+ Style/SymbolArray:
488
+ EnforcedStyle: brackets
489
+
490
+ # Offense count: 1
491
+ # Cop supports --auto-correct.
492
+ # Configuration parameters: EnforcedStyle, MinSize, WordRegex.
493
+ # SupportedStyles: percent, brackets
494
+ Style/WordArray:
495
+ Exclude:
496
+ - 'spec/fields/name_spec.rb'
497
+
498
+ # Offense count: 11
499
+ # Cop supports --auto-correct.
109
500
  Style/ZeroLengthPredicate:
110
501
  Exclude:
111
502
  - 'lib/mods_display/fields/cartographics.rb'
@@ -113,3 +504,10 @@ Style/ZeroLengthPredicate:
113
504
  - 'lib/mods_display/fields/imprint.rb'
114
505
  - 'lib/mods_display/fields/name.rb'
115
506
  - 'lib/mods_display/fields/related_item.rb'
507
+
508
+ # Offense count: 9
509
+ # Cop supports --auto-correct.
510
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
511
+ # URISchemes: http, https
512
+ Layout/LineLength:
513
+ Max: 255
data/README.md CHANGED
@@ -54,101 +54,6 @@ Optionally configure the mods display gem (more on configuration later).
54
54
  end
55
55
  end
56
56
 
57
- ## Configuration
58
-
59
- In the class that you include the `ModsDisplay::ControllerExtension` you can configure various behavior for different fields. The configuration options provided by `ModsDisplay::Configuration::Base` are:
60
-
61
- * label_class
62
- * value_class
63
- * ignore!
64
- * delimiter
65
- * link
66
-
67
- ### Label and Value classes
68
-
69
- Both label_ and value_class accept strings to put in as a class.
70
-
71
- class MyController
72
- include ModsDisplay::ControllerExtension
73
-
74
- configure_mods_display do
75
- title do
76
- label_class "title-label"
77
- value_class "title-value"
78
- end
79
- end
80
- end
81
-
82
- ### Ignore!
83
-
84
- In certain cases an application may need to explicitly remove a portion of the MODS metadata from the display (Contact being a prime example). You can accomplish this by using the ignore! option.
85
-
86
- class MyController
87
- include ModsDisplay::ControllerExtension
88
-
89
- configure_mods_display do
90
- contact do
91
- ignore!
92
- end
93
- end
94
- end
95
-
96
- ### Delimiter
97
-
98
- The delimiter configuration option accepts a string which will be used to delimit multiple multiple values within a single label.
99
-
100
- configure_mods_display do
101
- note do
102
- delimiter "<br/>"
103
- end
104
- end
105
-
106
- Note: Different MODS elements will have different default delimiters (mainly varying between a comma+space or a HTML line-break).
107
-
108
- ### Link
109
-
110
- The link configuration option takes 2 parameters. The first is a key that is a method_name available in the class including `ModsDisplay::ControllerExtension` and the 2nd is options to pass to that method. This method must return a string that will be used as the href attribute of the link. (NOTE: If you have the %value% token in your options that will be replaced with the value of the field being linked)
111
-
112
- class MyController
113
- include ModsDisplay::ControllerExtension
114
-
115
- configure_mods_display do
116
- format do
117
- link :format_path, '"%value%"'
118
- end
119
- end
120
-
121
- def format_path(format)
122
- "http://example.com/?f[format_field][]=#{format}"
123
- end
124
- end
125
-
126
- ### Special Subject Configuration
127
-
128
- Depending on the implementation of subjects there may be different ways you would want to link them. The standard way of linking will just create a link passing the value to the href and the link text. However; in certain cases the subjects should be linked so that each subject to the right of a delimiter should have the values of all its preceding values in the href.
129
-
130
- [Country](http://example.com/?"Country") > [State](http://example.com/?"Country State") > [City](http://example.com/?"Country State City")
131
-
132
- This can be accomplished by setting the hierarchical_link configuration option to true for subjects
133
-
134
- configure_mods_display do
135
- subject do
136
- hierarchical_link true
137
- end
138
- end
139
-
140
- NOTE: The default delimiter is set to > for subjects.
141
-
142
- ### Special Access Condition Configuration
143
-
144
- The access condition statement is set to be ignored by default (same as ignore! configuration option). If you would like the access condition statement to display you have to pass the access condition specific display! configuration option.
145
-
146
- configure_mods_display do
147
- access_condition do
148
- display!
149
- end
150
- end
151
-
152
57
  ## Usage
153
58
 
154
59
  Once installed, the class that included the `ControllerExtension` (`MyController`) will have the `render_mods_display` method available. This method takes one argument which is an instance of the class that included the `ModelExtension` (`MyClass`).
@@ -0,0 +1,13 @@
1
+ <% if @field.label %>
2
+ <%= tag.dt @field.label.sub(/:$/, ''), **@label_html_attributes %>
3
+ <% end %>
4
+
5
+ <% if @delimiter %>
6
+ <%= tag.dd **@value_html_attributes do %>
7
+ <%= safe_join @field.values.select(&:present?).map { |value| format_value(value) }, @delimiter %>
8
+ <% end %>
9
+ <% else %>
10
+ <% @field.values.select(&:present?).each do |value| %>
11
+ <%= tag.dd format_value(value), **@value_html_attributes %>
12
+ <% end %>
13
+ <% end %>