loggable_activity 0.5.0 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/README.md +45 -31
  4. data/app/assets/config/loggable_activity_manifest.js +1 -3
  5. data/app/assets/javascripts/loggable_activity/application.js +0 -1
  6. data/app/assets/stylesheets/loggable_activity/activities.scss +25 -0
  7. data/app/assets/stylesheets/loggable_activity/application.scss +2 -6
  8. data/app/views/kaminari/{kaminari-turbo-bootstrap → pico}/_first_page.html.erb +0 -1
  9. data/app/views/kaminari/pico/_last_page.html.erb +12 -0
  10. data/app/views/layouts/loggable_activity/application.html.slim +20 -0
  11. data/app/views/loggable_activity/activities/_activities.html.slim +28 -0
  12. data/app/views/loggable_activity/activities/index.html.erb +5 -6
  13. data/app/views/loggable_activity/bootstrap/kaminari/_first_page.html.erb +13 -0
  14. data/app/views/loggable_activity/bootstrap/kaminari/_gap.html.erb +8 -0
  15. data/app/views/loggable_activity/bootstrap/kaminari/_next_page.html.erb +13 -0
  16. data/app/views/loggable_activity/bootstrap/kaminari/_page.html.erb +14 -0
  17. data/app/views/loggable_activity/bootstrap/kaminari/_paginator.html.erb +27 -0
  18. data/app/views/loggable_activity/bootstrap/kaminari/_prev_page.html.erb +13 -0
  19. data/config/initializers/kaminari_config.rb +1 -1
  20. data/lib/loggable_activity/activity.rb +1 -0
  21. data/lib/loggable_activity/config_schema.json +3 -10
  22. data/lib/loggable_activity/configuration.rb +3 -8
  23. data/lib/loggable_activity/engine.rb +0 -5
  24. data/lib/loggable_activity/hooks.rb +3 -13
  25. data/lib/loggable_activity/services/payloads_builder.rb +3 -3
  26. data/lib/loggable_activity/services/update_payloads_builder.rb +4 -4
  27. data/lib/loggable_activity/version.rb +1 -1
  28. data/loggable_activity-0.5.0.gem +0 -0
  29. metadata +41 -33
  30. data/app/views/layouts/loggable_activity/application.html.erb +0 -19
  31. data/app/views/loggable_activity/activities/_activities.html.erb +0 -56
  32. data/app/views/loggable_activity/activities/show.html.erb +0 -2
  33. /data/app/views/kaminari/{kaminari-turbo-bootstrap → pico}/_gap.html.erb +0 -0
  34. /data/app/views/kaminari/{kaminari-turbo-bootstrap → pico}/_next_page.html.erb +0 -0
  35. /data/app/views/kaminari/{kaminari-turbo-bootstrap → pico}/_page.html.erb +0 -0
  36. /data/app/views/kaminari/{kaminari-turbo-bootstrap → pico}/_paginator.html.erb +0 -0
  37. /data/app/views/kaminari/{kaminari-turbo-bootstrap → pico}/_prev_page.html.erb +0 -0
  38. /data/app/views/{kaminari/kaminari-turbo-bootstrap → loggable_activity/bootstrap/kaminari}/_last_page.html.erb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62e1b197ae053af29d55c9b183c358a773f43186691c20c8e124ba7786bde586
4
- data.tar.gz: ae8bd2c8d9a9718c02fc246c2a5a703b6fad9b27823cf357a51020d96b0a5a16
3
+ metadata.gz: 24bd885b926bbd2d1b0795d5265b0121b03a99ea3057da14c60669de72d5ef98
4
+ data.tar.gz: b5d04e92f45bb6d7a1af4d1f6e22489cb4f88798771403ee6ad1cf97ae0433fd
5
5
  SHA512:
