loggable_activity 0.2.1 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +29 -42
  3. data/.vscode/commands.json +2 -2
  4. data/.vscode/terminals.json +8 -8
  5. data/CHANGELOG.md +9 -0
  6. data/CHEAT_SHEET.md +31 -0
  7. data/MIT-LICENSE +21 -0
  8. data/README.md +1 -1
  9. data/Rakefile +6 -4
  10. data/app/assets/config/loggable_activity_manifest.js +2 -0
  11. data/app/assets/javascripts/loggable_activity/application.js +1 -0
  12. data/app/assets/stylesheets/loggable_activity/activities.scss +25 -0
  13. data/app/assets/stylesheets/loggable_activity/application.scss +16 -0
  14. data/app/controllers/concerns/.keep +0 -0
  15. data/app/controllers/loggable_activity/activities_controller.rb +12 -0
  16. data/app/controllers/loggable_activity/application_controller.rb +6 -0
  17. data/app/helpers/loggable_activity/activities_helper.rb +17 -0
  18. data/app/helpers/loggable_activity/application_helper.rb +6 -0
  19. data/app/jobs/loggable_activity/application_job.rb +6 -0
  20. data/app/mailers/loggable_activity/application_mailer.rb +8 -0
  21. data/app/models/loggable_activity/application_record.rb +7 -0
  22. data/app/views/kaminari/pico/_first_page.html.erb +13 -0
  23. data/app/views/kaminari/pico/_gap.html.erb +8 -0
  24. data/app/views/kaminari/pico/_last_page.html.erb +12 -0
  25. data/app/views/kaminari/pico/_next_page.html.erb +13 -0
  26. data/app/views/kaminari/pico/_page.html.erb +14 -0
  27. data/app/views/kaminari/pico/_paginator.html.erb +27 -0
  28. data/app/views/kaminari/pico/_prev_page.html.erb +14 -0
  29. data/app/views/layouts/loggable_activity/application.html.slim +20 -0
  30. data/app/views/loggable_activity/activities/_activities.html.slim +28 -0
  31. data/app/views/loggable_activity/activities/index.html.erb +6 -0
  32. data/app/views/loggable_activity/bootstrap/kaminari/_first_page.html.erb +13 -0
  33. data/app/views/loggable_activity/bootstrap/kaminari/_gap.html.erb +8 -0
  34. data/app/views/loggable_activity/bootstrap/kaminari/_last_page.html.erb +13 -0
  35. data/app/views/loggable_activity/bootstrap/kaminari/_next_page.html.erb +13 -0
  36. data/app/views/loggable_activity/bootstrap/kaminari/_page.html.erb +14 -0
  37. data/app/views/loggable_activity/bootstrap/kaminari/_paginator.html.erb +27 -0
  38. data/app/views/loggable_activity/bootstrap/kaminari/_prev_page.html.erb +13 -0
  39. data/config/initializers/kaminari_config.rb +14 -0
  40. data/config/routes.rb +7 -0
  41. data/{lib/generators/loggable_activity/templates/create_loggable_activities.rb → db/migrate/20240702092648_create_loggable_activity_tables.rb} +18 -10
  42. data/git-org/HEAD +1 -0
  43. data/git-org/config +7 -0
  44. data/git-org/description +1 -0
  45. data/git-org/hooks/applypatch-msg.sample +15 -0
  46. data/git-org/hooks/commit-msg.sample +24 -0
  47. data/git-org/hooks/fsmonitor-watchman.sample +174 -0
  48. data/git-org/hooks/post-update.sample +8 -0
  49. data/git-org/hooks/pre-applypatch.sample +14 -0
  50. data/git-org/hooks/pre-commit.sample +49 -0
  51. data/git-org/hooks/pre-merge-commit.sample +13 -0
  52. data/git-org/hooks/pre-push.sample +53 -0
  53. data/git-org/hooks/pre-rebase.sample +169 -0
  54. data/git-org/hooks/pre-receive.sample +24 -0
  55. data/git-org/hooks/prepare-commit-msg.sample +42 -0
  56. data/git-org/hooks/push-to-checkout.sample +78 -0
  57. data/git-org/hooks/update.sample +128 -0
  58. data/git-org/info/exclude +6 -0
  59. data/lib/loggable_activity/activity.rb +4 -3
  60. data/lib/{schemas → loggable_activity}/config_schema.json +3 -10
  61. data/lib/loggable_activity/configuration.rb +48 -77
  62. data/lib/loggable_activity/data_owner.rb +0 -1
  63. data/lib/loggable_activity/encryption.rb +16 -7
  64. data/lib/loggable_activity/encryption_key.rb +4 -7
  65. data/lib/loggable_activity/engine.rb +22 -0
  66. data/lib/loggable_activity/error.rb +0 -10
  67. data/lib/loggable_activity/hooks.rb +10 -15
  68. data/lib/loggable_activity/payload.rb +8 -11
  69. data/lib/loggable_activity/sanitizer.rb +6 -2
  70. data/lib/loggable_activity/services/base_payloads_builder.rb +14 -5
  71. data/lib/loggable_activity/services/destroy_payloads_builder.rb +2 -1
  72. data/lib/loggable_activity/services/payloads_builder.rb +12 -5
  73. data/lib/loggable_activity/services/update_payloads_builder.rb +34 -6
  74. data/lib/loggable_activity/version.rb +1 -1
  75. data/lib/loggable_activity.rb +51 -14
  76. data/lib/tasks/loggable_activity_tasks.rake +6 -0
  77. data/loggable_activity-0.5.0.gem +0 -0
  78. metadata +129 -109
  79. data/.document +0 -1
  80. data/.nojekyll +0 -1
  81. data/.rspec +0 -3
  82. data/CONSIDERTIONS.md +0 -129
  83. data/GETTING-STARTED.md +0 -119
  84. data/LICENSE.txt +0 -21
  85. data/PAYLOAD_EXAMPLE.md +0 -63
  86. data/ROADMAP.md +0 -23
  87. data/docs/LoggableActivity/Activity.html +0 -555
  88. data/docs/LoggableActivity/Configuration.html +0 -330
  89. data/docs/LoggableActivity/ConfigurationError.html +0 -148
  90. data/docs/LoggableActivity/DataOwner.html +0 -138
  91. data/docs/LoggableActivity/Encryption.html +0 -234
  92. data/docs/LoggableActivity/EncryptionError.html +0 -145
  93. data/docs/LoggableActivity/EncryptionKey.html +0 -351
  94. data/docs/LoggableActivity/Error.html +0 -145
  95. data/docs/LoggableActivity/Hooks.html +0 -759
  96. data/docs/LoggableActivity/Payload.html +0 -432
  97. data/docs/LoggableActivity/Services/BasePayloadsBuilder.html +0 -442
  98. data/docs/LoggableActivity/Services/DestroyPayloadsBuilder.html +0 -395
  99. data/docs/LoggableActivity/Services/PayloadsBuilder.html +0 -342
  100. data/docs/LoggableActivity/Services/UpdatePayloadsBuilder.html +0 -490
  101. data/docs/LoggableActivity/Services.html +0 -93
  102. data/docs/LoggableActivity.html +0 -102
  103. data/docs/created.rid +0 -14
  104. data/docs/css/fonts.css +0 -167
  105. data/docs/css/rdoc.css +0 -687
  106. data/docs/fonts/Lato-Light.ttf +0 -0
  107. data/docs/fonts/Lato-LightItalic.ttf +0 -0
  108. data/docs/fonts/Lato-Regular.ttf +0 -0
  109. data/docs/fonts/Lato-RegularItalic.ttf +0 -0
  110. data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
  111. data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
  112. data/docs/images/add.png +0 -0
  113. data/docs/images/arrow_up.png +0 -0
  114. data/docs/images/brick.png +0 -0
  115. data/docs/images/brick_link.png +0 -0
  116. data/docs/images/bug.png +0 -0
  117. data/docs/images/bullet_black.png +0 -0
  118. data/docs/images/bullet_toggle_minus.png +0 -0
  119. data/docs/images/bullet_toggle_plus.png +0 -0
  120. data/docs/images/date.png +0 -0
  121. data/docs/images/delete.png +0 -0
  122. data/docs/images/find.png +0 -0
  123. data/docs/images/loadingAnimation.gif +0 -0
  124. data/docs/images/macFFBgHack.png +0 -0
  125. data/docs/images/package.png +0 -0
  126. data/docs/images/page_green.png +0 -0
  127. data/docs/images/page_white_text.png +0 -0
  128. data/docs/images/page_white_width.png +0 -0
  129. data/docs/images/plugin.png +0 -0
  130. data/docs/images/ruby.png +0 -0
  131. data/docs/images/tag_blue.png +0 -0
  132. data/docs/images/tag_green.png +0 -0
  133. data/docs/images/transparent.png +0 -0
  134. data/docs/images/wrench.png +0 -0
  135. data/docs/images/wrench_orange.png +0 -0
  136. data/docs/images/zoom.png +0 -0
  137. data/docs/index.html +0 -99
  138. data/docs/js/darkfish.js +0 -97
  139. data/docs/js/navigation.js +0 -105
  140. data/docs/js/navigation.js.gz +0 -0
  141. data/docs/js/search.js +0 -110
  142. data/docs/js/search_index.js +0 -1
  143. data/docs/js/search_index.js.gz +0 -0
  144. data/docs/js/searcher.js +0 -229
  145. data/docs/js/searcher.js.gz +0 -0
  146. data/docs/table_of_contents.html +0 -617
  147. data/help/loggable_activity_help.txt +0 -19
  148. data/lib/generators/.DS_Store +0 -0
  149. data/lib/generators/loggable_activity/.DS_Store +0 -0
  150. data/lib/generators/loggable_activity/install_generator.rb +0 -109
  151. data/lib/generators/loggable_activity/templates/.DS_Store +0 -0
  152. data/lib/generators/loggable_activity/templates/binary_ids/create_loggable_activities.rb +0 -30
  153. data/lib/generators/loggable_activity/templates/config/locales/loggable_activity.en.yml +0 -36
  154. data/lib/generators/loggable_activity/templates/config/loggable_activity.yaml +0 -29
  155. data/lib/generators/loggable_activity/templates/loggable_activity.en.yaml +0 -36
  156. data/pkg/loggable_activity-0.1.35.gem +0 -0
  157. data/sig/loggable_activity.rbs +0 -4
  158. /data/{.rspec_status → app/assets/images/loggable_activity/.keep} +0 -0
  159. /data/lib/{generators/loggable_activity/templates → loggable_activity/concerns}/current_user.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c639f2566d6a3dd820a7657b9b8bb398e5a861347ae1bc7d7474724c6c344b4c
