Display templated parts as italic in the part list

This commit is contained in:
Oliver Walters 2019-05-26 00:29:17 +10:00
parent 6603d6e9ed
commit 21dd893c01
4 changed files with 18 additions and 0 deletions

View File

@ -93,6 +93,7 @@ class EditPartForm(HelperForm):
'name',
'IPN',
'variant',
'is_template',
'description',
'keywords',
'URL',

View File

@ -85,6 +85,8 @@ class PartSerializer(serializers.ModelSerializer):
'full_name',
'name',
'IPN',
'is_template',
'variant_of',
'variant',
'description',
'keywords',

View File

@ -47,10 +47,12 @@
<button type='button' class='btn btn-default btn-glyph' id='toggle-starred' title='Star this part'>
<span id='part-star-icon' class='starred-part glyphicon {% if starred %}glyphicon-star{% else %}glyphicon-star-empty{% endif %}'/>
</button>
{% if part.is_template == False %}
{% include "qr_button.html" %}
<button type='button' class='btn btn-default btn-glyph' id='price-button' title='Show pricing information'>
<span id='part-price-icon' class='part-price glyphicon glyphicon-usd'/>
</button>
{% endif %}
</div>
</p>
<table class='table table-condensed'>

View File

@ -124,7 +124,12 @@ function loadPartTable(table, url, options={}) {
sortable: true,
formatter: function(value, row, index, field) {
if (row.is_template) {
value = '<i>' + value + '</i>';
}
var display = imageHoverIcon(row.image_url) + renderLink(value, row.url);
if (!row.active) {
display = display + "<span class='label label-warning' style='float: right;'>INACTIVE</span>";
}
@ -135,6 +140,14 @@ function loadPartTable(table, url, options={}) {
sortable: true,
field: 'description',
title: 'Description',
formatter: function(value, row, index, field) {
if (row.is_template) {
value = '<i>' + value + '</i>';
}
return value;
}
},
{
sortable: true,