beetle_reporter 0.1.0 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -0
- data/README.md +70 -16
- data/Rakefile +5 -9
- data/app/assets/config/beetle_reporter_manifest.js +1 -0
- data/app/assets/stylesheets/beetle_reporter/application.css +15 -0
- data/app/assets/stylesheets/beetle_reporter/home.css +4 -0
- data/app/assets/stylesheets/beetle_reporter/reports.css +4 -0
- data/app/assets/stylesheets/beetle_reporter/tailwind.min.css +1 -0
- data/app/assets/stylesheets/scaffold.css +80 -0
- data/app/controllers/beetle_reporter/application_controller.rb +11 -0
- data/app/controllers/beetle_reporter/home_controller.rb +8 -0
- data/app/controllers/beetle_reporter/reports_controller.rb +166 -0
- data/app/helpers/beetle_reporter/application_helper.rb +9 -0
- data/app/helpers/beetle_reporter/home_helper.rb +4 -0
- data/app/helpers/beetle_reporter/reports_helper.rb +4 -0
- data/app/jobs/beetle_reporter/application_job.rb +4 -0
- data/app/mailers/beetle_reporter/application_mailer.rb +6 -0
- data/app/models/beetle_reporter/application_record.rb +5 -0
- data/app/models/beetle_reporter/report.rb +123 -0
- data/app/views/beetle_reporter/home/index.html.haml +4 -0
- data/app/views/beetle_reporter/reports/_form.html.haml +14 -0
- data/app/views/beetle_reporter/reports/_report.html.haml +55 -0
- data/app/views/beetle_reporter/reports/destroy.turbo_stream.haml +1 -0
- data/app/views/beetle_reporter/reports/edit.html.haml +6 -0
- data/app/views/beetle_reporter/reports/index.html.haml +38 -0
- data/app/views/beetle_reporter/reports/new.html.haml +5 -0
- data/app/views/beetle_reporter/reports/show.html.haml +1 -0
- data/app/views/layouts/beetle_reporter/application.html.haml +22 -0
- data/config/locales/beetle_reporter.yml +18 -0
- data/config/routes.rb +13 -0
- data/db/migrate/20211216073022_create_beetle_reporter_reports.rb +20 -0
- data/lib/beetle_reporter/configuration.rb +9 -0
- data/lib/beetle_reporter/engine.rb +9 -0
- data/lib/beetle_reporter/version.rb +1 -3
- data/lib/beetle_reporter.rb +46 -4
- data/lib/tasks/beetle_reporter_tasks.rake +4 -0
- metadata +137 -15
- data/.rspec +0 -3
- data/.rubocop.yml +0 -13
- data/CHANGELOG.md +0 -5
- data/Gemfile +0 -12
- data/LICENSE.txt +0 -21
- data/beetle_reporter.gemspec +0 -39
- data/bin/console +0 -15
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e21f52dd81361247e7975618d2845f2f4fcad19105ccc425de454b56ac2d68e
|
4
|
+
data.tar.gz: 78a8a0b42e6109b2635999728cbd17007b9cdc848d218e73f01fb0add257d085
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a433451965599cf2dd833c770d4a588e742158cf99fcafe3d47822fd005dc41cc2acfafea4cf606ab95825017e7fd778d12b0b9d316d5c038f0082f1dcedea7
|
7
|
+
data.tar.gz: 8ad3142dc940e29a0990e4ed054da58251dbcdcb8af33e006abdf131fb4bdd42c9aec86d54db4bbc8e9e4e13d623192c073a5c3b2e946ae0d7c2345bbd2c570a
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2021 42up
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# BeetleReporter
|
2
|
+
Short description and motivation.
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
6
|
|
7
7
|
## Installation
|
8
|
-
|
9
8
|
Add this line to your application's Gemfile:
|
10
9
|
|
11
10
|
```ruby
|
@@ -13,27 +12,82 @@ gem 'beetle_reporter'
|
|
13
12
|
```
|
14
13
|
|
15
14
|
And then execute:
|
16
|
-
|
17
|
-
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
18
|
|
19
19
|
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install beetle_reporter
|
22
|
+
```
|
20
23
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
路由
|
25
|
+
```ruby
|
26
|
+
mount BeetleReporter::Engine => "/beetle_reporter", as: "beetle_reporter"
|
27
|
+
```
|
24
28
|
|
25
|
-
|
29
|
+
初始化配置
|
30
|
+
```ruby
|
31
|
+
BeetleReporter.configure do |config|
|
32
|
+
config.user_class = 'Admin'
|
33
|
+
config.user_name_method = 'username'
|
26
34
|
|
27
|
-
|
35
|
+
config.main_app_root_path_method = 'admins_user_root_path'
|
36
|
+
config.main_app_user_path_method = 'admins_user_path'
|
37
|
+
end
|
38
|
+
```
|
28
39
|
|
29
|
-
|
40
|
+
实现hook方法
|
41
|
+
```ruby
|
42
|
+
class Diary
|
43
|
+
def beetle_record_path
|
44
|
+
Rails.application.routes.url_helpers.admins_diary_path(id)
|
45
|
+
end
|
46
|
+
|
47
|
+
def beetle_hide
|
48
|
+
update_columns(is_approved: false)
|
49
|
+
end
|
50
|
+
|
51
|
+
def beetle_undo_hide
|
52
|
+
update_columns(is_approved: true)
|
53
|
+
end
|
54
|
+
|
55
|
+
def beetle_remove
|
56
|
+
discard
|
57
|
+
end
|
58
|
+
|
59
|
+
def beetle_undo_remove
|
60
|
+
undiscard
|
61
|
+
end
|
62
|
+
|
63
|
+
def beetle_mute
|
64
|
+
true
|
65
|
+
end
|
66
|
+
|
67
|
+
def beetle_undo_mute
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
def beetle_forbid
|
72
|
+
true
|
73
|
+
end
|
74
|
+
|
75
|
+
def beetle_undo_forbid
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
def beetle_record_partial_path
|
80
|
+
"admins/diaries/beetle"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
```
|
30
84
|
|
31
|
-
|
85
|
+
## 约定
|
86
|
+
+ 支持 `is_approved` 字段
|
87
|
+
+ 支持 `discard` 软删 gem
|
32
88
|
|
33
89
|
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/beetle_reporter.
|
90
|
+
Contribution directions go here.
|
36
91
|
|
37
92
|
## License
|
38
|
-
|
39
93
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -1,12 +1,8 @@
|
|
1
|
-
|
1
|
+
require "bundler/setup"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
3
|
+
APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
|
4
|
+
load "rails/tasks/engine.rake"
|
7
5
|
|
8
|
-
|
6
|
+
load "rails/tasks/statistics.rake"
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
task default: %i[spec rubocop]
|
8
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/beetle_reporter .css
|
@@ -0,0 +1,15 @@
|
|
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
|
+
*/
|