4
- data.tar.gz: 8551b4aab8f630be997b6af7b8372d7efd84221824bbacb25bb6c444f6c83978
3
+ metadata.gz: 24bd885b926bbd2d1b0795d5265b0121b03a99ea3057da14c60669de72d5ef98
4
+ data.tar.gz: b5d04e92f45bb6d7a1af4d1f6e22489cb4f88798771403ee6ad1cf97ae0433fd
5
5
  SHA512:
6
- metadata.gz: 03422fe2e2d154f894da7a0eab5fac78f1048b6e6d3d4addbf1fa0bd66d9a674913ca666a4a4e743cbaf95ff5edbfb8711641596330b370d5d29d3e0922f4af6
7
- data.tar.gz: '08de4b66e4aba0d210be64f83eb78b51fcb6c351d3340e9f1dfba334194d5c6a705daeefe6f66aae8a7cc8409a94b1ba4ec33d222a957e549b0811629f6ebfcb'
6
+ metadata.gz: 5a88d29b6655e37f8713ece59f8cbd48f36da48e2d1f1945e7de7f08572db4591109bd88b4804e6523d9a8c428c12799f04e7d220d221be4b48fc38c6761eee3
7
+ data.tar.gz: a6e037dc4d8732af308fc162134144a164815d5f1915701cad9cb5b543353fceac2b7bd0a56ae19bd028163eb42b78316f0a16d533da6f24bc0447e7f967bf3c
data/.rubocop.yml CHANGED
@@ -1,51 +1,38 @@
1
1
  AllCops:
