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 <[email protected]> Signed-off-by: Belen Barros Pena <[email protected]> --- bitbake/lib/toaster/toastergui/tables.py | 9 +++++++++ bitbake/lib/toaster/toastergui/templates/toastertable.html | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index 479ba1e..d163e15 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py @@ -470,7 +470,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. + <a href="{% url 'newcustomimage' data.pid %}"> + Create your first custom image</a> + ''' + 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/bitbake/lib/toaster/toastergui/templates/toastertable.html b/bitbake/lib/toaster/toastergui/templates/toastertable.html index f391c12..6634c20 100644 --- a/bitbake/lib/toaster/toastergui/templates/toastertable.html +++ b/bitbake/lib/toaster/toastergui/templates/toastertable.html @@ -26,7 +26,7 @@ {% include 'toastertable-filter.html' %} <div class="row-fluid" id="empty-state-{{table_name}}" style="display:none"> - <div class="alert alert-info">{{empty_state}}</div> + <div class="alert alert-info">{{empty_state|safe}}</div> </div> <div id="no-results-{{table_name}}" style="display:none"> -- 1.9.1 -- _______________________________________________ toaster mailing list [email protected] https://lists.yoctoproject.org/listinfo/toaster
