lots of improvements and bookmarklet import working again

This commit is contained in:
vabene1111
2022-03-05 15:16:58 +01:00
parent 1caabef56a
commit 2565ab30a4
8 changed files with 305 additions and 217 deletions

View File

@@ -145,6 +145,27 @@ export function resolveDjangoUrl(url, params = null) {
}
}
/*
* Utility functions to use djangos static files
* */
export const StaticMixin = {
methods: {
/**
* access django static files from javascript
* @param {string} param path to static file
*/
resolveDjangoStatic: function (param) {
return resolveDjangoStatic(param)
},
},
}
export function resolveDjangoStatic(param) {
let url = localStorage.getItem('STATIC_URL') + param
return url.replace('//','/') //replace // with / in case param started with / which resulted in // after the static base url
}
/*
* other utilities
* */