[bitbake-devel] [PATCH 04/23] toaster: fixing undefined variables

Alex DAMIAN alexandru.damian at intel.com
Thu Jun 25 10:33:41 UTC 2015


From: Alexandru DAMIAN <alexandru.damian at intel.com>

This patchset fixes usage of undefined variables in
the base page.

Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
---
 lib/toaster/toastergui/templates/base.html          | 11 +++++++----
 lib/toaster/toastergui/templates/basetable_top.html | 11 ++++++++---
 lib/toaster/toastergui/templates/filtersnippet.html |  2 +-
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/lib/toaster/toastergui/templates/base.html b/lib/toaster/toastergui/templates/base.html
index 9f19c03..3f3253d 100644
--- a/lib/toaster/toastergui/templates/base.html
+++ b/lib/toaster/toastergui/templates/base.html
@@ -29,17 +29,18 @@
 {% endif %}
 <script>
   libtoaster.ctx = {
-    projectId : {{project.id|default:'undefined'}},
     jsUrl : "{% static 'js/' %}",
     htmlUrl : "{% static 'html/' %}",
     projectsUrl : "{% url 'all-projects' %}",
     {% if project.id %}
+      projectId : {{project.id}},
       projectPageUrl : {% url 'project' project.id as purl%}{{purl|json}},
       projectName : {{project.name|json}},
       projectTargetsUrl: {% url 'projectavailabletargets' project.id as paturl%}{{paturl|json}},
       projectBuildsUrl: {% url 'projectbuilds' project.id as pburl %}{{pburl|json}},
       projectId : {{project.id}},
     {% else %}
+      projectId : undefined,
       projectPageUrl : undefined,
       projectName : undefined,
       projectId : undefined,
@@ -101,8 +102,10 @@
                   <h3>New build</h3>
                   <h6>Project:</h6>
                   <span id="project">
-                    <a class="lead" href="{% if project.id %}{% url 'project' project.id %}{% endif %}">{{project.name}}</a>
-                    <i class="icon-pencil"></i>
+                    {% if project.id %}
+                      <a class="lead" href="{% url 'project' project.id %}">{{project.name}}</a>
+                      <i class="icon-pencil"></i>
+                    {% endif %}
                   </span>
                   <form id="change-project-form" style="display:none;">
                     <div class="input-append">
@@ -122,7 +125,7 @@
                     <form>
                       <input type="text" class="input-xlarge" id="build-target-input" placeholder="Type a recipe name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead" disabled/>
                       <div>
-                        <button class="btn btn-primary" id="build-button" data-project-id="{{project.id}}" disabled>Build</button>
+                        <button class="btn btn-primary" id="build-button" disabled>Build</button>
                       </div>
                     </form>
                   </li>
diff --git a/lib/toaster/toastergui/templates/basetable_top.html b/lib/toaster/toastergui/templates/basetable_top.html
index fcd2f03..8dd56ed 100644
--- a/lib/toaster/toastergui/templates/basetable_top.html
+++ b/lib/toaster/toastergui/templates/basetable_top.html
@@ -162,7 +162,7 @@
 <div class="navbar">
     <div class="navbar-inner">
         <form class="navbar-search input-append pull-left" id="searchform">
-            <input class="input-xxlarge" id="search" name="search" type="text" placeholder="Search {%if object_search_display %}{{object_search_display}}{%else%}{{objectname}}{%endif%}" value="{{request.GET.search}}"/>{% if request.GET.search %}<a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>{%endif%}
+            <input class="input-xxlarge" id="search" name="search" type="text" placeholder="Search {%if object_search_display %}{{object_search_display}}{%else%}{{objectname}}{%endif%}" value="{%if request.GET.search %}{{request.GET.search}}{% endif %}"/>{% if request.GET.search %}<a href="javascript:$('#search').val('');searchform.submit()" class="add-on btn" tabindex="-1"><i class="icon-remove"></i></a>{%endif%}
             <input type="hidden" name="orderby" value="{{request.GET.orderby}}">
             <input type="hidden" name="page" value="1">
             <button class="btn" type="submit" value="Search">Search</button>
@@ -191,7 +191,12 @@
                                        onclick="showhideTableColumn(
                                            $(this).attr('id'),
                                            $(this).is(':checked'),
-                                           '{{i.orderkey}}' )"
+                                           {% if i.ordericon %}
+                                              '{{i.orderkey}}'
+                                           {% else %}
+                                              undefined
+                                           {% endif %}
+                                       )"
                                    {%else%}
                                        checked disabled
                                    {% endif %}/>   {{i.name}}
@@ -221,7 +226,7 @@
     <thead>
         <!-- Table header row; generated from "tablecols" entry in the context dict -->
         <tr>
-            {% for tc in tablecols %}<th class="{{tc.dclass}} {{tc.clclass}}">
+            {% for tc in tablecols %}<th class="{%if tc.dclass%}{{tc.dclass}}{%endif%} {% if tc.clclass %}{{tc.clclass}}{% endif %}">
                 {%if tc.qhelp%}<i class="icon-question-sign get-help" title="{{tc.qhelp}}"></i>{%endif%}
                 {%if tc.orderfield%}<a {%if tc.ordericon%} class="sorted" {%endif%}href="javascript:reload_params({'page': 1, 'orderby' : '{{tc.orderfield}}' })">{{tc.name}}</a>{%else%}<span class="muted">{{tc.name}}</span>{%endif%}
                 {%if tc.ordericon%} <i class="icon-caret-{{tc.ordericon}}"></i>{%endif%}
diff --git a/lib/toaster/toastergui/templates/filtersnippet.html b/lib/toaster/toastergui/templates/filtersnippet.html
index f624d88..56e2b21 100644
--- a/lib/toaster/toastergui/templates/filtersnippet.html
+++ b/lib/toaster/toastergui/templates/filtersnippet.html
@@ -2,7 +2,7 @@
 <!-- '{{f.class}}' filter -->
 {% with f.class as  key %}
 <form id="filter_{{f.class}}" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
-        <input type="hidden" name="search" value="{{request.GET.search}}"/>
+        <input type="hidden" name="search" value="{%if request.GET.search %}{{request.GET.search}}{%endif%}"/>
         <div class="modal-header">
             <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
             {% if search_term %}
-- 
1.9.1




More information about the bitbake-devel mailing list