rails-image-post-solution 0.1.2 → 0.1.3
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 +51 -29
- data/config/routes.rb +1 -23
- 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: c7571374228755e2620e8e36a0ec464bbe97a52c6b1777700db8aa318576fdb9
|
|
4
|
+
data.tar.gz: f39a22c93948a4765d7b56a615cb75dce86f5dcb1237ff211937e58888416869
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 86ab4ec85cc0745707befb5398e7b48adb115f788e995678f3af75b1033eabe899360a6ac173ddaca0b1591cf57a1f7a105e38b975aa08993dad1534e075e962
|
|
7
|
+
data.tar.gz: b8d5afcecb509146557a7446ded4fd8dbc2fa277d7512ec14cef678e8e74a09e46dd3203ccf951afe46ea0454fedd87dc3ebde7325593a6a78164b93b2f53e27
|
data/README.md
CHANGED
|
@@ -62,19 +62,12 @@ Mount the engine in your `config/routes.rb`:
|
|
|
62
62
|
|
|
63
63
|
```ruby
|
|
64
64
|
Rails.application.routes.draw do
|
|
65
|
-
# Mount the engine
|
|
65
|
+
# Mount the engine
|
|
66
66
|
mount RailsImagePostSolution::Engine => "/moderation"
|
|
67
67
|
|
|
68
|
-
# Optional: Add
|
|
68
|
+
# Optional: Add admin routes for extended features (user management, frozen posts)
|
|
69
69
|
namespace :admin do
|
|
70
|
-
resources :
|
|
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
|
|
70
|
+
resources :users, only: %i[index show] do
|
|
78
71
|
member do
|
|
79
72
|
post :suspend
|
|
80
73
|
post :unsuspend
|
|
@@ -83,14 +76,14 @@ Rails.application.routes.draw do
|
|
|
83
76
|
end
|
|
84
77
|
end
|
|
85
78
|
|
|
86
|
-
resources :frozen_posts, only: [:index]
|
|
79
|
+
resources :frozen_posts, only: [:index] do
|
|
87
80
|
collection do
|
|
88
|
-
post "unfreeze_stage/:id", to: "
|
|
89
|
-
post "unfreeze_comment/:id", to: "
|
|
90
|
-
post "permanent_freeze_stage/:id", to: "
|
|
91
|
-
post "permanent_freeze_comment/:id", to: "
|
|
92
|
-
delete "destroy_stage/:id", to: "
|
|
93
|
-
delete "destroy_comment/:id", to: "
|
|
81
|
+
post "unfreeze_stage/:id", to: "frozen_posts#unfreeze_stage", as: :unfreeze_stage
|
|
82
|
+
post "unfreeze_comment/:id", to: "frozen_posts#unfreeze_comment", as: :unfreeze_comment
|
|
83
|
+
post "permanent_freeze_stage/:id", to: "frozen_posts#permanent_freeze_stage", as: :permanent_freeze_stage
|
|
84
|
+
post "permanent_freeze_comment/:id", to: "frozen_posts#permanent_freeze_comment", as: :permanent_freeze_comment
|
|
85
|
+
delete "destroy_stage/:id", to: "frozen_posts#destroy_stage", as: :destroy_stage
|
|
86
|
+
delete "destroy_comment/:id", to: "frozen_posts#destroy_comment", as: :destroy_comment
|
|
94
87
|
end
|
|
95
88
|
end
|
|
96
89
|
end
|
|
@@ -328,7 +321,7 @@ end
|
|
|
328
321
|
|
|
329
322
|
### Engine Routes (via /moderation mount point)
|
|
330
323
|
|
|
331
|
-
|
|
324
|
+
The engine provides these routes when mounted at `/moderation`:
|
|
332
325
|
|
|
333
326
|
```
|
|
334
327
|
POST /moderation/image_reports # Create report
|
|
@@ -336,25 +329,54 @@ GET /moderation/admin/image_reports # List all reports
|
|
|
336
329
|
GET /moderation/admin/image_reports/:id # View report details
|
|
337
330
|
PATCH /moderation/admin/image_reports/:id/confirm # Mark as inappropriate
|
|
338
331
|
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
|
|
346
332
|
```
|
|
347
333
|
|
|
348
|
-
###
|
|
334
|
+
### Host Application Routes (Required for Extended Features)
|
|
335
|
+
|
|
336
|
+
The gem provides additional admin controllers in `app/controllers/admin/` that you can use in your host application. **You must add these routes to your host application's `config/routes.rb`** to use them:
|
|
337
|
+
|
|
338
|
+
```ruby
|
|
339
|
+
namespace :admin do
|
|
340
|
+
# User management
|
|
341
|
+
resources :users, only: %i[index show] do
|
|
342
|
+
member do
|
|
343
|
+
post :suspend
|
|
344
|
+
post :unsuspend
|
|
345
|
+
post :ban
|
|
346
|
+
post :unban
|
|
347
|
+
end
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
# Frozen posts management
|
|
351
|
+
resources :frozen_posts, only: [:index] do
|
|
352
|
+
collection do
|
|
353
|
+
post "unfreeze_stage/:id", to: "frozen_posts#unfreeze_stage", as: :admin_unfreeze_stage
|
|
354
|
+
post "unfreeze_comment/:id", to: "frozen_posts#unfreeze_comment", as: :admin_unfreeze_comment
|
|
355
|
+
post "permanent_freeze_stage/:id", to: "frozen_posts#permanent_freeze_stage", as: :admin_permanent_freeze_stage
|
|
356
|
+
post "permanent_freeze_comment/:id", to: "frozen_posts#permanent_freeze_comment", as: :admin_permanent_freeze_comment
|
|
357
|
+
delete "destroy_stage/:id", to: "frozen_posts#destroy_stage", as: :admin_destroy_stage
|
|
358
|
+
delete "destroy_comment/:id", to: "frozen_posts#destroy_comment", as: :admin_destroy_comment
|
|
359
|
+
end
|
|
360
|
+
end
|
|
361
|
+
end
|
|
362
|
+
```
|
|
349
363
|
|
|
350
|
-
|
|
364
|
+
This provides these routes:
|
|
351
365
|
|
|
352
366
|
```
|
|
353
|
-
GET /admin/image_reports # List all reports
|
|
354
|
-
GET /admin/image_reports/:id # View report details
|
|
355
367
|
GET /admin/users # List all users
|
|
356
368
|
GET /admin/users/:id # View user details
|
|
369
|
+
POST /admin/users/:id/suspend # Suspend user
|
|
370
|
+
POST /admin/users/:id/unsuspend # Unsuspend user
|
|
371
|
+
POST /admin/users/:id/ban # Ban user
|
|
372
|
+
POST /admin/users/:id/unban # Unban user
|
|
357
373
|
GET /admin/frozen_posts # List frozen posts
|
|
374
|
+
POST /admin/frozen_posts/unfreeze_stage/:id # Unfreeze a stage
|
|
375
|
+
POST /admin/frozen_posts/unfreeze_comment/:id # Unfreeze a comment
|
|
376
|
+
POST /admin/frozen_posts/permanent_freeze_stage/:id # Permanently freeze a stage
|
|
377
|
+
POST /admin/frozen_posts/permanent_freeze_comment/:id # Permanently freeze a comment
|
|
378
|
+
DELETE /admin/frozen_posts/destroy_stage/:id # Delete a frozen stage
|
|
379
|
+
DELETE /admin/frozen_posts/destroy_comment/:id # Delete a frozen comment
|
|
358
380
|
```
|
|
359
381
|
|
|
360
382
|
## Customization
|
data/config/routes.rb
CHANGED
|
@@ -4,7 +4,7 @@ RailsImagePostSolution::Engine.routes.draw do
|
|
|
4
4
|
# User-facing report API
|
|
5
5
|
resources :image_reports, only: [ :create ]
|
|
6
6
|
|
|
7
|
-
# Admin dashboard
|
|
7
|
+
# Admin dashboard (engine controllers)
|
|
8
8
|
namespace :admin do
|
|
9
9
|
resources :image_reports, only: %i[index show] do
|
|
10
10
|
member do
|
|
@@ -12,27 +12,5 @@ RailsImagePostSolution::Engine.routes.draw do
|
|
|
12
12
|
patch :dismiss
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
|
-
|
|
16
|
-
# User management
|
|
17
|
-
resources :users, only: %i[index show] do
|
|
18
|
-
member do
|
|
19
|
-
post :suspend
|
|
20
|
-
post :unsuspend
|
|
21
|
-
post :ban
|
|
22
|
-
post :unban
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Frozen posts management
|
|
27
|
-
resources :frozen_posts, only: [:index] do
|
|
28
|
-
collection do
|
|
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
|
-
delete "destroy_stage/:id", to: "frozen_posts#destroy_stage", as: :destroy_stage
|
|
34
|
-
delete "destroy_comment/:id", to: "frozen_posts#destroy_comment", as: :destroy_comment
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
15
|
end
|
|
38
16
|
end
|