2
- TargetRubyVersion: '3.2.0'
3
- NewCops: enable
4
- Exclude:
5
- # - 'vendor/**/*'
6
-
7
- Style/OpenStructUse:
8
- Enabled: false
9
-
10
- Style/Documentation:
11
- Enabled: false
12
-
13
- Gemspec/DevelopmentDependencies:
14
- Enabled: false
15
-
2
+ Exclude:
3
+ - 'db/migrate/20240702092648_create_loggable_activity_tables.rb'
16
4
  Layout/LineLength:
17
- Enabled: false
18
-
5
+ Exclude:
6
+ - 'lib/loggable_activity/services/payloads_builder.rb'
7
+ - 'lib/loggable_activity/hooks.rb'
8
+ - 'lib/loggable_activity/activity.rb'
9
+ Metrics/AbcSize:
10
+ Exclude:
11
+ - 'lib/loggable_activity/encryption.rb'
19
12
  Metrics/BlockLength:
20
- Enabled: false
21
-
22
- Metrics/MethodLength:
23
- Enabled: false
24
-
25
- Metrics/CyclomaticComplexity:
26
- Enabled: false
27
-
28
- Style/IfUnlessModifier:
29
- Enabled: false
30
-
31
- Metrics/PerceivedComplexity:
32
- Enabled: false
33
-
13
+ Exclude:
14
+ - 'test/dummy/config/environments/development.rb'
15
+ - 'loggable_activity.gemspec'
16
+ - 'test/dummy/db/schema.rb'
34
17
  Metrics/ClassLength:
