mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Add user setting for configuring table string length (#3715)
This commit is contained in:
parent
5a08ef908d
commit
a7e4d27d6d
@ -1642,6 +1642,16 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
|||||||
'default': True,
|
'default': True,
|
||||||
'validator': bool,
|
'validator': bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'TABLE_STRING_MAX_LENGTH': {
|
||||||
|
'name': _('Table String Length'),
|
||||||
|
'description': _('Maximimum length limit for strings displayed in table views'),
|
||||||
|
'validator': [
|
||||||
|
int,
|
||||||
|
MinValueValidator(0),
|
||||||
|
],
|
||||||
|
'default': 100,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typ = 'user'
|
typ = 'user'
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
{% include "InvenTree/settings/setting.html" with key="FORMS_CLOSE_USING_ESCAPE" icon="fa-window-close" user_setting=True %}
|
{% include "InvenTree/settings/setting.html" with key="FORMS_CLOSE_USING_ESCAPE" icon="fa-window-close" user_setting=True %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="PART_SHOW_QUANTITY_IN_FORMS" icon="fa-hashtag" user_setting=True %}
|
{% include "InvenTree/settings/setting.html" with key="PART_SHOW_QUANTITY_IN_FORMS" icon="fa-hashtag" user_setting=True %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="DISPLAY_SCHEDULE_TAB" icon="fa-calendar-alt" user_setting=True %}
|
{% include "InvenTree/settings/setting.html" with key="DISPLAY_SCHEDULE_TAB" icon="fa-calendar-alt" user_setting=True %}
|
||||||
|
{% include "InvenTree/settings/setting.html" with key="TABLE_STRING_MAX_LENGTH" icon="fa-table" user_setting=True %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,10 +45,11 @@ function deleteButton(url, text='{% trans "Delete" %}') {
|
|||||||
*/
|
*/
|
||||||
function shortenString(input_string, options={}) {
|
function shortenString(input_string, options={}) {
|
||||||
|
|
||||||
var max_length = options.max_length || 100;
|
// Maximum length can be provided via options argument, or via a user-configurable setting
|
||||||
|
var max_length = options.max_length || user_settings.TABLE_STRING_MAX_LENGTH;
|
||||||
|
|
||||||
if (input_string == null) {
|
if (!max_length || !input_string) {
|
||||||
return null;
|
return input_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
input_string = input_string.toString();
|
input_string = input_string.toString();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user