diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-04-10 18:15:03 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-08 17:42:05 +0100 |
commit | ed26a06a07a75c8039f2a9b251b350331c7474aa (patch) | |
tree | ebb2d88d75b51a856322c0a26ab89570a9954276 /bitbake/lib/toaster/toastergui/templates | |
parent | 4b59ba1bbb61fe60f500ad742a6515227b22397d (diff) | |
download | poky-ed26a06a07a75c8039f2a9b251b350331c7474aa.tar.gz |
bitbake: 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.
(Bitbake rev: 4ef2774a2f683929c700550a9acc7b8f6074195b)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templates')
5 files changed, 13 insertions, 20 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html index 58392b36f5..25933a1e90 100644 --- a/bitbake/lib/toaster/toastergui/templates/base.html +++ b/bitbake/lib/toaster/toastergui/templates/base.html | |||
@@ -26,20 +26,27 @@ | |||
26 | libtoaster.debug = true; | 26 | libtoaster.debug = true; |
27 | </script> | 27 | </script> |
28 | {% endif %} | 28 | {% endif %} |
29 | <script> | ||
30 | libtoaster.ctx = { | ||
31 | projectId : {{project.id|default:'undefined'}}, | ||
32 | xhrDataTypeaheadUrl : "{% url 'xhr_datatypeahead' %}", | ||
33 | {% if project.id %} | ||
34 | xhrProjectEditUrl : "{% url 'xhr_projectedit' project.id %}", | ||
35 | projectPageUrl : "{% url 'project' project.id %}", | ||
36 | projectName : "{{project.name}}", | ||
37 | {% endif %} | ||
38 | }; | ||
39 | </script> | ||
29 | <script src="{% static 'js/base.js' %}"></script> | 40 | <script src="{% static 'js/base.js' %}"></script> |
30 | {%if MANAGED %} | 41 | {%if MANAGED %} |
31 | <script> | 42 | <script> |
32 | $(document).ready(function () { | 43 | $(document).ready(function () { |
33 | /* Vars needed for base.js */ | 44 | /* Vars needed for base.js */ |
34 | var ctx = {}; | 45 | var ctx = {}; |
35 | ctx.xhrDataTypeaheadUrl = "{% url 'xhr_datatypeahead' %}"; | ||
36 | ctx.projectBuildUrl = "{% url 'xhr_build' %}"; | 46 | ctx.projectBuildUrl = "{% url 'xhr_build' %}"; |
37 | ctx.projectPageUrl = "{% url 'base_project' %}"; | 47 | ctx.projectBasePageUrl = "{% url 'base_project' %}"; |
38 | ctx.projectInfoUrl = "{% url 'xhr_projectinfo' %}"; | 48 | ctx.projectInfoUrl = "{% url 'xhr_projectinfo' %}"; |
39 | ctx.numProjects = {{projects|length}}; | 49 | ctx.numProjects = {{projects|length}}; |
40 | {% if project %} | ||
41 | ctx.projectId = {{project.id}}; | ||
42 | {% endif %} | ||
43 | ctx.currentUrl = "{{request.path|escapejs}}"; | 50 | ctx.currentUrl = "{{request.path|escapejs}}"; |
44 | 51 | ||
45 | basePageInit(ctx); | 52 | basePageInit(ctx); |
diff --git a/bitbake/lib/toaster/toastergui/templates/importlayer.html b/bitbake/lib/toaster/toastergui/templates/importlayer.html index 5ef8a5786c..c92b5d8b24 100644 --- a/bitbake/lib/toaster/toastergui/templates/importlayer.html +++ b/bitbake/lib/toaster/toastergui/templates/importlayer.html | |||
@@ -13,12 +13,8 @@ | |||
13 | <script> | 13 | <script> |
14 | $(document).ready(function (){ | 14 | $(document).ready(function (){ |
15 | var ctx = { | 15 | var ctx = { |
16 | xhrDataTypeaheadUrl : "{% url 'xhr_datatypeahead' %}", | ||
17 | layerDetailsUrl : "{% url 'base_layerdetails' %}", | 16 | layerDetailsUrl : "{% url 'base_layerdetails' %}", |
18 | xhrImportLayerUrl : "{% url 'xhr_importlayer' %}", | 17 | xhrImportLayerUrl : "{% url 'xhr_importlayer' %}", |
19 | xhrEditProjectUrl : "{% url 'xhr_projectedit' project.id %}", | ||
20 | projectPageUrl : "{% url 'project' project.id %}", | ||
21 | projectId : {{project.id}} | ||
22 | }; | 18 | }; |
23 | 19 | ||
24 | try { | 20 | try { |
diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html index 0d3aa15373..435bf04e42 100644 --- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html +++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html | |||
@@ -18,12 +18,7 @@ | |||
18 | var ctx = { | 18 | var ctx = { |
19 | projectBuildUrl : "{% url 'xhr_build' %}", | 19 | projectBuildUrl : "{% url 'xhr_build' %}", |
20 | layerDetailsUrl : "{% url 'base_layerdetails' %}", | 20 | layerDetailsUrl : "{% url 'base_layerdetails' %}", |
21 | projectPageUrl : "{% url 'project' project.id %}", | ||
22 | xhrEditProjectUrl : "{% url 'xhr_projectedit' project.id %}", | ||
23 | xhrDataTypeaheadUrl : "{% url 'xhr_datatypeahead' %}", | ||
24 | xhrUpdateLayerUrl : "{% url 'xhr_updatelayer' %}", | 21 | xhrUpdateLayerUrl : "{% url 'xhr_updatelayer' %}", |
25 | projectId : {{project.id}}, | ||
26 | projectName : "{{project.name}}", | ||
27 | numTargets : {{total_targets}}, | 22 | numTargets : {{total_targets}}, |
28 | numMachines: {{machines|length}}, | 23 | numMachines: {{machines|length}}, |
29 | layerVersion : { | 24 | layerVersion : { |
diff --git a/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html b/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html index 8222027d4f..ea49af50d8 100644 --- a/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html +++ b/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html | |||
@@ -18,7 +18,7 @@ | |||
18 | </div> | 18 | </div> |
19 | 19 | ||
20 | <script> | 20 | <script> |
21 | /* projectId: current project | 21 | /* |
22 | * layer: Object representing the parent layer { id: .. name: ... url } | 22 | * layer: Object representing the parent layer { id: .. name: ... url } |
23 | * dependencies: array of dependency layer objects { id: .. name: ..} | 23 | * dependencies: array of dependency layer objects { id: .. name: ..} |
24 | * title: optional override for title | 24 | * title: optional override for title |
diff --git a/bitbake/lib/toaster/toastergui/templates/machines.html b/bitbake/lib/toaster/toastergui/templates/machines.html index 2ac35378e0..64db0f9ca7 100644 --- a/bitbake/lib/toaster/toastergui/templates/machines.html +++ b/bitbake/lib/toaster/toastergui/templates/machines.html | |||
@@ -12,11 +12,6 @@ | |||
12 | 12 | ||
13 | $(document).ready(function (){ | 13 | $(document).ready(function (){ |
14 | var ctx = { | 14 | var ctx = { |
15 | projectPageUrl : "{% url 'project' project.id %}", | ||
16 | projectName : "{{project.name}}", | ||
17 | xhrEditProjectUrl : "{% url 'xhr_projectedit' project.id %}", | ||
18 | projectId : {{project.id}}, | ||
19 | xhrDataTypeaheadUrl : "{% url 'xhr_datatypeahead' %}", | ||
20 | }; | 15 | }; |
21 | 16 | ||
22 | try { | 17 | try { |