Added static files directory

- Improved display of part image
This commit is contained in:
Oliver 2018-04-14 18:22:31 +10:00
parent 72b44e15f4
commit a31ec388f4
8 changed files with 56 additions and 27 deletions

View File

@ -136,6 +136,10 @@ USE_TZ = True
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

View File

@ -1,23 +0,0 @@
body {
padding-left: 15px;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 10px;
}
th {
text-align: left;
}
table tr:nth-child(even) {
background-color: #eee;
}
table tr:nth-child(odd) {
background-color: #fff;
}

View File

@ -10,7 +10,7 @@
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel="stylesheet" href="{% static 'css/part.css' %}">
<link rel="stylesheet" href="{% static 'css/inventree.css' %}">
<title>
{% block title %}
@ -20,11 +20,14 @@ InvenTree
</head>
<body>
{% include "navbar.html" %}
<div class="inventree-content">
{% block content %}
<!-- Each view fills in here.. -->
{% endblock %}
</div>
</body>
</html>

View File

@ -1,4 +1,4 @@
<div class="container">
<div class='navigation'>
<a href="/part/list/">Parts</a> >
{% if category %}
{% for path_item in category.parentpath %}

View File

@ -1,15 +1,17 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
{% include "part/cat_link.html" with category=part.category %}
<div class="media">
<img class="mr-3"
<img class="mr-3 part-thumb"
{% if part.image %}
src="{{ part.image.url }}"
{% else %}
src="/media/part_images/missing.png"
src="{% static 'img/blank_image.png' %}"
{% endif %}/>
<div class="media-body">
<h5>{{ part.name }}</h5>

View File

@ -0,0 +1,43 @@
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 10px;
}
th {
text-align: left;
}
table tr:nth-child(even) {
background-color: #eee;
}
table tr:nth-child(odd) {
background-color: #fff;
}
.part-thumb {
width: 250px;
height: 250px;
border: 1px black solid;
margin: 5px;
padding: 5px;
object-fit: contain;
}
.media-body {
padding-top: 10px;
}
.navigation {
padding: 5px;
padding-left: 15px;
background-color: #EEE;
}
.inventree-content {
padding-left: 15px;
padding-right: 15px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB