Added the init_libs template tag to initialize the CSS and JavaScript library resolver in the Mia core application.
This commit is contained in:
parent
c0946481dd
commit
4cb92dd309
@ -104,6 +104,21 @@ def url_keep_return(context: RequestContext, url: str) -> str:
|
||||
return str(UrlBuilder(url).query(r=context.request.GET.get("r")))
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def init_libs(context: RequestContext) -> str:
|
||||
"""Initializes the static libraries.
|
||||
|
||||
Args:
|
||||
context: The request context.
|
||||
|
||||
Returns:
|
||||
An empty string.
|
||||
"""
|
||||
if "libs" not in context.dicts[0]:
|
||||
context.dicts[0]["libs"] = CssAndJavaScriptLibraries()
|
||||
return ""
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def add_lib(context: RequestContext, *args) -> str:
|
||||
"""Adds CSS and JavaScript libraries.
|
||||
|
Loading…
Reference in New Issue
Block a user