1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-20 11:51:28 +02:00

feat(admin-plugin): add modules partials templates #211

This commit is contained in:
Awilum
2020-01-30 00:20:31 +03:00
parent b6d505ac07
commit 2f2c7a9b82
12 changed files with 156 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
<script type="text/javascript">
new ClipboardJS('.js-clipboard-btn');
</script>

View File

@@ -0,0 +1,52 @@
<script type="text/javascript">
function qsa(sel) {
return Array.apply(null, document.querySelectorAll(sel));
}
qsa(".js-code").forEach(function (editorEl) {
var editor = CodeMirror.fromTextArea(editorEl, {
lineNumbers: true,
{% if is_current_path('admin.fieldsets.edit') %}
indentUnit: 4,
tabSize: 4,
{% else %}
tabSize: 4,
indentUnit: 4,
{% endif %}
{% if is_current_path('admin.fieldsets.edit') %}
mode: "text/javascript",
{% else %}
mode: "application/x-httpd-php",
{% endif %}
indentWithTabs: false,
{% if registry.settings.admin_panel.theme == 'light' %}
theme: "elegant",
{% elseif registry.settings.admin_panel.theme == 'dark' %}
theme: "monokai",
{% endif %}
styleActiveLine: true
});
editor.addKeyMap({
"Tab": function (cm) {
if (cm.somethingSelected()) {
var sel = editor.getSelection("\n");
// Indent only if there are multiple lines selected, or if the selection spans a full line
if (sel.length > 0 && (sel.indexOf("\n") > -1 || sel.length === cm.getLine(cm.getCursor().line).length)) {
cm.indentSelection("add");
return;
}
}
if (cm.options.indentWithTabs)
cm.execCommand("insertTab");
else
cm.execCommand("insertSoftTab");
}
,
"Shift-Tab": function (cm) {
cm.indentSelection("subtract");
}
});
});
</script>

View File

@@ -0,0 +1,3 @@
<script type="text/javascript">
bsCustomFileInput.init();
</script>

View File

@@ -0,0 +1,16 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment-with-locales.min.js" integrity="sha256-AdQN98MVZs44Eq2yTwtoKufhnU+uZ7v2kXnD5vqzZVo=" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.0.0-alpha14/js/tempusdominus-bootstrap-4.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.0.0-alpha14/css/tempusdominus-bootstrap-4.min.css" />
<script type="text/javascript">
$(function () {
$("#datetimepicker").datetimepicker({
locale: "{{ locale }}",
format: "{{ dateformatToMomentJS(registry.settings.date_format) }}",
debug: false,
icons: {
time: "far fa-clock",
date: "far fa-calendar-alt"
}
});
});
</script>

View File

@@ -0,0 +1,3 @@
<script type="text/javascript">
// $.validate({});
</script>

View File

@@ -0,0 +1,5 @@
<script type="text/javascript">
$('.js-save-form-submit').click(function() {
$("#form").submit();
});
</script>

View File

@@ -0,0 +1,18 @@
<script type="text/javascript">
Messenger.options = {
extraClasses: 'messenger-fixed messenger-on-bottom messenger-on-right',
theme: 'flat'
}
{% for message in flash()['success'] %}
Messenger().post({ type: "success", message : "{{ message }}", hideAfter: '3' });
{% endfor %}
{% for message in flash()['warning'] %}
Messenger().post({ type: "warning", message : "{{ message }}", hideAfter: '3' });
{% endfor %}
{% for message in flash()['error'] %}
Messenger().post({ type: "error", message : "{{ message }}", hideAfter: '3' });
{% endfor %}
</script>

View File

@@ -0,0 +1,3 @@
<script>
$('.js-example-basic-single').select2();
</script>

View File

@@ -0,0 +1,7 @@
<script src="//cdn.jsdelivr.net/npm/speakingurl@14.0.1/speakingurl.min.js"></script>
<script>
$("#title").on("keyup change", function () {
var slug = getSlug($("#title").val());
$("#id").val(slug);
});
</script>

View File

@@ -0,0 +1 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tagsinput/0.8.0/bootstrap-tagsinput.min.js" integrity="sha256-tQ3x4V2JW+L0ew/P3v2xzL46XDjEWUExFkCDY0Rflqc=" crossorigin="anonymous"></script>

View File

@@ -0,0 +1,17 @@
<script>
tippy('.js-nav', {placement: 'right'});
tippy('.js-dropdown-btn', {
placement: 'bottom',
allowHTML: true,
flipOnUpdate: true,
inlinePositioning: true,
interactive: true,
popperOptions: {
positionFixed: true
},
trigger: 'click',
maxWidth: 500,
zIndex: 10,
content: $('.js-dropdown-btn').siblings().html()
});
</script>

View File

@@ -0,0 +1,28 @@
<script type="text/javascript">
$.trumbowyg.svgPath = '{{base_url()}}/site/plugins/admin/assets/dist/fonts/trumbowyg/icons.svg';
$('.js-html-editor').trumbowyg({
btnsDef: {
// Customizables dropdowns
image: {
dropdown: ['insertImage', 'noembed'],
ico: 'insertImage'
}
},
btns: [
['undo', 'redo'], // Only supported in Blink browsers
['formatting'],
['strong', 'em', 'del'],
['link'],
['image'],
['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
['unorderedList', 'orderedList'],
['table'],
['removeformat'],
['fullscreen'],
['viewHTML']
],
lang: '{{ locale }}',
autogrow: false,
removeformatPasted: true
});
</script>