iron_admin 0.4.1 → 0.5.0

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: 6a7e6f008423227296c7d793dc516a5e535249bedececc1c41af83dd91a019d4
4
- data.tar.gz: 1eb8f4c673a35d21fd1f04bc38fa72d55fba0e984cccc965156bc273f9696ab3
3
+ metadata.gz: a0ecb90c4ba9e2c3f605ceae6041d3b73ba81ebf8cf39814d07a01d879c3a005
4
+ data.tar.gz: 36979178db1f62372e1ca1d660ad86c8696729db3cc6831326df7747789bb331
5
5
  SHA512:
6
- metadata.gz: 7259b141211a0575f49d8df3dc3f22fc3d421b0ef60a31770b26aff5da46da70d566a8e6c4255723f836ce7995c39ea4b5764a036dc96157b42004897d52aade
7
- data.tar.gz: fb326e0e209721a1341c8b0740325f2129a5d8e66de8ba2697f3e6325a271227961128c786c25574c88006333c4887c3d805055584284c7589ac925290c45ef3
6
+ metadata.gz: e8dbf2accd69aa53038df74fb9e5a080581b9cd70d45cc5af806a13df2934ffe072da678ed81fb22c9b3354274e4997ccf5b335f5ac140eab3a54c55aaf8d697
7
+ data.tar.gz: d8d3fbf9c74c876dc85837ebbf5f767ae68eb3246e6fb543b17baf8e9d196a33b45505489660ff73816699de9054c2d7cc04611f78668af0af7ae754a07b6e66
data/README.md CHANGED
@@ -20,6 +20,7 @@ Convention-over-configuration admin panel engine for Ruby on Rails. Build beauti
20
20
 
21
21
  - Ruby >= 3.2
22
22
  - Rails >= 7.1
