Mathias Markl 7 years ago
parent
commit
aa18eb0391
  1. 2
      muk_web_utils/__manifest__.py
  2. 22
      muk_web_utils/static/src/js/common.js
  3. 22
      muk_web_utils/template/assets.xml

2
muk_web_utils/__manifest__.py

@ -25,7 +25,7 @@
"description": """
Technical module to provide some utility features.
""",
"version": "11.0.1.0.3",
"version": "11.0.1.0.4",
"category": "Extra Tools",
"license": "AGPL-3",
"website": "http://www.mukit.at",

22
muk_web_utils/static/src/js/common.js

@ -62,10 +62,30 @@ function format_size(bytes, options) {
return format_number(bytes) + ' ' + units[u];
}
function unique_string() {
function chr4() {
return Math.random().toString(16).slice(-4);
}
return chr4() + chr4() + '-' + chr4() + '-' + chr4() + '-' + chr4() + '-' + chr4() + chr4() + chr4();
}
function unique_id(prefix) {
var random = unique_string();
var prefix = prefix || "";
var id = prefix + random;
while ($('#' + id).length >= 1) {
id = prefix + unique_string();
}
return id;
}
return {
delay: delay,
format_number: format_number,
format_size: format_size,
}
unique_string: unique_string,
unique_id: unique_id,
};
});

22
muk_web_utils/template/assets.xml

@ -26,22 +26,22 @@
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_utils/static/lib/spectrum/js/spectrum.js"/>
<script type="text/javascript" src="/muk_web_utils/static/lib/bootstrap-switch/js/bootstrap-switch.js"/>
<script type="text/javascript" src="/muk_web_utils/static/src/js/jquery.js"/>
<script type="text/javascript" src="/muk_web_utils/static/src/js/common.js"/>
</xpath>
</template>
<template id="assets_editor" name="Editor Assets" inherit_id="web_editor.assets_editor">
<xpath expr="//link[last()]" position="after">
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_utils/static/lib/summernote/specialchars/summernote-ext-specialchars.js" />
<script type="text/javascript" src="/muk_web_utils/static/lib/summernote/emoji/summernote-ext-emoji.js" />
</xpath>
</template>
<template id="assets_editor" name="Editor Assets" inherit_id="web_editor.assets_editor">
<xpath expr="//link[last()]" position="after">
</xpath>
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_utils/static/lib/summernote/specialchars/summernote-ext-specialchars.js" />
<script type="text/javascript" src="/muk_web_utils/static/lib/summernote/emoji/summernote-ext-emoji.js" />
</xpath>
</template>
<template id="assets_backend" inherit_id="web.assets_backend">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/muk_web_utils/static/src/js/jquery.js"/>
<script type="text/javascript" src="/muk_web_utils/static/src/js/common.js"/>
<script type="text/javascript" src="/muk_web_utils/static/src/js/mimetype.js"/>
</xpath>
</template>

Loading…
Cancel
Save