admin_suite 0.2.0 → 0.2.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/app/assets/admin_suite.css +128 -0
- data/app/controllers/admin_suite/application_controller.rb +32 -2
- data/app/controllers/admin_suite/dashboard_controller.rb +59 -226
- data/app/helpers/admin_suite/base_helper.rb +108 -108
- data/app/helpers/admin_suite/panels_helper.rb +1 -1
- data/app/javascript/controllers/admin_suite/file_upload_controller.js +9 -9
- data/app/javascript/controllers/admin_suite/json_editor_controller.js +8 -8
- data/app/javascript/controllers/admin_suite/searchable_select_controller.js +2 -2
- data/app/javascript/controllers/admin_suite/tag_select_controller.js +1 -1
- data/app/javascript/controllers/admin_suite/toggle_switch_controller.js +1 -1
- data/app/views/admin_suite/dashboard/index.html.erb +6 -15
- data/app/views/admin_suite/panels/_cards.html.erb +6 -6
- data/app/views/admin_suite/panels/_chart.html.erb +12 -12
- data/app/views/admin_suite/panels/_health.html.erb +14 -14
- data/app/views/admin_suite/panels/_recent.html.erb +11 -11
- data/app/views/admin_suite/panels/_stat.html.erb +24 -24
- data/app/views/admin_suite/panels/_table.html.erb +10 -10
- data/app/views/admin_suite/portals/show.html.erb +1 -1
- data/app/views/admin_suite/resources/_form.html.erb +1 -1
- data/app/views/admin_suite/resources/edit.html.erb +4 -4
- data/app/views/admin_suite/resources/index.html.erb +23 -23
- data/app/views/admin_suite/resources/new.html.erb +4 -4
- data/app/views/admin_suite/resources/show.html.erb +17 -17
- data/app/views/admin_suite/shared/_form.html.erb +8 -8
- data/app/views/admin_suite/shared/_json_editor_field.html.erb +4 -4
- data/app/views/admin_suite/shared/_sidebar.html.erb +4 -4
- data/app/views/admin_suite/shared/_topbar.html.erb +1 -1
- data/app/views/layouts/admin_suite/application.html.erb +4 -4
- data/docs/configuration.md +56 -6
- data/docs/portals.md +42 -0
- data/lib/admin/base/action_executor.rb +69 -0
- data/lib/admin_suite/configuration.rb +12 -0
- data/lib/admin_suite/engine.rb +82 -31
- data/lib/admin_suite/ui/field_renderer_registry.rb +2 -2
- data/lib/admin_suite/ui/form_field_renderer.rb +2 -2
- data/lib/admin_suite/ui/show_formatter_registry.rb +5 -5
- data/lib/admin_suite/ui/show_value_formatter.rb +1 -1
- data/lib/admin_suite/version.rb +1 -1
- data/lib/admin_suite.rb +31 -0
- data/lib/generators/admin_suite/install/templates/admin_suite.rb +8 -0
- data/test/dummy/log/test.log +1512 -0
- data/test/dummy/tmp/local_secret.txt +1 -0
- data/test/integration/dashboard_test.rb +57 -1
- data/test/lib/action_executor_test.rb +172 -0
- data/test/lib/zeitwerk_integration_test.rb +69 -16
- metadata +4 -1
|
@@ -130,7 +130,7 @@ module AdminSuite
|
|
|
130
130
|
content_tag(:span, class: "inline-flex items-center gap-1") do
|
|
131
131
|
svg = '<svg class="w-4 h-4 text-green-500" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg>'.html_safe
|
|
132
132
|
concat(svg)
|
|
133
|
-
concat(content_tag(:span, "Yes", class: "text-green-600
|
|
133
|
+
concat(content_tag(:span, "Yes", class: "text-green-600 font-medium"))
|
|
134
134
|
end
|
|
135
135
|
when false
|
|
136
136
|
content_tag(:span, class: "inline-flex items-center gap-1") do
|
|
@@ -141,13 +141,13 @@ module AdminSuite
|
|
|
141
141
|
when Time, DateTime
|
|
142
142
|
content_tag(:span, class: "inline-flex items-center gap-2") do
|
|
143
143
|
concat(content_tag(:span, value.strftime("%B %d, %Y at %H:%M"), class: "font-medium"))
|
|
144
|
-
concat(content_tag(:span, "(#{time_ago_in_words(value)} ago)", class: "text-slate-500
|
|
144
|
+
concat(content_tag(:span, "(#{time_ago_in_words(value)} ago)", class: "text-slate-500 text-xs"))
|
|
145
145
|
end
|
|
146
146
|
when Date
|
|
147
147
|
value.strftime("%B %d, %Y")
|
|
148
148
|
when ActiveRecord::Base
|
|
149
149
|
link_text = value.respond_to?(:name) ? value.name : "#{value.class.name} ##{value.id}"
|
|
150
|
-
content_tag(:span, link_text, class: "text-indigo-600
|
|
150
|
+
content_tag(:span, link_text, class: "text-indigo-600")
|
|
151
151
|
when Hash
|
|
152
152
|
render_json_block(value)
|
|
153
153
|
when Array
|
|
@@ -158,7 +158,7 @@ module AdminSuite
|
|
|
158
158
|
else
|
|
159
159
|
content_tag(:div, class: "flex flex-wrap gap-1") do
|
|
160
160
|
value.each do |item|
|
|
161
|
-
concat(content_tag(:span, item.to_s, class: "inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-slate-100
|
|
161
|
+
concat(content_tag(:span, item.to_s, class: "inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-slate-100 text-slate-700"))
|
|
162
162
|
end
|
|
163
163
|
end
|
|
164
164
|
end
|
|
@@ -197,27 +197,27 @@ module AdminSuite
|
|
|
197
197
|
end
|
|
198
198
|
|
|
199
199
|
content_tag(:div, class: "space-y-2") do
|
|
200
|
-
concat(content_tag(:div, class: "inline-block rounded-lg overflow-hidden border border-slate-200
|
|
200
|
+
concat(content_tag(:div, class: "inline-block rounded-lg overflow-hidden border border-slate-200") do
|
|
201
201
|
image_tag(variant_url,
|
|
202
202
|
class: "max-w-full h-auto max-h-64 object-contain",
|
|
203
203
|
alt: blob.filename.to_s)
|
|
204
204
|
end)
|
|
205
|
-
concat(content_tag(:div, class: "flex items-center gap-3 text-sm text-slate-500
|
|
206
|
-
concat(content_tag(:span, blob.filename.to_s, class: "font-medium text-slate-700
|
|
205
|
+
concat(content_tag(:div, class: "flex items-center gap-3 text-sm text-slate-500") do
|
|
206
|
+
concat(content_tag(:span, blob.filename.to_s, class: "font-medium text-slate-700"))
|
|
207
207
|
concat(content_tag(:span, "•"))
|
|
208
208
|
concat(content_tag(:span, number_to_human_size(blob.byte_size)))
|
|
209
209
|
concat(content_tag(:span, "•"))
|
|
210
|
-
concat(link_to("View full size", admin_suite_rails_blob_path(blob, disposition: :inline), target: "_blank", class: "text-indigo-600
|
|
210
|
+
concat(link_to("View full size", admin_suite_rails_blob_path(blob, disposition: :inline), target: "_blank", class: "text-indigo-600 hover:underline"))
|
|
211
211
|
end)
|
|
212
212
|
end
|
|
213
213
|
else
|
|
214
|
-
content_tag(:div, class: "flex items-center gap-3 p-3 bg-slate-50
|
|
215
|
-
concat(content_tag(:div, class: "flex-shrink-0 w-10 h-10 bg-slate-200
|
|
214
|
+
content_tag(:div, class: "flex items-center gap-3 p-3 bg-slate-50 rounded-lg border border-slate-200") do
|
|
215
|
+
concat(content_tag(:div, class: "flex-shrink-0 w-10 h-10 bg-slate-200 rounded-lg flex items-center justify-center") do
|
|
216
216
|
'<svg class="w-5 h-5 text-slate-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>'.html_safe
|
|
217
217
|
end)
|
|
218
218
|
concat(content_tag(:div, class: "flex-1 min-w-0") do
|
|
219
|
-
concat(content_tag(:p, blob.filename.to_s, class: "font-medium text-slate-700
|
|
220
|
-
concat(content_tag(:p, number_to_human_size(blob.byte_size), class: "text-sm text-slate-500
|
|
219
|
+
concat(content_tag(:p, blob.filename.to_s, class: "font-medium text-slate-700 truncate"))
|
|
220
|
+
concat(content_tag(:p, number_to_human_size(blob.byte_size), class: "text-sm text-slate-500"))
|
|
221
221
|
end)
|
|
222
222
|
concat(link_to("Download", admin_suite_rails_blob_path(blob, disposition: :attachment),
|
|
223
223
|
class: "flex-shrink-0 px-3 py-1.5 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium rounded-lg transition-colors"))
|
|
@@ -240,11 +240,11 @@ module AdminSuite
|
|
|
240
240
|
|
|
241
241
|
content_tag(:div, class: "relative group") do
|
|
242
242
|
concat(content_tag(:div, class: "absolute top-2 right-2 flex items-center gap-2") do
|
|
243
|
-
concat(content_tag(:span, "JSON", class: "text-xs font-medium text-slate-400
|
|
243
|
+
concat(content_tag(:span, "JSON", class: "text-xs font-medium text-slate-400 uppercase tracking-wider"))
|
|
244
244
|
concat(content_tag(:button,
|
|
245
245
|
'<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>'.html_safe,
|
|
246
246
|
type: "button",
|
|
247
|
-
class: "p-1 text-slate-400 hover:text-slate-600
|
|
247
|
+
class: "p-1 text-slate-400 hover:text-slate-600 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
248
248
|
data: { controller: "admin-suite--clipboard", action: "click->admin-suite--clipboard#copy", "admin-suite--clipboard-text-value": json_str },
|
|
249
249
|
title: "Copy to clipboard"))
|
|
250
250
|
end)
|
|
@@ -260,11 +260,11 @@ module AdminSuite
|
|
|
260
260
|
def render_text_block(text, language = nil)
|
|
261
261
|
content_tag(:div, class: "relative group") do
|
|
262
262
|
concat(content_tag(:div, class: "absolute top-2 right-2 flex items-center gap-2") do
|
|
263
|
-
concat(content_tag(:span, language.to_s.upcase, class: "text-xs font-medium text-slate-400
|
|
263
|
+
concat(content_tag(:span, language.to_s.upcase, class: "text-xs font-medium text-slate-400 uppercase tracking-wider")) if language
|
|
264
264
|
concat(content_tag(:button,
|
|
265
265
|
'<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>'.html_safe,
|
|
266
266
|
type: "button",
|
|
267
|
-
class: "p-1 text-slate-400 hover:text-slate-600
|
|
267
|
+
class: "p-1 text-slate-400 hover:text-slate-600 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
268
268
|
data: { controller: "admin-suite--clipboard", action: "click->admin-suite--clipboard#copy", "admin-suite--clipboard-text-value": text },
|
|
269
269
|
title: "Copy to clipboard"))
|
|
270
270
|
end)
|
|
@@ -335,11 +335,11 @@ module AdminSuite
|
|
|
335
335
|
|
|
336
336
|
content_tag(:div, class: "relative group") do
|
|
337
337
|
concat(content_tag(:div, class: "absolute top-2 right-2 flex items-center gap-2") do
|
|
338
|
-
concat(content_tag(:span, "TEMPLATE", class: "text-xs font-medium text-slate-400
|
|
338
|
+
concat(content_tag(:span, "TEMPLATE", class: "text-xs font-medium text-slate-400 uppercase tracking-wider"))
|
|
339
339
|
concat(content_tag(:button,
|
|
340
340
|
'<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>'.html_safe,
|
|
341
341
|
type: "button",
|
|
342
|
-
class: "p-1 text-slate-400 hover:text-slate-600
|
|
342
|
+
class: "p-1 text-slate-400 hover:text-slate-600 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
343
343
|
data: { controller: "admin-suite--clipboard", action: "click->admin-suite--clipboard#copy", "admin-suite--clipboard-text-value": template },
|
|
344
344
|
title: "Copy to clipboard"))
|
|
345
345
|
end)
|
|
@@ -395,11 +395,11 @@ module AdminSuite
|
|
|
395
395
|
end
|
|
396
396
|
|
|
397
397
|
role_class = case role.to_s
|
|
398
|
-
when "user" then "bg-blue-50
|
|
399
|
-
when "assistant" then "bg-emerald-50
|
|
400
|
-
when "tool" then "bg-amber-50
|
|
401
|
-
when "system" then "bg-slate-50
|
|
402
|
-
else "bg-slate-50
|
|
398
|
+
when "user" then "bg-blue-50 border-blue-200"
|
|
399
|
+
when "assistant" then "bg-emerald-50 border-emerald-200"
|
|
400
|
+
when "tool" then "bg-amber-50 border-amber-200"
|
|
401
|
+
when "system" then "bg-slate-50 border-slate-200"
|
|
402
|
+
else "bg-slate-50 border-slate-200"
|
|
403
403
|
end
|
|
404
404
|
|
|
405
405
|
role_icon = case role.to_s
|
|
@@ -417,7 +417,7 @@ module AdminSuite
|
|
|
417
417
|
concat(content_tag(:div, class: "flex items-center justify-between mb-3") do
|
|
418
418
|
concat(content_tag(:div, class: "flex items-center gap-2") do
|
|
419
419
|
concat(role_icon)
|
|
420
|
-
concat(content_tag(:span, role.to_s.capitalize, class: "text-sm font-medium text-slate-700
|
|
420
|
+
concat(content_tag(:span, role.to_s.capitalize, class: "text-sm font-medium text-slate-700"))
|
|
421
421
|
end)
|
|
422
422
|
concat(content_tag(:div, class: "flex items-center gap-2 text-xs text-slate-400") do
|
|
423
423
|
concat(content_tag(:span, created_at.strftime("%H:%M:%S"))) if created_at.respond_to?(:strftime)
|
|
@@ -431,10 +431,10 @@ module AdminSuite
|
|
|
431
431
|
parsed = JSON.parse(content_str)
|
|
432
432
|
concat(render_json_block(parsed))
|
|
433
433
|
rescue JSON::ParserError
|
|
434
|
-
concat(content_tag(:div, simple_format(h(content_str)), class: "prose
|
|
434
|
+
concat(content_tag(:div, simple_format(h(content_str)), class: "prose prose-sm max-w-none"))
|
|
435
435
|
end
|
|
436
436
|
else
|
|
437
|
-
concat(content_tag(:div, simple_format(h(content_str)), class: "prose
|
|
437
|
+
concat(content_tag(:div, simple_format(h(content_str)), class: "prose prose-sm max-w-none"))
|
|
438
438
|
end
|
|
439
439
|
end)
|
|
440
440
|
end
|
|
@@ -448,7 +448,7 @@ module AdminSuite
|
|
|
448
448
|
|
|
449
449
|
content_tag(:div, class: "space-y-6") do
|
|
450
450
|
concat(content_tag(:div) do
|
|
451
|
-
concat(content_tag(:h4, "Arguments", class: "text-sm font-medium text-slate-500
|
|
451
|
+
concat(content_tag(:h4, "Arguments", class: "text-sm font-medium text-slate-500 mb-2"))
|
|
452
452
|
if args.present? && args != {}
|
|
453
453
|
concat(render_json_block(args))
|
|
454
454
|
else
|
|
@@ -457,17 +457,17 @@ module AdminSuite
|
|
|
457
457
|
end)
|
|
458
458
|
|
|
459
459
|
if result.present? && result != {}
|
|
460
|
-
concat(content_tag(:div, class: "pt-4 border-t border-slate-200
|
|
461
|
-
concat(content_tag(:h4, "Result", class: "text-sm font-medium text-slate-500
|
|
460
|
+
concat(content_tag(:div, class: "pt-4 border-t border-slate-200") do
|
|
461
|
+
concat(content_tag(:h4, "Result", class: "text-sm font-medium text-slate-500 mb-2"))
|
|
462
462
|
concat(render_json_block(result))
|
|
463
463
|
end)
|
|
464
464
|
end
|
|
465
465
|
|
|
466
466
|
if error.present?
|
|
467
|
-
concat(content_tag(:div, class: "pt-4 border-t border-slate-200
|
|
468
|
-
concat(content_tag(:h4, "Error", class: "text-sm font-medium text-red-500
|
|
469
|
-
concat(content_tag(:div, class: "bg-red-50
|
|
470
|
-
content_tag(:pre, h(error.to_s), class: "text-sm text-red-700
|
|
467
|
+
concat(content_tag(:div, class: "pt-4 border-t border-slate-200") do
|
|
468
|
+
concat(content_tag(:h4, "Error", class: "text-sm font-medium text-red-500 mb-2"))
|
|
469
|
+
concat(content_tag(:div, class: "bg-red-50 border border-red-200 rounded-lg p-4") do
|
|
470
|
+
content_tag(:pre, h(error.to_s), class: "text-sm text-red-700 whitespace-pre-wrap font-mono")
|
|
471
471
|
end)
|
|
472
472
|
end)
|
|
473
473
|
end
|
|
@@ -480,22 +480,22 @@ module AdminSuite
|
|
|
480
480
|
|
|
481
481
|
content_tag(:div, class: "space-y-4") do
|
|
482
482
|
if user_msg
|
|
483
|
-
concat(content_tag(:div, class: "rounded-lg border p-4 bg-blue-50
|
|
483
|
+
concat(content_tag(:div, class: "rounded-lg border p-4 bg-blue-50 border-blue-200") do
|
|
484
484
|
concat(content_tag(:div, class: "flex items-center gap-2 mb-2") do
|
|
485
485
|
concat('<svg class="w-4 h-4 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/></svg>'.html_safe)
|
|
486
|
-
concat(content_tag(:span, "User", class: "text-sm font-medium text-slate-700
|
|
486
|
+
concat(content_tag(:span, "User", class: "text-sm font-medium text-slate-700"))
|
|
487
487
|
end)
|
|
488
|
-
concat(content_tag(:div, simple_format(h(user_msg.respond_to?(:content) ? user_msg.content.to_s : user_msg.to_s)), class: "prose
|
|
488
|
+
concat(content_tag(:div, simple_format(h(user_msg.respond_to?(:content) ? user_msg.content.to_s : user_msg.to_s)), class: "prose prose-sm max-w-none"))
|
|
489
489
|
end)
|
|
490
490
|
end
|
|
491
491
|
|
|
492
492
|
if asst_msg
|
|
493
|
-
concat(content_tag(:div, class: "rounded-lg border p-4 bg-emerald-50
|
|
493
|
+
concat(content_tag(:div, class: "rounded-lg border p-4 bg-emerald-50 border-emerald-200") do
|
|
494
494
|
concat(content_tag(:div, class: "flex items-center gap-2 mb-2") do
|
|
495
495
|
concat('<svg class="w-4 h-4 text-emerald-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"/></svg>'.html_safe)
|
|
496
|
-
concat(content_tag(:span, "Assistant", class: "text-sm font-medium text-slate-700
|
|
496
|
+
concat(content_tag(:span, "Assistant", class: "text-sm font-medium text-slate-700"))
|
|
497
497
|
end)
|
|
498
|
-
concat(content_tag(:div, simple_format(h(asst_msg.respond_to?(:content) ? asst_msg.content.to_s : asst_msg.to_s)), class: "prose
|
|
498
|
+
concat(content_tag(:div, simple_format(h(asst_msg.respond_to?(:content) ? asst_msg.content.to_s : asst_msg.to_s)), class: "prose prose-sm max-w-none"))
|
|
499
499
|
end)
|
|
500
500
|
end
|
|
501
501
|
|
|
@@ -536,19 +536,19 @@ module AdminSuite
|
|
|
536
536
|
def render_show_section(resource, section, position = :main)
|
|
537
537
|
is_association = section.association.present? && !resource.public_send(section.association).is_a?(ActiveRecord::Base) rescue false
|
|
538
538
|
|
|
539
|
-
content_tag(:div, class: "bg-white
|
|
539
|
+
content_tag(:div, class: "bg-white rounded-xl border border-slate-200 overflow-hidden") do
|
|
540
540
|
header_padding = position == :sidebar ? "px-4 py-2.5" : "px-6 py-3"
|
|
541
541
|
header_text_size = position == :sidebar ? "text-sm" : ""
|
|
542
|
-
header_border = is_association ? "" : "border-b border-slate-200
|
|
542
|
+
header_border = is_association ? "" : "border-b border-slate-200"
|
|
543
543
|
|
|
544
|
-
concat(content_tag(:div, class: "#{header_padding} #{header_border} bg-slate-50
|
|
545
|
-
concat(content_tag(:h3, section.title, class: "font-medium text-slate-900
|
|
544
|
+
concat(content_tag(:div, class: "#{header_padding} #{header_border} bg-slate-50 flex items-center justify-between") do
|
|
545
|
+
concat(content_tag(:h3, section.title, class: "font-medium text-slate-900 #{header_text_size}"))
|
|
546
546
|
|
|
547
547
|
if section.association.present?
|
|
548
548
|
assoc = resource.public_send(section.association) rescue nil
|
|
549
549
|
if assoc && !assoc.is_a?(ActiveRecord::Base)
|
|
550
550
|
count = assoc.count rescue 0
|
|
551
|
-
color_class = count > 0 ? "bg-indigo-100
|
|
551
|
+
color_class = count > 0 ? "bg-indigo-100 text-indigo-700" : "bg-slate-200 text-slate-600"
|
|
552
552
|
concat(content_tag(:span, number_with_delimiter(count), class: "text-xs font-semibold px-2 py-0.5 rounded-full #{color_class}"))
|
|
553
553
|
end
|
|
554
554
|
end
|
|
@@ -582,8 +582,8 @@ module AdminSuite
|
|
|
582
582
|
concat(render_sidebar_attachment(value))
|
|
583
583
|
else
|
|
584
584
|
concat(content_tag(:div, class: "flex justify-between items-start gap-2") do
|
|
585
|
-
concat(content_tag(:span, field_name.to_s.humanize, class: "text-xs font-medium text-slate-500
|
|
586
|
-
concat(content_tag(:span, class: "text-sm text-slate-900
|
|
585
|
+
concat(content_tag(:span, field_name.to_s.humanize, class: "text-xs font-medium text-slate-500 uppercase tracking-wider flex-shrink-0"))
|
|
586
|
+
concat(content_tag(:span, class: "text-sm text-slate-900 text-right") { format_show_value(resource, field_name) })
|
|
587
587
|
end)
|
|
588
588
|
end
|
|
589
589
|
end
|
|
@@ -605,21 +605,21 @@ module AdminSuite
|
|
|
605
605
|
end
|
|
606
606
|
|
|
607
607
|
content_tag(:div, class: "space-y-2") do
|
|
608
|
-
concat(content_tag(:div, class: "rounded-lg overflow-hidden border border-slate-200
|
|
608
|
+
concat(content_tag(:div, class: "rounded-lg overflow-hidden border border-slate-200") do
|
|
609
609
|
image_tag(variant_url, class: "w-full h-auto object-cover", alt: blob.filename.to_s)
|
|
610
610
|
end)
|
|
611
|
-
concat(content_tag(:div, class: "flex items-center justify-between text-xs text-slate-500
|
|
611
|
+
concat(content_tag(:div, class: "flex items-center justify-between text-xs text-slate-500") do
|
|
612
612
|
concat(content_tag(:span, number_to_human_size(blob.byte_size)))
|
|
613
|
-
concat(link_to("View full", admin_suite_rails_blob_path(blob, disposition: :inline), target: "_blank", class: "text-indigo-600
|
|
613
|
+
concat(link_to("View full", admin_suite_rails_blob_path(blob, disposition: :inline), target: "_blank", class: "text-indigo-600 hover:underline"))
|
|
614
614
|
end)
|
|
615
615
|
end
|
|
616
616
|
else
|
|
617
|
-
content_tag(:div, class: "flex items-center gap-2 p-2 bg-slate-50
|
|
618
|
-
concat(content_tag(:div, class: "flex-shrink-0 w-8 h-8 bg-slate-200
|
|
617
|
+
content_tag(:div, class: "flex items-center gap-2 p-2 bg-slate-50 rounded-lg") do
|
|
618
|
+
concat(content_tag(:div, class: "flex-shrink-0 w-8 h-8 bg-slate-200 rounded flex items-center justify-center") do
|
|
619
619
|
'<svg class="w-4 h-4 text-slate-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>'.html_safe
|
|
620
620
|
end)
|
|
621
621
|
concat(content_tag(:div, class: "flex-1 min-w-0") do
|
|
622
|
-
concat(content_tag(:p, blob.filename.to_s.truncate(20), class: "text-xs font-medium text-slate-700
|
|
622
|
+
concat(content_tag(:p, blob.filename.to_s.truncate(20), class: "text-xs font-medium text-slate-700 truncate"))
|
|
623
623
|
concat(content_tag(:p, number_to_human_size(blob.byte_size), class: "text-xs text-slate-500"))
|
|
624
624
|
end)
|
|
625
625
|
end
|
|
@@ -630,8 +630,8 @@ module AdminSuite
|
|
|
630
630
|
content_tag(:dl, class: "space-y-6") do
|
|
631
631
|
fields.each do |field_name|
|
|
632
632
|
concat(content_tag(:div) do
|
|
633
|
-
concat(content_tag(:dt, field_name.to_s.humanize, class: "text-sm font-medium text-slate-500
|
|
634
|
-
concat(content_tag(:dd, class: "text-sm text-slate-900
|
|
633
|
+
concat(content_tag(:dt, field_name.to_s.humanize, class: "text-sm font-medium text-slate-500 mb-2"))
|
|
634
|
+
concat(content_tag(:dd, class: "text-sm text-slate-900") { format_show_value(resource, field_name) })
|
|
635
635
|
end)
|
|
636
636
|
end
|
|
637
637
|
end
|
|
@@ -679,7 +679,7 @@ module AdminSuite
|
|
|
679
679
|
def association_page_param(section) = "#{section.association}_page"
|
|
680
680
|
|
|
681
681
|
def render_association_pagination(pagy)
|
|
682
|
-
content_tag(:div, class: "-mx-6 border-t border-slate-200
|
|
682
|
+
content_tag(:div, class: "-mx-6 border-t border-slate-200 bg-slate-50/50 px-6 py-3") do
|
|
683
683
|
content_tag(:nav, class: "flex items-center justify-between", "aria-label" => "Pagination") do
|
|
684
684
|
concat(pagy_prev_link(pagy))
|
|
685
685
|
concat(pagy_page_links(pagy))
|
|
@@ -691,20 +691,20 @@ module AdminSuite
|
|
|
691
691
|
def pagy_prev_link(pagy)
|
|
692
692
|
if pagy.prev
|
|
693
693
|
link_to("Prev", pagy_url_for(pagy, pagy.prev),
|
|
694
|
-
class: "px-3 py-1.5 text-sm font-medium text-slate-700
|
|
694
|
+
class: "px-3 py-1.5 text-sm font-medium text-slate-700 bg-white border border-slate-300 rounded-lg hover:bg-slate-50 transition-colors")
|
|
695
695
|
else
|
|
696
696
|
content_tag(:span, "Prev",
|
|
697
|
-
class: "px-3 py-1.5 text-sm font-medium text-slate-400
|
|
697
|
+
class: "px-3 py-1.5 text-sm font-medium text-slate-400 bg-slate-100 border border-slate-200 rounded-lg cursor-not-allowed")
|
|
698
698
|
end
|
|
699
699
|
end
|
|
700
700
|
|
|
701
701
|
def pagy_next_link(pagy)
|
|
702
702
|
if pagy.next
|
|
703
703
|
link_to("Next", pagy_url_for(pagy, pagy.next),
|
|
704
|
-
class: "px-3 py-1.5 text-sm font-medium text-slate-700
|
|
704
|
+
class: "px-3 py-1.5 text-sm font-medium text-slate-700 bg-white border border-slate-300 rounded-lg hover:bg-slate-50 transition-colors")
|
|
705
705
|
else
|
|
706
706
|
content_tag(:span, "Next",
|
|
707
|
-
class: "px-3 py-1.5 text-sm font-medium text-slate-400
|
|
707
|
+
class: "px-3 py-1.5 text-sm font-medium text-slate-400 bg-slate-100 border border-slate-200 rounded-lg cursor-not-allowed")
|
|
708
708
|
end
|
|
709
709
|
end
|
|
710
710
|
|
|
@@ -718,11 +718,11 @@ module AdminSuite
|
|
|
718
718
|
case item
|
|
719
719
|
when Integer
|
|
720
720
|
link_to(item, pagy_url_for(pagy, item),
|
|
721
|
-
class: "px-2.5 py-1 text-sm font-medium text-slate-700
|
|
721
|
+
class: "px-2.5 py-1 text-sm font-medium text-slate-700 bg-white border border-slate-300 rounded hover:bg-slate-50 transition-colors")
|
|
722
722
|
when String
|
|
723
723
|
content_tag(:span, item, class: "px-2.5 py-1 text-sm font-semibold text-white bg-indigo-600 border border-indigo-600 rounded")
|
|
724
724
|
when :gap
|
|
725
|
-
content_tag(:span, "…", class: "px-2 text-sm text-slate-400
|
|
725
|
+
content_tag(:span, "…", class: "px-2 text-sm text-slate-400")
|
|
726
726
|
else
|
|
727
727
|
""
|
|
728
728
|
end
|
|
@@ -735,31 +735,31 @@ module AdminSuite
|
|
|
735
735
|
concat(content_tag(:div, class: "flex items-center justify-between gap-3") do
|
|
736
736
|
concat(content_tag(:div, class: "min-w-0 flex-1") do
|
|
737
737
|
title = item_display_title(item)
|
|
738
|
-
title_class = link_path ? "font-medium text-slate-900
|
|
738
|
+
title_class = link_path ? "font-medium text-slate-900 group-hover:text-indigo-600" : "font-medium text-slate-900"
|
|
739
739
|
concat(content_tag(:div, title, class: title_class))
|
|
740
740
|
|
|
741
741
|
subtitle = []
|
|
742
742
|
subtitle << item.status.to_s.humanize if item.respond_to?(:status) && item.status.present?
|
|
743
743
|
subtitle << item.email_address if item.respond_to?(:email_address) && item.email_address.present?
|
|
744
744
|
subtitle << item.tool_key if item.respond_to?(:tool_key) && item.tool_key.present?
|
|
745
|
-
concat(content_tag(:div, subtitle.first, class: "text-sm text-slate-500
|
|
745
|
+
concat(content_tag(:div, subtitle.first, class: "text-sm text-slate-500 mt-0.5")) if subtitle.any?
|
|
746
746
|
end)
|
|
747
747
|
|
|
748
748
|
if link_path
|
|
749
|
-
concat('<svg class="w-5 h-5 text-slate-300
|
|
749
|
+
concat('<svg class="w-5 h-5 text-slate-300 group-hover:text-indigo-500 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/></svg>'.html_safe)
|
|
750
750
|
end
|
|
751
751
|
end)
|
|
752
752
|
end
|
|
753
753
|
|
|
754
|
-
link_path ? link_to(card_content, link_path, class: "flex items-center -m-4 p-4 rounded-lg hover:bg-indigo-50
|
|
754
|
+
link_path ? link_to(card_content, link_path, class: "flex items-center -m-4 p-4 rounded-lg hover:bg-indigo-50 transition-colors group") : content_tag(:div, card_content, class: "flex items-center")
|
|
755
755
|
end
|
|
756
756
|
|
|
757
757
|
def render_association_list(items, section)
|
|
758
|
-
content_tag(:div, class: "divide-y divide-slate-200
|
|
758
|
+
content_tag(:div, class: "divide-y divide-slate-200 -mx-6 -mt-2 -mb-6") do
|
|
759
759
|
items.each do |item|
|
|
760
760
|
link_path = build_association_link(item, section)
|
|
761
761
|
wrapper = if link_path
|
|
762
|
-
->(content) { link_to(link_path, class: "block px-6 py-4 hover:bg-indigo-50/50
|
|
762
|
+
->(content) { link_to(link_path, class: "block px-6 py-4 hover:bg-indigo-50/50 transition-colors group") { content } }
|
|
763
763
|
else
|
|
764
764
|
->(content) { content_tag(:div, content, class: "px-6 py-4") }
|
|
765
765
|
end
|
|
@@ -769,7 +769,7 @@ module AdminSuite
|
|
|
769
769
|
concat(content_tag(:div, class: "min-w-0 flex-1") do
|
|
770
770
|
concat(content_tag(:div, class: "flex items-center gap-2") do
|
|
771
771
|
title = item_display_title(item)
|
|
772
|
-
title_class = link_path ? "text-slate-900
|
|
772
|
+
title_class = link_path ? "text-slate-900 group-hover:text-indigo-600" : "text-slate-900"
|
|
773
773
|
concat(content_tag(:span, title.truncate(60), class: "font-medium #{title_class} truncate"))
|
|
774
774
|
concat(render_status_badge(item.status, size: :sm)) if item.respond_to?(:status) && item.status.present?
|
|
775
775
|
end)
|
|
@@ -778,7 +778,7 @@ module AdminSuite
|
|
|
778
778
|
concat(content_tag(:div, class: "flex items-center gap-3 flex-shrink-0 text-xs text-slate-400") do
|
|
779
779
|
concat(content_tag(:span, time_ago_in_words(item.created_at) + " ago")) if item.respond_to?(:created_at) && item.created_at
|
|
780
780
|
if link_path
|
|
781
|
-
concat('<svg class="w-4 h-4 text-slate-300
|
|
781
|
+
concat('<svg class="w-4 h-4 text-slate-300 group-hover:text-indigo-500 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/></svg>'.html_safe)
|
|
782
782
|
end
|
|
783
783
|
end)
|
|
784
784
|
end)
|
|
@@ -792,28 +792,28 @@ module AdminSuite
|
|
|
792
792
|
columns = section.columns.presence || detect_table_columns(items.first)
|
|
793
793
|
|
|
794
794
|
content_tag(:div, class: "overflow-x-auto -mx-6 -mt-1") do
|
|
795
|
-
content_tag(:table, class: "min-w-full divide-y divide-slate-200
|
|
796
|
-
concat(content_tag(:thead, class: "bg-slate-50/50
|
|
795
|
+
content_tag(:table, class: "min-w-full divide-y divide-slate-200") do
|
|
796
|
+
concat(content_tag(:thead, class: "bg-slate-50/50") do
|
|
797
797
|
content_tag(:tr) do
|
|
798
798
|
Array.wrap(columns).each do |col|
|
|
799
799
|
header = col.to_s.gsub(/_id$/, "").humanize
|
|
800
|
-
concat(content_tag(:th, header, class: "px-4 py-2.5 text-left text-xs font-medium text-slate-500
|
|
800
|
+
concat(content_tag(:th, header, class: "px-4 py-2.5 text-left text-xs font-medium text-slate-500 uppercase tracking-wider first:pl-6"))
|
|
801
801
|
end
|
|
802
802
|
concat(content_tag(:th, "", class: "px-4 py-2.5 w-16"))
|
|
803
803
|
end
|
|
804
804
|
end)
|
|
805
805
|
|
|
806
|
-
concat(content_tag(:tbody, class: "divide-y divide-slate-200
|
|
806
|
+
concat(content_tag(:tbody, class: "divide-y divide-slate-200") do
|
|
807
807
|
items.each do |item|
|
|
808
808
|
link_path = build_association_link(item, section)
|
|
809
|
-
concat(content_tag(:tr, class: link_path ? "hover:bg-indigo-50/50
|
|
809
|
+
concat(content_tag(:tr, class: link_path ? "hover:bg-indigo-50/50 cursor-pointer group" : "") do
|
|
810
810
|
Array.wrap(columns).each_with_index do |col, idx|
|
|
811
811
|
value = item.public_send(col) rescue nil
|
|
812
812
|
text = format_table_cell(value)
|
|
813
813
|
concat(content_tag(:td, text, class: (idx == 0 ? "px-4 py-3 text-sm first:pl-6" : "px-4 py-3 text-sm")))
|
|
814
814
|
end
|
|
815
815
|
concat(content_tag(:td, class: "px-4 py-3 text-right pr-6") do
|
|
816
|
-
link_path ? link_to("View", link_path, class: "inline-flex items-center text-indigo-600
|
|
816
|
+
link_path ? link_to("View", link_path, class: "inline-flex items-center text-indigo-600 hover:text-indigo-800 text-sm font-medium") : ""
|
|
817
817
|
end)
|
|
818
818
|
end)
|
|
819
819
|
end
|
|
@@ -826,19 +826,19 @@ module AdminSuite
|
|
|
826
826
|
content_tag(:div, class: "grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1") do
|
|
827
827
|
items.each do |item|
|
|
828
828
|
link_path = build_association_link(item, section)
|
|
829
|
-
card_class = "border border-slate-200
|
|
830
|
-
card_class += link_path ? " hover:border-indigo-300
|
|
829
|
+
card_class = "border border-slate-200 rounded-lg p-4 transition-all"
|
|
830
|
+
card_class += link_path ? " hover:border-indigo-300 hover:shadow-md group cursor-pointer" : " hover:bg-slate-50"
|
|
831
831
|
|
|
832
832
|
card_content = capture do
|
|
833
833
|
concat(content_tag(:div, class: "flex items-start justify-between gap-2 mb-2") do
|
|
834
834
|
title = item_display_title(item)
|
|
835
|
-
title_class = link_path ? "font-medium text-slate-900
|
|
835
|
+
title_class = link_path ? "font-medium text-slate-900 group-hover:text-indigo-600" : "font-medium text-slate-900"
|
|
836
836
|
concat(content_tag(:span, title.truncate(35), class: title_class))
|
|
837
837
|
concat(render_status_badge(item.status, size: :sm)) if item.respond_to?(:status) && item.status.present?
|
|
838
838
|
end)
|
|
839
|
-
concat(content_tag(:div, class: "flex items-center justify-between text-xs text-slate-400 pt-2 border-t border-slate-100
|
|
839
|
+
concat(content_tag(:div, class: "flex items-center justify-between text-xs text-slate-400 pt-2 border-t border-slate-100") do
|
|
840
840
|
concat(content_tag(:span, time_ago_in_words(item.created_at) + " ago")) if item.respond_to?(:created_at) && item.created_at
|
|
841
|
-
concat('<svg class="w-4 h-4 text-slate-300
|
|
841
|
+
concat('<svg class="w-4 h-4 text-slate-300 group-hover:text-indigo-500 group-hover:translate-x-0.5 transition-all" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/></svg>'.html_safe) if link_path
|
|
842
842
|
end)
|
|
843
843
|
end
|
|
844
844
|
|
|
@@ -894,15 +894,15 @@ module AdminSuite
|
|
|
894
894
|
status_str = status.to_s.downcase
|
|
895
895
|
colors = case status_str
|
|
896
896
|
when "active", "open", "success", "approved", "completed", "enabled"
|
|
897
|
-
"bg-green-100
|
|
897
|
+
"bg-green-100 text-green-700"
|
|
898
898
|
when "pending", "proposed", "queued", "waiting"
|
|
899
|
-
"bg-amber-100
|
|
899
|
+
"bg-amber-100 text-amber-700"
|
|
900
900
|
when "running", "processing", "in_progress"
|
|
901
|
-
"bg-blue-100
|
|
901
|
+
"bg-blue-100 text-blue-700"
|
|
902
902
|
when "error", "failed", "rejected", "cancelled"
|
|
903
|
-
"bg-red-100
|
|
903
|
+
"bg-red-100 text-red-700"
|
|
904
904
|
else
|
|
905
|
-
"bg-slate-100
|
|
905
|
+
"bg-slate-100 text-slate-600"
|
|
906
906
|
end
|
|
907
907
|
|
|
908
908
|
padding = size == :sm ? "px-1.5 py-0.5 text-xs" : "px-2 py-1 text-xs"
|
|
@@ -927,25 +927,25 @@ module AdminSuite
|
|
|
927
927
|
def label_badge_colors(color)
|
|
928
928
|
case color.to_s.downcase
|
|
929
929
|
when "green"
|
|
930
|
-
"bg-green-100
|
|
930
|
+
"bg-green-100 text-green-700"
|
|
931
931
|
when "amber", "yellow", "orange"
|
|
932
|
-
"bg-amber-100
|
|
932
|
+
"bg-amber-100 text-amber-700"
|
|
933
933
|
when "blue"
|
|
934
|
-
"bg-blue-100
|
|
934
|
+
"bg-blue-100 text-blue-700"
|
|
935
935
|
when "red"
|
|
936
|
-
"bg-red-100
|
|
936
|
+
"bg-red-100 text-red-700"
|
|
937
937
|
when "indigo"
|
|
938
|
-
"bg-indigo-100
|
|
938
|
+
"bg-indigo-100 text-indigo-700"
|
|
939
939
|
when "purple"
|
|
940
|
-
"bg-purple-100
|
|
940
|
+
"bg-purple-100 text-purple-700"
|
|
941
941
|
when "violet"
|
|
942
|
-
"bg-violet-100
|
|
942
|
+
"bg-violet-100 text-violet-700"
|
|
943
943
|
when "emerald"
|
|
944
|
-
"bg-emerald-100
|
|
944
|
+
"bg-emerald-100 text-emerald-700"
|
|
945
945
|
when "cyan"
|
|
946
|
-
"bg-cyan-100
|
|
946
|
+
"bg-cyan-100 text-cyan-700"
|
|
947
947
|
else
|
|
948
|
-
"bg-slate-100
|
|
948
|
+
"bg-slate-100 text-slate-600"
|
|
949
949
|
end
|
|
950
950
|
end
|
|
951
951
|
|
|
@@ -979,7 +979,7 @@ module AdminSuite
|
|
|
979
979
|
when :searchable_select then render_searchable_select(f, field, resource)
|
|
980
980
|
when :multi_select, :tags then render_multi_select(f, field, resource)
|
|
981
981
|
when :image, :attachment then render_file_upload(f, field, resource)
|
|
982
|
-
when :trix, :rich_text then f.rich_text_area(field.name, class: "prose
|
|
982
|
+
when :trix, :rich_text then f.rich_text_area(field.name, class: "prose max-w-none")
|
|
983
983
|
when :markdown
|
|
984
984
|
f.text_area(field.name, class: "#{field_class} font-mono", rows: field.rows || 12, data: { controller: "admin-suite--markdown-editor" }, placeholder: field.placeholder)
|
|
985
985
|
when :file then f.file_field(field.name, class: "form-input-file", accept: field.accept)
|
|
@@ -995,8 +995,8 @@ module AdminSuite
|
|
|
995
995
|
|
|
996
996
|
concat(field_html)
|
|
997
997
|
|
|
998
|
-
concat(content_tag(:p, field.help, class: "mt-1 text-sm text-slate-500
|
|
999
|
-
concat(content_tag(:p, resource.errors[field.name].first, class: "mt-1 text-sm text-red-600
|
|
998
|
+
concat(content_tag(:p, field.help, class: "mt-1 text-sm text-slate-500")) if field.help.present?
|
|
999
|
+
concat(content_tag(:p, resource.errors[field.name].first, class: "mt-1 text-sm text-red-600")) if resource.errors[field.name].any?
|
|
1000
1000
|
end)
|
|
1001
1001
|
end
|
|
1002
1002
|
end
|
|
@@ -1062,7 +1062,7 @@ module AdminSuite
|
|
|
1062
1062
|
action: "input->admin-suite--searchable-select#search focus->admin-suite--searchable-select#open keydown->admin-suite--searchable-select#keydown"
|
|
1063
1063
|
}))
|
|
1064
1064
|
concat(content_tag(:div, "",
|
|
1065
|
-
class: "absolute z-10 w-full mt-1 bg-white
|
|
1065
|
+
class: "absolute z-10 w-full mt-1 bg-white border border-slate-200 rounded-lg shadow-lg hidden max-h-60 overflow-y-auto",
|
|
1066
1066
|
data: { "admin-suite--searchable-select-target": "dropdown" }))
|
|
1067
1067
|
end
|
|
1068
1068
|
end
|
|
@@ -1100,11 +1100,11 @@ module AdminSuite
|
|
|
1100
1100
|
concat(hidden_field_tag(full_field_name, "", id: nil, data: { "admin-suite--tag-select-target": "placeholder" }))
|
|
1101
1101
|
|
|
1102
1102
|
concat(content_tag(:div,
|
|
1103
|
-
class: "flex flex-wrap gap-2 min-h-[2.5rem] p-2 bg-white
|
|
1103
|
+
class: "flex flex-wrap gap-2 min-h-[2.5rem] p-2 bg-white border border-slate-200 rounded-lg",
|
|
1104
1104
|
data: { "admin-suite--tag-select-target": "tags" }) do
|
|
1105
1105
|
current_values.each do |val|
|
|
1106
1106
|
concat(content_tag(:span,
|
|
1107
|
-
class: "inline-flex items-center gap-1 px-2 py-1 bg-indigo-100
|
|
1107
|
+
class: "inline-flex items-center gap-1 px-2 py-1 bg-indigo-100 text-indigo-700 rounded text-sm") do
|
|
1108
1108
|
concat(val.to_s)
|
|
1109
1109
|
concat(hidden_field_tag(full_field_name, val, id: nil))
|
|
1110
1110
|
concat(button_tag("×", type: "button", class: "text-indigo-500 hover:text-indigo-700 font-bold", data: { action: "admin-suite--tag-select#remove" }))
|
|
@@ -1119,13 +1119,13 @@ module AdminSuite
|
|
|
1119
1119
|
|
|
1120
1120
|
if options.any?
|
|
1121
1121
|
concat(content_tag(:div,
|
|
1122
|
-
class: "hidden border border-slate-200
|
|
1122
|
+
class: "hidden border border-slate-200 rounded-lg bg-white shadow-lg max-h-48 overflow-y-auto",
|
|
1123
1123
|
data: { "admin-suite--tag-select-target": "dropdown" }) do
|
|
1124
1124
|
options.each do |opt|
|
|
1125
1125
|
label, value = opt.is_a?(Array) ? [ opt[0], opt[1] ] : [ opt, opt ]
|
|
1126
1126
|
concat(content_tag(:button, label,
|
|
1127
1127
|
type: "button",
|
|
1128
|
-
class: "block w-full text-left px-3 py-2 text-sm hover:bg-slate-100
|
|
1128
|
+
class: "block w-full text-left px-3 py-2 text-sm hover:bg-slate-100",
|
|
1129
1129
|
data: { action: "admin-suite--tag-select#select", value: value }))
|
|
1130
1130
|
end
|
|
1131
1131
|
end)
|
|
@@ -1157,18 +1157,18 @@ module AdminSuite
|
|
|
1157
1157
|
class: "space-y-3") do
|
|
1158
1158
|
if has_attachment && is_image
|
|
1159
1159
|
concat(content_tag(:div, class: "relative inline-block") do
|
|
1160
|
-
concat(image_tag(existing_url, class: "max-w-[200px] max-h-[150px] rounded-lg border border-slate-200
|
|
1160
|
+
concat(image_tag(existing_url, class: "max-w-[200px] max-h-[150px] rounded-lg border border-slate-200 object-cover", data: { "admin-suite--file-upload-target": "imagePreview" }))
|
|
1161
1161
|
concat(button_tag("×", type: "button",
|
|
1162
1162
|
class: "absolute -top-2 -right-2 w-6 h-6 bg-red-500 hover:bg-red-600 text-white rounded-full flex items-center justify-center text-sm",
|
|
1163
1163
|
data: { "admin-suite--file-upload-target": "removeButton", action: "admin-suite--file-upload#remove" }))
|
|
1164
1164
|
end)
|
|
1165
1165
|
else
|
|
1166
|
-
concat(image_tag("", class: "hidden max-w-[200px] max-h-[150px] rounded-lg border border-slate-200
|
|
1166
|
+
concat(image_tag("", class: "hidden max-w-[200px] max-h-[150px] rounded-lg border border-slate-200 object-cover", data: { "admin-suite--file-upload-target": "imagePreview" }))
|
|
1167
1167
|
concat(content_tag(:div, "", class: "hidden", data: { "admin-suite--file-upload-target": "filename" }))
|
|
1168
1168
|
end
|
|
1169
1169
|
|
|
1170
1170
|
concat(content_tag(:div,
|
|
1171
|
-
class: "relative border-2 border-dashed border-slate-300
|
|
1171
|
+
class: "relative border-2 border-dashed border-slate-300 rounded-lg hover:border-indigo-400 transition-colors",
|
|
1172
1172
|
data: { "admin-suite--file-upload-target": "dropzone" }) do
|
|
1173
1173
|
concat(f.file_field(field.name,
|
|
1174
1174
|
class: "sr-only",
|
|
@@ -1177,9 +1177,9 @@ module AdminSuite
|
|
|
1177
1177
|
data: { "admin-suite--file-upload-target": "input", action: "change->admin-suite--file-upload#preview" }))
|
|
1178
1178
|
|
|
1179
1179
|
concat(content_tag(:label, for: "#{field.name}_input",
|
|
1180
|
-
class: "flex flex-col items-center justify-center w-full py-6 cursor-pointer hover:bg-slate-50
|
|
1180
|
+
class: "flex flex-col items-center justify-center w-full py-6 cursor-pointer hover:bg-slate-50 rounded-lg transition-colors") do
|
|
1181
1181
|
concat('<svg class="w-8 h-8 text-slate-400 mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"/></svg>'.html_safe)
|
|
1182
|
-
concat(content_tag(:span, "Click to upload or drag and drop", class: "text-sm text-slate-500
|
|
1182
|
+
concat(content_tag(:span, "Click to upload or drag and drop", class: "text-sm text-slate-500"))
|
|
1183
1183
|
concat(content_tag(:span, "PNG, JPG, WebP up to 10MB", class: "text-xs text-slate-400 mt-1")) if is_image
|
|
1184
1184
|
end)
|
|
1185
1185
|
end)
|
|
@@ -10,7 +10,7 @@ module AdminSuite
|
|
|
10
10
|
|
|
11
11
|
content_tag(:div, class: "space-y-6") do
|
|
12
12
|
rows.each do |row|
|
|
13
|
-
concat(content_tag(:div, class: "grid grid-cols-1 lg:grid-cols-12 gap-6") do
|
|
13
|
+
concat(content_tag(:div, class: "admin-suite-dashboard-row grid grid-cols-1 lg:grid-cols-12 gap-6") do
|
|
14
14
|
Array(row.panels).each do |panel|
|
|
15
15
|
concat(render_panel(panel))
|
|
16
16
|
end
|