mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-03 22:55:43 +00:00 
			
		
		
		
	@@ -292,6 +292,19 @@ def progress_bar(val, max, *args, **kwargs):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@register.simple_tag()
 | 
					@register.simple_tag()
 | 
				
			||||||
def get_color_theme_css(username):
 | 
					def get_color_theme_css(username):
 | 
				
			||||||
 | 
					    user_theme_name = get_user_color_theme(username)
 | 
				
			||||||
 | 
					    # Build path to CSS sheet
 | 
				
			||||||
 | 
					    inventree_css_sheet = os.path.join('css', 'color-themes', user_theme_name + '.css')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Build static URL
 | 
				
			||||||
 | 
					    inventree_css_static_url = os.path.join(settings.STATIC_URL, inventree_css_sheet)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return inventree_css_static_url
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@register.simple_tag()
 | 
				
			||||||
 | 
					def get_user_color_theme(username):
 | 
				
			||||||
 | 
					    """ Get current user color theme """
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        user_theme = ColorTheme.objects.filter(user=username).get()
 | 
					        user_theme = ColorTheme.objects.filter(user=username).get()
 | 
				
			||||||
        user_theme_name = user_theme.name
 | 
					        user_theme_name = user_theme.name
 | 
				
			||||||
@@ -300,13 +313,7 @@ def get_color_theme_css(username):
 | 
				
			|||||||
    except ColorTheme.DoesNotExist:
 | 
					    except ColorTheme.DoesNotExist:
 | 
				
			||||||
        user_theme_name = 'default'
 | 
					        user_theme_name = 'default'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Build path to CSS sheet
 | 
					    return user_theme_name
 | 
				
			||||||
    inventree_css_sheet = os.path.join('css', 'color-themes', user_theme_name + '.css')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Build static URL
 | 
					 | 
				
			||||||
    inventree_css_static_url = os.path.join(settings.STATIC_URL, inventree_css_sheet)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return inventree_css_static_url
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@register.simple_tag()
 | 
					@register.simple_tag()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,8 +37,9 @@
 | 
				
			|||||||
            <div class='form-group input-group mb-3'>
 | 
					            <div class='form-group input-group mb-3'>
 | 
				
			||||||
                <select id='theme' name='theme' class='select form-control'>
 | 
					                <select id='theme' name='theme' class='select form-control'>
 | 
				
			||||||
                    {% get_available_themes as themes %}
 | 
					                    {% get_available_themes as themes %}
 | 
				
			||||||
 | 
					                    {% get_user_color_theme request.user.username as user_theme %}
 | 
				
			||||||
                    {% for theme in themes %}
 | 
					                    {% for theme in themes %}
 | 
				
			||||||
                    <option value='{{ theme.key }}'>{{ theme.name }}</option>
 | 
					                    <option value='{{ theme.key }}'{% if theme.key == user_theme %} selected{% endif%}>{{ theme.name }}</option>
 | 
				
			||||||
                    {% endfor %}
 | 
					                    {% endfor %}
 | 
				
			||||||
                </select>
 | 
					                </select>
 | 
				
			||||||
                <div class='input-group-append'>
 | 
					                <div class='input-group-append'>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user