35
18
  Exclude:
36
- - lib/loggable_activity/services/update_payloads_builder.rb
37
-
38
- Metrics/ParameterLists:
19
+ - 'lib/loggable_activity/services/update_payloads_builder.rb'
20
+ Metrics/MethodLength:
39
21
  Exclude:
40
- - lib/loggable_activity/services/base_payloads_builder.rb
41
-
22
+ - 'lib/loggable_activity/services/update_payloads_builder.rb'
23
+ - 'lib/loggable_activity/services/destroy_payloads_builder.rb'
24
+ - 'lib/loggable_activity/services/base_payloads_builder.rb'
25
+ - 'lib/loggable_activity/hooks.rb'
26
+ - 'lib/loggable_activity/encryption.rb'
27
+ - 'lib/loggable_activity/activity.rb'
28
+ - 'lib/loggable_activity/services/payloads_builder.rb'
29
+ - 'lib/loggable_activity/hooks.rb'
42
30
  Metrics/ModuleLength:
43
31
  Exclude:
44
- - lib/loggable_activity/hooks.rb
45
-
46
- Metrics/AbcSize:
32
+ - 'lib/loggable_activity/hooks.rb'
33
+ Style/Documentation:
47
34
  Exclude:
48
- - lib/loggable_activity/encryption.rb
49
- # - lib/loggable_activity/update_payloads_builderx.rb
50
- - lib/generators/loggable_activity/templates/binary_ids/create_loggable_activities.rb
51
- - lib/generators/loggable_activity/templates/create_loggable_activities.rb
35
+ - 'test/**/*'
36
+ - 'app/models/loggable_activity/application_record.rb'
37
+ - 'app/mailers/loggable_activity/application_mailer.rb'
38
+ - 'app/helpers/loggable_activity/application_helper.rb'
@@ -9,7 +9,7 @@
9
9
  "alignment": "right",
10
10
  "priority": 300,
11
11
  "tooltip": "Run test for current line",
12
- "filterFileRegex": ".*_spec\\.rb"
12
+ "filterFileRegex": ".*_test\\.rb"
13
13
  },
14
14
  {
15
15
  "command": "terminals.runTerminalByName",
@@ -20,7 +20,7 @@
20
20
  "alignment": "right",
21
21
  "priority": 290,
22
22
  "tooltip": "Run test for current file",
23
- "filterFileRegex": ".*_spec\\.rb"
23
+ "filterFileRegex": ".*_test\\.rb"
24
24
  }
25
25
  ]
26
26
  }
@@ -8,10 +8,10 @@
8
8
  "onlySingle": true,
9
9
  "icon": "run",
10
10
  "commands": [
11
- "dir=[file] && test_path=${${(s:/spec/:)dir}[1]} && file=\"spec/\"${${(s:/spec/:)dir}[2]}",
12
- "echo \"$dir\\n$test_path\\n$file:[lineNumber]\"",
13
- "cd $test_path",
14
- "rspec $file:[lineNumber]"
11
+ "dir=$(dirname [file]) && test_file=$(basename [file])",
12
+ "echo \"$dir\\n$test_file:[lineNumber]\"",
13
+ "cd $dir",
14
+ "rails test $dir/$test_file:[lineNumber]"
15
15
  ]
16
16
  },
17
17
  {
@@ -21,10 +21,10 @@
21
21
  "onlySingle": true,
22
22
  "icon": "run-all",
23
23
  "commands": [
24
- "dir=[file] && test_path=${${(s:/spec/:)dir}[1]} && file=\"spec/\"${${(s:/spec/:)dir}[2]}",
25
- "echo \"$dir\\n$test_path\\n$file\"",
26
- "cd $test_path",
27
- "rspec $file"
24
+ "dir=$(dirname [file]) && test_file=$(basename [file])",
25
+ "echo \"$dir\\n$test_file\"",
26
+ "cd $dir",
27
+ "rails test $dir/$test_file"
28
28
  ]
29
29
  }
