From: Belen Barros Pena Date: Thu, 5 May 2016 14:51:09 +0000 (+0100) Subject: toaster: toaster tables Enable complex empty states X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f21a1781345a2d2757616a9ab6f34ec48e9e93d;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git toaster: toaster tables Enable complex empty states Make sure we can create empty states for toaster tables that include actions for users to get out of the empty state. Allows a template to be used as an empty state. Signed-off-by: Michael Wood Signed-off-by: Belen Barros Pena --- diff --git a/lib/toaster/toastergui/tables.py b/lib/toaster/toastergui/tables.py index a0eb69591bd..0cf96a0ef34 100644 --- a/lib/toaster/toastergui/tables.py +++ b/lib/toaster/toastergui/tables.py @@ -477,7 +477,16 @@ class CustomImagesTable(ToasterTable): def get_context_data(self, **kwargs): context = super(CustomImagesTable, self).get_context_data(**kwargs) + + empty_state_template = ''' + You have not created any custom images yet. + + Create your first custom image + ''' + context['empty_state'] = self.render_static_data(empty_state_template, + kwargs) project = Project.objects.get(pk=kwargs['pid']) + # TODO put project into the ToasterTable base class context['project'] = project return context diff --git a/lib/toaster/toastergui/templates/toastertable.html b/lib/toaster/toastergui/templates/toastertable.html index d85d01f1570..aa148955e4f 100644 --- a/lib/toaster/toastergui/templates/toastertable.html +++ b/lib/toaster/toastergui/templates/toastertable.html @@ -26,7 +26,7 @@ {% include 'toastertable-filter.html' %}