beetle_reporter 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +70 -16
  4. data/Rakefile +5 -9
  5. data/app/assets/config/beetle_reporter_manifest.js +1 -0
  6. data/app/assets/stylesheets/beetle_reporter/application.css +15 -0
  7. data/app/assets/stylesheets/beetle_reporter/home.css +4 -0
  8. data/app/assets/stylesheets/beetle_reporter/reports.css +4 -0
  9. data/app/assets/stylesheets/beetle_reporter/tailwind.min.css +1 -0
  10. data/app/assets/stylesheets/scaffold.css +80 -0
  11. data/app/controllers/beetle_reporter/application_controller.rb +11 -0
  12. data/app/controllers/beetle_reporter/home_controller.rb +8 -0
  13. data/app/controllers/beetle_reporter/reports_controller.rb +143 -0
  14. data/app/helpers/beetle_reporter/application_helper.rb +9 -0
  15. data/app/helpers/beetle_reporter/home_helper.rb +4 -0
  16. data/app/helpers/beetle_reporter/reports_helper.rb +4 -0
  17. data/app/jobs/beetle_reporter/application_job.rb +4 -0
  18. data/app/mailers/beetle_reporter/application_mailer.rb +6 -0
  19. data/app/models/beetle_reporter/application_record.rb +5 -0
  20. data/app/models/beetle_reporter/report.rb +126 -0
  21. data/app/views/beetle_reporter/home/index.html.haml +4 -0
  22. data/app/views/beetle_reporter/reports/_form.html.haml +14 -0
  23. data/app/views/beetle_reporter/reports/_report.html.haml +57 -0
  24. data/app/views/beetle_reporter/reports/destroy.turbo_stream.haml +1 -0
  25. data/app/views/beetle_reporter/reports/edit.html.haml +6 -0
  26. data/app/views/beetle_reporter/reports/index.html.haml +38 -0
  27. data/app/views/beetle_reporter/reports/new.html.haml +5 -0
  28. data/app/views/beetle_reporter/reports/show.html.haml +1 -0
  29. data/app/views/layouts/beetle_reporter/application.html.haml +22 -0
  30. data/config/locales/beetle_reporter.yml +18 -0
  31. data/config/routes.rb +13 -0
  32. data/db/migrate/20211216073022_create_beetle_reporter_reports.rb +20 -0
  33. data/lib/beetle_reporter/configuration.rb +9 -0
  34. data/lib/beetle_reporter/engine.rb +9 -0
  35. data/lib/beetle_reporter/version.rb +1 -3
  36. data/lib/beetle_reporter.rb +46 -4
  37. data/lib/tasks/beetle_reporter_tasks.rake +4 -0
  38. metadata +137 -15
  39. data/.rspec +0 -3
  40. data/.rubocop.yml +0 -13
  41. data/CHANGELOG.md +0 -5
  42. data/Gemfile +0 -12
  43. data/LICENSE.txt +0 -21
  44. data/beetle_reporter.gemspec +0 -39
  45. data/bin/console +0 -15
  46. data/bin/setup +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b36c45e5e90842e9caf265c5d6b5af031f2e01fa9c7557a9e3aaa63313a87a93
4
- data.tar.gz: c86b27daab8de919d9526b6b75ba08c499e77ffd4938f34309660f950e0fb9a5
3
+ metadata.gz: 224576858692394234faa775751f23ebfa338a9aaabd4fd50330f60d87b38751
4
+ data.tar.gz: 34afd7af8fa7c95315722dc50ee4110c5c8f1924a0bcf02aa334650fc3dc46b1
5
5
  SHA512:
6
- metadata.gz: b2c39dad2ef2fdee37da4169d008900dac4ae1205ce1f3edb501af211fbd3caeda7272eac300d750f0aeca7b3b897c80e831b9a5126cc10dd6244ca69760e357
7
- data.tar.gz: 7d6ee8e9185e6567190b692a2078e6f5466667d38b71ffa6a9e8a7d1c2334db82eb9f7a8a6654053848136a6485283f48bff5cfb9375b1212edf7a1aa7155318
6
+ metadata.gz: d3c6f2ce890632f07592eeedbe7a7a6d8dbea53d303b28325f931ed0ed4cf934f191c0c0bf0ccf48b60961476fbfc84063f70171cb31016610aaebe0c78117b4
7
+ data.tar.gz: 667a1644f4244932806802bb813729d9a3569f4d43a8e0f961007ae87c269f2ac1b2638d485d110fc6a5974aea3e32f1c2c7073642162e27c30f3c39aea8b91c
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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/beetle_reporter`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- $ bundle install
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
- $ gem install beetle_reporter
22
-
23
- ## Usage
24
+ 路由
25
+ ```ruby
26
+ mount BeetleReporter::Engine => "/beetle_reporter", as: "beetle_reporter"
27
+ ```
24
28
 
25
- TODO: Write usage instructions here
29
+ 初始化配置
30
+ ```ruby
31
+ BeetleReporter.configure do |config|
32
+ config.user_class = 'Admin'
33
+ config.user_name_method = 'username'
26
34
 
27
- ## Development
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
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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_images
80
+ pictures.map{|pic| {src: pic.full_url} }
81
+ end
82
+ end
83
+ ```
30
84
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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
- # frozen_string_literal: true
1
+ require "bundler/setup"
2
2
 
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
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
- require "rubocop/rake_task"
6
+ load "rails/tasks/statistics.rake"
9
7
 
10
- RuboCop::RakeTask.new
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
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */