diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-04-10 18:15:03 +0100 |
---|---|---|
committer | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-05-01 17:37:38 +0100 |
commit | 4ef2774a2f683929c700550a9acc7b8f6074195b (patch) | |
tree | c466f9de0fecaa07438aceb8bd74f6dfcbdd870f /lib/toaster/toastergui/templates/base.html | |
parent | af63abe88327fd5c1b3d7c00a84d9e408ef23285 (diff) | |
download | bitbake-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/base.html')
-rw-r--r-- | lib/toaster/toastergui/templates/base.html | 17 |
1 files changed, 12 insertions, 5 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); |