]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: toaster tables Enable complex empty states
authorBelen Barros Pena <belen.barros.pena@linux.intel.com>
Thu, 5 May 2016 14:51:09 +0000 (15:51 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 13 Jun 2016 21:04:30 +0000 (22:04 +0100)
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 <michael.g.wood@intel.com>
Signed-off-by: Belen Barros Pena <belen.barros.pena@linux.intel.com>
lib/toaster/toastergui/tables.py
lib/toaster/toastergui/templates/toastertable.html

index a0eb69591bd4b5fc24968c8ecc5012e24c755c50..0cf96a0ef34bbd4be190a5a9bdc4426d98d106a3 100644 (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
index d85d01f1570a10693d5d5adb1fb4f933cc89033a..aa148955e4f001f52a39445eb98f4d361be7173e 100644 (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">