Patchwork [bitbake-devel,10/19] toaster: Add no search results page

login
register
mail settings
Submitter Alexandru DAMIAN
Date March 14, 2014, 5:58 p.m.
Message ID <3feff77091b3926c10ca8f30890c9049633ccb66.1394819783.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/68659/
State New
Headers show

Comments

Alexandru DAMIAN - March 14, 2014, 5:58 p.m.
From: Belen Barros Pena <belen.barros.pena@intel.com>

Adding the no search results page to the built packages
(bpackage.html), variables (configvars.html), recipes
(recipes.html) and tasks (tasks.html) tables.

The change copies the code from the build.html template
into the other 4 templates. There is probably a smarter way
of doing this, though.

Signed-off-by: Belen Barros Pena <belen.barros.pena@intel.com>
---
 lib/toaster/toastergui/templates/bpackage.html   | 13 +++++++++++++
 lib/toaster/toastergui/templates/configvars.html | 14 ++++++++++++++
 lib/toaster/toastergui/templates/recipes.html    | 14 ++++++++++++++
 lib/toaster/toastergui/templates/tasks.html      | 15 +++++++++++++++
 4 files changed, 56 insertions(+)

Patch

diff --git a/lib/toaster/toastergui/templates/bpackage.html b/lib/toaster/toastergui/templates/bpackage.html
index 1eb1f8e..54f4bb4 100644
--- a/lib/toaster/toastergui/templates/bpackage.html
+++ b/lib/toaster/toastergui/templates/bpackage.html
@@ -20,6 +20,18 @@ 
  </h1>
 </div>
 
+{% if objects.paginator.count == 0 %}
+  <div class="row-fluid">
+      <div class="alert">
+        <form class="no-results input-append" id="searchform">
+            <input id="search" name="search" class="input-xxlarge" type="text" value="{{request.GET.search}}"/><a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>
+            <button class="btn" type="submit" value="Search">Search</button>
+            <button class="btn btn-link" onclick="javascript:$('#search').val('');searchform.submit()">Show all packages</button>
+        </form>
+      </div>
+  </div>
+  
+{% else %}
 {% include "basetable_top.html" %}
 
     {% for package in objects %}
@@ -69,5 +81,6 @@ 
     {% endfor %}
 
 {% include "basetable_bottom.html" %}
+{% endif %}
 </div>
 {% endblock %}
diff --git a/lib/toaster/toastergui/templates/configvars.html b/lib/toaster/toastergui/templates/configvars.html
index ecd5a0f..5c552c9 100644
--- a/lib/toaster/toastergui/templates/configvars.html
+++ b/lib/toaster/toastergui/templates/configvars.html
@@ -30,6 +30,19 @@ 
 
   <!-- variables -->
   <div id="variables" class="tab-pane">
+  
+  {% if objects.paginator.count == 0 %}
+  <div class="row-fluid">
+      <div class="alert">
+        <form class="no-results input-append" id="searchform">
+            <input id="search" name="search" class="input-xxlarge" type="text" value="{{request.GET.search}}"/><a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>
+            <button class="btn" type="submit" value="Search">Search</button>
+            <button class="btn btn-link" onclick="javascript:$('#search').val('');searchform.submit()">Show all variables</button>
+        </form>
+      </div>
+  </div>
+  
+  {% else %}
   {% include "basetable_top.html" %}
 
   {% for variable in objects %}
@@ -52,6 +65,7 @@ 
 {% endfor %}
 
 {% include "basetable_bottom.html" %}
+{% endif %}
 </div> <!-- endvariables -->
 
 <!-- file list popups -->
diff --git a/lib/toaster/toastergui/templates/recipes.html b/lib/toaster/toastergui/templates/recipes.html
index 724bcf5..da5ac99 100755
--- a/lib/toaster/toastergui/templates/recipes.html
+++ b/lib/toaster/toastergui/templates/recipes.html
@@ -19,6 +19,19 @@ 
   {%endif%}
  </h1>
 </div>
+
+{% if objects.paginator.count == 0 %}
+  <div class="row-fluid">
+      <div class="alert">
+        <form class="no-results input-append" id="searchform">
+            <input id="search" name="search" class="input-xxlarge" type="text" value="{{request.GET.search}}"/><a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>
+            <button class="btn" type="submit" value="Search">Search</button>
+            <button class="btn btn-link" onclick="javascript:$('#search').val('');searchform.submit()">Show all recipes</button>
+        </form>
+      </div>
+  </div>
+
+{% else %}
 {% include "basetable_top.html" %}
 
     {% for recipe in objects %}
@@ -80,5 +93,6 @@ 
     {% endfor %}
 
 {% include "basetable_bottom.html" %}
+{% endif %}
 </div>
 {% endblock %}
diff --git a/lib/toaster/toastergui/templates/tasks.html b/lib/toaster/toastergui/templates/tasks.html
index ce75b75..f484867 100644
--- a/lib/toaster/toastergui/templates/tasks.html
+++ b/lib/toaster/toastergui/templates/tasks.html
@@ -17,6 +17,20 @@ 
   {%endif%}
  </h1>
 </div>
+
+{% if objects.paginator.count == 0 %}
+  <div class="row-fluid">
+      <div class="alert">
+        <form class="no-results input-append" id="searchform">
+            <input id="search" name="search" class="input-xxlarge" type="text" value="{{request.GET.search}}"/><a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>
+            <button class="btn" type="submit" value="Search">Search</button>
+            <button class="btn btn-link" onclick="javascript:$('#search').val('');searchform.submit()">Show all tasks</button>
+        </form>
+      </div>
+  </div>
+
+
+{% else %}
 {% include "basetable_top.html" %}
 
     {% for task in objects %}
@@ -58,5 +72,6 @@ 
     {% endfor %}
 
 {% include "basetable_bottom.html" %}
+{% endif %}
 </div>
 {% endblock %}