From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 1B5C9E00FC5; Fri, 25 Sep 2015 11:07:48 -0700 (PDT) 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,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.212.175 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 940CEE00FB6 for ; Fri, 25 Sep 2015 11:07:44 -0700 (PDT) Received: by wiclk2 with SMTP id lk2so29869792wic.1 for ; Fri, 25 Sep 2015 11:07:43 -0700 (PDT) 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; bh=WLseHZUo2x7Drt4jVZz5+wE+o10bo8XxPB/DwtakYuQ=; b=H51F54KXO1j0Fr/lS3Qi8JWiCna3JeevXypJERDylnli7/fCRaJ98qn9gxBwmPHF0O ydU7C65tmoFsLao7TfKtv+LgQdZyOrDZzcFt7WkqCfyOjGz0Z8TmhMIZ0NYhU7YBR5SF ICGWc5cu/nayuRz8JuWe7ihDoMnTKYZoaEQoLjGfIDbxAlrbgx/T+Xp+RFtOWJ/tA1cZ ogtAn96E99/kw63dfDYjEAGqxX46AiKFi24n634XTyYrlyGRM6GvMJWg6/LlAMh57yoY IC17PhAFt6SYKqwimEhAxgWObCPMxcODACl2rSo66PVWVhrINmfMdq3qBlLXeKPQNo5+ 9mxg== X-Gm-Message-State: ALoCoQkaK9AG1w2IrRql102j23SWr4zaN2kztqv9Fv/+Tv+xcCMw8kipPhKAkDyCmS8Hrpj7Nilp X-Received: by 10.194.189.235 with SMTP id gl11mr7811839wjc.68.1443204463768; Fri, 25 Sep 2015 11:07:43 -0700 (PDT) Received: from draco.isw.intel.com ([83.217.123.106]) by smtp.gmail.com with ESMTPSA id uq5sm4511789wjc.3.2015.09.25.11.07.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Sep 2015 11:07:43 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Fri, 25 Sep 2015 19:07:13 +0100 Message-Id: <1443204452-32244-3-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1443204452-32244-1-git-send-email-michael.g.wood@intel.com> References: <1443204452-32244-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 02/21] toaster: tables Move the title and name into the widget 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: Fri, 25 Sep 2015 18:07:48 -0000 For historical reasons this was being set in the urls definition. We can set this in the actual definition of the table and defaults in the widget. Signed-off-by: Michael Wood --- bitbake/lib/toaster/toastergui/tables.py | 2 ++ bitbake/lib/toaster/toastergui/urls.py | 22 +++++++++++++--------- bitbake/lib/toaster/toastergui/widgets.py | 9 ++++++++- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index 92e3b5c..70e4b6d 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py @@ -50,6 +50,7 @@ class LayersTable(ToasterTable): def __init__(self, *args, **kwargs): super(LayersTable, self).__init__(*args, **kwargs) self.default_orderby = "layer__name" + self.title = "Compatible layers" def get_context_data(self, **kwargs): context = super(LayersTable, self).get_context_data(**kwargs) @@ -208,6 +209,7 @@ class MachinesTable(ToasterTable, ProjectFiltersMixin): def __init__(self, *args, **kwargs): super(MachinesTable, self).__init__(*args, **kwargs) self.empty_state = "No machines maybe you need to do a build?" + self.title = "Compatible machines" self.default_orderby = "name" def get_context_data(self, **kwargs): diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index 46e5761..55f325d 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py @@ -87,15 +87,21 @@ urlpatterns = patterns('toastergui.views', # the table pages that have been converted to ToasterTable widget url(r'^project/(?P\d+)/machines/$', tables.MachinesTable.as_view(template_name="generic-toastertable-page.html"), - { 'table_name': tables.MachinesTable.__name__.lower(), - 'title' : 'Compatible machines' }, name="projectmachines"), - url(r'^project/(?P\d+)/recipes/$', - tables.RecipesTable.as_view(template_name="generic-toastertable-page.html"), - { 'table_name': tables.RecipesTable.__name__.lower(), - 'title' : 'Compatible recipes' }, - name="projecttargets"), + url(r'^project/(?P\d+)/softwarerecipes/$', + tables.SoftwareRecipesTable.as_view(template_name="generic-toastertable-page.html"), + name="projectsoftwarerecipes"), + + url(r'^project/(?P\d+)/images/$', + tables.ImageRecipesTable.as_view(template_name="generic-toastertable-page.html"), name="projectimagerecipes"), + + url(r'^project/(?P\d+)/customimages/$', + tables.CustomImagesTable.as_view(template_name="generic-toastertable-page.html"), name="projectcustomimages"), + + url(r'^project/(?P\d+)/newcustomimage/$', + tables.NewCustomImagesTable.as_view(template_name="newcustomimage.html"), + name="newcustomimage"), url(r'^project/(?P\d+)/availablerecipes/$', tables.ProjectLayersRecipesTable.as_view(template_name="generic-toastertable-page.html"), @@ -105,8 +111,6 @@ urlpatterns = patterns('toastergui.views', url(r'^project/(?P\d+)/layers/$', tables.LayersTable.as_view(template_name="generic-toastertable-page.html"), - { 'table_name': tables.LayersTable.__name__.lower(), - 'title' : 'Compatible layers' }, name="projectlayers"), url(r'^project/(?P\d+)/layer/(?P\d+)$', diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py index eb2914d..eb49692 100644 --- a/bitbake/lib/toaster/toastergui/widgets.py +++ b/bitbake/lib/toaster/toastergui/widgets.py @@ -45,7 +45,7 @@ class ToasterTable(TemplateView): super(ToasterTable, self).__init__() if 'template_name' in kwargs: self.template_name = kwargs['template_name'] - self.title = None + self.title = "Table" self.queryset = None self.columns = [] self.filters = {} @@ -61,6 +61,13 @@ class ToasterTable(TemplateView): orderable=True, field_name="id") + def get_context_data(self, **kwargs): + context = super(ToasterTable, self).get_context_data(**kwargs) + context['title'] = self.title + context['table_name'] = type(self).__name__.lower() + + return context + def get(self, request, *args, **kwargs): if request.GET.get('format', None) == 'json': -- 2.1.4