easy-admin-rails 0.2.7 → 0.2.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74e3a17e7d1c33152242a68ca0b0211d72b37d5b206307721e006d09a6c07ef1
|
4
|
+
data.tar.gz: b8c3645a8c1d27de9b5c7ee20b718b9a4cc10d16b2d2a87d285d24c7228a9c62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19405da82b73193c8009360e481c9bac007623dbd4c36e3bea6c09f0d248547689d8eb74d4e84f2affd7da4c6f83b6ce30c9295814bb2aacb4f6f4659ef01960
|
7
|
+
data.tar.gz: fb822864ee9ac13b116385492d8c34617ab12e25660df46ac90fcd3f281768a612c99bd16ec7addf9c53b5556325e4956996681f95ad4a4ee5aacd693bb8bbee
|
@@ -71,9 +71,9 @@ module EasyAdmin
|
|
71
71
|
else
|
72
72
|
# For static mode, render all options
|
73
73
|
render_option("", "All")
|
74
|
-
|
75
|
-
if
|
76
|
-
|
74
|
+
|
75
|
+
if resolved_options
|
76
|
+
resolved_options.each do |option_value, option_label|
|
77
77
|
render_option(option_value, option_label)
|
78
78
|
end
|
79
79
|
end
|
@@ -108,16 +108,33 @@ module EasyAdmin
|
|
108
108
|
|
109
109
|
def current_display_value
|
110
110
|
return "All" if @search_params["#{filter_field_name}_eq"].blank?
|
111
|
-
|
112
|
-
if
|
113
|
-
|
111
|
+
|
112
|
+
if resolved_options
|
113
|
+
resolved_options.each do |option_value, option_label|
|
114
114
|
return option_label.to_s if option_value.to_s == @search_params["#{filter_field_name}_eq"].to_s
|
115
115
|
end
|
116
116
|
end
|
117
|
-
|
117
|
+
|
118
118
|
@search_params["#{filter_field_name}_eq"].to_s
|
119
119
|
end
|
120
120
|
|
121
|
+
def resolved_options
|
122
|
+
return nil unless @field[:options]
|
123
|
+
|
124
|
+
if @field[:options].is_a?(Proc)
|
125
|
+
# For filters, call the Proc without parameters
|
126
|
+
# (filters don't have a specific record context like forms do)
|
127
|
+
if @field[:options].arity == 0 || @field[:options].arity == -1
|
128
|
+
@field[:options].call
|
129
|
+
else
|
130
|
+
# If Proc expects parameters, call it with nil
|
131
|
+
@field[:options].call(nil)
|
132
|
+
end
|
133
|
+
else
|
134
|
+
@field[:options]
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
121
138
|
def render_no_results_message
|
122
139
|
div(
|
123
140
|
class: "select-no-results px-3 py-2 text-sm text-gray-500 text-center",
|
data/lib/easy_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy-admin-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Slaurmagan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -412,7 +412,6 @@ files:
|
|
412
412
|
- app/views/layouts/easy_admin/application.html.erb
|
413
413
|
- app/views/layouts/easy_admin/auth.html.erb
|
414
414
|
- config/initializers/easy_admin_card_factory.rb
|
415
|
-
- config/initializers/easy_admin_permissions.rb
|
416
415
|
- config/initializers/pagy.rb
|
417
416
|
- config/initializers/rack_mini_profiler.rb
|
418
417
|
- config/routes.rb
|
@@ -1,73 +0,0 @@
|
|
1
|
-
EasyAdmin::Permissions.configure do |config|
|
2
|
-
# Enable the permissions system
|
3
|
-
config.enabled = true
|
4
|
-
|
5
|
-
# Cache duration for permission lookups (default: 1 hour)
|
6
|
-
config.cache_duration = 1.hour
|
7
|
-
|
8
|
-
# Allow admin users to bypass permissions (default: true)
|
9
|
-
config.admin_bypass = true
|
10
|
-
|
11
|
-
# Set the user model class name (default: 'User')
|
12
|
-
config.user_class 'EasyAdmin::AdminUser'
|
13
|
-
|
14
|
-
# Define permission contexts (optional - for scoped permissions)
|
15
|
-
|
16
|
-
# config.contexts :organization, :project
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
# Define your permissions here
|
21
|
-
# Note: This will only run if the database tables exist
|
22
|
-
if ActiveRecord::Base.connection.table_exists?(:easy_admin_permissions)
|
23
|
-
EasyAdmin::Permissions.define do
|
24
|
-
# Dashboard permissions
|
25
|
-
permission :dashboard, :view, description: "Access admin dashboard"
|
26
|
-
|
27
|
-
# Admin user management permissions
|
28
|
-
resource :admin_users, actions: [:read, :create, :update, :delete]
|
29
|
-
permission :admin_users, :manage_roles, description: "Assign and remove user roles"
|
30
|
-
|
31
|
-
# Reports permissions
|
32
|
-
permission :reports, :view, description: "View reports"
|
33
|
-
permission :reports, :export, description: "Export reports"
|
34
|
-
|
35
|
-
# Settings permissions
|
36
|
-
permission :settings, :read, description: "View system settings"
|
37
|
-
permission :settings, :update, description: "Update system settings"
|
38
|
-
|
39
|
-
# Role definitions
|
40
|
-
role :super_admin,
|
41
|
-
description: "Full system access",
|
42
|
-
permissions: %w[
|
43
|
-
dashboard:view admin_users:read admin_users:create admin_users:update
|
44
|
-
admin_users:delete admin_users:manage_roles reports:view reports:export
|
45
|
-
settings:read settings:update
|
46
|
-
]
|
47
|
-
|
48
|
-
role :admin,
|
49
|
-
description: "Administrative access with user management",
|
50
|
-
permissions: %w[
|
51
|
-
dashboard:view admin_users:read admin_users:create admin_users:update
|
52
|
-
admin_users:manage_roles reports:view reports:export settings:read
|
53
|
-
]
|
54
|
-
|
55
|
-
role :manager,
|
56
|
-
description: "Management access with limited user permissions",
|
57
|
-
permissions: %w[
|
58
|
-
dashboard:view admin_users:read admin_users:update reports:view reports:export
|
59
|
-
]
|
60
|
-
|
61
|
-
role :editor,
|
62
|
-
description: "Content editing permissions",
|
63
|
-
permissions: %w[
|
64
|
-
dashboard:view admin_users:read
|
65
|
-
]
|
66
|
-
|
67
|
-
role :viewer,
|
68
|
-
description: "Read-only access",
|
69
|
-
permissions: %w[
|
70
|
-
dashboard:view admin_users:read reports:view
|
71
|
-
]
|
72
|
-
end
|
73
|
-
end
|