rails-image-post-solution 0.1.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32426dffba22192bd75b188bd48b57c794cfa2f64b28d699f7dc375c55060d21
4
- data.tar.gz: dad18086d9ff9c6d613ecded2c48fcb17e6de7543f87fefbddcf33e196669fa4
3
+ metadata.gz: c7571374228755e2620e8e36a0ec464bbe97a52c6b1777700db8aa318576fdb9
4
+ data.tar.gz: f39a22c93948a4765d7b56a615cb75dce86f5dcb1237ff211937e58888416869
5
5
  SHA512:
6
- metadata.gz: 30ce677ce249bc09956d4ac0948946a3046840342db546de43b5c4b620a3bf8d47cb2a6d8d6c65b36cbc080c9abf724bfe096430a4f9a35ef840450ec5dd5e8c
7
- data.tar.gz: '08acf121746c98771333797ac6bd58d1060c3176c049e56422e237e2c4591cbabe3afbad39d6cb67ce7d4457c5bdf73500c4c7d62bb55ef4c15fc75ac02ea915'
6
+ metadata.gz: 86ab4ec85cc0745707befb5398e7b48adb115f788e995678f3af75b1033eabe899360a6ac173ddaca0b1591cf57a1f7a105e38b975aa08993dad1534e075e962
7
+ data.tar.gz: b8d5afcecb509146557a7446ded4fd8dbc2fa277d7512ec14cef678e8e74a09e46dd3203ccf951afe46ea0454fedd87dc3ebde7325593a6a78164b93b2f53e27
data/README.md CHANGED
@@ -62,7 +62,32 @@ 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
66
  mount RailsImagePostSolution::Engine => "/moderation"
67
+
68
+ # Optional: Add admin routes for extended features (user management, frozen posts)
69
+ namespace :admin do
70
+ resources :users, only: %i[index show] do
71
+ member do
72
+ post :suspend
73
+ post :unsuspend
74
+ post :ban
75
+ post :unban
76
+ end
77
+ end
78
+
79
+ resources :frozen_posts, only: [:index] do
80
+ collection do
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
87
+ end
88
+ end
89
+ end
90
+
66
91
  # ... your other routes
67
92
  end
68
93
  ```
@@ -294,7 +319,9 @@ end
294
319
 
295
320
  ## Routes
296
321
 
297
- The engine provides the following routes:
322
+ ### Engine Routes (via /moderation mount point)
323
+
324
+ The engine provides these routes when mounted at `/moderation`:
298
325
 
299
326
  ```
300
327
  POST /moderation/image_reports # Create report
@@ -304,14 +331,14 @@ PATCH /moderation/admin/image_reports/:id/confirm # Mark as inappropriate
304
331
  PATCH /moderation/admin/image_reports/:id/dismiss # Mark as safe
305
332
  ```
306
333
 
307
- ### Extended Admin Features (Optional)
334
+ ### Host Application Routes (Required for Extended Features)
308
335
 
309
- The gem includes additional admin controllers for extended functionality. To use these, add the following routes to your `config/routes.rb`:
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:
310
337
 
311
338
  ```ruby
312
339
  namespace :admin do
313
340
  # User management
314
- resources :users, only: [:index, :show] do
341
+ resources :users, only: %i[index show] do
315
342
  member do
316
343
  post :suspend
317
344
  post :unsuspend
@@ -323,30 +350,34 @@ namespace :admin do
323
350
  # Frozen posts management
324
351
  resources :frozen_posts, only: [:index] do
325
352
  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
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
340
359
  end
341
360
  end
342
361
  end
343
362
  ```
344
363
 
345
- These extended features include:
364
+ This provides these routes:
346
365
 
347
- - **User Management**: Suspend, unsuspend, ban, and unban users
348
- - **Frozen Posts Management**: View, unfreeze, permanently freeze, or delete frozen posts
349
- - **Enhanced Image Reports**: Additional views and functionality for managing image reports
366
+ ```
367
+ GET /admin/users # List all users
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
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
380
+ ```
350
381
 
351
382
  ## Customization
352
383
 
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: [ :index, :show ] do
18
- member do
19
- patch :suspend
20
- patch :unsuspend
21
- patch :ban
22
- patch :unban
23
- end
24
- end
25
-
26
- # Frozen posts management
27
- resources :frozen_posts, only: [ :index ] do
28
- collection do
29
- patch "unfreeze_stage/:id", to: "frozen_posts#unfreeze_stage", as: :unfreeze_stage
30
- patch "unfreeze_comment/:id", to: "frozen_posts#unfreeze_comment", as: :unfreeze_comment
31
- patch "permanent_freeze_stage/:id", to: "frozen_posts#permanent_freeze_stage", as: :permanent_freeze_stage
32
- patch "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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsImagePostSolution
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-image-post-solution
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - dhq_boiler