eventsimple 2.3.0 → 2.4.0

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: 394c4820e133907b2e63fe826b7891ab2cd0fbc1f436683b667ac9cfee73e57a
4
- data.tar.gz: 70508717fa8b8a1b2528a38044648c3748b63ffd721c606ec66fdf959e54b53a
3
+ metadata.gz: 552ecc441120517eee35f12c6ebef012611c7565730b4c0cdf180f2e58ab1d05
4
+ data.tar.gz: c5e55ce426acbf14f25dddcbc861a3eb8a3fac2635ce6d706dd97e90eb4151db
5
5
  SHA512:
6
- metadata.gz: 1150de14bcfc4580f7b2be46a406d602a29bcecb7b75aabd136215e8893fc8b4cc98fbfc29082cc1a7ac30cb7235e7ac81206e05532cdf260c74d8e68bf10176
7
- data.tar.gz: 4d47af195c91593c5424c0f9a5316cd35e3c4aa9b135cbdb894fa86bcef72d899b1e6f1187afe063c627dbeb787d9bb0dfc310fc8de60ad0bbbf7d48cbbf4a60
6
+ metadata.gz: dbeb3130ffe536969366bdfe22cb193310d045eac757eee98c894d7944f7ff0b31d6be889a068030432ff51d4adc6a50ff56c026c4b78f48f65e1e9356ff6967
7
+ data.tar.gz: a35d64be339e546d3dcbb48ff5f27d0385bca49d119d3b054ab970ae91458e76a42160871b252deab2ebaf2d65475052085fb9f9487132f4381f5c8139ad254f
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 2.4.0 - 2026-04-25
10
+ ### Added
11
+ - Collapsible JSON viewer for Hash and Array values in the admin UI.
12
+
9
13
  ## 2.3.0 - 2026-02-24
10
14
  ### Added
11
15
  - Per-event metadata class: pass `metadata_class:` to `drives_events_for` to use a custom metadata class for that event (Class or String).
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eventsimple (2.3.0)
4
+ eventsimple (2.4.0)
5
5
  concurrent-ruby (>= 1.2.3)
6
6
  dry-struct (>= 1.8.0)
7
7
  dry-types (>= 1.7.0)
@@ -458,7 +458,7 @@ CHECKSUMS
458
458
  dry-types (1.9.0) sha256=7b656fe0a78d2432500ae1f29fefd6762f5a032ca7000e4f36bc111453d45d4d
459
459
  erb (6.0.1) sha256=28ecdd99c5472aebd5674d6061e3c6b0a45c049578b071e5a52c2a7f13c197e5
460
460
  erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9
461
- eventsimple (2.3.0)
461
+ eventsimple (2.4.0)
462
462
  factory_bot (6.5.6) sha256=12beb373214dccc086a7a63763d6718c49769d5606f0501e0a4442676917e077
463
463
  factory_bot_rails (6.5.1) sha256=d3cc4851eae4dea8a665ec4a4516895045e710554d2b5ac9e68b94d351bc6d68
464
464
  ffi (1.17.3-aarch64-linux-gnu) sha256=28ad573df26560f0aedd8a90c3371279a0b2bd0b4e834b16a2baa10bd7a97068
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Eventsimple
4
+ module EntitiesHelper
5
+ def render_value(value)
6
+ case value
7
+ when nil
8
+ content_tag(:code, '-', class: 'entity-property')
9
+ when Hash, Array
10
+ content_tag(:div, '', class: 'json-viewer-target', data: { json: value.to_json })
11
+ else
12
+ content_tag(:code, value.to_s, class: 'entity-property')
13
+ end
14
+ end
15
+ end
16
+ end
@@ -32,8 +32,8 @@
32
32
  <% @entity_changes.each do |property| %>
33
33
  <tr class="<%= property[:is_changed] ? 'table-info' : '' %>">
34
34
  <th scope="row"><%= property[:label] %></th>
35
- <td><code class="entity-property"><%= property[:historical_value].nil? ? '-' : property[:historical_value] %></code></td>
36
- <td><code class="entity-property"><%= property[:current_value].nil? ? '-' : property[:current_value] %></code></td>
35
+ <td><%= render_value(property[:historical_value]) %></td>
36
+ <td><%= render_value(property[:current_value]) %></td>
37
37
  </tr>
38
38
  <% end %>
39
39
  </tbody>
@@ -64,7 +64,7 @@
64
64
  <% @selected_event.data.to_h.each do |attr_name, attr_value| %>
65
65
  <tr>
66
66
  <td>&nbsp;&nbsp;&nbsp;&nbsp;<%= attr_name %></td>
67
- <td><code class="entity-property"><%= attr_value %></code></td>
67
+ <td><%= render_value(attr_value) %></td>
68
68
  </tr>
69
69
  <% end %>
70
70
  <% end %>
@@ -75,7 +75,7 @@
75
75
  <% @selected_event.metadata.to_h.each do |attr_name, attr_value| %>
76
76
  <tr>
77
77
  <td>&nbsp;&nbsp;&nbsp;&nbsp;<%= attr_name %></td>
78
- <td><code class="entity-property">: <%= attr_value %></code></td>
78
+ <td><%= render_value(attr_value) %></td>
79
79
  </tr>
80
80
  <% end %>
81
81
  </tbody>
@@ -25,6 +25,15 @@
25
25
  integrity: "sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=",
26
26
  crossorigin: "anonymous"
27
27
  %>
28
+ <%= stylesheet_link_tag "https://cdn.jsdelivr.net/npm/jquery.json-viewer@1.5.0/json-viewer/jquery.json-viewer.css",
29
+ media: "all",
30
+ integrity: "sha256-rXfxviikI1RGZM3px6piq9ZL0YZuO5ETcO8+toY+DDY=",
31
+ crossorigin: "anonymous"
32
+ %>
33
+ <%= javascript_include_tag "https://cdn.jsdelivr.net/npm/jquery.json-viewer@1.5.0/json-viewer/jquery.json-viewer.js",
34
+ integrity: "sha256-Tbq6mI1/ZeudUckwCGhWMlV8S/Ae9cQRIf/yBDVg0Ek=",
35
+ crossorigin: "anonymous"
36
+ %>
28
37
 
29
38
  <%= render partial: 'eventsimple/shared/style' %>
30
39
  </head>
@@ -63,6 +72,10 @@
63
72
  query.set(param, value);
64
73
  link.attr("href",window.location.pathname + '?' + query.toString());
65
74
  });
75
+
76
+ $('.json-viewer-target').each(function () {
77
+ $(this).jsonViewer($(this).data('json'), { collapsed: true, withQuotes: true, withLinks: false });
78
+ });
66
79
  });
67
80
  </script>
68
81
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Eventsimple
4
- VERSION = '2.3.0'
4
+ VERSION = '2.4.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventsimple
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zulfiqar Ali
@@ -330,6 +330,7 @@ files:
330
330
  - app/controllers/eventsimple/entities_controller.rb
331
331
  - app/controllers/eventsimple/home_controller.rb
332
332
  - app/controllers/eventsimple/models_controller.rb
333
+ - app/helpers/eventsimple/entities_helper.rb
333
334
  - app/views/eventsimple/entities/show.html.erb
334
335
  - app/views/eventsimple/home/index.html.erb
335
336
  - app/views/eventsimple/models/show.html.erb