admin_suite 0.2.2 → 0.2.4
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/app/assets/admin_suite.css +1 -0
- data/app/controllers/admin_suite/resources_controller.rb +55 -20
- data/app/helpers/admin_suite/base_helper.rb +52 -2
- data/app/javascript/controllers/admin_suite/flash_controller.js +45 -0
- data/app/javascript/controllers/admin_suite/searchable_select_controller.js +121 -38
- data/app/javascript/controllers/admin_suite/toggle_switch_controller.js +24 -15
- data/app/views/admin_suite/resources/edit.html.erb +1 -1
- data/app/views/admin_suite/resources/new.html.erb +1 -1
- data/app/views/admin_suite/shared/_flash.html.erb +15 -2
- data/app/views/admin_suite/shared/_toggle_cell.html.erb +4 -2
- data/app/views/admin_suite/shared/_topbar.html.erb +13 -0
- data/docs/configuration.md +30 -0
- data/lib/admin_suite/configuration.rb +6 -0
- data/lib/admin_suite/ui/show_value_formatter.rb +30 -2
- data/lib/admin_suite/version.rb +1 -1
- data/lib/generators/admin_suite/install/templates/admin_suite.rb +5 -0
- metadata +7 -5
- data/test/dummy/log/test.log +0 -1512
- data/test/dummy/tmp/local_secret.txt +0 -1
|
@@ -6,6 +6,9 @@ module AdminSuite
|
|
|
6
6
|
attr_accessor :authenticate,
|
|
7
7
|
:current_actor,
|
|
8
8
|
:authorize,
|
|
9
|
+
:logout_path,
|
|
10
|
+
:logout_method,
|
|
11
|
+
:logout_label,
|
|
9
12
|
:resource_globs,
|
|
10
13
|
:action_globs,
|
|
11
14
|
:portal_globs,
|
|
@@ -30,6 +33,9 @@ module AdminSuite
|
|
|
30
33
|
@authenticate = nil
|
|
31
34
|
@current_actor = nil
|
|
32
35
|
@authorize = nil
|
|
36
|
+
@logout_path = nil
|
|
37
|
+
@logout_method = :delete
|
|
38
|
+
@logout_label = "Log out"
|
|
33
39
|
@resource_globs = []
|
|
34
40
|
@action_globs = []
|
|
35
41
|
@portal_globs = []
|
|
@@ -12,6 +12,8 @@ module AdminSuite
|
|
|
12
12
|
|
|
13
13
|
if (field_def = admin_suite_field_definition(field_name))
|
|
14
14
|
case field_def.type
|
|
15
|
+
when :toggle
|
|
16
|
+
return render_show_toggle(record, field_def.name)
|
|
15
17
|
when :markdown
|
|
16
18
|
rendered =
|
|
17
19
|
if defined?(::MarkdownRenderer)
|
|
@@ -40,8 +42,13 @@ module AdminSuite
|
|
|
40
42
|
# If the field isn't in the form config, fall back to index column config
|
|
41
43
|
# so show pages can still render labels consistently.
|
|
42
44
|
if respond_to?(:resource_config, true) && (rc = resource_config) && rc.index_config&.columns_list
|
|
43
|
-
col = rc.index_config.columns_list.find
|
|
44
|
-
|
|
45
|
+
col = rc.index_config.columns_list.find do |c|
|
|
46
|
+
c.name.to_sym == field_name.to_sym || c.toggle_field&.to_sym == field_name.to_sym
|
|
47
|
+
end
|
|
48
|
+
if col&.type == :toggle
|
|
49
|
+
toggle_field = (col.toggle_field || col.name).to_sym
|
|
50
|
+
return render_show_toggle(record, toggle_field)
|
|
51
|
+
elsif col&.type == :label
|
|
45
52
|
label_value = col.content.is_a?(Proc) ? col.content.call(record) : value
|
|
46
53
|
return render_label_badge(label_value, color: col.label_color, size: col.label_size, record: record)
|
|
47
54
|
end
|
|
@@ -65,6 +72,27 @@ module AdminSuite
|
|
|
65
72
|
|
|
66
73
|
super
|
|
67
74
|
end
|
|
75
|
+
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
def render_show_toggle(record, field)
|
|
79
|
+
toggle_url =
|
|
80
|
+
begin
|
|
81
|
+
resource_toggle_path(
|
|
82
|
+
portal: current_portal,
|
|
83
|
+
resource_name: resource_name,
|
|
84
|
+
id: record.to_param,
|
|
85
|
+
field: field
|
|
86
|
+
)
|
|
87
|
+
rescue StandardError
|
|
88
|
+
nil
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
render(
|
|
92
|
+
partial: "admin_suite/shared/toggle_cell",
|
|
93
|
+
locals: { record: record, field: field, toggle_url: toggle_url }
|
|
94
|
+
)
|
|
95
|
+
end
|
|
68
96
|
end
|
|
69
97
|
end
|
|
70
98
|
end
|
data/lib/admin_suite/version.rb
CHANGED
|
@@ -14,6 +14,11 @@ AdminSuite.configure do |config|
|
|
|
14
14
|
# config.authorize = ->(actor, action:, subject:, resource:, controller:) { true }
|
|
15
15
|
config.authorize = nil
|
|
16
16
|
|
|
17
|
+
# Optional sign-out action in the topbar.
|
|
18
|
+
# config.logout_path = ->(view) { view.main_app.logout_path }
|
|
19
|
+
# config.logout_method = :delete
|
|
20
|
+
# config.logout_label = "Log out"
|
|
21
|
+
|
|
17
22
|
# Resource definition file globs (host app can override).
|
|
18
23
|
config.resource_globs = [
|
|
19
24
|
Rails.root.join("config/admin_suite/resources/*.rb").to_s,
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: admin_suite
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- TechWright Labs
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-02-18 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: rails
|
|
@@ -139,6 +140,7 @@ files:
|
|
|
139
140
|
- app/javascript/controllers/admin_suite/clipboard_controller.js
|
|
140
141
|
- app/javascript/controllers/admin_suite/code_editor_controller.js
|
|
141
142
|
- app/javascript/controllers/admin_suite/file_upload_controller.js
|
|
143
|
+
- app/javascript/controllers/admin_suite/flash_controller.js
|
|
142
144
|
- app/javascript/controllers/admin_suite/json_editor_controller.js
|
|
143
145
|
- app/javascript/controllers/admin_suite/live_filter_controller.js
|
|
144
146
|
- app/javascript/controllers/admin_suite/markdown_editor_controller.js
|
|
@@ -237,7 +239,6 @@ files:
|
|
|
237
239
|
- test/dummy/config/puma.rb
|
|
238
240
|
- test/dummy/config/routes.rb
|
|
239
241
|
- test/dummy/db/seeds.rb
|
|
240
|
-
- test/dummy/log/test.log
|
|
241
242
|
- test/dummy/public/400.html
|
|
242
243
|
- test/dummy/public/404.html
|
|
243
244
|
- test/dummy/public/406-unsupported-browser.html
|
|
@@ -247,7 +248,6 @@ files:
|
|
|
247
248
|
- test/dummy/public/icon.svg
|
|
248
249
|
- test/dummy/public/robots.txt
|
|
249
250
|
- test/dummy/test/test_helper.rb
|
|
250
|
-
- test/dummy/tmp/local_secret.txt
|
|
251
251
|
- test/fixtures/docs/progress/PROGRESS_REPORT.md
|
|
252
252
|
- test/integration/dashboard_test.rb
|
|
253
253
|
- test/integration/docs_test.rb
|
|
@@ -264,6 +264,7 @@ metadata:
|
|
|
264
264
|
rubygems_mfa_required: 'true'
|
|
265
265
|
source_code_uri: https://github.com/techwright-lab/admin_suite
|
|
266
266
|
changelog_uri: https://github.com/techwright-lab/admin_suite/blob/main/CHANGELOG.md
|
|
267
|
+
post_install_message:
|
|
267
268
|
rdoc_options: []
|
|
268
269
|
require_paths:
|
|
269
270
|
- lib
|
|
@@ -278,7 +279,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
278
279
|
- !ruby/object:Gem::Version
|
|
279
280
|
version: '0'
|
|
280
281
|
requirements: []
|
|
281
|
-
rubygems_version: 3.
|
|
282
|
+
rubygems_version: 3.5.22
|
|
283
|
+
signing_key:
|
|
282
284
|
specification_version: 4
|
|
283
285
|
summary: Reusable admin suite engine
|
|
284
286
|
test_files: []
|