mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 03:56:43 +00:00
Convert SEARCH_PREVIEW_RESULTS to a "user" setting
This commit is contained in:
parent
3e0655a9d8
commit
33a0b73a05
@ -668,13 +668,6 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
|||||||
'validator': bool,
|
'validator': bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
'SEARCH_PREVIEW_RESULTS': {
|
|
||||||
'name': _('Search Preview Results'),
|
|
||||||
'description': _('Number of results to show in search preview window'),
|
|
||||||
'default': 10,
|
|
||||||
'validator': [int, MinValueValidator(1)]
|
|
||||||
},
|
|
||||||
|
|
||||||
'STOCK_ENABLE_EXPIRY': {
|
'STOCK_ENABLE_EXPIRY': {
|
||||||
'name': _('Stock Expiry'),
|
'name': _('Stock Expiry'),
|
||||||
'description': _('Enable stock expiry functionality'),
|
'description': _('Enable stock expiry functionality'),
|
||||||
@ -857,6 +850,13 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
|||||||
'default': True,
|
'default': True,
|
||||||
'validator': bool,
|
'validator': bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'SEARCH_PREVIEW_RESULTS': {
|
||||||
|
'name': _('Search Preview Results'),
|
||||||
|
'description': _('Number of results to show in search preview window'),
|
||||||
|
'default': 10,
|
||||||
|
'validator': [int, MinValueValidator(1)]
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -22,16 +22,4 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<table class='table table-striped table-condensed'>
|
|
||||||
{% include "InvenTree/settings/header.html" %}
|
|
||||||
<tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h4>{% trans "Search Settings" %}</h4>
|
|
||||||
<table class='table table-striped table-condensed'>
|
|
||||||
<tbody>
|
|
||||||
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_RESULTS" icon="fa-search" %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -24,6 +24,12 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class='list-group-item' title='{% trans "Search" %}'>
|
||||||
|
<a href='#' class='nav-toggle' id='select-user-search'>
|
||||||
|
<span class='fas fa-search'></span> {% trans "Search" %}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<li class='list-group-item' title='{% trans "Settings" %}'>
|
<li class='list-group-item' title='{% trans "Settings" %}'>
|
||||||
<a href='#' class='nav-toggle' id='select-user-settings'>
|
<a href='#' class='nav-toggle' id='select-user-settings'>
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
{% include "InvenTree/settings/user.html" %}
|
{% include "InvenTree/settings/user.html" %}
|
||||||
{% include "InvenTree/settings/user_settings.html" %}
|
{% include "InvenTree/settings/user_settings.html" %}
|
||||||
{% include "InvenTree/settings/user_homepage.html" %}
|
{% include "InvenTree/settings/user_homepage.html" %}
|
||||||
|
{% include "InvenTree/settings/user_search.html" %}
|
||||||
|
|
||||||
{% if user.is_staff %}
|
{% if user.is_staff %}
|
||||||
|
|
||||||
|
23
InvenTree/templates/InvenTree/settings/user_search.html
Normal file
23
InvenTree/templates/InvenTree/settings/user_search.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{% extends "panel.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load inventree_extras %}
|
||||||
|
|
||||||
|
{% block label %}user-search{% endblock %}
|
||||||
|
|
||||||
|
{% block heading %}
|
||||||
|
{% trans "Search Settings" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<table class='table table-striped table-condensed'>
|
||||||
|
{% include "InvenTree/settings/header.html" %}
|
||||||
|
<tbody>
|
||||||
|
{% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_RESULTS" user_setting=True icon='fa-search' %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -91,7 +91,7 @@ function inventreeDocReady() {
|
|||||||
url: '/api/part/',
|
url: '/api/part/',
|
||||||
data: {
|
data: {
|
||||||
search: request.term,
|
search: request.term,
|
||||||
limit: {% settings_value 'SEARCH_PREVIEW_RESULTS' %},
|
limit: {% settings_value 'SEARCH_PREVIEW_RESULTS' user=request.user %},
|
||||||
offset: 0
|
offset: 0
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user