loggable_activity 0.2.1c → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +29 -42
- data/.vscode/commands.json +2 -2
- data/.vscode/terminals.json +8 -8
- data/CHANGELOG.md +0 -3
- data/CHEAT_SHEET.md +31 -0
- data/MIT-LICENSE +21 -0
- data/README.md +31 -45
- data/Rakefile +6 -4
- data/app/assets/config/loggable_activity_manifest.js +4 -0
- data/app/assets/javascripts/loggable_activity/application.js +2 -0
- data/app/assets/stylesheets/loggable_activity/application.scss +20 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/loggable_activity/activities_controller.rb +12 -0
- data/app/controllers/loggable_activity/application_controller.rb +6 -0
- data/app/helpers/loggable_activity/activities_helper.rb +17 -0
- data/app/helpers/loggable_activity/application_helper.rb +6 -0
- data/app/jobs/loggable_activity/application_job.rb +6 -0
- data/app/mailers/loggable_activity/application_mailer.rb +8 -0
- data/app/models/loggable_activity/application_record.rb +7 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_first_page.html.erb +14 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_gap.html.erb +8 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_last_page.html.erb +13 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_next_page.html.erb +13 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_page.html.erb +14 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_paginator.html.erb +27 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_prev_page.html.erb +14 -0
- data/app/views/layouts/loggable_activity/application.html.erb +19 -0
- data/app/views/loggable_activity/activities/_activities.html.erb +56 -0
- data/app/views/loggable_activity/activities/index.html.erb +7 -0
- data/app/views/loggable_activity/activities/show.html.erb +2 -0
- data/config/initializers/kaminari_config.rb +14 -0
- data/config/routes.rb +7 -0
- data/{lib/generators/loggable_activity/templates/create_loggable_activities.rb → db/migrate/20240702092648_create_loggable_activity_tables.rb} +18 -10
- data/git-org/HEAD +1 -0
- data/git-org/config +7 -0
- data/git-org/description +1 -0
- data/git-org/hooks/applypatch-msg.sample +15 -0
- data/git-org/hooks/commit-msg.sample +24 -0
- data/git-org/hooks/fsmonitor-watchman.sample +174 -0
- data/git-org/hooks/post-update.sample +8 -0
- data/git-org/hooks/pre-applypatch.sample +14 -0
- data/git-org/hooks/pre-commit.sample +49 -0
- data/git-org/hooks/pre-merge-commit.sample +13 -0
- data/git-org/hooks/pre-push.sample +53 -0
- data/git-org/hooks/pre-rebase.sample +169 -0
- data/git-org/hooks/pre-receive.sample +24 -0
- data/git-org/hooks/prepare-commit-msg.sample +42 -0
- data/git-org/hooks/push-to-checkout.sample +78 -0
- data/git-org/hooks/update.sample +128 -0
- data/git-org/info/exclude +6 -0
- data/lib/loggable_activity/activity.rb +3 -3
- data/lib/{schemas → loggable_activity}/config_schema.json +3 -3
- data/lib/loggable_activity/configuration.rb +51 -74
- data/lib/loggable_activity/data_owner.rb +0 -1
- data/lib/loggable_activity/encryption.rb +16 -7
- data/lib/loggable_activity/encryption_key.rb +4 -7
- data/lib/loggable_activity/engine.rb +27 -0
- data/lib/loggable_activity/error.rb +0 -10
- data/lib/loggable_activity/hooks.rb +10 -5
- data/lib/loggable_activity/payload.rb +8 -11
- data/lib/loggable_activity/sanitizer.rb +6 -2
- data/lib/loggable_activity/services/base_payloads_builder.rb +14 -5
- data/lib/loggable_activity/services/destroy_payloads_builder.rb +2 -1
- data/lib/loggable_activity/services/payloads_builder.rb +9 -2
- data/lib/loggable_activity/services/update_payloads_builder.rb +30 -2
- data/lib/loggable_activity/version.rb +1 -1
- data/lib/loggable_activity.rb +51 -14
- data/lib/tasks/loggable_activity_tasks.rake +6 -0
- metadata +126 -114
- data/.document +0 -1
- data/.nojekyll +0 -1
- data/.rspec +0 -3
- data/CONSIDERTIONS.md +0 -129
- data/GETTING-STARTED.md +0 -119
- data/LICENSE.txt +0 -21
- data/PAYLOAD_EXAMPLE.md +0 -63
- data/ROADMAP.md +0 -23
- data/docs/LoggableActivity/Activity.html +0 -555
- data/docs/LoggableActivity/Configuration.html +0 -330
- data/docs/LoggableActivity/ConfigurationError.html +0 -148
- data/docs/LoggableActivity/DataOwner.html +0 -138
- data/docs/LoggableActivity/Encryption.html +0 -234
- data/docs/LoggableActivity/EncryptionError.html +0 -145
- data/docs/LoggableActivity/EncryptionKey.html +0 -351
- data/docs/LoggableActivity/Error.html +0 -145
- data/docs/LoggableActivity/Hooks.html +0 -759
- data/docs/LoggableActivity/Payload.html +0 -432
- data/docs/LoggableActivity/Services/BasePayloadsBuilder.html +0 -442
- data/docs/LoggableActivity/Services/DestroyPayloadsBuilder.html +0 -395
- data/docs/LoggableActivity/Services/PayloadsBuilder.html +0 -342
- data/docs/LoggableActivity/Services/UpdatePayloadsBuilder.html +0 -490
- data/docs/LoggableActivity/Services.html +0 -93
- data/docs/LoggableActivity.html +0 -102
- data/docs/created.rid +0 -14
- data/docs/css/fonts.css +0 -167
- data/docs/css/rdoc.css +0 -687
- data/docs/fonts/Lato-Light.ttf +0 -0
- data/docs/fonts/Lato-LightItalic.ttf +0 -0
- data/docs/fonts/Lato-Regular.ttf +0 -0
- data/docs/fonts/Lato-RegularItalic.ttf +0 -0
- data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
- data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
- data/docs/images/add.png +0 -0
- data/docs/images/arrow_up.png +0 -0
- data/docs/images/brick.png +0 -0
- data/docs/images/brick_link.png +0 -0
- data/docs/images/bug.png +0 -0
- data/docs/images/bullet_black.png +0 -0
- data/docs/images/bullet_toggle_minus.png +0 -0
- data/docs/images/bullet_toggle_plus.png +0 -0
- data/docs/images/date.png +0 -0
- data/docs/images/delete.png +0 -0
- data/docs/images/find.png +0 -0
- data/docs/images/loadingAnimation.gif +0 -0
- data/docs/images/macFFBgHack.png +0 -0
- data/docs/images/package.png +0 -0
- data/docs/images/page_green.png +0 -0
- data/docs/images/page_white_text.png +0 -0
- data/docs/images/page_white_width.png +0 -0
- data/docs/images/plugin.png +0 -0
- data/docs/images/ruby.png +0 -0
- data/docs/images/tag_blue.png +0 -0
- data/docs/images/tag_green.png +0 -0
- data/docs/images/transparent.png +0 -0
- data/docs/images/wrench.png +0 -0
- data/docs/images/wrench_orange.png +0 -0
- data/docs/images/zoom.png +0 -0
- data/docs/index.html +0 -99
- data/docs/js/darkfish.js +0 -97
- data/docs/js/navigation.js +0 -105
- data/docs/js/navigation.js.gz +0 -0
- data/docs/js/search.js +0 -110
- data/docs/js/search_index.js +0 -1
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +0 -229
- data/docs/js/searcher.js.gz +0 -0
- data/docs/table_of_contents.html +0 -617
- data/help/loggable_activity_help.txt +0 -19
- data/lib/generators/.DS_Store +0 -0
- data/lib/generators/loggable_activity/.DS_Store +0 -0
- data/lib/generators/loggable_activity/install_generator.rb +0 -109
- data/lib/generators/loggable_activity/templates/.DS_Store +0 -0
- data/lib/generators/loggable_activity/templates/binary_ids/create_loggable_activities.rb +0 -30
- data/lib/generators/loggable_activity/templates/config/locales/loggable_activity.en.yml +0 -36
- data/lib/generators/loggable_activity/templates/config/loggable_activity.yaml +0 -29
- data/lib/generators/loggable_activity/templates/loggable_activity.en.yaml +0 -36
- data/pkg/loggable_activity-0.1.35.gem +0 -0
- data/sig/loggable_activity.rbs +0 -4
- /data/{.rspec_status → app/assets/images/loggable_activity/.keep} +0 -0
- /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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62e1b197ae053af29d55c9b183c358a773f43186691c20c8e124ba7786bde586
|
4
|
+
data.tar.gz: ae8bd2c8d9a9718c02fc246c2a5a703b6fad9b27823cf357a51020d96b0a5a16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ed08eae394bc830b08d21f68de6b3f77811fde3b73d4278351bc807ee7c9de3369632bb349f16e45dd518e74297064494b1f810bb1b2c3cf1744d34f898adf9
|
7
|
+
data.tar.gz: 91891b25f6826cd70fcacc3bd3365a14b50e319c6d3af6ceecf72cb8340adb1298a79d28a1d08964087011c9e3766e188fe80193a3d293d087611a543817a7f4
|
data/.rubocop.yml
CHANGED
@@ -1,51 +1,38 @@
|
|
1
1
|
AllCops:
|
2
|
-
|
3
|
-
|
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
|
-
|
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
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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/
|
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
|
-
-
|
49
|
-
|
50
|
-
-
|
51
|
-
-
|
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'
|
data/.vscode/commands.json
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"alignment": "right",
|
10
10
|
"priority": 300,
|
11
11
|
"tooltip": "Run test for current line",
|
12
|
-
"filterFileRegex": ".*
|
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": ".*
|
23
|
+
"filterFileRegex": ".*_test\\.rb"
|
24
24
|
}
|
25
25
|
]
|
26
26
|
}
|
data/.vscode/terminals.json
CHANGED
@@ -8,10 +8,10 @@
|
|
8
8
|
"onlySingle": true,
|
9
9
|
"icon": "run",
|
10
10
|
"commands": [
|
11
|
-
"dir
|
12
|
-
"echo \"$dir\\n$
|
13
|
-
"cd $
|
14
|
-
"
|
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
|
25
|
-
"echo \"$dir\\n$
|
26
|
-
"cd $
|
27
|
-
"
|
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
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
@@ -1,45 +1,31 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
+
# 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
|
data/Rakefile
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'bundler/
|
4
|
-
|
3
|
+
require 'bundler/setup'
|
4
|
+
|
5
|
+
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
6
|
+
load 'rails/tasks/engine.rake'
|
5
7
|
|
6
|
-
|
8
|
+
load 'rails/tasks/statistics.rake'
|
7
9
|
|
8
|
-
|
10
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,20 @@
|
|
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
|
+
*/
|
16
|
+
|
17
|
+
@import "bootstrap/functions";
|
18
|
+
@import "bootstrap/variables";
|
19
|
+
@import "bootstrap/mixins";
|
20
|
+
@import "bootstrap";
|
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,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,14 @@
|
|
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', :remote => remote %>
|
12
|
+
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, class: 'page-link', data: { turbo: true } %>
|
13
|
+
</li>
|
14
|
+
<% 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 -%>
|
@@ -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,19 @@
|
|
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>
|
@@ -0,0 +1,56 @@
|
|
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>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Kaminari.configure do |config|
|
4
|
+
config.default_per_page = 3
|
5
|
+
# config.max_per_page = nil
|
6
|
+
# config.window = 4
|
7
|
+
# config.outer_window = 0
|
8
|
+
# config.left = 0
|
9
|
+
# config.right = 0
|
10
|
+
# config.page_method_name = :page
|
11
|
+
# config.param_name = :page
|
12
|
+
# config.max_pages = nil
|
13
|
+
# config.params_on_first_page = false
|
14
|
+
end
|