23
+ - [tailwindcss-rails](https://github.com/rails/tailwindcss-rails) >= 4.0
23
24
 
24
25
  ## Installation
25
26
 
@@ -27,6 +28,7 @@ Add to your Gemfile:
27
28
 
28
29
  ```ruby
29
30
  gem "iron_admin"
31
+ gem "tailwindcss-rails"
30
32
  ```
31
33
 
32
34
  Then run:
@@ -36,14 +38,40 @@ bundle install
36
38
  rails generate iron_admin:install
37
39
  ```
38
40
 
39
- Mount the engine in your `config/routes.rb`:
41
+ The install generator will:
42
+ - Create `app/iron_admin/resources/` and `app/iron_admin/dashboards/` directories
43
+ - Add a configuration initializer at `config/initializers/iron_admin.rb`
44
+ - Create a sample dashboard
45
+ - Mount the engine at `/admin` in your routes
46
+ - Add the IronAdmin Tailwind CSS import to your `app/assets/tailwind/application.css`
40
47
 
41
- ```ruby
42
- Rails.application.routes.draw do
43
- mount IronAdmin::Engine, at: "/admin"
44
- end
48
+ ### Tailwind CSS Setup
49
+
50
+ IronAdmin uses Tailwind CSS v4 for all styling. The `tailwindcss-rails` gem handles
51
+ compilation. After running the install generator, your `app/assets/tailwind/application.css`
52
+ should include:
53
+
54
+ ```css
55
+ @import "tailwindcss";
56
+ @import "../builds/tailwind/iron_admin";
57
+ ```
58
+
59
+ The second line imports IronAdmin's `@source` directives so the Tailwind compiler
60
+ scans the engine's views and components for CSS classes. Without it, the admin panel
61
+ will render unstyled.
62
+
63
+ If you're setting up manually (without the generator), run:
64
+
65
+ ```bash
66
+ rails tailwindcss:build
45
67
  ```
46
68
 
69
+ Then verify that `app/assets/builds/tailwind/iron_admin.css` was created. If not,
70
+ check that `tailwindcss-rails` >= 4.0 is installed and that the engine gem is properly
71
+ loaded.
72
+
73
+ For development, use `bin/dev` or `rails tailwindcss:watch` to recompile CSS on changes.
74
+
47
75
  ## Quick Start
48
76
 
49
77
  ### 1. Configure Authentication
@@ -75,26 +103,30 @@ rails generate iron_admin:resource Order
75
103
  ### 3. Customize Resources
76
104
 
77
105
  ```ruby
78
- # app/iron_admin/user_resource.rb
79
- class UserResource < IronAdmin::Resource
80
- field :role, type: :badge, colors: { admin: :purple, user: :blue }
81
- field :email, type: :text
106
+ # app/iron_admin/resources/user_resource.rb
107
+ module IronAdmin
108
+ module Resources
109
+ class UserResource < IronAdmin::Resource
110
+ field :role, type: :badge, colors: { admin: :purple, user: :blue }
111
+ field :email, type: :text
82
112
 
83
- searchable :name, :email
113
+ searchable :name, :email
84
114
 
85
- filter :role, type: :select, choices: User.roles.keys
86
- filter :created_at, type: :date_range
115
+ filter :role, type: :select, choices: User.roles.keys
116
+ filter :created_at, type: :date_range
87
117
 
88
- scope :admins, -> { where(role: :admin) }
89
- scope :recent, -> { where("created_at > ?", 7.days.ago) }
118
+ scope :admins, -> { where(role: :admin) }
119
+ scope :recent, -> { where("created_at > ?", 7.days.ago) }
90
120
 
91
- index_fields :id, :name, :email, :role, :created_at
92
- form_fields :name, :email, :role
121
+ index_fields :id, :name, :email, :role, :created_at
122
+ form_fields :name, :email, :role
93
123
 
94
- menu priority: 1, icon: "users", group: "People"
124
+ menu priority: 1, icon: "users", group: "People"
95
125
 
96
- action :lock, icon: "lock-closed", confirm: true do |record|
97
- record.update!(locked_at: Time.current)
126
+ action :lock, icon: "lock-closed", confirm: true do |record|
127
+ record.update!(locked_at: Time.current)
128
+ end
129
+ end
98
130
  end
99
131
  end
100
132
  ```
@@ -102,18 +134,22 @@ end
102
134
  ### 4. Create a Dashboard
103
135
 
104
136
  ```ruby
105
- # app/iron_admin/admin_dashboard.rb
106
- class AdminDashboard < IronAdmin::Dashboard
107
- metric :total_users, format: :number do
108
- User.count
137
+ # app/iron_admin/dashboards/admin_dashboard.rb
138
+ module IronAdmin
139
+ module Dashboards
140
+ class AdminDashboard < IronAdmin::Dashboard
141
+ metric :total_users, format: :number do
142
+ User.count
143
+ end
144
+
145
+ metric :monthly_revenue, format: :currency do
146
+ Payment.where("created_at > ?", 30.days.ago).sum(:amount)
147
+ end
148
+
149
+ recent :users, limit: 5, scope: -> { order(created_at: :desc) }
150
+ recent :payments, limit: 5
151
+ end
109
152
  end
110
-
111
- metric :monthly_revenue, format: :currency do
112
- Payment.where("created_at > ?", 30.days.ago).sum(:amount)
113
- end
114
-
115
- recent :users, limit: 5, scope: -> { order(created_at: :desc) }
116
- recent :payments, limit: 5
117
153
  end
118
154
  ```
119
155
 
@@ -4,18 +4,15 @@
4
4
 
5
5
  - Ruby >= 3.2
6
6
  - Rails >= 7.1
7
- - Tailwind CSS (for default theme classes)
7
+ - [tailwindcss-rails](https://github.com/rails/tailwindcss-rails) >= 4.0
8
8
 
9
- ## Step 1: Add the Gem
9
+ ## Step 1: Add the Gems
10
10
 
11
- Add IronAdmin to your `Gemfile`:
11
+ Add IronAdmin and `tailwindcss-rails` to your `Gemfile`:
12
12
 
13
13
  ```ruby
14
- # From a local path:
15
- gem "iron_admin", path: "/path/to/iron_admin"
16
-
17
- # Or if published to a gem server:
18
14
  gem "iron_admin"
15
+ gem "tailwindcss-rails"
19
16
  ```
20
17
 
21
18
  Then run:
@@ -35,11 +32,13 @@ This creates:
35
32
  | File | Purpose |
36
33
  |------|---------|
37
34
  | `config/initializers/iron_admin.rb` | Main configuration (title, auth, theme) |
38
- | `app/iron_admin/dashboards/` | Directory for dashboard definitions |
39
35
  | `app/iron_admin/resources/` | Directory for resource definitions |
40
- | `app/iron_admin/dashboard.rb` | Default dashboard class |
36
+ | `app/iron_admin/dashboards/` | Directory for dashboard definitions |
37
+ | `app/iron_admin/dashboards/admin_dashboard.rb` | Default dashboard class |
41
38
 
42
- It also mounts the engine in `config/routes.rb`.
39
+ It also:
40
+ - Mounts the engine at `/admin` in `config/routes.rb`
41
+ - Adds the IronAdmin CSS import to `app/assets/tailwind/application.css`
43
42
 
44
43
  ## Step 3: Mount the Engine (if not auto-mounted)
45
44
 
@@ -79,9 +78,107 @@ rails generate iron_admin:resource User
79
78
 
80
79
  This creates `app/iron_admin/resources/user_resource.rb`. IronAdmin automatically infers fields from your model's database schema.
81
80
 
82
- ## Step 6: Visit the Admin Panel
81
+ ## Step 6: Build CSS and Start the Server
82
+
83
+ ```bash
84
+ rails tailwindcss:build
85
+ bin/rails server
86
+ ```
87
+
88
+ Visit `/admin` and your admin panel is ready.
89
+
90
+ For development with live CSS recompilation, use `bin/dev` (which runs
91
+ `tailwindcss:watch` alongside the Rails server via foreman).
92
+
93
+ > **Note:** There is a [known issue](https://github.com/rails/tailwindcss-rails/issues/602)
94
+ > in `tailwindcss-rails` v4 where `bin/dev` exits immediately after
95
+ > starting. If this happens, edit `Procfile.dev` and change the CSS line
96
+ > to `css: bin/rails tailwindcss:watch[always]`. See
97
+ > [Troubleshooting](../guides/troubleshooting.md#bindev-exits-immediately-after-starting)
98
+ > for details.
99
+
100
+ ## Tailwind CSS Setup
101
+
102
+ IronAdmin uses Tailwind CSS v4 for all styling via the `tailwindcss-rails` gem.
103
+ Understanding how the CSS pipeline works will help you troubleshoot any styling issues.
104
+
105
+ ### How it works
106
+
107
+ 1. IronAdmin ships with `@source` directives at `app/assets/tailwind/iron_admin/engine.css`
108
+ inside the gem. These tell the Tailwind compiler where to scan for CSS utility classes
109
+ used by the engine's views, components, and helpers.
110
+
111
+ 2. When `tailwindcss:build` runs, it first executes `tailwindcss:engines`. This task
112
+ detects IronAdmin's engine CSS and creates a bridge file at
113
+ `app/assets/builds/tailwind/iron_admin.css` containing an `@import` that points
114
+ to the engine's CSS.
115
+
116
+ 3. Your `app/assets/tailwind/application.css` must import this bridge file:
117
+
118
+ ```css
119
+ @import "tailwindcss";
120
+ @import "../builds/tailwind/iron_admin";
121
+ ```
122
+
123
+ 4. The Tailwind compiler processes `application.css`, follows the imports, scans all
124
+ the engine's source files via the `@source` directives, and generates the final
125
+ `app/assets/builds/tailwind.css` with all necessary utility classes.
126
+
127
+ 5. The engine's layout references `stylesheet_link_tag "tailwind"`, which serves
128
+ this compiled CSS file.
129
+
130
+ ### Manual setup (without the generator)
131
+
132
+ If you didn't use the install generator, or the import line is missing:
83
133
 
84
- Start your server and navigate to `/admin`.
134
+ 1. Verify `tailwindcss-rails` is in your Gemfile and installed
135
+ 2. Add the import to `app/assets/tailwind/application.css`:
136
+
137
+ ```css
138
+ @import "tailwindcss";
139
+ @import "../builds/tailwind/iron_admin";
140
+ ```
141
+
142
+ 3. Build the CSS:
143
+
144
+ ```bash
145
+ rails tailwindcss:build
146
+ ```
147
+
148
+ 4. Verify the build output:
149
+
150
+ ```bash
151
+ ls -la app/assets/builds/tailwind.css
152
+ # Should be ~30KB+ (not ~6KB which indicates no utility classes)
153
+ ```
154
+
155
+ ### Troubleshooting
156
+
157
+ **Styles not loading (unstyled admin panel)**
158
+
159
+ This almost always means the Tailwind compiler didn't scan IronAdmin's source files.
160
+ Check:
161
+
162
+ 1. The `@import "../builds/tailwind/iron_admin"` line exists in
163
+ `app/assets/tailwind/application.css`
164
+ 2. The bridge file exists at `app/assets/builds/tailwind/iron_admin.css`
165
+ (run `rails tailwindcss:build` to regenerate it)
166
+ 3. The compiled CSS at `app/assets/builds/tailwind.css` is large enough
167
+ (~30KB+, not ~6KB)
168
+
169
+ **Bridge file not generated**
170
+
171
+ If `app/assets/builds/tailwind/iron_admin.css` doesn't exist after running
172
+ `rails tailwindcss:build`:
173
+
174
+ - Ensure `tailwindcss-rails` >= 4.0 is installed (`bundle info tailwindcss-rails`)
175
+ - Ensure `iron_admin` is properly loaded (check `bundle info iron_admin`)
176
+ - Try running `rails tailwindcss:engines` directly
177
+
178
+ **Styles disappear after bundle update**
179
+
180
+ The bridge file uses an absolute path to the gem's CSS. After updating the gem
181
+ (which changes the gem path), run `rails tailwindcss:build` to regenerate it.
85
182
 
86
183
  ## Dependencies
87
184
 
@@ -97,19 +194,8 @@ IronAdmin depends on the following gems (installed automatically):
97
194
  | `haml-rails` | >= 2.0 | Template engine |
98
195
  | `heroicon` | >= 1.0 | SVG icons |
99
196
 
100
- ## Tailwind CSS Setup
101
-
102
- IronAdmin uses Tailwind CSS classes for all styling. Ensure your Tailwind configuration includes the engine's view paths in the `content` array so that all CSS classes are properly compiled.
197
+ **Peer dependency** (must be added to your Gemfile manually):
103
198
 
104
- Add the path to the engine's app directory in your `tailwind.config.js`:
105
-
106
- ```js
107
- module.exports = {
108
- content: [
109
- // ... your app paths
110
- "./path/to/iron_admin/app/**/*.{rb,haml}",
111
- ],
112
- }
113
- ```
114
-
115
- If installed as a gem, use `bundle show iron_admin` to find the installed path and add it to your Tailwind content paths.
199
+ | Gem | Version | Purpose |
200
+ |-----|---------|---------|
201
+ | `tailwindcss-rails` | >= 4.0 | Tailwind CSS compilation |
@@ -22,19 +22,48 @@ Common issues and their solutions.
22
22
  mount IronAdmin::Engine => "/admin"
23
23
  ```
24
24
 
25
- ### Assets/CSS not loading
25
+ ### Assets/CSS not loading (unstyled admin panel)
26
26
 
27
- **Cause:** Tailwind CSS not configured to scan IronAdmin files.
27
+ **Cause:** The Tailwind compiler didn't scan IronAdmin's source files.
28
28
 
29
- **Solution:** Add to `tailwind.config.js`:
30
- ```javascript
31
- content: [
32
- // ... your paths
33
- "./path/to/iron_admin/app/**/*.{rb,haml}",
34
- ]
29
+ **Solutions:**
30
+
31
+ 1. Verify the import line exists in `app/assets/tailwind/application.css`:
32
+ ```css
33
+ @import "tailwindcss";
34
+ @import "../builds/tailwind/iron_admin";
35
+ ```
36
+ 2. Check the bridge file exists at `app/assets/builds/tailwind/iron_admin.css`
37
+ (run `rails tailwindcss:build` to regenerate it)
38
+ 3. Verify the compiled CSS is large enough (~30KB+, not ~6KB):
39
+ ```bash
40
+ ls -la app/assets/builds/tailwind.css
41
+ ```
42
+
43
+ See the [Installation guide](../getting-started/installation.md#tailwind-css-setup) for full
44
+ details on how the CSS pipeline works.
45
+
46
+ ### `bin/dev` exits immediately after starting
47
+
48
+ **Cause:** This is a known upstream issue in `tailwindcss-rails` ([#602](https://github.com/rails/tailwindcss-rails/issues/602)).
49
+ The Tailwind CSS v4 binary's `--watch` flag exits when stdin is closed.
50
+ Foreman (used by `bin/dev`) does not provide a TTY to child processes, so the
51
+ watcher receives EOF on stdin and terminates. Since foreman treats any child
52
+ exit as a signal to shut down all processes, the entire `bin/dev` stack stops.
53
+
54
+ This affects **all** Rails apps using `tailwindcss-rails` v4 with foreman, not
55
+ just IronAdmin.
56
+
57
+ **Solution:** Edit `Procfile.dev` and append `[always]` to the watch task:
58
+
59
+ ```diff
60
+ web: bin/rails server
61
+ - css: bin/rails tailwindcss:watch
62
+ + css: bin/rails tailwindcss:watch[always]
35
63
  ```
36
64
 
37
- Find the gem path with: `bundle show iron_admin`
65
+ The `always` flag tells the Tailwind binary to keep watching even when stdin is
66
+ closed. This is the recommended workaround until the issue is resolved upstream.
38
67
 
39
68
  ## Resource Issues
40
69
 
@@ -64,7 +93,7 @@ Find the gem path with: `bundle show iron_admin`
64
93
  **Cause:** Resource not registered or menu configuration issue.
65
94
 
66
95
  **Solutions:**
67
- 1. Ensure resource file exists in `app/iron_admin/`
96
+ 1. Ensure resource file exists in `app/iron_admin/resources/`
68
97
  2. Check resource inherits from `IronAdmin::Resource`
69
98
  3. Verify filename matches class name (`user_resource.rb` → `UserResource`)
70
99
 
@@ -10,6 +10,7 @@ module IronAdmin
10
10
  # - Adds an initializer with default configuration
11
11
  # - Creates a sample dashboard
12
12
  # - Mounts the engine at /admin in routes
13
+ # - Adds the Tailwind CSS import for engine styles
13
14
  #
14
15
  # @example Running the generator
15
16
  # rails generate iron_admin:install
@@ -18,10 +19,11 @@ module IronAdmin
18
19
  class InstallGenerator < Rails::Generators::Base
19
20
  source_root File.expand_path("templates", __dir__)
20
21
 
21
- # Creates the directory for resource definitions.
22
+ # Creates the directory structure for resource and dashboard definitions.
22
23
  # @return [void]
23
- def create_iron_admin_directory
24
- empty_directory "app/iron_admin"
24
+ def create_iron_admin_directories
25
+ empty_directory "app/iron_admin/resources"
26
+ empty_directory "app/iron_admin/dashboards"
25
27
  end
26
28
 
27
29
  # Copies the initializer template with default configuration.
@@ -33,7 +35,7 @@ module IronAdmin
33
35
  # Copies the dashboard template.
34
36
  # @return [void]
35
37
  def copy_dashboard
36
- template "dashboard.rb.tt", "app/iron_admin/dashboard.rb"
38
+ template "dashboard.rb.tt", "app/iron_admin/dashboards/admin_dashboard.rb"
37
39
  end
38
40
 
39
41
  # Adds the engine mount to config/routes.rb.
@@ -41,6 +43,25 @@ module IronAdmin
41
43
  def add_route
42
44
  route 'mount IronAdmin::Engine => "/admin"'
43
45
  end
46
+
47
+ # Adds the IronAdmin CSS import to the Tailwind application stylesheet.
48
+ #
49
+ # This import is required so the Tailwind compiler scans the engine's
50
+ # views and components for CSS utility classes. Without it, the admin
51
+ # panel renders unstyled.
52
+ #
53
+ # @return [void]
54
+ def add_tailwind_import
55
+ css_path = "app/assets/tailwind/application.css"
56
+ return unless File.exist?(File.join(destination_root, css_path))
57
+
58
+ import_line = '@import "../builds/tailwind/iron_admin";'
59
+ content = File.read(File.join(destination_root, css_path))
60
+
61
+ return if content.include?(import_line)
62
+
63
+ append_to_file css_path, "#{import_line}\n"
64
+ end
44
65
  end
45
66
  end
46
67
  end
@@ -1,2 +1,6 @@
1
- class AdminDashboard < IronAdmin::Dashboard
1
+ module IronAdmin
2
+ module Dashboards
3
+ class AdminDashboard < IronAdmin::Dashboard
4
+ end
5
+ end
2
6
  end
@@ -20,7 +20,7 @@ module IronAdmin
20
20
  # Creates the resource file from template.
21
21
  # @return [void]
22
22
  def create_resource_file
23
- template "resource.rb.tt", File.join("app/iron_admin", class_path, "#{file_name}_resource.rb")
23
+ template "resource.rb.tt", File.join("app/iron_admin/resources", class_path, "#{file_name}_resource.rb")
24
24
  end
25
25
  end
26
26
  end
@@ -1,4 +1,8 @@
1
+ module IronAdmin
2
+ module Resources
1
3
  <% module_namespacing do -%>
2
- class <%= class_name %>Resource < IronAdmin::Resource
3
- end
4
+ class <%= class_name %>Resource < IronAdmin::Resource
5
+ end
4
6
  <% end -%>
7
+ end
8
+ end
@@ -38,31 +38,17 @@ module IronAdmin
38
38
  config.i18n.load_path += Dir[root.join("config", "locales", "**", "*.yml")]
39
39
  end
40
40
 
41
- initializer "iron_admin.tailwindcss" do
42
- if defined?(Tailwindcss)
43
- engine_css = root.join("app/assets/tailwind/iron_admin/engine.css")
44
-
45
- Rails.application.config.after_initialize do
46
- if defined?(Rake) && Rake::Task.task_defined?("tailwindcss:engines")
47
- Rake::Task["tailwindcss:engines"].enhance do
48
- tailwind_dir = Rails.root.join("app/assets/tailwind")
49
- bridge_file = tailwind_dir.join("iron_admin.css")
50
-
51
- if engine_css.exist? && tailwind_dir.exist?
52
- File.write(bridge_file, <<~CSS)
53
- /* DO NOT MODIFY - auto-generated by iron_admin */
54
- @import "#{engine_css}";
55
- CSS
56
- end
57
- end
58
- end
59
- end
60
- end
41
+ initializer "iron_admin.autoload", before: :set_autoload_paths do
42
+ resource_path = Rails.root.join("app/iron_admin")
43
+ Rails.autoloaders.main.push_dir(resource_path, namespace: IronAdmin) if resource_path.exist?
61
44
  end
62
45
 
63
- config.after_initialize do
46
+ config.to_prepare do
64
47
  resource_path = Rails.root.join("app/iron_admin")
65
- Rails.autoloaders.main.eager_load_dir(resource_path.to_s) if resource_path.exist?
48
+ if resource_path.exist?
49
+ IronAdmin::ResourceRegistry.reset!
50
+ Rails.autoloaders.main.eager_load_dir(resource_path)
51
+ end
66
52
  end
67
53
  end
68
54
  end
@@ -86,7 +86,7 @@ module IronAdmin
86
86
  def model
87
87
  return model_class_override if model_class_override
88
88
 
89
- name.sub(/Resource\z/, "").constantize
89
+ name.sub(/Resource\z/, "").sub(/\AIronAdmin::Resources::/, "").constantize
90
90
  end
91
91
 
92
92
  # Configures display and behavior options for a field.
@@ -3,5 +3,5 @@
3
3
  module IronAdmin
4
4
  # The current version of the IronAdmin gem.
5
5
  # @return [String]
6
- VERSION = "0.4.1"
6
+ VERSION = "0.5.0"
7
7
  end
data/lib/iron_admin.rb CHANGED
@@ -25,7 +25,7 @@ require "iron_admin/engine"
25
25
  # 1. Add the gem to your Gemfile and run bundle install
26
26
  # 2. Run the install generator: `rails generate iron_admin:install`
27
27
  # 3. Mount the engine in config/routes.rb: `mount IronAdmin::Engine => "/admin"`
28
- # 4. Create resources in app/iron_admin/ for each model you want to manage
28
+ # 4. Create resources in app/iron_admin/resources/ for each model you want to manage
29
29
  #
30
30
  # == Key Concepts
31
31
  #
@@ -34,22 +34,30 @@ require "iron_admin/engine"
34
34
  # that inherits from {IronAdmin::Resource} and provides a DSL for configuring
35
35
  # fields, filters, actions, and authorization.
36
36
  #
37
- # class UserResource < IronAdmin::Resource
38
- # field :email, readonly: true
39
- # field :password_digest, visible: false
40
- # searchable :name, :email
41
- # filter :role, type: :select, options: %w[admin user]
37
+ # module IronAdmin
38
+ # module Resources
39
+ # class UserResource < IronAdmin::Resource
40
+ # field :email, readonly: true
41
+ # field :password_digest, visible: false
42
+ # searchable :name, :email
43
+ # filter :role, type: :select, options: %w[admin user]
44
+ # end
45
+ # end
42
46
  # end
43
47
  #
44
48
  # === Dashboard
45
49
  # The dashboard is the admin panel home page. Create a class inheriting from
46
50
  # {IronAdmin::Dashboard} to define metrics, charts, and recent record lists.
47
51
  #
48
- # class AdminDashboard < IronAdmin::Dashboard
49
- # metric :total_users do
50
- # User.count
52
+ # module IronAdmin
53
+ # module Dashboards
54
+ # class AdminDashboard < IronAdmin::Dashboard
55
+ # metric :total_users do
56
+ # User.count
57
+ # end
58
+ # recent :orders, limit: 10
59
+ # end
51
60
  # end
52
- # recent :orders, limit: 10
53
61
  # end
54
62
  #
55
63
  # === Configuration
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RubyLab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-14 00:00:00.000000000 Z
11
+ date: 2026-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml-rails