2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 04:55:44 +00:00

Feature/icons for PartCategory and StockLocation (#3542)

* Added icon to stock location

- added `icon` field to `stock_stocklocation` model
- added input field to stock location form
- added icon to breadcrumb treeview in header
- added icon to sub-locations table
- added icon to location detail information
- added `STOCK_LOCATION_DEFAULT_ICON` setting as default

* Added icon to part category

- added `icon` field to `part_partcategory` model
- added input field to part category form
- added icon to breadcrumb treeview in header
- added icon to sub-categories table
- added icon to category detail information
- added `PART_CATEGORY_DEFAULT_ICON` setting as default

* Added `blocktrans` to allowed tags in ci check

* fix: style

* Added `endblocktrans` to allowed tags in ci check

* fix: missing `,` in ci check allowed tags script

* Removed blocktrans from js and fixed style
This commit is contained in:
wolflu05
2022-08-16 13:51:55 +02:00
committed by GitHub
parent 1b76828305
commit b9f83eefc8
15 changed files with 111 additions and 5 deletions

View File

@ -36,6 +36,8 @@
<tr><td colspan='5'></td></tr>
{% include "InvenTree/settings/setting.html" with key="PART_INTERNAL_PRICE" %}
{% include "InvenTree/settings/setting.html" with key="PART_BOM_USE_INTERNAL_PRICE" %}
<tr><td colspan='5'></td></tr>
{% include "InvenTree/settings/setting.html" with key="PART_CATEGORY_DEFAULT_ICON" icon="fa-icons" %}
</tbody>
</table>

View File

@ -17,6 +17,7 @@
{% include "InvenTree/settings/setting.html" with key="STOCK_ALLOW_EXPIRED_SALE" icon="fa-truck" %}
{% include "InvenTree/settings/setting.html" with key="STOCK_ALLOW_EXPIRED_BUILD" icon="fa-tools" %}
{% include "InvenTree/settings/setting.html" with key="STOCK_OWNERSHIP_CONTROL" icon="fa-users" %}
{% include "InvenTree/settings/setting.html" with key="STOCK_LOCATION_DEFAULT_ICON" icon="fa-icons" %}
</tbody>
</table>
{% endblock %}

View File

@ -216,6 +216,7 @@ function enableBreadcrumbTree(options) {
enableLinks: true,
expandIcon: 'fas fa-chevron-right',
collapseIcon: 'fa fa-chevron-down',
nodeIcon: options.defaultIcon,
});
}

View File

@ -301,7 +301,11 @@ function categoryFields() {
default_location: {},
default_keywords: {
icon: 'fa-key',
}
},
icon: {
help_text: `{% trans "Icon (optional) - Explore all available icons on" %} <a href="https://fontawesome.com/v5/search?s=solid" target="_blank" rel="noopener noreferrer">Font Awesome</a>.`,
placeholder: 'fas fa-tag',
},
};
}
@ -1916,6 +1920,11 @@ function loadPartCategoryTable(table, options) {
}
}
const icon = row.icon || global_settings.PART_CATEGORY_DEFAULT_ICON;
if (icon) {
html += `<span class="${icon} me-1"></span>`;
}
html += renderLink(
value,
`/part/category/${row.pk}/`

View File

@ -114,6 +114,10 @@ function stockLocationFields(options={}) {
name: {},
description: {},
owner: {},
icon: {
help_text: `{% trans "Icon (optional) - Explore all available icons on" %} <a href="https://fontawesome.com/v5/search?s=solid" target="_blank" rel="noopener noreferrer">Font Awesome</a>.`,
placeholder: 'fas fa-box',
},
};
if (options.parent) {
@ -2402,6 +2406,11 @@ function loadStockLocationTable(table, options) {
}
}
const icon = row.icon || global_settings.STOCK_LOCATION_DEFAULT_ICON;
if (icon) {
html += `<span class="${icon} me-1"></span>`;
}
html += renderLink(
value,
`/stock/location/${row.pk}/`