rails-image-post-solution 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +50 -41
- data/config/routes.rb +10 -10
- data/lib/rails_image_post_solution/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2120b2a444d646648b7e9fe57165b4a89f2bffd99b9e6ca2e4aeb19f924dd626
|
|
4
|
+
data.tar.gz: fadbb2a26397c2f4172630cbb24ef71f63dc05fd56463097856d0c0516c797bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5472105bd1e6764ff1f977b4f46900f1f7560531a0c30ee05b94b59a645ee8ca103a9d3fcc966328203295796f9cf8fae4a4c41d49034ad9ad65cfe1086bde76
|
|
7
|
+
data.tar.gz: 57655c478d8a9a30e4c4f7e3e1158cc62c58eda115725c53810b043ced3599da95c28373c8804e650f1235d99b73deace7a2e16db25ed5cbc942821722117b07
|
data/README.md
CHANGED
|
@@ -62,7 +62,39 @@ Mount the engine in your `config/routes.rb`:
|
|
|
62
62
|
|
|
63
63
|
```ruby
|
|
64
64
|
Rails.application.routes.draw do
|
|
65
|
+
# Mount the engine (admin routes will be at /moderation/admin/image_reports)
|
|
65
66
|
mount RailsImagePostSolution::Engine => "/moderation"
|
|
67
|
+
|
|
68
|
+
# Optional: Add direct admin routes (accessible at /admin/*)
|
|
69
|
+
namespace :admin do
|
|
70
|
+
resources :image_reports, only: %i[index show], controller: 'admin/image_reports' do
|
|
71
|
+
member do
|
|
72
|
+
patch :confirm
|
|
73
|
+
patch :dismiss
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
resources :users, only: %i[index show], controller: 'admin/users' do
|
|
78
|
+
member do
|
|
79
|
+
post :suspend
|
|
80
|
+
post :unsuspend
|
|
81
|
+
post :ban
|
|
82
|
+
post :unban
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
resources :frozen_posts, only: [:index], controller: 'admin/frozen_posts' do
|
|
87
|
+
collection do
|
|
88
|
+
post "unfreeze_stage/:id", to: "admin/frozen_posts#unfreeze_stage", as: :unfreeze_stage
|
|
89
|
+
post "unfreeze_comment/:id", to: "admin/frozen_posts#unfreeze_comment", as: :unfreeze_comment
|
|
90
|
+
post "permanent_freeze_stage/:id", to: "admin/frozen_posts#permanent_freeze_stage", as: :permanent_freeze_stage
|
|
91
|
+
post "permanent_freeze_comment/:id", to: "admin/frozen_posts#permanent_freeze_comment", as: :permanent_freeze_comment
|
|
92
|
+
delete "destroy_stage/:id", to: "admin/frozen_posts#destroy_stage", as: :destroy_stage
|
|
93
|
+
delete "destroy_comment/:id", to: "admin/frozen_posts#destroy_comment", as: :destroy_comment
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
66
98
|
# ... your other routes
|
|
67
99
|
end
|
|
68
100
|
```
|
|
@@ -294,7 +326,9 @@ end
|
|
|
294
326
|
|
|
295
327
|
## Routes
|
|
296
328
|
|
|
297
|
-
|
|
329
|
+
### Engine Routes (via /moderation mount point)
|
|
330
|
+
|
|
331
|
+
When you mount the engine at `/moderation`, these routes are available:
|
|
298
332
|
|
|
299
333
|
```
|
|
300
334
|
POST /moderation/image_reports # Create report
|
|
@@ -302,51 +336,26 @@ GET /moderation/admin/image_reports # List all reports
|
|
|
302
336
|
GET /moderation/admin/image_reports/:id # View report details
|
|
303
337
|
PATCH /moderation/admin/image_reports/:id/confirm # Mark as inappropriate
|
|
304
338
|
PATCH /moderation/admin/image_reports/:id/dismiss # Mark as safe
|
|
339
|
+
GET /moderation/admin/users # List all users
|
|
340
|
+
GET /moderation/admin/users/:id # View user details
|
|
341
|
+
POST /moderation/admin/users/:id/suspend # Suspend user
|
|
342
|
+
POST /moderation/admin/users/:id/unsuspend # Unsuspend user
|
|
343
|
+
POST /moderation/admin/users/:id/ban # Ban user
|
|
344
|
+
POST /moderation/admin/users/:id/unban # Unban user
|
|
345
|
+
GET /moderation/admin/frozen_posts # List frozen posts
|
|
305
346
|
```
|
|
306
347
|
|
|
307
|
-
###
|
|
348
|
+
### Optional: Direct Admin Routes (via host application routes)
|
|
308
349
|
|
|
309
|
-
|
|
350
|
+
If you want admin routes accessible at `/admin/*` instead of `/moderation/admin/*`, add the routes shown in the Installation section to your host application's `config/routes.rb`. This allows you to access:
|
|
310
351
|
|
|
311
|
-
```ruby
|
|
312
|
-
namespace :admin do
|
|
313
|
-
# User management
|
|
314
|
-
resources :users, only: [:index, :show] do
|
|
315
|
-
member do
|
|
316
|
-
post :suspend
|
|
317
|
-
post :unsuspend
|
|
318
|
-
post :ban
|
|
319
|
-
post :unban
|
|
320
|
-
end
|
|
321
|
-
end
|
|
322
|
-
|
|
323
|
-
# Frozen posts management
|
|
324
|
-
resources :frozen_posts, only: [:index] do
|
|
325
|
-
collection do
|
|
326
|
-
post 'unfreeze_stage/:id', action: :unfreeze_stage, as: :unfreeze_stage
|
|
327
|
-
post 'unfreeze_comment/:id', action: :unfreeze_comment, as: :unfreeze_comment
|
|
328
|
-
post 'permanent_freeze_stage/:id', action: :permanent_freeze_stage, as: :permanent_freeze_stage
|
|
329
|
-
post 'permanent_freeze_comment/:id', action: :permanent_freeze_comment, as: :permanent_freeze_comment
|
|
330
|
-
delete 'destroy_stage/:id', action: :destroy_stage, as: :destroy_stage
|
|
331
|
-
delete 'destroy_comment/:id', action: :destroy_comment, as: :destroy_comment
|
|
332
|
-
end
|
|
333
|
-
end
|
|
334
|
-
|
|
335
|
-
# Extended image reports (alternative to engine's admin controller)
|
|
336
|
-
resources :image_reports, only: [:index, :show] do
|
|
337
|
-
member do
|
|
338
|
-
patch :confirm
|
|
339
|
-
patch :dismiss
|
|
340
|
-
end
|
|
341
|
-
end
|
|
342
|
-
end
|
|
343
352
|
```
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
353
|
+
GET /admin/image_reports # List all reports
|
|
354
|
+
GET /admin/image_reports/:id # View report details
|
|
355
|
+
GET /admin/users # List all users
|
|
356
|
+
GET /admin/users/:id # View user details
|
|
357
|
+
GET /admin/frozen_posts # List frozen posts
|
|
358
|
+
```
|
|
350
359
|
|
|
351
360
|
## Customization
|
|
352
361
|
|
data/config/routes.rb
CHANGED
|
@@ -14,22 +14,22 @@ RailsImagePostSolution::Engine.routes.draw do
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
# User management
|
|
17
|
-
resources :users, only: [
|
|
17
|
+
resources :users, only: %i[index show] do
|
|
18
18
|
member do
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
post :suspend
|
|
20
|
+
post :unsuspend
|
|
21
|
+
post :ban
|
|
22
|
+
post :unban
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
# Frozen posts management
|
|
27
|
-
resources :frozen_posts, only: [
|
|
27
|
+
resources :frozen_posts, only: [:index] do
|
|
28
28
|
collection do
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
post "unfreeze_stage/:id", to: "frozen_posts#unfreeze_stage", as: :unfreeze_stage
|
|
30
|
+
post "unfreeze_comment/:id", to: "frozen_posts#unfreeze_comment", as: :unfreeze_comment
|
|
31
|
+
post "permanent_freeze_stage/:id", to: "frozen_posts#permanent_freeze_stage", as: :permanent_freeze_stage
|
|
32
|
+
post "permanent_freeze_comment/:id", to: "frozen_posts#permanent_freeze_comment", as: :permanent_freeze_comment
|
|
33
33
|
delete "destroy_stage/:id", to: "frozen_posts#destroy_stage", as: :destroy_stage
|
|
34
34
|
delete "destroy_comment/:id", to: "frozen_posts#destroy_comment", as: :destroy_comment
|
|
35
35
|
end
|