mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-21 19:18:44 -06:00
Fixes #19999: Script list widget now displays correctly
- Extract script list content into reusable partial template - Add object-list CSS class for proper embedded table styling - Hide module headers and management actions in widget context - Use compact buttons with icon-only labels for widgets - Add test coverage for embedded parameter handling The embedded version now renders cleanly in dashboard widgets while preserving full functionality in the main script list page.
This commit is contained in:
@@ -1282,11 +1282,18 @@ class ScriptListView(ContentTypePermissionRequiredMixin, View):
|
||||
script_modules = ScriptModule.objects.restrict(request.user).prefetch_related(
|
||||
'data_source', 'data_file', 'jobs'
|
||||
)
|
||||
|
||||
return render(request, 'extras/script_list.html', {
|
||||
context = {
|
||||
'model': ScriptModule,
|
||||
'script_modules': script_modules,
|
||||
})
|
||||
}
|
||||
|
||||
# Use partial template for dashboard widgets
|
||||
template_name = 'extras/script_list.html'
|
||||
if request.GET.get('embedded'):
|
||||
template_name = 'extras/inc/script_list_content.html'
|
||||
context['embedded'] = True
|
||||
|
||||
return render(request, template_name, context)
|
||||
|
||||
|
||||
class BaseScriptView(generic.ObjectView):
|
||||
|
||||
Reference in New Issue
Block a user