mirror of
https://github.com/slawkens/myaac.git
synced 2025-05-01 19:59:21 +02:00
Merge branch 'develop' into feature/settings
This commit is contained in:
commit
94f8e3602c
@ -46,6 +46,7 @@ if (isset($_REQUEST['template'])) {
|
|||||||
if ($cache->enabled()) {
|
if ($cache->enabled()) {
|
||||||
$cache->delete('template_menus');
|
$cache->delete('template_menus');
|
||||||
}
|
}
|
||||||
|
|
||||||
success('Saved at ' . date('H:i'));
|
success('Saved at ' . date('H:i'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ if (isset($_REQUEST['template'])) {
|
|||||||
echo 'Cannot find template config.php file.';
|
echo 'Cannot find template config.php file.';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($config['menu_categories'])) {
|
if (!isset($config['menu_categories'])) {
|
||||||
echo "No menu categories set in template config.php.<br/>This template doesn't support dynamic menus.";
|
echo "No menu categories set in template config.php.<br/>This template doesn't support dynamic menus.";
|
||||||
return;
|
return;
|
||||||
@ -91,15 +93,16 @@ if (isset($_REQUEST['template'])) {
|
|||||||
<ul class="sortable" id="sortable-<?php echo $id ?>">
|
<ul class="sortable" id="sortable-<?php echo $id ?>">
|
||||||
<?php
|
<?php
|
||||||
if (isset($menus[$id])) {
|
if (isset($menus[$id])) {
|
||||||
foreach ($menus[$id] as $i => $menu):
|
$i = 0;
|
||||||
|
foreach ($menus[$id] as $menu):
|
||||||
?>
|
?>
|
||||||
<li class="ui-state-default" id="list-<?php echo $id ?>-<?php echo $i ?>"><label>Name:</label> <input type="text" name="menu[<?php echo $id ?>][]" value="<?php echo escapeHtml($menu['name']); ?>"/>
|
<li class="ui-state-default" id="list-<?php echo $id ?>-<?php echo $i ?>"><label>Name:</label> <input type="text" name="menu[<?php echo $id ?>][]" value="<?php echo escapeHtml($menu['name']); ?>"/>
|
||||||
<label>Link:</label> <input type="text" name="menu_link[<?php echo $id ?>][]" value="<?php echo $menu['link'] ?>"/>
|
<label>Link:</label> <input type="text" name="menu_link[<?php echo $id ?>][]" value="<?php echo $menu['link'] ?>"/>
|
||||||
<input type="hidden" name="menu_blank[<?php echo $id ?>][]" value="0"/>
|
<input type="hidden" name="menu_blank[<?php echo $id ?>][]" value="0"/>
|
||||||
<label><input class="blank-checkbox" type="checkbox" <?php echo($menu['blank'] == 1 ? 'checked' : '') ?>/><span title="Open in New Window">New Window</span></label>
|
<label><input class="blank-checkbox" type="checkbox" <?php echo($menu['blank'] == 1 ? 'checked' : '') ?>/><span title="Open in New Window">New Window</span></label>
|
||||||
<input class="color-picker" type="text" name="menu_color[<?php echo $id ?>][]" value="#<?php echo $menu['color'] ?>"/>
|
<input class="color-picker" type="text" name="menu_color[<?php echo $id ?>][]" value="<?php echo (empty($menu['color']) ? ($config['menu_default_color'] ?? '#ffffff') : $menu['color']); ?>"/>
|
||||||
<a class="remove-button" id="remove-button-<?php echo $id ?>-<?php echo $i ?>"><i class="fas fa-trash"></a></i></li>
|
<a class="remove-button" id="remove-button-<?php echo $id ?>-<?php echo $i ?>"><i class="fas fa-trash"></a></i></li>
|
||||||
<?php $last_id[$id] = $i;
|
<?php $i++; $last_id[$id] = $i;
|
||||||
endforeach;
|
endforeach;
|
||||||
} ?>
|
} ?>
|
||||||
</ul>
|
</ul>
|
||||||
@ -120,7 +123,8 @@ if (isset($_REQUEST['template'])) {
|
|||||||
<?php
|
<?php
|
||||||
$twig->display('admin.menus.js.html.twig', array(
|
$twig->display('admin.menus.js.html.twig', array(
|
||||||
'menus' => $menus,
|
'menus' => $menus,
|
||||||
'last_id' => $last_id
|
'last_id' => $last_id,
|
||||||
|
'menu_default_color' => $config['menu_default_color'] ?? '#ffffff'
|
||||||
));
|
));
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
var cat = $(this).attr("id").replace('add-button-', '');
|
var cat = $(this).attr("id").replace('add-button-', '');
|
||||||
var id = last_id[cat];
|
var id = last_id[cat];
|
||||||
last_id[cat]++;
|
last_id[cat]++;
|
||||||
$('#sortable-' + cat).append('<li class="ui-state-default" id="list-' + cat + '-' + id + '"><label>Name:</label> <input type="text" name="menu[' + cat + '][]" value=""/> <label>Link:</label> <input type="text" name="menu_link[' + cat + '][]" value=""/><input type="hidden" name="menu_blank[' + cat + '][]" value="0" /> <label><input class="blank-checkbox" type="checkbox"/><span title="Open in New Window">New Window</span></label> <input class="color-picker" type="text" name="menu_color[' + cat + '][]" value="#ffffff" /><a class="remove-button" id="remove-button-' + cat + '-' + id + '"><i class="fas fa-trash"></i></a></li>'); //add input bo
|
$('#sortable-' + cat).append('<li class="ui-state-default" id="list-' + cat + '-' + id + '"><label>Name:</label> <input type="text" name="menu[' + cat + '][]" value=""/> <label>Link:</label> <input type="text" name="menu_link[' + cat + '][]" value=""/><input type="hidden" name="menu_blank[' + cat + '][]" value="0" /> <label><input class="blank-checkbox" type="checkbox"/><span title="Open in New Window">New Window</span></label> <input class="color-picker" type="text" name="menu_color[' + cat + '][]" value="{{ menu_default_color }}" /><a class="remove-button" id="remove-button-' + cat + '-' + id + '"><i class="fas fa-trash"></i></a></li>'); //add input bo
|
||||||
$('#remove-button-' + cat + '-' + id).click(function () {
|
$('#remove-button-' + cat + '-' + id).click(function () {
|
||||||
$('#list-' + $(this).attr("id").replace('remove-button-', '')).remove();
|
$('#list-' + $(this).attr("id").replace('remove-button-', '')).remove();
|
||||||
});
|
});
|
||||||
@ -69,4 +69,4 @@
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
$config['menu_default_color'] = '#ffffff';
|
||||||
|
|
||||||
$config['menu_categories'] = array(
|
$config['menu_categories'] = array(
|
||||||
MENU_CATEGORY_NEWS => array('id' => 'news', 'name' => 'Latest News'),
|
MENU_CATEGORY_NEWS => array('id' => 'news', 'name' => 'Latest News'),
|
||||||
MENU_CATEGORY_ACCOUNT => array('id' => 'account', 'name' => 'Account'),
|
MENU_CATEGORY_ACCOUNT => array('id' => 'account', 'name' => 'Account'),
|
||||||
MENU_CATEGORY_COMMUNITY => array('id' => 'community', 'name' => 'Community'),
|
MENU_CATEGORY_COMMUNITY => array('id' => 'community', 'name' => 'Community'),
|
||||||
MENU_CATEGORY_LIBRARY => array('id' => 'library', 'name' => 'Library'),
|
MENU_CATEGORY_LIBRARY => array('id' => 'library', 'name' => 'Library'),
|
||||||
MENU_CATEGORY_SHOP => array('id' => 'shops', 'name' => 'Shop')
|
MENU_CATEGORY_SHOP => array('id' => 'shops', 'name' => 'Shop')
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
$config['menu_default_color'] = '#ffffff';
|
||||||
|
|
||||||
$config['menu_categories'] = array(
|
$config['menu_categories'] = array(
|
||||||
MENU_CATEGORY_NEWS => array('id' => 'news', 'name' => 'Latest News'),
|
MENU_CATEGORY_NEWS => array('id' => 'news', 'name' => 'Latest News'),
|
||||||
MENU_CATEGORY_ACCOUNT => array('id' => 'account', 'name' => 'Account'),
|
MENU_CATEGORY_ACCOUNT => array('id' => 'account', 'name' => 'Account'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user