easy-admin-rails 0.1.0 → 0.1.2
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/config/initializers/rack_mini_profiler.rb +2 -3
- data/lib/{easy-admin.rb → easy-admin-rails.rb} +0 -1
- data/lib/easy_admin/configuration.rb +3 -2
- data/lib/easy_admin/resource.rb +15 -3
- data/lib/easy_admin/resource_registry.rb +1 -1
- data/lib/easy_admin/version.rb +1 -1
- metadata +2 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08ad3d25712dbf0cbe36f63b4a88fdbf24dfbf285aeec8ba2e7419fc23f52809'
|
4
|
+
data.tar.gz: a65a78cbc09cdaf6ba6583d5782c39553c4fd4bdf751846361cdde48e3ef5e20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65e3655530ec7a30a5317c5ae5173e31ab6992f9db04f3715ebd2fb34146115de396a5fa11c0a0b19cab6e8b7689c6d72d6c5df3f625cfbb7fb33a13f07c7790
|
7
|
+
data.tar.gz: d5bebdb3acd49da4654df19c130e7e63fe4b013d882e565a511309c5cfd00aab140e000ce79910e2b20614507e34621c1044fabe7ead05648f9762aa943d7e08
|
@@ -32,9 +32,8 @@ if defined?(Rack::MiniProfiler)
|
|
32
32
|
# Show SQL queries by default
|
33
33
|
config.enable_advanced_debugging_tools = true
|
34
34
|
|
35
|
-
# Storage (use
|
36
|
-
config.storage = Rack::MiniProfiler::
|
37
|
-
config.storage_options = { path: Rails.root.join('tmp', 'miniprofiler') }
|
35
|
+
# Storage (use memory storage to avoid file path issues)
|
36
|
+
config.storage = Rack::MiniProfiler::MemoryStore
|
38
37
|
|
39
38
|
# Only profile requests that take longer than this (in milliseconds)
|
40
39
|
config.flamegraph_sample_rate = 0.5
|
@@ -24,12 +24,13 @@ module EasyAdmin
|
|
24
24
|
@current_group = nil
|
25
25
|
end
|
26
26
|
|
27
|
-
def item(label, path = nil, icon: nil, active: false, &block)
|
27
|
+
def item(label, path = nil, icon: nil, active: false, resource: nil, &block)
|
28
28
|
item_config = {
|
29
29
|
label: label,
|
30
30
|
path: path,
|
31
31
|
icon: icon,
|
32
|
-
active: active
|
32
|
+
active: active,
|
33
|
+
resource: resource
|
33
34
|
}
|
34
35
|
|
35
36
|
if block_given?
|
data/lib/easy_admin/resource.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module EasyAdmin
|
2
2
|
class Resource
|
3
|
-
class_attribute :model_class_name, :resource_name, :fields_config, :form_tabs_config, :show_layout_config, :scopes_config, :pagination_config, :includes_config, :batch_actions_config, :batch_actions_enabled, :row_actions_config
|
3
|
+
class_attribute :model_class_name, :resource_name, :fields_config, :form_tabs_config, :show_layout_config, :scopes_config, :pagination_config, :includes_config, :batch_actions_config, :batch_actions_enabled, :row_actions_config, :custom_title
|
4
4
|
|
5
5
|
def self.inherited(subclass)
|
6
6
|
super
|
@@ -28,6 +28,16 @@ module EasyAdmin
|
|
28
28
|
EasyAdmin::ResourceRegistry.register(subclass)
|
29
29
|
end
|
30
30
|
|
31
|
+
# DSL for setting custom model name
|
32
|
+
def self.model(model_name)
|
33
|
+
self.model_class_name = model_name.to_s
|
34
|
+
end
|
35
|
+
|
36
|
+
# DSL for setting custom title
|
37
|
+
def self.resource_title(title_name)
|
38
|
+
self.custom_title = title_name.to_s
|
39
|
+
end
|
40
|
+
|
31
41
|
# DSL for defining fields
|
32
42
|
def self.field(name, type = :string, **options)
|
33
43
|
self.fields_config += [{
|
@@ -164,11 +174,13 @@ module EasyAdmin
|
|
164
174
|
|
165
175
|
# Get resource title/name
|
166
176
|
def self.title
|
167
|
-
|
177
|
+
return custom_title.pluralize if custom_title.present?
|
178
|
+
resource_name.underscore.humanize.pluralize
|
168
179
|
end
|
169
180
|
|
170
181
|
def self.singular_title
|
171
|
-
|
182
|
+
return custom_title.singularize if custom_title.present?
|
183
|
+
resource_name.underscore.humanize
|
172
184
|
end
|
173
185
|
|
174
186
|
# Get fields for different contexts
|
@@ -3,7 +3,7 @@ module EasyAdmin
|
|
3
3
|
@@resources = {}
|
4
4
|
|
5
5
|
def self.register(resource_class)
|
6
|
-
route_key = resource_class.name.demodulize.gsub(/Resource$/, '').
|
6
|
+
route_key = resource_class.name.demodulize.gsub(/Resource$/, '').underscore.pluralize
|
7
7
|
@@resources[route_key] = resource_class
|
8
8
|
end
|
9
9
|
|
data/lib/easy_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy-admin-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Slaurmagan
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.3'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: importmap-rails
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '2.0'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '2.0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: devise
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,20 +178,6 @@ dependencies:
|
|
192
178
|
- - "~>"
|
193
179
|
- !ruby/object:Gem::Version
|
194
180
|
version: '2.0'
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
|
-
name: esbuild
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - "~>"
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: '0.19'
|
202
|
-
type: :development
|
203
|
-
prerelease: false
|
204
|
-
version_requirements: !ruby/object:Gem::Requirement
|
205
|
-
requirements:
|
206
|
-
- - "~>"
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
version: '0.19'
|
209
181
|
description: EasyAdmin provides a straightforward way to add an admin panel to your
|
210
182
|
Rails project.
|
211
183
|
email:
|
@@ -385,7 +357,7 @@ files:
|
|
385
357
|
- config/initializers/rack_mini_profiler.rb
|
386
358
|
- config/routes.rb
|
387
359
|
- db/migrate/20250101000001_create_easy_admin_admin_users.rb
|
388
|
-
- lib/easy-admin.rb
|
360
|
+
- lib/easy-admin-rails.rb
|
389
361
|
- lib/easy_admin/action.rb
|
390
362
|
- lib/easy_admin/batch_action.rb
|
391
363
|
- lib/easy_admin/configuration.rb
|