6
- metadata.gz: 7ed08eae394bc830b08d21f68de6b3f77811fde3b73d4278351bc807ee7c9de3369632bb349f16e45dd518e74297064494b1f810bb1b2c3cf1744d34f898adf9
7
- data.tar.gz: 91891b25f6826cd70fcacc3bd3365a14b50e319c6d3af6ceecf72cb8340adb1298a79d28a1d08964087011c9e3766e188fe80193a3d293d087611a543817a7f4
6
+ metadata.gz: 5a88d29b6655e37f8713ece59f8cbd48f36da48e2d1f1945e7de7f08572db4591109bd88b4804e6523d9a8c428c12799f04e7d220d221be4b48fc38c6761eee3
7
+ data.tar.gz: a6e037dc4d8732af308fc162134144a164815d5f1915701cad9cb5b543353fceac2b7bd0a56ae19bd028163eb42b78316f0a16d533da6f24bc0447e7f967bf3c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [0.5.3] - 2024-03-21
2
+ ### Breaking change
3
+ - Styling changed to bootstrap
4
+ - Configuration.yml changed
5
+
6
+ ## [0.5.2] - 2024-03-21
7
+ ### Breaking change
8
+ - Styling with pico css
9
+ - Public attrs added
1
10
 
2
11
  ## [0.2.0] - 2024-07-03
3
12
  - Keys kan be kept until LoggableActivity::Sanitizer.run is called
