mods_display 1.0.0.alpha2 → 1.0.0.alpha3
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/components/mods_display/list_field_component.html.erb +2 -2
- data/app/components/mods_display/list_field_component.rb +2 -2
- data/lib/mods_display/fields/contents.rb +1 -1
- data/lib/mods_display/fields/field.rb +1 -1
- data/lib/mods_display/fields/name.rb +1 -1
- data/lib/mods_display/fields/nested_related_item.rb +6 -4
- data/lib/mods_display/fields/sub_title.rb +1 -1
- data/lib/mods_display/fields/subject.rb +1 -1
- data/lib/mods_display/html.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: 6bdb26528f999cd2a0b4fc6ef1ebcfdb65f2e1519ce5bf60a53165dd253cda56
|
4
|
+
data.tar.gz: 7a62db3452190084b29368f5ef6c0362f570aa81d2f53a90b4714ea906b0dca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b60063a6c9cc97e37e1ba731400acfa304247c46910715a86fe24a458df238dbdabcde7b988d3d8eb4365c1735b91b6b8d96129d581c6b06aef2f5f53d1add80
|
7
|
+
data.tar.gz: d518a05161e94ba4b48017a222f53a9299921b99455fd7a1918307e033ee69aedb0e7794d4bc415488cbd8f08d61383d0c899f62fd25458a6b6c54e6125ce33d
|
@@ -2,8 +2,8 @@
|
|
2
2
|
<%= tag.dt @field.label.sub(/:$/, ''), **@label_html_attributes %>
|
3
3
|
<% end %>
|
4
4
|
|
5
|
-
<%= tag.dd
|
6
|
-
|
5
|
+
<%= tag.dd **@value_html_attributes do %>
|
6
|
+
<%= tag.ul **@list_html_attributes do %>
|
7
7
|
<% @field.values.select(&:present?).each do |value| %>
|
8
8
|
<%= tag.li format_value(value), **@list_item_html_attributes %>
|
9
9
|
<% end %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ModsDisplay
|
2
2
|
class ListFieldComponent < ModsDisplay::FieldComponent
|
3
|
-
def initialize(list_html_attributes: {}, list_item_html_attributes: {}, **args)
|
4
|
-
super(**args)
|
3
|
+
def initialize(field:, list_html_attributes: {}, list_item_html_attributes: {}, **args)
|
4
|
+
super(field: field, **args)
|
5
5
|
|
6
6
|
@list_html_attributes = list_html_attributes
|
7
7
|
@list_item_html_attributes = list_item_html_attributes
|
@@ -21,7 +21,7 @@ module ModsDisplay
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def to_html(view_context = ApplicationController.renderer)
|
24
|
-
view_context.render ModsDisplay::FieldComponent.with_collection(fields, delimiter: delimiter)
|
24
|
+
view_context.render ModsDisplay::FieldComponent.with_collection(fields, delimiter: delimiter), layout: false
|
25
25
|
end
|
26
26
|
|
27
27
|
def render_in(view_context)
|
@@ -19,7 +19,7 @@ module ModsDisplay
|
|
19
19
|
def to_html(view_context = ApplicationController.renderer)
|
20
20
|
component = ModsDisplay::FieldComponent.with_collection(fields, value_transformer: ->(value) { value.to_s })
|
21
21
|
|
22
|
-
view_context.render component
|
22
|
+
view_context.render component, layout: false
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
@@ -21,9 +21,9 @@ module ModsDisplay
|
|
21
21
|
def to_html(view_context = ApplicationController.renderer)
|
22
22
|
helpers = view_context.respond_to?(:simple_format) ? view_context : ApplicationController.new.view_context
|
23
23
|
|
24
|
-
component = ModsDisplay::
|
24
|
+
component = ModsDisplay::ListFieldComponent.with_collection(fields, value_transformer: ->(value) { helpers.link_urls_and_email(value.to_s) }, list_html_attributes: { class: 'mods_display_nested_related_items' }, list_item_html_attributes: { class: 'mods_display_nested_related_item open' })
|
25
25
|
|
26
|
-
view_context.render component
|
26
|
+
view_context.render component, layout: false
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
@@ -39,8 +39,10 @@ module ModsDisplay
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def related_item_body(related_item)
|
42
|
-
|
43
|
-
|
42
|
+
body = related_item.body
|
43
|
+
|
44
|
+
return if body == '<dl></dl>'
|
45
|
+
body
|
44
46
|
end
|
45
47
|
|
46
48
|
def related_item_label(item)
|
data/lib/mods_display/html.rb
CHANGED
@@ -47,13 +47,13 @@ module ModsDisplay
|
|
47
47
|
# Maybe have a separate class that will omit the first tite natively
|
48
48
|
# and replace the first key in the the fields list with that.
|
49
49
|
def body(view_context = ApplicationController.renderer)
|
50
|
-
view_context.render ModsDisplay::RecordComponent.new(record: self)
|
50
|
+
view_context.render ModsDisplay::RecordComponent.new(record: self), layout: false
|
51
51
|
end
|
52
52
|
|
53
53
|
# @deprecated
|
54
54
|
def to_html(view_context = ApplicationController.renderer)
|
55
55
|
fields = [:title] + ModsDisplay::RecordComponent::DEFAULT_FIELDS - [:subTitle]
|
56
|
-
view_context.render ModsDisplay::RecordComponent.new(record: self, fields: fields)
|
56
|
+
view_context.render ModsDisplay::RecordComponent.new(record: self, fields: fields), layout: false
|
57
57
|
end
|
58
58
|
|
59
59
|
MODS_DISPLAY_FIELD_MAPPING.each do |key, _value|
|
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.0.0.
|
4
|
+
version: 1.0.0.alpha3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jessie Keck
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stanford-mods
|