rails-image-post-solution 0.1.4 → 0.1.5
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 +14 -0
- data/lib/rails_image_post_solution/engine.rb +27 -0
- 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: 53bedd05012e7de53fb923d5f59bfad301425de29b0878403c0b2567bfaddef5
|
|
4
|
+
data.tar.gz: d48a1d5c4f4ad3df39131b85b55ab47c4029c5cf44b29d16ae502b5ddd6039ed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6afda9c3e23182b67be36065bc91cc5208d5f43bcd60196f10565a9ae8f9fc42242bd44939fdc21474b9951a4fd856c528575247132b66c02e7e698923b7555
|
|
7
|
+
data.tar.gz: b021855c6bc5aaaba5059914e47641dca0bf3a8c9453fb20adf243d383553f5537b8a01993cc97bcfc9f2604c0a707c77ebaed421c555211fd9ec70d141eae67
|
data/README.md
CHANGED
|
@@ -298,6 +298,20 @@ end
|
|
|
298
298
|
|
|
299
299
|
The engine provides the following routes when mounted at `/moderation`:
|
|
300
300
|
|
|
301
|
+
### Using Route Helpers
|
|
302
|
+
|
|
303
|
+
The engine automatically makes route helpers available in your application. You can use them directly:
|
|
304
|
+
|
|
305
|
+
```ruby
|
|
306
|
+
# In your views or controllers
|
|
307
|
+
admin_image_reports_path # => /moderation/admin/image_reports
|
|
308
|
+
admin_user_path(@user) # => /moderation/admin/users/:id
|
|
309
|
+
image_reports_path # => /moderation/image_reports
|
|
310
|
+
|
|
311
|
+
# Or use the engine namespace explicitly
|
|
312
|
+
rails_image_post_solution.admin_image_reports_path
|
|
313
|
+
```
|
|
314
|
+
|
|
301
315
|
### User-Facing Routes
|
|
302
316
|
|
|
303
317
|
```
|
|
@@ -18,5 +18,32 @@ module RailsImagePostSolution
|
|
|
18
18
|
initializer "rails_image_post_solution.assets" do |app|
|
|
19
19
|
app.config.assets.paths << root.join("app/assets")
|
|
20
20
|
end
|
|
21
|
+
|
|
22
|
+
# Make engine route helpers available in the main application
|
|
23
|
+
initializer "rails_image_post_solution.route_helpers" do
|
|
24
|
+
config.after_initialize do
|
|
25
|
+
Rails.application.routes.url_helpers.class_eval do
|
|
26
|
+
# Delegate common route helpers to the engine
|
|
27
|
+
delegate :admin_image_reports_path, :admin_image_reports_url,
|
|
28
|
+
:admin_image_report_path, :admin_image_report_url,
|
|
29
|
+
:confirm_admin_image_report_path, :confirm_admin_image_report_url,
|
|
30
|
+
:dismiss_admin_image_report_path, :dismiss_admin_image_report_url,
|
|
31
|
+
:admin_users_path, :admin_users_url,
|
|
32
|
+
:admin_user_path, :admin_user_url,
|
|
33
|
+
:suspend_admin_user_path, :suspend_admin_user_url,
|
|
34
|
+
:unsuspend_admin_user_path, :unsuspend_admin_user_url,
|
|
35
|
+
:ban_admin_user_path, :ban_admin_user_url,
|
|
36
|
+
:unban_admin_user_path, :unban_admin_user_url,
|
|
37
|
+
:admin_frozen_posts_path, :admin_frozen_posts_url,
|
|
38
|
+
:image_reports_path, :image_reports_url,
|
|
39
|
+
to: RailsImagePostSolution::Engine.routes.url_helpers
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Also make helpers available in controllers and views
|
|
43
|
+
ActiveSupport.on_load(:action_controller_base) do
|
|
44
|
+
helper RailsImagePostSolution::Engine.routes.url_helpers
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
21
48
|
end
|
|
22
49
|
end
|