layerindex-web/templates/layerindex/comparisonrecipeselect.html
Paul Eggleton f38bae1dd9 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 <paul.eggleton@linux.intel.com>
2018-08-13 16:04:16 +02:00

120 lines
6.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% 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 title_append %} - comparison - select match for {{ select_for.name }}{% endblock %}
-->
{% block page_heading %}
<h2>Select match for {{ select_for.pn }} in {% if branch.comparison %}{{ branch }}{% else %}OpenEmbedded{% endif %}</h2>
<div class="pull-right">
<a href="#selectRecipeDialog" role="button" data-toggle="modal" class="select_recipe_button btn {% if recipe.id == existing_cover_recipe.id %}btn-primary{% else %}btn-default{% endif %}">No match</a>
<a href="{% url 'comparison_recipe' select_for.id %}" class="btn btn-default">Cancel</a>
</div>
<form id="comparison_form" class="form-inline" method="post">
<div id="selectRecipeDialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="selectRecipeDialogLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="selectRecipeDialogLabel">Select <span id="id_span_select_recipe">recipe</span> to match {{ select_for.pn }}</h3>
</div>
<div class="modal-body">
{% csrf_token %}
{% for hidden in comparison_form.hidden_fields %}
{{ hidden }}
{% endfor %}
<select class="hidden-select" id="id_hidden_selectbox">
</select>
Coverage {{ comparison_form.cover_status }}
{% if comparison_form.cover_verified %}
<label class="checkbox" id="id_label_cover_verified">
{{ comparison_form.cover_verified }} verified
</label>
{% endif %}
{% if comparison_form.classic_category %}
<p>
<label>
Category
{{ comparison_form.classic_category }}
</label>
</p>
{% endif %}
<p>
<label>
Comment
{{ comparison_form.cover_comment }}
</label>
</p>
{% if comparison_form.needs_attention %}
<p>
<label class="checkbox" id="id_label_needs_attention">
{{ comparison_form.needs_attention }}
Needs attention
</label>
</p>
{% endif %}
</div>
<div class="modal-footer">
<button class="btn btn-primary" id="id_selectrecipedialog_save" data-dismiss="modal" aria-hidden="true">Save</button>
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>
</div>
</form>
{% endblock %}
{% block table_head_extra %}<th></th>{% endblock %}
{% block table_row_extra %}<td><a href="#selectRecipeDialog" role="button" data-toggle="modal" class="select_recipe_button btn {% if recipe.id == existing_cover_recipe.id %}btn-primary{% else %}btn-default{% endif %}" recipe-pn="{{ recipe.pn }}" recipe-layerbranch="{{ recipe.layerbranch.id }}">Select</a></td>{% 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 %}