data/README.md CHANGED
@@ -1,31 +1,45 @@
1
- # LoggableActivity
2
- Short description and motivation.
3
-
4
- ## Usage
5
- How to use my plugin.
6
-
7
- ## Installation
8
- Add this line to your application's Gemfile:
9
-
10
- ```ruby
11
- gem "loggable_activity"
12
- ```
13
-
14
- And then execute:
15
- ```bash
16
- $ bundle
17
- ```
18
-
19
- Or install it yourself as:
20
- ```bash
21
- $ gem install loggable_activity
22
- ```
23
-
24
- ## Contributing
25
- Contribution directions go here.
26
-
27
- ## License
28
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
29
-
30
- ##
31
- bin/rails loggable_activity:install:migrations
1
+ # Loggable Activity 🌟
2
+ Secure protect data and log how it is handled
3
+ - Keep an activity log of how data in the db are handled.
4
+ - Protect and secure the privacy of data stored in Activity Logs
5
+ - Prepare for General Data Protection Regulation (GDPR) compliance.
6
+ - Handles activities that involves more than one table in the DB.
7
+ - Encrypt data stored in the activity log
8
+ - Support binary_ids
9
+
10
+ ### Important!
11
+ This project is under development and not ready for production. There might be breaking changes, so please consult the CHANGELOG.md
12
+ ### What it is not
13
+ - An error logging system
14
+ - A paper trails system with rollback.
15
+ - A backup system
16
+
17
+ ### Applications
18
+ Most organizations needs to keep a log of how users interact with data stored in the DB
19
+ - Finance
20
+ - Healthcare
21
+ - Sales and Support
22
+
23
+ *Super simplified example from the healthcare.*
24
+ - Each patient has a journal, that is updated on a regular basis.
25
+ - Supervisor needs to follow the journal, how was it updated, who read it, did it get deleted.
26
+ - Security personnel needs to know how the journal is handled, who did what when.
27
+ - Patients has the right to know how their journal is handled and that their data will be removed when required.
28
+
29
+ Beside the journal in the db, an activity log is kept so it is possible to track how the journal is used.<br/>
30
+ At some point in time the patients data from the DB and the activity log has to be removed according to GDPR.<br/>
31
+
32
+ ### Getting started
33
+ please read the [GETTING-STARTED.md](https://github.com/LoggableActivity/LoggableActivity/blob/main/GETTING-STARTED.md) guide
34
+
35
+ ### Contribute
36
+ 👉 Join the Slack channel here: [LoggableActivity Slack Workspace](https://join.slack.com/t/loggableactivity/shared_invite/zt-2a3tvgv37-mGwjHJTrBXBH2srXFRRSXQ)
37
+ <br/>
38
+ 👉 Want to play around with an online version: [Show Demo](https://loggableactivity-efe7b931c886.herokuapp.com/)
39
+ <br/>
40
+ We value each contribution and believe in the power of community. Looking forward to seeing you there!
41
+
42
+
43
+ ### Test
44
+ We embrace the philosophy of black-box testing, where we focus on the input and output of the public interface without worrying about internal implementation details.<br/>
45
+ This approach aligns with the principle of testing behavior rather than implementation.
@@ -1,4 +1,2 @@
1
1
  //= link_directory ../stylesheets/loggable_activity .css
2
- //= link application.css
3
- //= link_directory ../javascripts/loggable_activity .js
4
- //= link application.js
2
+
@@ -1,2 +1 @@
1
- //= require bootstrap
2
1
 
@@ -0,0 +1,25 @@
1
+ .activity {
2
+ --bs-alert-bg: transparent;
3
+ --bs-alert-padding-x: 1rem;
4
+ --bs-alert-padding-y: 0.5rem;
5
+ // --bs-alert-margin-bottom: 1rem;
6
+ --bs-alert-color: inherit;
7
+ --bs-alert-border-color: transparent;
8
+ --bs-alert-border: var(--bs-border-width) solid var(--bs-alert-border-color);
9
+ --bs-alert-border-radius: var(--bs-border-radius);
10
+ --bs-alert-link-color: inherit;
11
+ position: relative;
12
+ padding: var(--bs-alert-padding-y) var(--bs-alert-padding-x);
13
+ margin-bottom: var(--bs-alert-margin-bottom);
14
+ color: var(--bs-alert-color);
15
+ background-color: var(--bs-alert-bg);
16
+ border: var(--bs-alert-border);
17
+ // border-radius: 0;
18
+ }
19
+
20
+ .activity-info {
21
+ --bs-alert-color: var(--bs-info-text-emphasis);
22
+ --bs-alert-bg: var(--bs-info-bg-subtle);
23
+ --bs-alert-border-color: var(--bs-info-border-subtle);
24
+ --bs-alert-link-color: var(--bs-info-text-emphasis);
25
+ }
@@ -12,9 +12,5 @@
12
12
  *
13
13
  *= require_tree .
14
14
  *= require_self
15
- */
16
-
17
- @import "bootstrap/functions";
18
- @import "bootstrap/variables";
19
- @import "bootstrap/mixins";
20
- @import "bootstrap";
15
+ *= require loggable_activity/activities
16
+ */
@@ -8,7 +8,6 @@
8
8
  -%>
9
9
  <% unless current_page.first? %>
10
10
  <li class="page-item">
11
- <%# <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :class => 'page-link', :remote => remote %>
12
11
  <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, class: 'page-link', data: { turbo: true } %>
13
12
  </li>
14
13
  <% end %>
@@ -0,0 +1,12 @@
1
+ <%# Link to the "Last" page
2
+ - available local variables
3
+ url: url to the last page
4
+ current_page: a page object for the currently displayed page
5
+ num_pages: total number of pages
6
+ per_page: number of items to fetch per page
7
+ remote: data-remote
8
+ -%>
9
+ <% unless current_page.last? %>
10
+ <%= link_to_unless current_page.last?, raw(t('views.pagination.last')), url, class: 'page-link', data: { turbo: true } %>
11
+ </li>
12
+ <% end %>
@@ -0,0 +1,20 @@
1
+ doctype html
2
+ html
3
+ head
4
+ title Loggable activity
5
+ = csrf_meta_tags
6
+ = csp_meta_tag
7
+ = stylesheet_link_tag "loggable_activity/application", media: "all"
8
+
9
+ link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/themes/prism.min.css" rel="stylesheet"
10
+ script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/prism.min.js"
11
+
12
+ = stylesheet_link_tag 'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css',
13
+ integrity: 'sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH',
14
+ crossorigin: 'anonymous'
15
+
16
+ body data-bs-theme="dark"
17
+ = yield
18
+ = javascript_include_tag 'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js',
19
+ integrity: 'sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz',
20
+ crossorigin: 'anonymous'
@@ -0,0 +1,28 @@
1
+
2
+ .row
3
+ .col-3
4
+ b.text-secondary Action
5
+ .col-3
6
+ b.text-secondary Record
7
+ .col-3
8
+ b.text-secondary Actor
9
+ .col-3
10
+ b.text-secondary Created At
11
+
12
+ - @activities.each do |activity|
13
+ .activity.activity-info[type="button" data-bs-toggle="collapse" data-bs-target="#activity_#{activity.id}" aria-expanded="false" aria-controls="collapseExample"]
14
+ .row
15
+ .col-3
16
+ = activity_action(activity)
17
+ .col-3
18
+ = t(activity.record_display_name)
19
+ .col-3
20
+ = t(activity.actor_display_name)
21
+ .col-3
22
+ = l(activity.created_at, format: :long)
23
+ .collapse id="activity_#{activity.id}"
24
+ pre
25
+ code.language-json
26
+ = format_json_for_display(activity.attrs)
27
+ javascript:
28
+ Prism.highlightAll();
@@ -1,7 +1,6 @@
1
- <h1>Activities</h1>
2
- <%= render partial: "activities", activities: @activities %>
1
+ <div class="container">
2
+ <h1>Activities</h1>
3
+ <%= paginate @activities, views_prefix: "loggable_activity/bootstrap" %>
4
+ <%= render partial: "activities", activities: @activities %>
5
+ </div>
3
6
 
4
- <%= paginate @activities, theme: 'kaminari-turbo-bootstrap' %>
5
-
6
-
7
-
@@ -0,0 +1,13 @@
1
+ <%# Link to the "First" page
2
+ - available local variables
3
+ url: url to the first page
4
+ current_page: a page object for the currently displayed page
5
+ num_pages: total number of pages
6
+ per_page: number of items to fetch per page
7
+ remote: data-remote
8
+ -%>
9
+ <% unless current_page.first? %>
10
+ <li class="page-item">
11
+ <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, class: 'page-link', data: { turbo: true } %>
12
+ </li>
13
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <%# Non-link tag that stands for skipped pages...
2
+ - available local variables
3
+ current_page: a page object for the currently displayed page
4
+ num_pages: total number of pages
5
+ per_page: number of items to fetch per page
6
+ remote: data-remote
7
+ -%>
8
+ <li class="page-item disabled"><a href="#" onclick="return false;" class="page-link"><%= raw(t 'views.pagination.truncate') %></a></li>
@@ -0,0 +1,13 @@
1
+ <%# Link to the "Next" page
2
+ - available local variables
3
+ url: url to the next page
4
+ current_page: a page object for the currently displayed page
5
+ num_pages: total number of pages
6
+ per_page: number of items to fetch per page
7
+ remote: data-remote
8
+ -%>
9
+ <% unless current_page.last? %>
10
+ <li class="page-item">
11
+ <%= link_to_unless current_page.last?, raw(t('views.pagination.next')), url, class: 'page-link', rel: 'next', data: { turbo: true }, remote: remote %>
12
+ </li>
13
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <%# Link showing page number
2
+ - available local variables
3
+ page: a page object for "this" page
4
+ url: url to this page
5
+ current_page: a page object for the currently displayed page
6
+ num_pages: total number of pages
7
+ per_page: number of items to fetch per page
8
+ remote: data-remote
9
+ -%>
10
+ <li class="page-item<%= ' active' if page.current? %>">
11
+ <%#= link_to page, url, opts = {:remote => remote, :class => 'page-link', :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
12
+ <%= link_to page, url, class: 'page-link', rel: page.next? ? 'next' : page.prev? ? 'prev' : nil, data: { turbo: true }, remote: remote %>
13
+
14
+ </li>
@@ -0,0 +1,27 @@
1
+ <%# The container tag
2
+ - available local variables
3
+ current_page: a page object for the currently displayed page
4
+ num_pages: total number of pages
5
+ per_page: number of items to fetch per page
6
+ remote: data-remote
7
+ paginator: the paginator that renders the pagination tags inside
8
+ -%>
9
+ <%- pagination_class ||= '' %>
10
+ <%- nav_class ||= '' %>
11
+ <%= paginator.render do -%>
12
+ <nav class="<%= nav_class %>">
13
+ <ul class="pagination <%= pagination_class %>">
14
+ <%= first_page_tag unless current_page.first? %>
15
+ <%= prev_page_tag unless current_page.first? %>
16
+ <% each_page do |page| -%>
17
+ <% if page.left_outer? || page.right_outer? || page.inside_window? -%>
18
+ <%= page_tag page %>
19
+ <% elsif !page.was_truncated? -%>
20
+ <%= gap_tag %>
21
+ <% end -%>
22
+ <% end -%>
23
+ <%= next_page_tag unless current_page.last? %>
24
+ <%= last_page_tag unless current_page.last? %>
25
+ </ul>
26
+ </nav>
27
+ <% end -%>
@@ -0,0 +1,13 @@
1
+ <%# Link to the "Previous" page
2
+ - available local variables
3
+ url: url to the previous page
4
+ current_page: a page object for the currently displayed page
5
+ num_pages: total number of pages
6
+ per_page: number of items to fetch per page
7
+ remote: data-remote
8
+ -%>
9
+ <% unless current_page.first? %>
10
+ <li class="page-item">
11
+ <%= link_to_unless current_page.first?, raw(t('views.pagination.previous')), url, rel: 'prev', class: 'page-link', data: { turbo: true }, remote: remote %>
12
+ </li>
13
+ <% end %>
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Kaminari.configure do |config|
4
- config.default_per_page = 3
4
+ # config.default_per_page = 10
5
5
  # config.max_per_page = nil
6
6
  # config.window = 4
7
7
  # config.outer_window = 0
@@ -135,6 +135,7 @@ module LoggableActivity
135
135
  return I18n.t('loggable.activity.deleted') if actor_deleted?
136
136
 
137
137
  ::LoggableActivity::Encryption.decrypt(encrypted_actor_name, actor_secret_key)
138
+
138
139
  end
139
140
 
140
141
  # Returns a list of activities for a given actor.
@@ -2,10 +2,7 @@
2
2
  "$schema": "http://json-schema.org/draft-06/schema#",
3
3
  "type": "object",
4
4
  "properties": {
5
- "current_user_model_name": {
6
- "type": "string"
7
- },
8
- "current_user_name": {
5
+ "fetch_actor_name_from": {
9
6
  "type": "string"
10
7
  },
11
8
  "task_for_sanitization": {
@@ -13,7 +10,7 @@
13
10
  }
14
11
  },
15
12
  "patternProperties": {
16
- "^(?!current_user_model_name$|current_user_name$|task_for_sanitization)[A-Za-z0-9_:]+$": {
13
+ "^(?!fetch_actor_name_from$|task_for_sanitization)[A-Za-z0-9_:]+$": {
17
14
  "type": "object",
18
15
  "properties": {
19
16
  "data_owner": {
@@ -72,9 +69,6 @@
72
69
  "route": {
73
70
  "type": "string",
74
71
  "minLength": 1
75
- },
76
- "fetch_record_name_from": {
77
- "type": "string"
78
72
  }
79
73
  },
80
74
  "required": [
@@ -90,7 +84,6 @@
90
84
  },
91
85
  "additionalProperties": false,
92
86
  "required": [
93
- "current_user_model_name",
94
- "current_user_name"
87
+ "fetch_actor_name_from"
95
88
  ]
96
89
  }
@@ -53,15 +53,10 @@ module LoggableActivity
53
53
  end
54
54
 
55
55
  # Returns the name of the field or method to use for the actor's display name.
56
- def current_user_name
57
- config_data['current_user_name']
56
+ def fetch_actor_name_from
57
+ config_data['fetch_actor_name_from']
58
58
  end
59
-
60
- # Returns the name of the model to use for the current user.
61
- def current_user_model_name
62
- config_data['current_user_model_name']
63
- end
64
-
59
+
65
60
  # Returns whatever models should be sanitized on delete.
66
61
  def task_for_sanitization
67
62
  config_data['task_for_sanitization']
@@ -18,10 +18,5 @@ module LoggableActivity
18
18
  #
19
19
  class Engine < ::Rails::Engine
20
20
  isolate_namespace LoggableActivity
21
-
22
- # initializer 'loggable_activity.assets.precompile' do |app|
23
- # app.config.assets.precompile += %w( loggable_activity/application.css )
24
- # app.config.assets.precompile += %w( loggable_activity/bootstrap.css )
25
- # end
26
21
  end
27
22
  end
@@ -165,13 +165,13 @@ module LoggableActivity
165
165
 
166
166
  # Returns the encrypted name of the actor.
167
167
  def encrypted_actor_name
168
- name = @actor.send(current_user_name)
168
+ name = @actor.send(fetch_actor_name_from)
169
169
  ::LoggableActivity::Encryption.encrypt(name, actor_secret_key)
170
170
  end
171
171
 
172
172
  # Reads the field to feetch the record name from.
173
- def current_user_name
174
- ::LoggableActivity::Configuration.current_user_name
173
+ def fetch_actor_name_from
174
+ ::LoggableActivity::Configuration.fetch_actor_name_from
175
175
  end
176
176
 
177
177
  # Returns the action key for the current action.
@@ -194,16 +194,6 @@ module LoggableActivity
194
194
  encryption_key_for_record(@actor)&.secret_key
195
195
  end
196
196
 
197
- # Returns the display name of the actor.
198
- def actor__name_field
199
- Rails.application.config.loggable_activity.actor_display_name || "id: #{@actor.id}, class: #{@actor.class.name}"
200
- end
201
-
202
- # Returns the model name of the current user.
203
- def current_user_model?
204
- Rails.application.config.loggable_activity.current_user_model_name == self.class.name
205
- end
206
-
207
197
  class_methods do
208
198
  # The loggable_attrs attribute is used read the configuration for the model that included LoggableActivity::Hooks.
209
199
  attr_accessor :loggable_attrs, :relations, :auto_log, :fetch_record_name_from, :route, :public_attrs
@@ -57,7 +57,7 @@ module LoggableActivity
57
57
  def build_has_many_payloads(relation_config)
58
58
  relation = (relation_config['has_many']).to_s
59
59
  records = @record.send(relation)
60
- data_owner = relation_config['data_owner']
60
+ data_owner = relation_config['data_owner'] || false
61
61
  options = { related_to_activity_as: 'has_many_payload', current_payload: true, data_owner: }
62
62
  records.each do |record|
63
63
  record.disable_hooks!
@@ -73,7 +73,7 @@ module LoggableActivity
73
73
 
74
74
  record.disable_hooks!
75
75
 
76
- data_owner = relation_config['data_owner']
76
+ data_owner = relation_config['data_owner'] || false
77
77
  options =
78
78
  {
79
79
  related_to_activity_as: 'has_one_payload',
@@ -90,7 +90,7 @@ module LoggableActivity
90
90
  record = @record.send(relation)
91
91
  return if record.nil?
92
92
 
93
- data_owner = relation_config['data_owner']
93
+ data_owner = relation_config['data_owner'] || false
94
94
 
95
95
  if data_owner
96
96
  encryption_key = encryption_key_for_record(@record)
@@ -56,7 +56,7 @@ module LoggableActivity
56
56
  relation_id = "#{relation_config['belongs_to']}_id"
57
57
  model_class_name = relation_config['model']
58
58
  model_class = model_class_name.constantize
59
- data_owner = relation_config['data_owner']
59
+ data_owner = relation_config['data_owner'] || false
60
60
 
61
61
  model_ids = saved_changes(@record).map { |hash| hash[relation_id] }
62
62
 
@@ -101,7 +101,7 @@ module LoggableActivity
101
101
  )
102
102
 
103
103
  previous_values = previous_values.slice(*loggable_attrs)
104
- data_owner = relation_config['data_owner']
104
+ data_owner = relation_config['data_owner'] || false
105
105
  options = { related_to_activity_as: 'has_many_update_payload', current_payload: true, data_owner: }
106
106
 
107
107
  build_encrypted_update_payload(
@@ -115,7 +115,7 @@ module LoggableActivity
115
115
 
116
116
  def build_has_many_create_payload(relation_config, record)
117
117
  record.disable_hooks = true
118
- data_owner = relation_config['data_owner']
118
+ data_owner = relation_config['data_owner'] || false
119
119
  options =
120
120
  { related_to_activity_as: 'has_many_create_payload', current_payload: true, data_owner: }
121
121
  build_encrypted_payload(record, options)
@@ -138,7 +138,7 @@ module LoggableActivity
138
138
 
139
139
  previous_values = previous_values.slice(*loggable_attrs)
140
140
  current_values = current_values.slice(*loggable_attrs)
141
- data_owner = relation_config['data_owner']
141
+ data_owner = relation_config['data_owner'] || false
142
142
  options = { related_to_activity_as: 'has_one_update_payload', current_payload: true, data_owner: }
143
143
 
144
144
  build_encrypted_update_payload(
@@ -3,5 +3,5 @@
3
3
  # Version of the gem
4
4
  module LoggableActivity
5
5
  # Version
6
- VERSION = '0.5.0'
6
+ VERSION = '0.5.4'
7
7
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loggable_activity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
- - "Max \nGroenlund"
7
+ - Max Groenlund
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-08 00:00:00.000000000 Z
11
+ date: 2024-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -24,26 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 7.1.3
27
- - !ruby/object:Gem::Dependency
28
- name: bootstrap
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '5.3'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 5.3.3
37
- type: :runtime
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - "~>"
42
- - !ruby/object:Gem::Version
43
- version: '5.3'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 5.3.3
47
27
  - !ruby/object:Gem::Dependency
48
28
  name: json-schema
49
29
  requirement: !ruby/object:Gem::Requirement
@@ -118,6 +98,26 @@ dependencies:
118
98
  - - ">="
119
99
  - !ruby/object:Gem::Version
120
100
  version: 2.1.2
101
+ - !ruby/object:Gem::Dependency
102
+ name: slim-rails
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - "~>"
106
+ - !ruby/object:Gem::Version
107
+ version: '3.6'
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 3.6.3
111
+ type: :runtime
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.6'
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 3.6.3
121
121
  - !ruby/object:Gem::Dependency
122
122
  name: sqlite3
123
123
  requirement: !ruby/object:Gem::Requirement
@@ -251,6 +251,7 @@ files:
251
251
  - app/assets/config/loggable_activity_manifest.js
252
252
  - app/assets/images/loggable_activity/.keep
253
253
  - app/assets/javascripts/loggable_activity/application.js
254
+ - app/assets/stylesheets/loggable_activity/activities.scss
254
255
  - app/assets/stylesheets/loggable_activity/application.scss
255
256
  - app/controllers/concerns/.keep
256
257
  - app/controllers/loggable_activity/activities_controller.rb
@@ -260,17 +261,23 @@ files:
260
261
  - app/jobs/loggable_activity/application_job.rb
261
262
  - app/mailers/loggable_activity/application_mailer.rb
262
263
  - app/models/loggable_activity/application_record.rb
263
- - app/views/kaminari/kaminari-turbo-bootstrap/_first_page.html.erb
264
- - app/views/kaminari/kaminari-turbo-bootstrap/_gap.html.erb
265
- - app/views/kaminari/kaminari-turbo-bootstrap/_last_page.html.erb
266
- - app/views/kaminari/kaminari-turbo-bootstrap/_next_page.html.erb
267
- - app/views/kaminari/kaminari-turbo-bootstrap/_page.html.erb
268
- - app/views/kaminari/kaminari-turbo-bootstrap/_paginator.html.erb
269
- - app/views/kaminari/kaminari-turbo-bootstrap/_prev_page.html.erb
270
- - app/views/layouts/loggable_activity/application.html.erb
271
- - app/views/loggable_activity/activities/_activities.html.erb
264
+ - app/views/kaminari/pico/_first_page.html.erb
265
+ - app/views/kaminari/pico/_gap.html.erb
266
+ - app/views/kaminari/pico/_last_page.html.erb
267
+ - app/views/kaminari/pico/_next_page.html.erb
268
+ - app/views/kaminari/pico/_page.html.erb
269
+ - app/views/kaminari/pico/_paginator.html.erb
270
+ - app/views/kaminari/pico/_prev_page.html.erb
271
+ - app/views/layouts/loggable_activity/application.html.slim
272
+ - app/views/loggable_activity/activities/_activities.html.slim
272
273
  - app/views/loggable_activity/activities/index.html.erb
273
- - app/views/loggable_activity/activities/show.html.erb
274
+ - app/views/loggable_activity/bootstrap/kaminari/_first_page.html.erb
275
+ - app/views/loggable_activity/bootstrap/kaminari/_gap.html.erb
276
+ - app/views/loggable_activity/bootstrap/kaminari/_last_page.html.erb
277
+ - app/views/loggable_activity/bootstrap/kaminari/_next_page.html.erb
278
+ - app/views/loggable_activity/bootstrap/kaminari/_page.html.erb
279
+ - app/views/loggable_activity/bootstrap/kaminari/_paginator.html.erb
280
+ - app/views/loggable_activity/bootstrap/kaminari/_prev_page.html.erb
274
281
  - config/initializers/kaminari_config.rb
275
282
  - config/routes.rb
276
283
  - db/migrate/20240702092648_create_loggable_activity_tables.rb
@@ -311,6 +318,7 @@ files:
311
318
  - lib/loggable_activity/services/update_payloads_builder.rb
312
319
  - lib/loggable_activity/version.rb
313
320
  - lib/tasks/loggable_activity_tasks.rake
321
+ - loggable_activity-0.5.0.gem
314
322
  homepage: https://loggableactivity-efe7b931c886.herokuapp.com/
315
323
  licenses:
316
324
  - MIT
@@ -1,19 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Loggable activity</title>
5
- <%= csrf_meta_tags %>
6
- <%= csp_meta_tag %>
7
- <%= stylesheet_link_tag "loggable_activity/application", media: "all" %>
8
- <%= javascript_include_tag 'loggable_activity/application', defer: true %>
9
- <link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/themes/prism.min.css" rel="stylesheet">
10
- <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/prism.min.js"></script>
11
-
12
- </head>
13
- <body>
14
- <div class="container">
15
- <%= yield %>
16
- </div>
17
-
18
- </body>
19
- </html>
@@ -1,56 +0,0 @@
1
- <table class="table table-borderless">
2
- <thead>
3
- <tr>
4
- <th>
5
- <div class="row">
6
- <div class="col-3">
7
- <b class="text-secondary">Action</b>
8
- </div>
9
- <div class="col-3">
10
- <b class="text-secondary">Record</b>
11
- </div>
12
- <div class="col-3">
13
- <b class="text-secondary">Actor</b>
14
- </div>
15
- <div class="col-3">
16
- <b class="text-secondary">Created At</b>
17
- </div>
18
- </div>
19
- </th>
20
- </tr>
21
- </thead>
22
- <tbody>
23
- <% @activities.each do |activity| %>
24
- <tr>
25
- <td>
26
- <div class="alert alert-info" type="button" data-bs-toggle="collapse" data-bs-target="#activity_<%= activity.id %>" aria-expanded="false" aria-controls="collapseExample">
27
- <div class="row">
28
- <div class="col-3">
29
- <%= activity_action(activity) %>
30
- </div>
31
- <div class="col-3">
32
- <%= t(activity.record_display_name) %>
33
- </div>
34
- <div class="col-3">
35
- <%= t(activity.actor_display_name) %>
36
- </div>
37
- <div class="col-3">
38
- <%= l(activity.created_at, format: :long) %>
39
- </div>
40
- </div>
41
- </div>
42
- <div class="collapse" id="activity_<%= activity.id %>">
43
- <pre>
44
- <code class="language-json">
45
- <%= format_json_for_display(activity.attrs) %>
46
- </code>
47
- </pre>
48
- </div>
49
- </td>
50
- </tr>
51
- <% end %>
52
- </tbody>
53
- </table>
54
- <script>
55
- Prism.highlightAll();
56
- </script>
@@ -1,2 +0,0 @@
1
- <h1>Activities#show</h1>
2
- <p>Find me in app/views/loggable_activity/activities/show.html.erb</p>