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 | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html b/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html deleted file mode 100644 index ea49af50d8..0000000000 --- a/bitbake/lib/toaster/toastergui/templates/layers_dep_modal.html +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | <!-- 'Layer dependencies modal' --> | ||
2 | <div id="dependencies_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true"> | ||
3 | <form id="dependencies_modal_form"> | ||
4 | <div class="modal-header"> | ||
5 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button> | ||
6 | <h3><span id="title"></span> dependencies</h3> | ||
7 | </div> | ||
8 | <div class="modal-body"> | ||
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"> | ||
11 | </ul> | ||
12 | </div> | ||
13 | <div class="modal-footer"> | ||
14 | <button class="btn btn-primary" type="submit">Add layers</button> | ||
15 | <button class="btn" type="reset" data-dismiss="modal">Cancel</button> | ||
16 | </div> | ||
17 | </form> | ||
18 | </div> | ||
19 | |||
20 | <script> | ||
21 | /* | ||
22 | * layer: Object representing the parent layer { id: .. name: ... url } | ||
23 | * dependencies: array of dependency layer objects { id: .. name: ..} | ||
24 | * title: optional override for title | ||
25 | * body: optional override for body | ||
26 | * addToProject: Whether to add layers to project on accept | ||
27 | * successAdd: function to run on success | ||
28 | */ | ||
29 | function show_layer_deps_modal(projectId, layer, dependencies, title, body, addToProject, successAdd) { | ||
30 | |||
31 | // update layer name | ||
32 | if (title) { | ||
33 | $('#dependencies_modal #title').text(title); | ||
34 | } else { | ||
35 | $('#dependencies_modal #title').text(layer.name); | ||
36 | } | ||
37 | |||
38 | if (body) { | ||
39 | $("#dependencies_modal #body-text").html(body); | ||
40 | } else { | ||
41 | $("#dependencies_modal #layer-name").text(layer.name); | ||
42 | } | ||
43 | |||
44 | var deplistHtml = ""; | ||
45 | for (var i = 0; i < dependencies.length; i++) { | ||
46 | deplistHtml += "<li><label class=\"checkbox\"><input name=\"dependencies\" value=\""; | ||
47 | deplistHtml += dependencies[i].id; | ||
48 | deplistHtml +="\" type=\"checkbox\" checked=\"checked\"/>"; | ||
49 | deplistHtml += dependencies[i].name; | ||
50 | deplistHtml += "</label></li>"; | ||
51 | } | ||
52 | $('#dependencies_list').html(deplistHtml); | ||
53 | |||
54 | var selected = []; | ||
55 | /* -1 is a special dummy Id which we use when the layer isn't yet in the | ||
56 | * system, normally we would add the current layer to the selection. | ||
57 | */ | ||
58 | if (layer.id != -1) | ||
59 | selected.push(layer.id); | ||
60 | |||
61 | var layer_link_list = "<a href='"+layer.url+"'>"+layer.name+"</a>"; | ||
62 | |||
63 | $("#dependencies_modal_form").submit(function (e) { | ||
64 | e.preventDefault(); | ||
65 | $("input[name='dependencies']:checked").map(function () { selected.push(parseInt($(this).val()))}); | ||
66 | if (selected.length > 1) { | ||
67 | tooltipUpdateText = "" + selected.length + " layers added"; | ||
68 | } else { | ||
69 | tooltipUpdateText = "1 layer added"; | ||
70 | } | ||
71 | |||
72 | for (var i = 0; i < selected.length; i++) { | ||
73 | for (var j = 0; j < dependencies.length; j++) { | ||
74 | if (dependencies[j].id == selected[i]) { | ||
75 | layer_link_list+= ", <a href='"+dependencies[j].layerdetailurl+"'>"+dependencies[j].name+"</a>" | ||
76 | break; | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | |||
81 | $('#dependencies_modal').modal('hide'); | ||
82 | |||
83 | if (addToProject) { | ||
84 | var editProjectUrl = "{% url 'xhr_projectedit' project.id %}"; | ||
85 | libtoaster.editProject(editProjectUrl, projectId, { 'layerAdd': selected.join(",") }, function () { | ||
86 | if (successAdd) { | ||
87 | successAdd(selected); | ||
88 | } | ||
89 | }, function () { | ||
90 | console.log ("Adding layers to project failed"); | ||
91 | }); | ||
92 | } else { | ||
93 | successAdd(selected); | ||
94 | } | ||
95 | }); | ||
96 | |||
97 | $('#dependencies_modal').modal('show'); | ||
98 | } | ||
99 | </script> | ||