hide delete button from modules list when uninstaller exists
This commit is contained in:
parent
3e02bd7d00
commit
6f5e6f42b3
@ -1,10 +1,6 @@
|
|||||||
/*global $, dotclear */
|
/*global $, dotclear */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
Object.assign(dotclear.msg, dotclear.getData('uninstaller'));
|
|
||||||
|
|
||||||
$(() => {
|
$(() => {
|
||||||
$('#uninstall-form').on('submit', function () {
|
$('a.uninstall_module_button').parent().find('input.delete').hide();
|
||||||
return window.confirm(dotclear.msg.confirm_uninstall);
|
|
||||||
});
|
|
||||||
});
|
});
|
10
js/manage.js
Normal file
10
js/manage.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/*global $, dotclear */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.assign(dotclear.msg, dotclear.getData('uninstaller'));
|
||||||
|
|
||||||
|
$(() => {
|
||||||
|
$('#uninstall-form').on('submit', function () {
|
||||||
|
return window.confirm(dotclear.msg.confirm_uninstall);
|
||||||
|
});
|
||||||
|
});
|
@ -19,6 +19,7 @@ use dcCore;
|
|||||||
use dcModuleDefine;
|
use dcModuleDefine;
|
||||||
use dcNsProcess;
|
use dcNsProcess;
|
||||||
use dcPage;
|
use dcPage;
|
||||||
|
use dcUtils;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Backend extends dcNsProcess
|
class Backend extends dcNsProcess
|
||||||
@ -47,7 +48,7 @@ class Backend extends dcNsProcess
|
|||||||
|
|
||||||
return empty(Uninstaller::instance()->loadModules([$define])->getUserActions($define->getId())) ? '' :
|
return empty(Uninstaller::instance()->loadModules([$define])->getUserActions($define->getId())) ? '' :
|
||||||
sprintf(
|
sprintf(
|
||||||
' <a href="%s" class="button delete">' . __('Uninstall') . '</a>',
|
' <a href="%s" class="button delete uninstall_module_button">' . __('Uninstall') . '</a>',
|
||||||
dcCore::app()->adminurl?->get('admin.plugin.' . My::id(), ['type' => $define->get('type'), 'id' => $define->getId()])
|
dcCore::app()->adminurl?->get('admin.plugin.' . My::id(), ['type' => $define->get('type'), 'id' => $define->getId()])
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -59,6 +60,14 @@ class Backend extends dcNsProcess
|
|||||||
'pluginBeforeDeleteV2' => function (dcModuleDefine $define): void {
|
'pluginBeforeDeleteV2' => function (dcModuleDefine $define): void {
|
||||||
self::moduleBeforeDelete($define);
|
self::moduleBeforeDelete($define);
|
||||||
},
|
},
|
||||||
|
// add js to hide delete button when uninstaller exists
|
||||||
|
'pluginsToolsHeadersV2' => function (): string {
|
||||||
|
return self::modulesToolsHeader();
|
||||||
|
},
|
||||||
|
// add js to hide delete button when uninstaller exists
|
||||||
|
'themesToolsHeadersV2' => function (): string {
|
||||||
|
return self::modulesToolsHeader();
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -98,4 +107,9 @@ class Backend extends dcNsProcess
|
|||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static function modulesToolsHeader()
|
||||||
|
{
|
||||||
|
return dcUtils::jsModuleLoad(My::id() . '/js/backend.js');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ class Manage extends dcNsProcess
|
|||||||
dcPage::openModule(
|
dcPage::openModule(
|
||||||
My::name(),
|
My::name(),
|
||||||
dcPage::jsJson('uninstaller', ['confirm_uninstall' => __('Are you sure you perform these ations?')]) .
|
dcPage::jsJson('uninstaller', ['confirm_uninstall' => __('Are you sure you perform these ations?')]) .
|
||||||
dcPage::jsModuleLoad(My::id() . '/js/backend.js') .
|
dcPage::jsModuleLoad(My::id() . '/js/manage.js') .
|
||||||
|
|
||||||
# --BEHAVIOR-- UninstallerHeader
|
# --BEHAVIOR-- UninstallerHeader
|
||||||
dcCore::app()->callBehavior('UninstallerHeader')
|
dcCore::app()->callBehavior('UninstallerHeader')
|
||||||
|
Loading…
Reference in New Issue
Block a user