bitbake: 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.

(Bitbake rev: 9f21a1781345a2d2757616a9ab6f34ec48e9e93d)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Belen Barros Pena <belen.barros.pena@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Belen Barros Pena 2016-05-05 15:51:09 +01:00 committed by Richard Purdie
parent 443f7b3915
commit 0bd6095d92
2 changed files with 10 additions and 1 deletions

View File

@ -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.
<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

View File

@ -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">