Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 7FFE3E00BAB; Tue, 8 Dec 2015 13:17:50 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.192.169 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pf0-f169.google.com (mail-pf0-f169.google.com [209.85.192.169]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id E9A0BE00B02 for ; Tue, 8 Dec 2015 13:17:16 -0800 (PST) Received: by pfdd184 with SMTP id d184so17919878pfd.3 for ; Tue, 08 Dec 2015 13:17:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=n3kn7VT4Xny3v2fkjES0Nap+OSwxDL1tS8XD1o3mai0=; b=p7i/HGjXeCrrM0XTjwVNh7u+Y2Dox/xxXIoaaYiCW5nVd0+pKfghfapQRHNBDFZgtl BlnHVN2cs6csM5GQLC1f2yYu4tXLavzkyCs4gwll5KI2cilMHWBMHK5UBLHxKu60cwSm RtC9juyoy04dgB1dX/WpDJI+jILAxuNHs6iz6dcHHugjq/pdy3Dj2Rkl39FUJbbcjuQd 6VFGRhz5qJ8vBGwfag0nnYVtEFsH0gp9N0v3OEIB0Lpgq82beMPjAGG659/uW9vYsmlV Ac9lZUSiXTRD44FNN7CdCfXNrwJBduIP6+X3SXnt1abNrfJ9h8oWdqNWiT2opG57pbw9 5JxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=n3kn7VT4Xny3v2fkjES0Nap+OSwxDL1tS8XD1o3mai0=; b=CulKOdC6Y1KHLWv6XSqUqbJNDeu3Uj2YZB9OsoVvUswswTJirotasvsTDxheOcVHEM dSRBusGauzeXn0mviHKxwHHU1/GbmA3HKCBjHRfqO2JwdAPN6JNKxydLRRGN7KPqlW3C eJGvyBMestf1uU8yHGB/fTKT9+9wBJVpihj1W+ETIBGq6TkimaDG7J+0wdu0Xt6VGMKU q54c9WSyb4jvZBoxJEHdtiAVshU0H3HAXgBDOLBXQdrzZXloJFw8lLMrW0ZHAPXRXq3h iG+5pspazbjaoUbKj9tYlLUJO78l/I+X/tDSn9+N9noJIgYwPBtrCtM+6uHakGRjV5BM YIlQ== X-Gm-Message-State: ALoCoQmBrFwX30rCBympJpPKjybVhIro18PYsi6OUYQLq/rpDawK9br7CT1vk8toqBQSa9zdHM+3AiOP0D3HWi3fhn9LNz67UA== X-Received: by 10.98.72.134 with SMTP id q6mr8074389pfi.56.1449609436365; Tue, 08 Dec 2015 13:17:16 -0800 (PST) Received: from draco.ger.corp.intel.com ([192.55.54.40]) by smtp.gmail.com with ESMTPSA id v64sm6675766pfi.50.2015.12.08.13.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 13:17:15 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Tue, 8 Dec 2015 21:16:02 +0000 Message-Id: <1449609380-11073-17-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449609380-11073-1-git-send-email-michael.g.wood@intel.com> References: <1449609380-11073-1-git-send-email-michael.g.wood@intel.com> MIME-Version: 1.0 Subject: [PATCH 16/34] toaster: newcustomimage Move modal dialog out of newcustomimage template X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 21:17:50 -0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the modal template and JS out of the newcustomimage page so that it can also be used by the image details page. Signed-off-by: Michael Wood --- .../toaster/toastergui/static/js/newcustomimage.js | 49 ---------------------- .../toastergui/static/js/newcustomimage_modal.js | 48 +++++++++++++++++++++ .../toastergui/templates/newcustomimage.html | 44 +------------------ .../toastergui/templates/newcustomimage_modal.html | 33 +++++++++++++++ 4 files changed, 83 insertions(+), 91 deletions(-) delete mode 100644 bitbake/lib/toaster/toastergui/static/js/newcustomimage.js create mode 100644 bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js create mode 100644 bitbake/lib/toaster/toastergui/templates/newcustomimage_modal.html diff --git a/bitbake/lib/toaster/toastergui/static/js/newcustomimage.js b/bitbake/lib/toaster/toastergui/static/js/newcustomimage.js deleted file mode 100644 index 935b21e..0000000 --- a/bitbake/lib/toaster/toastergui/static/js/newcustomimage.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; - -function newCustomImagePageInit(ctx){ - - var newCustomImgBtn = $("#create-new-custom-image-btn"); - var imgCustomModal = $("#new-custom-image-modal"); - - newCustomImgBtn.click(function(e){ - e.preventDefault(); - - var name = imgCustomModal.find('input').val(); - var baseRecipeId = imgCustomModal.data('recipe'); - - if (name.length > 0) { - createCustomRecipe(name, baseRecipeId); - imgCustomModal.modal('hide'); - } else { - console.warn("TODO No name supplied"); - } - }); - - function createCustomRecipe(name, baseRecipeId){ - var data = { - 'name' : name, - 'project' : libtoaster.ctx.projectId, - 'base' : baseRecipeId, - }; - - $.ajax({ - type: "POST", - url: ctx.xhrCustomRecipeUrl, - data: data, - headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, - success: function (ret) { - if (ret.error !== "ok") { - console.warn(ret.error); - } else { - window.location.replace(ret.url + '?notify=new'); - } - }, - error: function (ret) { - console.warn("Call failed"); - console.warn(ret); - } - }); - } - - -} diff --git a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js new file mode 100644 index 0000000..71a28f7 --- /dev/null +++ b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js @@ -0,0 +1,48 @@ +"use strict"; + +/* Used for the newcustomimage_modal actions */ +function newCustomImageModalInit(ctx){ + + var newCustomImgBtn = $("#create-new-custom-image-btn"); + var imgCustomModal = $("#new-custom-image-modal"); + + newCustomImgBtn.click(function(e){ + e.preventDefault(); + + var name = imgCustomModal.find('input').val(); + var baseRecipeId = imgCustomModal.data('recipe'); + + if (name.length > 0) { + createCustomRecipe(name, baseRecipeId); + imgCustomModal.modal('hide'); + } else { + console.warn("TODO No name supplied"); + } + }); + + function createCustomRecipe(name, baseRecipeId){ + var data = { + 'name' : name, + 'project' : libtoaster.ctx.projectId, + 'base' : baseRecipeId, + }; + + $.ajax({ + type: "POST", + url: ctx.xhrCustomRecipeUrl, + data: data, + headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, + success: function (ret) { + if (ret.error !== "ok") { + console.warn(ret.error); + } else { + window.location.replace(ret.url + '?notify=new'); + } + }, + error: function (ret) { + console.warn("Call failed"); + console.warn(ret); + } + }); + } +} diff --git a/bitbake/lib/toaster/toastergui/templates/newcustomimage.html b/bitbake/lib/toaster/toastergui/templates/newcustomimage.html index 4487b3e..46aed90 100644 --- a/bitbake/lib/toaster/toastergui/templates/newcustomimage.html +++ b/bitbake/lib/toaster/toastergui/templates/newcustomimage.html @@ -4,51 +4,11 @@ {% load static %} {% block pagecontent %} - - - - - - +{% include "newcustomimage_modal.html" %} {% include "projecttopbar.html" %} - {% url table_name project.id as xhr_table_url %} +

{{title}} (0)

{% include "toastertable.html" %} - - {% endblock %} - - diff --git a/bitbake/lib/toaster/toastergui/templates/newcustomimage_modal.html b/bitbake/lib/toaster/toastergui/templates/newcustomimage_modal.html new file mode 100644 index 0000000..93cf9d7 --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templates/newcustomimage_modal.html @@ -0,0 +1,33 @@ +{% load static %} + + + + + -- 2.1.4