reset apps

This commit is contained in:
Mike Macgirvin 2023-10-21 20:13:59 +11:00
parent d03de9015d
commit 82330269bc
2 changed files with 17 additions and 6 deletions

View file

@ -29,6 +29,16 @@ class Apporder extends Controller
$navbar_apps = [];
if (argc() > 1 && argv(1) === 'reset') {
$baseApps = Apps::get_base_apps();
if ($baseApps) {
foreach ($baseApps as $app) {
q("delete from app where app_channel = %d and app_id = '%s'",
intval(local_channel()),
dbesc(hash('whirlpool', $app))
);
}
}
PConfig::Delete(local_channel(), 'system', 'import_system_apps');
PConfig::Delete(local_channel(), 'system', 'app_order');
PConfig::Delete(local_channel(), 'system', 'app_pin_order');
@ -62,7 +72,7 @@ class Apporder extends Controller
return replace_macros(Theme::get_template('apporder.tpl'), [
'$arrange' => t('Arrange Apps'),
'$reset' => t('Reset to site default order'),
'$reset' => t('Reset to defaults'),
'$header' => [t('Change order of pinned navbar apps'), t('Change order of app tray apps')],
'$desc' => [t('Use arrows to move the corresponding app left (top) or right (bottom) in the navbar'),
t('Use arrows to move the corresponding app up or down in the app tray')],

View file

@ -1,10 +1,7 @@
<div class="generic-content-wrapper">
<div class="section-title-wrapper clearfix"><h2>{{$arrange}}</h2></div>
<div class="section-content-wrapper clearfix">
<br>
<br>
<a href="apporder/reset">{{$reset}}</a>
<br>
<br>
{{if $navbar_apps}}
<h3>{{$header.0}}</h3>
@ -21,5 +18,9 @@
{{foreach $nav_apps as $nav_app}}
{{$nav_app}}
{{/foreach}}
<br>
<br>
<a href="apporder/reset">{{$reset}}</a>
<br>
</div>
</div>
</div>