mods_display 1.0.0.alpha2 → 1.0.0.alpha3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11dfd2a19312fa3a121188ad7285eaf4ae841ebd9077da079d996c8c044c75bb
4
- data.tar.gz: 03cf396d6fc8304f86d691041ae8f248b498626d225694fcf2aa02bd11eea91f
3
+ metadata.gz: 6bdb26528f999cd2a0b4fc6ef1ebcfdb65f2e1519ce5bf60a53165dd253cda56
4
+ data.tar.gz: 7a62db3452190084b29368f5ef6c0362f570aa81d2f53a90b4714ea906b0dca9
5
5
  SHA512:
6
- metadata.gz: 4a3978055d27cb58509dab4c33f5452d8b29331db2fa2669f6051f91ab390ddcb3c3561d1d89ccc47048032b9169b98f0f63ef8f29c37b3b5e6374131ce5d061
7
- data.tar.gz: 94962310a85cdb0bba23997b5b5bde94a9be8d8dbf34b58f383811e7144f8e3764e41462933ff5ff3dbc2161449f6e476eda36a7bd5560779c877bfbd1022ff5
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 format_value(value), **@value_html_attributes %>
6
- <% tag.ul **@list_html_attributes %>
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
@@ -14,7 +14,7 @@ module ModsDisplay
14
14
 
15
15
  component = ModsDisplay::FieldComponent.with_collection(f, value_transformer: value_transformer)
16
16
 
17
- view_context.render component
17
+ view_context.render component, layout: false
18
18
  end
19
19
 
20
20
  private
@@ -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::FieldComponent.with_collection(fields, value_transformer: ->(value) { helpers.link_urls_and_email(value.to_s) })
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
- return if related_item.body == '<dl></dl>'
43
- related_item.body
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)
@@ -1,7 +1,7 @@
1
1
  module ModsDisplay
2
2
  class SubTitle < ModsDisplay::Title
3
3
  def initialize(values)
4
- super(values[1..])
4
+ super(values[1..values.length])
5
5
  end
6
6
  end
7
7
  end
@@ -34,7 +34,7 @@ module ModsDisplay
34
34
  value_transformer: ->(value) { value.join(' > ') }
35
35
  )
36
36
 
37
- view_context.render component
37
+ view_context.render component, layout: false
38
38
  end
39
39
 
40
40
  def process_hierarchicalGeographic(element)
@@ -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|
@@ -1,3 +1,3 @@
1
1
  module ModsDisplay
2
- VERSION = '1.0.0.alpha2'
2
+ VERSION = '1.0.0.alpha3'
3
3
  end
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.alpha2
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 00:00:00.000000000 Z
11
+ date: 2022-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stanford-mods