[oe-commits] [bitbake] 07/44: toaster: toaster tables Enable complex empty states

git at git.openembedded.org git at git.openembedded.org
Mon Jun 13 21:10:55 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 9f21a1781345a2d2757616a9ab6f34ec48e9e93d
Author: Belen Barros Pena <belen.barros.pena at linux.intel.com>
AuthorDate: Thu May 5 15:51:09 2016 +0100

    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 <michael.g.wood at intel.com>
    Signed-off-by: Belen Barros Pena <belen.barros.pena at linux.intel.com>
---
 lib/toaster/toastergui/tables.py                   | 9 +++++++++
 lib/toaster/toastergui/templates/toastertable.html | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/toaster/toastergui/tables.py b/lib/toaster/toastergui/tables.py
index a0eb695..0cf96a0 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.
+        <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/lib/toaster/toastergui/templates/toastertable.html b/lib/toaster/toastergui/templates/toastertable.html
index d85d01f..aa14895 100644
--- a/lib/toaster/toastergui/templates/toastertable.html
+++ b/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">

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list