Merge remote-tracking branch 'inventree/master'

This commit is contained in:
Oliver Walters 2019-05-09 00:42:50 +10:00
commit a0d8fbede3
4 changed files with 13 additions and 5 deletions

View File

@ -10,6 +10,7 @@ import os
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from django.conf import settings from django.conf import settings
from django.contrib.staticfiles.templatetags.staticfiles import static
def rename_company_image(instance, filename): def rename_company_image(instance, filename):
@ -85,7 +86,7 @@ class Company(models.Model):
if self.image: if self.image:
return os.path.join(settings.MEDIA_URL, str(self.image.url)) return os.path.join(settings.MEDIA_URL, str(self.image.url))
else: else:
return '' return static('/img/blank_image.png')
@property @property
def part_count(self): def part_count(self):

View File

@ -19,6 +19,7 @@ from django.conf import settings
from django.db import models from django.db import models
from django.core.validators import MinValueValidator from django.core.validators import MinValueValidator
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db.models.signals import pre_delete from django.db.models.signals import pre_delete
from django.dispatch import receiver from django.dispatch import receiver
@ -130,7 +131,7 @@ class Part(models.Model):
if self.image: if self.image:
return os.path.join(settings.MEDIA_URL, str(self.image.url)) return os.path.join(settings.MEDIA_URL, str(self.image.url))
else: else:
return '' return static('/img/blank_image.png')
# Short name of the part # Short name of the part
name = models.CharField(max_length=100, unique=True, blank=False, help_text='Part name (must be unique)') name = models.CharField(max_length=100, unique=True, blank=False, help_text='Part name (must be unique)')

View File

@ -6,6 +6,10 @@
font-size: 20px; font-size: 20px;
} }
.glyphicon-small {
font-size: 14px;
}
.starred-part { .starred-part {
color: #ffcc00; color: #ffcc00;
} }

View File

@ -42,6 +42,8 @@ function downloadBom(options = {}) {
modalSetContent(modal, content); modalSetContent(modal, content);
modalEnable(modal, true);
$(modal).on('click', '#modal-form-submit', function() { $(modal).on('click', '#modal-form-submit', function() {
$(modal).modal('hide'); $(modal).modal('hide');
@ -91,7 +93,7 @@ function loadBomTable(table, options) {
title: 'Part', title: 'Part',
sortable: true, sortable: true,
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
return renderLink(value.name, value.url); return imageHoverIcon(value.image_url) + renderLink(value.name, value.url);
} }
} }
); );
@ -127,8 +129,8 @@ function loadBomTable(table, options) {
if (options.editable) { if (options.editable) {
cols.push({ cols.push({
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
var bEdit = "<button class='btn btn-success bom-edit-button btn-sm' type='button' url='/part/bom/" + row.pk + "/edit'>Edit</button>"; var bEdit = "<button title='Edit BOM Item' class='btn btn-success bom-edit-button btn-sm' type='button' url='/part/bom/" + row.pk + "/edit'><span class='glyphicon glyphicon-small glyphicon-pencil'></span></button>";
var bDelt = "<button class='btn btn-danger bom-delete-button btn-sm' type='button' url='/part/bom/" + row.pk + "/delete'>Delete</button>"; var bDelt = "<button title='Delete BOM Item' class='btn btn-danger bom-delete-button btn-sm' type='button' url='/part/bom/" + row.pk + "/delete'><span class='glyphicon glyphicon-small glyphicon-trash'></span></button>";
return "<div class='btn-group'>" + bEdit + bDelt + "</div>"; return "<div class='btn-group'>" + bEdit + bDelt + "</div>";
} }