mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +00:00 
			
		
		
		
	Add user setting for configuring table string length (#3715)
This commit is contained in:
		| @@ -1642,6 +1642,16 @@ class InvenTreeUserSetting(BaseInvenTreeSetting): | ||||
|             'default': True, | ||||
|             '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' | ||||
|   | ||||
| @@ -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="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="TABLE_STRING_MAX_LENGTH" icon="fa-table" user_setting=True %} | ||||
|         </tbody> | ||||
|     </table> | ||||
| </div> | ||||
|   | ||||
| @@ -45,10 +45,11 @@ function deleteButton(url, text='{% trans "Delete" %}') { | ||||
|  */ | ||||
| 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) { | ||||
|         return null; | ||||
|     if (!max_length || !input_string) { | ||||
|         return input_string; | ||||
|     } | ||||
|  | ||||
|     input_string = input_string.toString(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user