myaac/system/templates/admin.menus.js.html.twig
slawkens 6c9e09ea73 * moved template menus to database, they're now dynamically loaded
* you can edit them in Admin Panel under 'Menus' option.
* you can also add custom links, like http://google.pl
* removed videos pages, as it can be easily added using custom Menus and Pages with insert Media
* removed bug_report configurable, its now enabled by default
2017-10-24 14:42:23 +02:00

33 lines
1.3 KiB
Twig

<link rel="stylesheet" href="{{ constant('BASE_URL') }}tools/jquery-ui.min.css">
<script src="{{ constant('BASE_URL') }}tools/jquery-ui.min.js"></script>
<script>
var last_id = [];
{% for cat, menu in menus %}
last_id[{{ cat }}] = {{ last_id[cat] }};
{% endfor %}
$( function() {
$(".sortable").sortable();
$(".sortable").disableSelection();
$(".remove-button").click(function() {
var id = $(this).attr("id");
$('#list-' + id.replace('remove-button-', '')).remove();
});
$(".add-button").click(function() {
var cat = $(this).attr("id").replace('add-button-', '');
var id = last_id[cat];
last_id[cat]++;
$('#sortable-' + cat).append('<li class="ui-state-default" id="list-' + cat + '-' + id + '"><input type="text" name="menu[' + cat + '][]" value=""/><input type="text" name="menu_link[' + cat + '][]" value=""/><a class="remove-button" id="remove-button-' + cat + '-' + id + '"><img src="{{ constant('BASE_URL') }}images/del.png"/></a></li>'); //add input bo
$('#remove-button-' + cat + '-' + id).click(function() {
$('#list-' + $(this).attr("id").replace('remove-button-', '')).remove();
});
});
});
</script>
<style>
.sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
.remove-button, .add-button {
cursor: pointer;
}
</style>