30
30
  ]
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/CHEAT_SHEET.md ADDED
@@ -0,0 +1,31 @@
1
+ ### Build gem on localhost
2
+ ```
3
+ gem build loggable_activity.gemspec
4
+ ```
5
+
6
+ ### Release gem
7
+ - Catch DONT update VERSION, this is done by `gem bump --version x.x.x`
8
+ - Update the CHANGE_LOG.md
9
+
10
+ Make sure `gem install gem-release` is installed
11
+
12
+ ```
13
+ $ gem bump --version 0.3.0
14
+ $ rake release
15
+ $ read terminal output and authorize release
16
+ ```
17
+
18
+ ### Heroku
19
+ ```
20
+ $ heroku pg:backups:capture --app loggableactivity
21
+ $ heroku pg:backups:download --app loggableactivity
22
+ ```
23
+ install on localhost
24
+ ```
25
+ $ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U maxgronlund -d activity_logger_development latest.dump
26
+ ```
27
+
28
+ ## Build documentation
29
+ ```
30
+ $ rdoc -o docs/ --all --main
31
+ ```
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright Max
2
+ Groenlund
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -30,7 +30,7 @@ Beside the journal in the db, an activity log is kept so it is possible to track
30
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
31
 
32
32
  ### Getting started
33
- please read the [GETTING-STARTED.md](https://github.com/maxgronlund/LoggableActivity/blob/main/GETTING-STARTED.md) guide
33
+ please read the [GETTING-STARTED.md](https://github.com/LoggableActivity/LoggableActivity/blob/main/GETTING-STARTED.md) guide
34
34
 
35
35
  ### Contribute
36
36
  👉 Join the Slack channel here: [LoggableActivity Slack Workspace](https://join.slack.com/t/loggableactivity/shared_invite/zt-2a3tvgv37-mGwjHJTrBXBH2srXFRRSXQ)
data/Rakefile CHANGED
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
3
+ require 'bundler/setup'
4
+
5
+ APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
6
+ load 'rails/tasks/engine.rake'
5
7
 
6
- RSpec::Core::RakeTask.new(:spec)
8
+ load 'rails/tasks/statistics.rake'
7
9
 
8
- task default: :spec
10
+ require 'bundler/gem_tasks'
@@ -0,0 +1,2 @@
1
+ //= link_directory ../stylesheets/loggable_activity .css
2
+
@@ -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
+ }
@@ -0,0 +1,16 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ *= require loggable_activity/activities
16
+ */
File without changes
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LoggableActivity
4
+ # Controller for activities
5
+ class ActivitiesController < ApplicationController
6
+ def index
7
+ @activities = LoggableActivity::Activity.order(created_at: :desc).page params[:page]
8
+ end
9
+
10
+ def show; end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LoggableActivity
4
+ class ApplicationController < ActionController::Base
5
+ end
6
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LoggableActivity
4
+ # Helper methods for activities
5
+ module ActivitiesHelper
6
+ require 'json'
7
+ def activity_action(activity)
8
+ I18n.t("loggable_activity.#{activity.action}")
9
+ end
10
+
11
+ def format_json_for_display(hash_data)
12
+ JSON.pretty_generate(hash_data)
13
+ rescue JSON::ParserError
14
+ hash_data.to_s
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LoggableActivity
4
+ module ApplicationHelper
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LoggableActivity
4
+ class ApplicationJob < ActiveJob::Base
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LoggableActivity
4
+ class ApplicationMailer < ActionMailer::Base
5
+ default from: 'from@example.com'
6
+ layout 'mailer'
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LoggableActivity
4
+ class ApplicationRecord < ActiveRecord::Base
5
+ self.abstract_class = true
6
+ end
7
+ end
@@ -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,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,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,14 @@
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', :remote => remote, :class => 'page-link' %>
12
+ <%= link_to_unless current_page.first?, raw(t('views.pagination.previous')), url, rel: 'prev', class: 'page-link', data: { turbo: true }, remote: remote %>
13
+ </li>
14
+ <% 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();
@@ -0,0 +1,6 @@
1
+ <div class="container">
2
+ <h1>Activities</h1>
3
+ <%= paginate @activities, views_prefix: "loggable_activity/bootstrap" %>
4
+ <%= render partial: "activities", activities: @activities %>
5
+ </div>
6
+
@@ -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 "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
+ <li class="page-item">
11
+ <%= link_to_unless current_page.last?, raw(t('views.pagination.last')), url, class: 'page-link', data: { turbo: true } %>
12
+ </li>
13
+ <% end %>
@@ -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 -%>