diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html')
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html b/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html index 821bbda296..b03fd0b218 100644 --- a/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html +++ b/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html | |||
@@ -3,10 +3,10 @@ | |||
3 | <form id="dependencies_modal_form"> | 3 | <form id="dependencies_modal_form"> |
4 | <div class="modal-header"> | 4 | <div class="modal-header"> |
5 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button> | 5 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button> |
6 | <h3><span class="layer-name"></span> dependencies</h3> | 6 | <h3><span id="title"></span> dependencies</h3> |
7 | </div> | 7 | </div> |
8 | <div class="modal-body"> | 8 | <div class="modal-body"> |
9 | <p><strong class="layer-name"></strong> depends on some layers that are not added to your project. Select the ones you want to add:</p> | 9 | <p id="body-text"> <strong id="layer-name"></strong> depends on some layers that are not added to your project. Select the ones you want to add:</p> |
10 | <ul class="unstyled" id="dependencies_list"> | 10 | <ul class="unstyled" id="dependencies_list"> |
11 | </ul> | 11 | </ul> |
12 | </div> | 12 | </div> |
@@ -18,9 +18,20 @@ | |||
18 | </div> | 18 | </div> |
19 | 19 | ||
20 | <script> | 20 | <script> |
21 | function show_layer_deps_modal(projectId, layer, dependencies, successAdd) { | 21 | function show_layer_deps_modal(projectId, layer, dependencies, title, body, addToProject, successAdd) { |
22 | // update layer name | 22 | // update layer name |
23 | $('.layer-name').text(layer.name); | 23 | if (title) { |
24 | $('#dependencies_modal #title').text(title); | ||
25 | } else { | ||
26 | $('#dependencies_modal #title').text(layer.name); | ||
27 | } | ||
28 | |||
29 | if (body) { | ||
30 | $("#dependencies_modal #body-text").html(body); | ||
31 | } else { | ||
32 | $("#dependencies_modal #layer-name").text(layer.name); | ||
33 | } | ||
34 | |||
24 | var deplistHtml = ""; | 35 | var deplistHtml = ""; |
25 | for (var i = 0; i < dependencies.length; i++) { | 36 | for (var i = 0; i < dependencies.length; i++) { |
26 | deplistHtml += "<li><label class=\"checkbox\"><input name=\"dependencies\" value=\""; | 37 | deplistHtml += "<li><label class=\"checkbox\"><input name=\"dependencies\" value=\""; |
@@ -31,7 +42,13 @@ function show_layer_deps_modal(projectId, layer, dependencies, successAdd) { | |||
31 | } | 42 | } |
32 | $('#dependencies_list').html(deplistHtml); | 43 | $('#dependencies_list').html(deplistHtml); |
33 | 44 | ||
34 | var selected = [layer.id]; | 45 | var selected = []; |
46 | /* -1 is a special dummy Id which we use when the layer isn't yet in the | ||
47 | * system, normally we would add the current layer to the selection. | ||
48 | */ | ||
49 | if (layer.id != -1) | ||
50 | selected.push(layer.id); | ||
51 | |||
35 | var layer_link_list = "<a href='"+layer.url+"'>"+layer.name+"</a>"; | 52 | var layer_link_list = "<a href='"+layer.url+"'>"+layer.name+"</a>"; |
36 | 53 | ||
37 | $("#dependencies_modal_form").submit(function (e) { | 54 | $("#dependencies_modal_form").submit(function (e) { |
@@ -54,15 +71,20 @@ function show_layer_deps_modal(projectId, layer, dependencies, successAdd) { | |||
54 | 71 | ||
55 | $('#dependencies_modal').modal('hide'); | 72 | $('#dependencies_modal').modal('hide'); |
56 | 73 | ||
57 | var editProjectUrl = "{% url 'xhr_projectedit' project.id %}"; | 74 | if (addToProject) { |
58 | libtoaster.editProject(editProjectUrl, projectId, { 'layerAdd': selected.join(",") }, function () { | 75 | var editProjectUrl = "{% url 'xhr_projectedit' project.id %}"; |
59 | if (successAdd) { | 76 | libtoaster.editProject(editProjectUrl, projectId, { 'layerAdd': selected.join(",") }, function () { |
60 | successAdd(selected); | 77 | if (successAdd) { |
61 | } | 78 | successAdd(selected); |
62 | }, function () { | 79 | } |
63 | console.log ("Adding layers to project failed"); | 80 | }, function () { |
64 | }); | 81 | console.log ("Adding layers to project failed"); |
82 | }); | ||
83 | } else { | ||
84 | successAdd(selected); | ||
85 | } | ||
65 | }); | 86 | }); |
87 | |||
66 | $('#dependencies_modal').modal('show'); | 88 | $('#dependencies_modal').modal('show'); |
67 | } | 89 | } |
68 | </script> | 90 | </script> |