active_storage_dashboard 0.1.7 → 0.1.8

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: ed1a1e341dedaaab67801dd73a0b76df9449aca4ca18973563e2ed7dc6dda253
4
- data.tar.gz: 7a9aefffa3a6de909c51d0b6722d9d0850606ec50fbd06b05ce60ca96d122828
3
+ metadata.gz: 52688deaa501817d673f48ffe6844b5eacf8907e7772a8947685af641e7f44df
4
+ data.tar.gz: 6bb6a6aba5a21ba5bf4ab7d66c54b9803a3523ed37c3d7274917698d107dc6aa
5
5
  SHA512:
6
- metadata.gz: 3cd3148b29e82dfef918761d4cc12e888da4735bfd0a3c9a197fb61faef8c0462e2dae3b5346c18c8734a8b7756629cec8580013c04bf74abc1fff09f4dd5dea
7
- data.tar.gz: e3705b654f6ab6805fb7cdd03988df975e9af080cc372796045b836cd00fd0d25ce38293f8d90873a895b60bd6336cc398349388470539bc95eb29d82e1b4046
6
+ metadata.gz: e109061b41d12ecfa053d87e2e0a1a5b90083e27a04a9d8dcc40702909d414cd027d6bbc61681c407c5d0e2fac4c107505722058d97a51aa139cad6f0e4a7f38
7
+ data.tar.gz: b9ad63bb467d849d9591c3f539bd96aaa3706b8d84ae037162f33bed921a2e75978624bb960179ff0a95298b32dede9eb0265b006e56431be41dc3dba9bfa017
data/README.md CHANGED
@@ -46,20 +46,41 @@ Then visit `/active-storage-dashboard` in your browser to see the beautiful dash
46
46
 
47
47
  The dashboard provides direct file download capabilities from both the list and detail views. Simply click on the download button to get your files.
48
48
 
49
+ ### Tasks
50
+
51
+ The dashboard includes a task to remove unused blobs and attachments.
52
+
53
+ You can run this task from the command line:
54
+
55
+ ```bash
56
+ $ rails active_storage:dashboard:purge_orphans
57
+ ```
58
+ Re-analyze blobs that are not yet analyzed
59
+ ```bash
60
+ $ rails active_storage:dashboard:reanalyze
61
+ ```
62
+
63
+ Regenerate missing or outdated variants
64
+ ```bash
65
+ $ rails active_storage:dashboard:regenerate_variants
66
+ ```
67
+
68
+
69
+
49
70
  ### 📸 Screenshots
50
71
 
51
72
  <details>
52
73
  <summary>Click to see more screenshots</summary>
53
-
74
+
54
75
  #### Dashboard Overview
55
76
  ![Dashboard Overview](https://github.com/giovapanasiti/active_storage_dashboard/blob/main/screenshots/dashboard.png)
56
-
77
+
57
78
  #### Blob Details
58
79
  ![Blob Details](https://github.com/giovapanasiti/active_storage_dashboard/blob/main/screenshots/blob-details.png)
59
-
80
+
60
81
  #### Files Gallery
61
82
  ![Files Gallery](https://github.com/giovapanasiti/active_storage_dashboard/blob/main/screenshots/files-gallery.png)
62
-
83
+
63
84
  </details>
64
85
 
65
86
  ## 🔒 Security Considerations
@@ -81,6 +102,11 @@ constraints lambda { |req| req.session[:user_id].present? || (req.env['warden']
81
102
  end
82
103
  ```
83
104
 
105
+ Or, in your environment config or `application.rb`:
106
+ ```ruby
107
+ config.active_storage_dashboard.base_controller_class = "AdminController"
108
+ ```
109
+
84
110
 
85
111
  ## 🤝 Contributing
86
112
 
@@ -88,4 +114,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/giovap
88
114
 
89
115
  ## 📝 License
90
116
 
91
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
117
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveStorageDashboard
4
- class ApplicationController < ActionController::Base
4
+ class ApplicationController < ActiveStorageDashboard.base_controller_class.constantize
5
5
  protect_from_forgery with: :exception
6
-
6
+
7
7
  # Simple pagination without external dependencies
8
8
  helper_method :paginate
9
9
 
@@ -12,4 +12,4 @@ module ActiveStorageDashboard
12
12
  scope.limit(per_page).offset((@page - 1) * per_page)
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -3,10 +3,18 @@
3
3
  module ActiveStorageDashboard
4
4
  class Engine < ::Rails::Engine
5
5
  isolate_namespace ActiveStorageDashboard
6
-
6
+
7
7
  # Ensure URLs are generated correctly by setting defaults
8
8
  initializer "active_storage_dashboard.url_options" do |app|
9
9
  ActiveStorageDashboard::Engine.routes.default_url_options = app.routes.default_url_options
10
10
  end
11
+
12
+ config.active_storage_dashboard = ActiveSupport::OrderedOptions.new
13
+
14
+ config.before_initialize do
15
+ config.active_storage_dashboard.each do |key, value|
16
+ ActiveStorageDashboard.public_send("#{key}=", value)
17
+ end
18
+ end
11
19
  end
12
- end
20
+ end
@@ -9,10 +9,11 @@ require "active_storage_dashboard/analyzer"
9
9
  require "active_storage_dashboard/variant_regenerator"
10
10
 
11
11
  module ActiveStorageDashboard
12
+ mattr_accessor :base_controller_class, default: "ActionController::Base"
13
+
12
14
  class Railtie < Rails::Railtie
13
15
  rake_tasks do
14
16
  load File.expand_path("tasks/active_storage_dashboard_tasks.rake", __dir__)
15
17
  end
16
18
  end
17
- end
18
-
19
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_storage_dashboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Panasiti
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-22 00:00:00.000000000 Z
10
+ date: 2025-06-06 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails