standard_view 0.1.10 → 0.1.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a14888d9397034df7bb8174dc0a72b66532e30e8f7132b899c1a7ba3938ccaa
4
- data.tar.gz: 67938e84a77de461180820c95dd91db3d85161e6da79d57f5c77e310c5c4d7d7
3
+ metadata.gz: 4c258ef0752dbdba9cd49fcd0277172854b415423f1e3ea0d7797182d206aeea
4
+ data.tar.gz: 1b20bbd965bdb8050b4ae65cf8cd0b7846cfacd74991e18e4b42c4b5e384bb6b
5
5
  SHA512:
6
- metadata.gz: 7d4318a76209a44cec5f92200ad177494a3cbfce5df1b50bdf405b62f19aee3bb30f2ce1201e3a0d40b76851ace2b3a9871833d7b6ab110248b22810666d9811
7
- data.tar.gz: ccad31258efa6195f0e669a2c4fd210826911479ac0d710d8adb3efa2d02cae377ef8c8a6d74177003c16c7698b7c9f141871490317033691f5ff900fa08df1c
6
+ metadata.gz: 785fc53924c7482b289a5b06a22b2e3bb35c975ff919b0de9d3addca3165694d4e9d09e97eb742f500094ca0e9810c8e0a03ff364c64530ebfdab5ee08d61d6d
7
+ data.tar.gz: 8fbede84013d14c06335cdcefa5b286ddde2a4bd272d9b28807dec67ad94dab439bf176e0d4e432b3e4e290c5e48a47d31b24c2cc832258d59d25aa5dc9f2777
@@ -69,7 +69,7 @@ module StandardView
69
69
  def link_to_related(material, attribute_name)
70
70
  related_object_method_name = attribute_name.chomp("_id")
71
71
  related_object = material.public_send(related_object_method_name)
72
- raise ArgumentError, "no related object for #{material.inspect}" unless related_object.present?
72
+ return if related_object.blank?
73
73
 
74
74
  related_material = Material::Base.for(related_object)
75
75
  link_to related_material.reference_title, related_material
@@ -0,0 +1,16 @@
1
+ <% attribute_partial_name = "#{attribute_name}_attribute" %>
2
+ <% if lookup_context.template_exists?(attribute_partial_name, controller_name, true) %>
3
+ <%= render attribute_partial_name, material: material %>
4
+ <% else %>
5
+ <% attribute_value = attribute_value_for material, attribute_name %>
6
+ <% if attribute_value.present? %>
7
+ <%= attribute_value %>
8
+ <% else %>
9
+ <% missing_attribute_partial_name = "#{attribute_name}_missing" %>
10
+ <% if lookup_context.template_exists?(missing_attribute_partial_name, controller_name, true) %>
11
+ <%= render missing_attribute_partial_name, material: material %>
12
+ <% else %>
13
+ <%= badge t("common.not_defined"), type: :danger, pill: true %>
14
+ <% end %>
15
+ <% end %>
16
+ <% end %>
@@ -25,7 +25,7 @@
25
25
  <% material.sorted_attribute_names.each do |attribute_name| %>
26
26
  <tr>
27
27
  <th><%= material.human_attribute_name(attribute_name) %></th>
28
- <td><%= attribute_value_for material, attribute_name %></td>
28
+ <td><%= render "attribute_card_value", material: material, attribute_name: attribute_name %></td>
29
29
  </tr>
30
30
  <% end %>
31
31
  </tbody>
@@ -9,6 +9,7 @@ en:
9
9
  record_updated: "%{model_name} updated successfully."
10
10
  record_destroyed: "%{model_name} destroyed successfully."
11
11
  error_destroying_record: "%{model_name} could not be destroyed!"
12
+ not_defined: "Not Defined"
12
13
  application:
13
14
  title: Example Title
14
15
  separator: "|"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StandardView
4
- VERSION = "0.1.10"
4
+ VERSION = "0.1.11"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard_view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Garside
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-04-24 00:00:00.000000000 Z
12
+ date: 2020-04-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -274,6 +274,7 @@ files:
274
274
  - app/helpers/standard_view/formatting_helper.rb
275
275
  - app/helpers/standard_view/masthead_helper.rb
276
276
  - app/helpers/standard_view/navigation_helper.rb
277
+ - app/views/application/_attribute_card_value.html.erb
277
278
  - app/views/application/_attributes_card.html.erb
278
279
  - app/views/application/_flash_messages.html.erb
279
280
  - app/views/application/_icon.html.erb