From f38bae1dd964dc08b7da3fd886868965321cf2d0 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Thu, 19 Jul 2018 09:56:02 +0200 Subject: [PATCH] Add side-by-side comparison detail and enhanced selection Specifying the covering recipe in the comparison recipe detail page was always a bit awkward - you could only type the name, if you wanted to actually find a recipe or look up the currently selected one's details then you had to open another browser tab/window. To fix this, replace the form on the comparison recipe detail page with a side-by-side display of the covering recipe's information, along with a button that lets you search and then select the covering recipe and at the same time enter comments or set any of the other cover fields. Signed-off-by: Paul Eggleton --- layerindex/forms.py | 5 + layerindex/models.py | 6 + layerindex/static/css/additional.css | 4 + layerindex/urls.py | 12 +- layerindex/views.py | 135 +++++++++-- templates/layerindex/classicrecipedetail.html | 206 +++------------- templates/layerindex/classicrecipes.html | 35 ++- .../layerindex/comparisonrecipebase.html | 222 ++++++++++++++++++ .../layerindex/comparisonrecipeselect.html | 119 ++++++++++ .../comparisonrecipeselectdetail.html | 98 ++++++++ templates/layerindex/recipedetail.html | 7 + 11 files changed, 650 insertions(+), 199 deletions(-) create mode 100644 templates/layerindex/comparisonrecipebase.html create mode 100644 templates/layerindex/comparisonrecipeselect.html create mode 100644 templates/layerindex/comparisonrecipeselectdetail.html diff --git a/layerindex/forms.py b/layerindex/forms.py index 29d689f..c2e4e62 100644 --- a/layerindex/forms.py +++ b/layerindex/forms.py @@ -240,3 +240,8 @@ class ClassicRecipeSearchForm(forms.Form): cover_verified = forms.ChoiceField(label='Verified', choices=VERIFIED_CHOICES, required=False) needs_attention = forms.ChoiceField(label='Needs attention', choices=ATTENTION_CHOICES, required=False) + +class ComparisonRecipeSelectForm(forms.Form): + q = forms.CharField(label='Keyword', max_length=255, required=False) + oe_layer = forms.ModelChoiceField(label='OE Layer', queryset=LayerItem.objects.filter(comparison=False).filter(status__in=['P', 'X']).order_by('name'), empty_label="(any)", required=False) + diff --git a/layerindex/models.py b/layerindex/models.py index 2023ff6..66cbe67 100644 --- a/layerindex/models.py +++ b/layerindex/models.py @@ -615,6 +615,12 @@ class ClassicRecipe(Recipe): desc = "%s - %s" % (desc, self.cover_comment) return desc + def get_cover_recipe(self): + if self.cover_layerbranch and self.cover_pn: + return Recipe.objects.filter(layerbranch=self.cover_layerbranch).filter(pn=self.cover_pn).first() + else: + return None + class ComparisonRecipeUpdate(models.Model): update = models.ForeignKey(Update) diff --git a/layerindex/static/css/additional.css b/layerindex/static/css/additional.css index 3b3da39..30d2b77 100644 --- a/layerindex/static/css/additional.css +++ b/layerindex/static/css/additional.css @@ -254,3 +254,7 @@ td.warning { td.info { background-color: #d9edf7 !important; } + +.hidden-select { + display: none !important; +} diff --git a/layerindex/urls.py b/layerindex/urls.py index 4a78d36..9f9a74e 100644 --- a/layerindex/urls.py +++ b/layerindex/urls.py @@ -1,6 +1,6 @@ # layerindex-web - URL definitions # -# Copyright (C) 2013 Intel Corporation +# Copyright (C) 2013, 2018 Intel Corporation # # Licensed under the MIT license, see COPYING.MIT for details @@ -8,7 +8,7 @@ from django.conf.urls import * from django.views.generic import TemplateView, DetailView, ListView, RedirectView from django.views.defaults import page_not_found from django.core.urlresolvers import reverse_lazy -from layerindex.views import LayerListView, LayerReviewListView, LayerReviewDetailView, RecipeSearchView, MachineSearchView, LayerDetailView, edit_layer_view, delete_layer_view, edit_layernote_view, delete_layernote_view, HistoryListView, EditProfileFormView, AdvancedRecipeSearchView, BulkChangeView, BulkChangeSearchView, bulk_change_edit_view, bulk_change_patch_view, BulkChangeDeleteView, RecipeDetailView, RedirectParamsView, ClassicRecipeSearchView, ClassicRecipeDetailView, ClassicRecipeStatsView, LayerUpdateDetailView, UpdateListView, UpdateDetailView, StatsView, publish_view, LayerCheckListView, BBClassCheckListView, TaskStatusView +from layerindex.views import LayerListView, LayerReviewListView, LayerReviewDetailView, RecipeSearchView, MachineSearchView, LayerDetailView, edit_layer_view, delete_layer_view, edit_layernote_view, delete_layernote_view, HistoryListView, EditProfileFormView, AdvancedRecipeSearchView, BulkChangeView, BulkChangeSearchView, bulk_change_edit_view, bulk_change_patch_view, BulkChangeDeleteView, RecipeDetailView, RedirectParamsView, ClassicRecipeSearchView, ClassicRecipeDetailView, ClassicRecipeStatsView, LayerUpdateDetailView, UpdateListView, UpdateDetailView, StatsView, publish_view, LayerCheckListView, BBClassCheckListView, TaskStatusView, ComparisonRecipeSelectView, ComparisonRecipeSelectDetailView from layerindex.models import LayerItem, Recipe, RecipeChangeset from rest_framework import routers from . import restviews @@ -156,6 +156,14 @@ urlpatterns = [ ClassicRecipeDetailView.as_view( template_name='layerindex/classicrecipedetail.html'), name='comparison_recipe'), + url(r'^comparison/select/(?P[-\w]+)/$', + ComparisonRecipeSelectView.as_view( + template_name='layerindex/comparisonrecipeselect.html'), + name='comparison_select'), + url(r'^comparison/selectdetail/(?P[-\w]+)/(?P[-\w]+)/$', + ComparisonRecipeSelectDetailView.as_view( + template_name='layerindex/comparisonrecipeselectdetail.html'), + name='comparison_select_detail'), url(r'^task/(?P[-\w]+)/$', TaskStatusView.as_view( template_name='layerindex/task.html'), diff --git a/layerindex/views.py b/layerindex/views.py index 4993806..1ebef49 100644 --- a/layerindex/views.py +++ b/layerindex/views.py @@ -18,7 +18,7 @@ from django.views.generic import TemplateView, DetailView, ListView from django.views.generic.edit import CreateView, DeleteView, UpdateView from django.views.generic.base import RedirectView from django.contrib.messages.views import SuccessMessageMixin -from layerindex.forms import EditLayerForm, LayerMaintainerFormSet, EditNoteForm, EditProfileForm, RecipeChangesetForm, AdvancedRecipeSearchForm, BulkChangeEditFormSet, ClassicRecipeForm, ClassicRecipeSearchForm +from layerindex.forms import EditLayerForm, LayerMaintainerFormSet, EditNoteForm, EditProfileForm, RecipeChangesetForm, AdvancedRecipeSearchForm, BulkChangeEditFormSet, ClassicRecipeForm, ClassicRecipeSearchForm, ComparisonRecipeSelectForm from django.db import transaction from django.contrib.auth.models import User, Permission from django.db.models import Q, Count, Sum @@ -28,6 +28,7 @@ from django.template.loader import get_template from django.utils.decorators import method_decorator from django.contrib.auth.decorators import login_required from django.contrib import messages +from django import forms from reversion.models import Revision from . import utils from . import simplesearch @@ -1202,25 +1203,11 @@ class ClassicRecipeDetailView(SuccessMessageMixin, UpdateView): def _can_edit(self): if self.request.user.is_authenticated(): if not self.request.user.has_perm('layerindex.edit_classic'): - user_email = self.request.user.email.strip().lower() - if not LayerMaintainer.objects.filter(email__iexact=user_email): - return False + return False else: return False return True - def post(self, request, *args, **kwargs): - if not self._can_edit(): - raise PermissionDenied - - return super(ClassicRecipeDetailView, self).post(request, *args, **kwargs) - - def get_success_message(self, cleaned_data): - return "Comparison saved successfully" - - def get_success_url(self): - return reverse_lazy('comparison_recipe', args=(self.object.id,)) - def get_context_data(self, **kwargs): context = super(ClassicRecipeDetailView, self).get_context_data(**kwargs) context['can_edit'] = self._can_edit() @@ -1233,6 +1220,9 @@ class ClassicRecipeDetailView(SuccessMessageMixin, UpdateView): if rq: cover_recipe = rq.first() context['cover_recipe'] = cover_recipe + context['layerbranch_desc'] = str(recipe.layerbranch.branch) + context['to_desc'] = 'OpenEmbedded' + context['recipes'] = [recipe, cover_recipe] return context @@ -1375,3 +1365,116 @@ class TaskStatusView(TemplateView): context['result'] = AsyncResult(task_id) context['update'] = get_object_or_404(Update, task_id=task_id) return context + + +class ComparisonRecipeSelectView(ClassicRecipeSearchView): + def _can_edit(self): + if self.request.user.is_authenticated(): + if not self.request.user.has_perm('layerindex.edit_classic'): + return False + else: + return False + return True + + def get_context_data(self, **kwargs): + self.kwargs['branch'] = 'master' + context = super(ComparisonRecipeSelectView, self).get_context_data(**kwargs) + recipe = get_object_or_404(ClassicRecipe, pk=self.kwargs['pk']) + context['select_for'] = recipe + context['existing_cover_recipe'] = recipe.get_cover_recipe() + comparison_form = ClassicRecipeForm(prefix='selectrecipedialog', instance=recipe) + comparison_form.fields['cover_pn'].widget = forms.HiddenInput() + comparison_form.fields['cover_layerbranch'].widget = forms.HiddenInput() + context['comparison_form'] = comparison_form + + if 'q' in self.request.GET: + search_form = ComparisonRecipeSelectForm(self.request.GET) + else: + search_form = ComparisonRecipeSelectForm() + context['search_form'] = search_form + + context['can_edit'] = self._can_edit() + return context + + def get_queryset(self): + query_string = self.request.GET.get('q', '') + selectedlayers_param = self.request.GET.get('selectedlayers', '') + if selectedlayers_param: + layer_ids = [int(i) for i in selectedlayers_param.split(',')] + else: + layer_ids = [] + init_qs = Recipe.objects.filter(layerbranch__branch__name='master') + if layer_ids: + init_qs = init_qs.filter(layerbranch__layer__in=layer_ids) + if query_string.strip(): + order_by = (Lower('pn'), 'layerbranch__layer') + + qs0 = init_qs.filter(pn=query_string).order_by(*order_by) + + entry_query = simplesearch.get_query(query_string, ['pn']) + qs1 = init_qs.filter(entry_query).order_by(*order_by) + + entry_query = simplesearch.get_query(query_string, ['summary', 'description']) + qs2 = init_qs.filter(entry_query).order_by(*order_by) + + qs = list(utils.chain_unique(qs0, qs1, qs2)) + else: + if 'q' in self.request.GET: + qs = init_qs.order_by(Lower('pn'), 'layerbranch__layer') + else: + # It's a bit too slow to return all records by default, and most people + # won't actually want that (if they do they can just hit the search button + # with no query string) + return Recipe.objects.none() + return qs + + def post(self, request, *args, **kwargs): + if not self._can_edit(): + raise PermissionDenied + + recipe = get_object_or_404(ClassicRecipe, pk=self.kwargs['pk']) + form = ClassicRecipeForm(request.POST, prefix='selectrecipedialog', instance=recipe) + + if form.is_valid(): + form.save() + messages.success(request, 'Changes to comparison recipe %s saved successfully.' % recipe.pn) + return HttpResponseRedirect(reverse('comparison_recipe', args=(recipe.id,))) + else: + # FIXME this is ugly because HTML gets escaped + messages.error(request, 'Failed to save changes: %s' % form.errors) + + return self.get(request, *args, **kwargs) + + +class ComparisonRecipeSelectDetailView(DetailView): + model = Recipe + + def get_context_data(self, **kwargs): + context = super(ComparisonRecipeSelectDetailView, self).get_context_data(**kwargs) + recipe = get_object_or_404(ClassicRecipe, pk=self.kwargs['selectfor']) + context['select_for'] = recipe + context['existing_cover_recipe'] = recipe.get_cover_recipe() + comparison_form = ClassicRecipeForm(prefix='selectrecipedialog', instance=recipe) + comparison_form.fields['cover_pn'].widget = forms.HiddenInput() + comparison_form.fields['cover_layerbranch'].widget = forms.HiddenInput() + context['comparison_form'] = comparison_form + context['can_edit'] = False + return context + + def post(self, request, *args, **kwargs): + if not request.user.is_authenticated(): + raise PermissionDenied + + recipe = get_object_or_404(ClassicRecipe, pk=self.kwargs['selectfor']) + form = ClassicRecipeForm(request.POST, prefix='selectrecipedialog', instance=recipe) + + if form.is_valid(): + form.save() + messages.success(request, 'Changes to comparison recipe %s saved successfully.' % recipe.pn) + return HttpResponseRedirect(reverse('comparison_recipe', args=(recipe.id,))) + else: + # FIXME this is ugly because HTML gets escaped + messages.error(request, 'Failed to save changes: %s' % form.errors) + + return self.get(request, *args, **kwargs) + diff --git a/templates/layerindex/classicrecipedetail.html b/templates/layerindex/classicrecipedetail.html index 438f997..bc92fef 100644 --- a/templates/layerindex/classicrecipedetail.html +++ b/templates/layerindex/classicrecipedetail.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "layerindex/comparisonrecipebase.html" %} {% load i18n %} {% comment %} @@ -17,74 +17,43 @@ {% endautoescape %} --> -{% block content %} -{% autoescape on %} - + {% block breadcrumbs %} + {% endblock %} -
- -
- - - + {% block page_heading %} + {% if branch.name == 'oe-classic' %}
NOTE: This recipe is for OE-Classic, the older monolithic version of OpenEmbedded which is no longer actively developed. See below for migration information. If no replacement is available in current OpenEmbedded layers, you may be able to migrate the recipe yourself.
{% endif %} + {% endblock %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {% if recipe.bugtracker %} - - - - - {% endif %} - - - - +{% block to_recipe_extra %}{% if recipe.cover_verified %} verified{% endif %}{% if recipe.needs_attention %} needs attention{% endif %}{% endblock %} + + {% block selectbuttons %} + {% if can_edit %} + Select... + {% endif %} + {% endblock %} + + {% block origin_row %} + {% if branch.name == 'oe-classic' %} + + {% else %} + + {% endif %} + + + {% endblock %} + + {% block table_extra %} {% if recipe.extra_urls %} @@ -95,123 +64,8 @@ {% endfor %} + {% endif %} - -
Name{{ recipe.name }}
Version{{ recipe.pv }}
Summary{{ recipe.summary }}
Description{{ recipe.description }}
Section{{ recipe.section }}
License{{ recipe.license }}{% if branch.name == 'oe-classic' %}*{% endif %}
Homepage{% if recipe.homepage %}{{ recipe.homepage }}{% endif %}
Bug tracker{{ recipe.bugtracker }}
{% if branch.name == 'oe-classic' %}Recipe file{% else %}Package file{% endif %} - {% if recipe.vcs_web_url %} - {{ recipe.full_path }} - {% else %} - {{ recipe.full_path }} - {% endif %} -
OriginDistro / Layer{{ branch.short_description }}{% if cover_recipe %}{{ cover_recipe.layerbranch.layer }} ({{ cover_recipe.layerbranch.branch.name }} branch){% endif %}
Extra links +
- - {% if branch.name == 'oe-classic' %} -

* - in OE-Classic, some of the license values were not accurate. Please refer to current recipes (if available) for this information.

- {% endif %} - -

Patches

- {% if recipe.patch_set.exists %} - - - - - - - - - {% for patch in recipe.patch_set.all %} - - - - - {% endfor %} - -
PatchStatus
{{ patch.src_path }}{{ patch.get_status_display }} {{ patch.status_extra }}
- {% else %} -

None

- {% endif %} - - {% if branch.name == 'oe-classic' %} -

Migration information

- {% else %} -

Comparison information

- {% endif %} - - {% if can_edit %} -
- {% csrf_token %} - {% for hidden in form.hidden_fields %} - {{ hidden }} - {% endfor %} - - Coverage {{ form.cover_status }} by {{ form.cover_pn }} in {{ form.cover_layerbranch }} - -

- -

-

- -

-

- -

- -
- {% else %} - - - - - - - {% if recipe.cover_pn %} - - - {% endif %} - - - - - -
Coverage{{ recipe.get_cover_desc }}
Covering recipe{% if cover_recipe %}{% endif %}{{ recipe.cover_pn }}{% if cover_recipe %}{% endif %}{% if recipe.cover_layerbranch %} (in {{ recipe.cover_layerbranch.layer.name }}){% endif %}
Categories{{ recipe.classic_category }}
- {% endif %} - -
-
- -{% endautoescape %} - -{% endblock %} - -{% block scripts %} - -{% endblock %} + {% endblock %} diff --git a/templates/layerindex/classicrecipes.html b/templates/layerindex/classicrecipes.html index 9f19d2a..a39202f 100644 --- a/templates/layerindex/classicrecipes.html +++ b/templates/layerindex/classicrecipes.html @@ -51,6 +51,7 @@
+ {% block page_heading %} {% if branch.name == 'oe-classic' %}

OE-Classic recipes

@@ -60,6 +61,7 @@ {% else %}

{{ branch.short_description }} packages

{% endif %} + {% endblock %}
@@ -108,6 +110,8 @@ {% endif %} {% endfor %} + + {% if branch.comparison %} @@ -141,11 +145,14 @@
+ {% endif %} - - + + {% block export_button %} + + {% endblock %}
@@ -153,7 +160,13 @@ - {% if reversed %} + {% if not branch.comparison %} + + + + + + {% elif reversed %} @@ -190,13 +203,20 @@ {% endif %} + {% block table_head_extra %}{% endblock %} {% for recipe in recipe_list %} 0 %}class="muted"{% endif %}> - {% if reversed %} + {% if not branch.comparison %} + + + + + + {% elif reversed %} @@ -220,13 +240,14 @@ {% endif %} {% else %} - + {% endif %} + {% block table_row_extra %}{% endblock %} {% endfor %} @@ -240,6 +261,8 @@ {% if searched %} {% if branch.name == 'oe-classic' %}

No matching OE-Classic recipes in database.

+ {% elif not branch.comparison %} +

No matching recipes in {{ branch }} branch.

{% else %}

No matching {{ branch }} packages in database.

{% endif %} @@ -384,5 +407,7 @@ $('#id_reversed').click(function (e) { update_filters_enabled() }); +{% block scripts_extra %} +{% endblock %} {% endblock %} diff --git a/templates/layerindex/comparisonrecipebase.html b/templates/layerindex/comparisonrecipebase.html new file mode 100644 index 0000000..5fba8c1 --- /dev/null +++ b/templates/layerindex/comparisonrecipebase.html @@ -0,0 +1,222 @@ +{% extends "base.html" %} +{% load i18n %} + +{% comment %} + + layerindex-web - image comparison recipe detail page template + + Copyright (C) 2018 Intel Corporation + Licensed under the MIT license, see COPYING.MIT for details + +{% endcomment %} + + + + +{% block contenttag %}
{% endblock %} + +{% block content %} +{% autoescape on %} + + {% block breadcrumbs %} + + {% endblock %} + +
+
+ + {% block page_heading %} + + {% endblock %} + +
Recipe nameLayerVersionDescriptionSectionRecipe name OE Layer VersionCovering recipe Categories
{{ recipe.name }}{{ recipe.layerbranch.layer.name }}{{ recipe.pv }}{{ recipe.short_desc }}{{ recipe.section }}{{ recipe.name }}{% if recipe.needs_attention %} {% endif %} {{ recipe.layerbranch.layer.name }} {{ recipe.pv }}{{ recipe.name }}{% if recipe.needs_attention %} {% endif %}{{ recipe.name }}{% if recipe.needs_attention %} {% endif %} {{ recipe.pv }} {{ recipe.short_desc }} {{ recipe.get_cover_desc }} {% if recipe.cover_pn %}{% if recipe.cover_recipe %}{% endif %}{{ recipe.cover_pn }}{% if recipe.cover_recipe %}{% endif %}{% endif %} {{ recipe.classic_category }}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% if recipe.bugtracker or cover_recipe.bugtracker %} + + + + + + {% endif %} + + + {% for rcp in recipes %} + + {% endfor %} + + + {% block origin_row %} + + + + {% endblock %} + + {% block table_extra %} + {% endblock %} + +
{{ layerbranch_desc }}{{ layerbranch_addtext }}{{ to_desc }}
Name{{ recipe.name }}{% if cover_recipe %}{{ cover_recipe.name }} ({{ recipe.get_cover_status_display }}{% if recipe.cover_comment %} - {{ recipe.cover_comment }}{% endif %}){% else %}{{ recipe.get_cover_status_display }}{% if recipe.cover_comment %} - {{ recipe.cover_comment }}{% endif %}{% endif %}{% block to_recipe_extra %}{% endblock %} +
+ {% block selectbuttons %} + Select... + {% endblock %} +
+
Version{{ recipe.pv }}{{ cover_recipe.pv }}
Summary{{ recipe.summary }}{{ cover_recipe.summary }}
Description{{ recipe.description }}{{ cover_recipe.description }}
Section{{ recipe.section }}{{ cover_recipe.section }}
License{{ recipe.license }}{{ cover_recipe.license }}
Homepage + {% if recipe.homepage_url_only %} + {{ recipe.homepage }} + {% elif recipe.homepage %} + {{ recipe.homepage }} + {% endif %} + + {% if cover_recipe.homepage_url_only %} + {{ cover_recipe.homepage }} + {% elif cover_recipe.homepage %} + {{ cover_recipe.homepage }} + {% endif %} +
Bug tracker{{ recipe.bugtracker }}{{ cover_recipe.bugtracker }}
Package/recipe file + {% if rcp.vcs_web_url %} + {{ rcp.full_path }} + {% else %} + {{ rcp.full_path }} + {% endif %} +
Layer{{ layerbranch_desc }}{{ layerbranch_addtext }}
+ +

Sources

+ + + + + + + {% for rcp in recipes %} + {% if rcp.source_set.exists %} + + {% else %} + + {% endif %} + {% endfor %} + +
{{ layerbranch_desc }}{{ layerbranch_addtext }}{{ to_desc }}
+ + + {% for source in rcp.source_set.all %} + + + + {% endfor %} + +
{% if source.web_url %}{% endif %}{{ source.url }}{% if source.web_url %}{% endif %}
+
None
+ +

Patches

+ + + + + + + {% for rcp in recipes %} + {% if rcp.patch_set.exists %} + + {% else %} + + {% endif %} + {% endfor %} + +
{{ layerbranch_desc }}{{ layerbranch_addtext }}{{ to_desc }}
+ + + + + + + + + {% for patch in rcp.patch_set.all %} + + + + + {% endfor %} + +
PatchStatus
{{ patch.src_path }}{{ patch.get_status_display }} {{ patch.status_extra | urlize }}
+
None
+ + + +{% endautoescape %} + +{% endblock %} + +{% block scripts %} + +{% endblock %} diff --git a/templates/layerindex/comparisonrecipeselect.html b/templates/layerindex/comparisonrecipeselect.html new file mode 100644 index 0000000..1646ae3 --- /dev/null +++ b/templates/layerindex/comparisonrecipeselect.html @@ -0,0 +1,119 @@ +{% extends "layerindex/classicrecipes.html" %} +{% load i18n %} + +{% comment %} + + layerindex-web - comparison recipe selection page template + + Copyright (C) 2018 Intel Corporation + Licensed under the MIT license, see COPYING.MIT for details + +{% endcomment %} + + + + {% block page_heading %} +

Select match for {{ select_for.pn }} in {% if branch.comparison %}{{ branch }}{% else %}OpenEmbedded{% endif %}

+ + +
+ +
+ {% endblock %} + + {% block table_head_extra %}{% endblock %} + + {% block table_row_extra %}Select{% endblock %} + + {% block no_comparison_recipe_url %}{% url 'comparison_select_detail' select_for.id recipe.id %}{% endblock %} + + {% block export_button %} + {% endblock %} + +{% block scripts_extra %} + $('.select_recipe_button').click(function (e) { + pn = $(this).attr('recipe-pn'); + + // FIXME this does tend to cause items to re-sort + + $('#id_selectrecipedialog-cover_status').append($('#id_hidden_selectbox').children()); + if( !pn ) { + $('#id_hidden_selectbox').append($('#id_selectrecipedialog-cover_status option[value="D"]')); + $('#id_hidden_selectbox').append($('#id_selectrecipedialog-cover_status option[value="E"]')); + } + else { + $('#id_hidden_selectbox').append($('#id_selectrecipedialog-cover_status option[value="N"]')); + $('#id_hidden_selectbox').append($('#id_selectrecipedialog-cover_status option[value="S"]')); + $('#id_hidden_selectbox').append($('#id_selectrecipedialog-cover_status option[value="U"]')); + } + $('#id_span_select_recipe').text(pn); + $('#id_selectrecipedialog-cover_pn').val(pn); + $('#id_selectrecipedialog-cover_layerbranch').val($(this).attr('recipe-layerbranch')); + if( pn ) { + {% if existing_cover_recipe %} + $('#id_selectrecipedialog-cover_status').val('{{ select_for.cover_status }}'); + {% else %} + $('#id_selectrecipedialog-cover_status').val('D'); + {% endif %} + } + else { + $('#id_selectrecipedialog-cover_status').val('N'); + } + }); + $('#id_selectrecipedialog_save').click(function (e) { + $('#comparison_form').submit() + $('#selectRecipeDialog').modal('hide') + }); +{% endblock %} diff --git a/templates/layerindex/comparisonrecipeselectdetail.html b/templates/layerindex/comparisonrecipeselectdetail.html new file mode 100644 index 0000000..1ab1ee1 --- /dev/null +++ b/templates/layerindex/comparisonrecipeselectdetail.html @@ -0,0 +1,98 @@ +{% extends "layerindex/recipedetail.html" %} +{% load i18n %} + +{% comment %} + + layerindex-web - comparison recipe selection detail page template + + Copyright (C) 2018 Intel Corporation + Licensed under the MIT license, see COPYING.MIT for details + +{% endcomment %} + + + + {% block page_heading %} + + +
+ +
+ {% endblock %} + +{% block scripts %} + +{% endblock %} diff --git a/templates/layerindex/recipedetail.html b/templates/layerindex/recipedetail.html index 2e20107..47b5e3f 100644 --- a/templates/layerindex/recipedetail.html +++ b/templates/layerindex/recipedetail.html @@ -29,9 +29,11 @@
+ {% block page_heading %} + {% endblock %} {% if recipe.blacklisted %}
@@ -216,6 +218,9 @@
+{% block content_extra %} +{% endblock %} + {% endautoescape %} {% endblock %} @@ -226,4 +231,6 @@ $('[data-toggle="tooltip"]').tooltip(); }); +{% block scripts_extra %} +{% endblock %} {% endblock %}