aboutsummaryrefslogtreecommitdiffstats
path: root/lib/toaster/toastergui/templates
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-04-10 18:15:03 +0100
committerAlexandru DAMIAN <alexandru.damian@intel.com>2015-05-01 17:37:38 +0100
commit4ef2774a2f683929c700550a9acc7b8f6074195b (patch)
treec466f9de0fecaa07438aceb8bd74f6dfcbdd870f /lib/toaster/toastergui/templates
parentaf63abe88327fd5c1b3d7c00a84d9e408ef23285 (diff)
downloadbitbake-contrib-4ef2774a2f683929c700550a9acc7b8f6074195b.tar.gz
toaster: Move project context variables to common scope
We have a bunch of context data which are used in multiple pages so it makes more sense to have this in a single place libtoaster.ctx that's accessible from each page rather than request it from every page. Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Diffstat (limited to 'lib/toaster/toastergui/templates')
-rw-r--r--lib/toaster/toastergui/templates/base.html17
-rw-r--r--lib/toaster/toastergui/templates/importlayer.html4
-rw-r--r--lib/toaster/toastergui/templates/layerdetails.html5
-rw-r--r--lib/toaster/toastergui/templates/layers_dep_modal.html2
-rw-r--r--lib/toaster/toastergui/templates/machines.html5
5 files changed, 13 insertions, 20 deletions
diff --git a/lib/toaster/toastergui/templates/base.html b/lib/toaster/toastergui/templates/base.html
index 58392b36f..25933a1e9 100644
--- a/lib/toaster/toastergui/templates/base.html
+++ b/lib/toaster/toastergui/templates/base.html
@@ -26,20 +26,27 @@
libtoaster.debug = true;
</script>
{% endif %}
+<script>
+ libtoaster.ctx = {
+ projectId : {{project.id|default:'undefined'}},
+ xhrDataTypeaheadUrl : "{% url 'xhr_datatypeahead' %}",
+ {% if project.id %}
+ xhrProjectEditUrl : "{% url 'xhr_projectedit' project.id %}",
+ projectPageUrl : "{% url 'project' project.id %}",
+ projectName : "{{project.name}}",
+ {% endif %}
+ };
+</script>
<script src="{% static 'js/base.js' %}"></script>
{%if MANAGED %}
<script>
$(document).ready(function () {
/* Vars needed for base.js */
var ctx = {};
- ctx.xhrDataTypeaheadUrl = "{% url 'xhr_datatypeahead' %}";
ctx.projectBuildUrl = "{% url 'xhr_build' %}";
- ctx.projectPageUrl = "{% url 'base_project' %}";
+ ctx.projectBasePageUrl = "{% url 'base_project' %}";
ctx.projectInfoUrl = "{% url 'xhr_projectinfo' %}";
ctx.numProjects = {{projects|length}};
- {% if project %}
- ctx.projectId = {{project.id}};
- {% endif %}
ctx.currentUrl = "{{request.path|escapejs}}";
basePageInit(ctx);
diff --git a/lib/toaster/toastergui/templates/importlayer.html b/lib/toaster/toastergui/templates/importlayer.html
index 5ef8a5786..c92b5d8b2 100644
--- a/lib/toaster/toastergui/templates/importlayer.html
+++ b/lib/toaster/toastergui/templates/importlayer.html
@@ -13,12 +13,8 @@
<script>
$(document).ready(function (){
var ctx = {
- xhrDataTypeaheadUrl : "{% url 'xhr_datatypeahead' %}",
layerDetailsUrl : "{% url 'base_layerdetails' %}",
xhrImportLayerUrl : "{% url 'xhr_importlayer' %}",
- xhrEditProjectUrl : "{% url 'xhr_projectedit' project.id %}",
- projectPageUrl : "{% url 'project' project.id %}",
- projectId : {{project.id}}
};
try {
diff --git a/lib/toaster/toastergui/templates/layerdetails.html b/lib/toaster/toastergui/templates/layerdetails.html
index 0d3aa1537..435bf04e4 100644
--- a/lib/toaster/toastergui/templates/layerdetails.html
+++ b/lib/toaster/toastergui/templates/layerdetails.html
@@ -18,12 +18,7 @@
var ctx = {
projectBuildUrl : "{% url 'xhr_build' %}",
layerDetailsUrl : "{% url 'base_layerdetails' %}",
- projectPageUrl : "{% url 'project' project.id %}",
- xhrEditProjectUrl : "{% url 'xhr_projectedit' project.id %}",
- xhrDataTypeaheadUrl : "{% url 'xhr_datatypeahead' %}",
xhrUpdateLayerUrl : "{% url 'xhr_updatelayer' %}",
- projectId : {{project.id}},
- projectName : "{{project.name}}",
numTargets : {{total_targets}},
numMachines: {{machines|length}},
layerVersion : {
diff --git a/lib/toaster/toastergui/templates/layers_dep_modal.html b/lib/toaster/toastergui/templates/layers_dep_modal.html
index 8222027d4..ea49af50d 100644
--- a/lib/toaster/toastergui/templates/layers_dep_modal.html
+++ b/lib/toaster/toastergui/templates/layers_dep_modal.html
@@ -18,7 +18,7 @@
</div>
<script>
- /* projectId: current project
+ /*
* layer: Object representing the parent layer { id: .. name: ... url }
* dependencies: array of dependency layer objects { id: .. name: ..}
* title: optional override for title
diff --git a/lib/toaster/toastergui/templates/machines.html b/lib/toaster/toastergui/templates/machines.html
index 2ac35378e..64db0f9ca 100644
--- a/lib/toaster/toastergui/templates/machines.html
+++ b/lib/toaster/toastergui/templates/machines.html
@@ -12,11 +12,6 @@
$(document).ready(function (){
var ctx = {
- projectPageUrl : "{% url 'project' project.id %}",
- projectName : "{{project.name}}",
- xhrEditProjectUrl : "{% url 'xhr_projectedit' project.id %}",
- projectId : {{project.id}},
- xhrDataTypeaheadUrl : "{% url 'xhr_datatypeahead' %}",
};
try {