mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
app: Separate app enable/disable form from config form
- Introduce new API to mark an app that it can't be disabled. - Mark jsxc, storage, config, upgrade and firewall apps as can't be disabled. - Fixed functional tests - Replaced AppForm with forms.Form in all modules' forms.py. - Remove app.template.js. - Remove unused styles. - Remove app status checks in form_valid of Deluge, Diaspora, Matrix, Ejabberd, MediaWiki, Storage, Transmission, Quassel - Purge unused is_enabled context variables (Ikiwiki) - ejabberd: Minor cleanup in template - jsxc: Cleanup unneeded overrides - tahoe: Cleanup unnecessary overrides Tests performed: - For all apps affected, test enable/disable button works and submitting configuration form works: with changes updates message and without changes 'settings unchanged' message. - avahi - bind - cockpit - SKIP: coquelicot - datetime - deluge - SKIP: diaspora - ejabberd - gitweb - i2p - infinoted - ikiwiki - matrixsynapse - mediawiki - minetest - minidlna - mldonkey - mumble - pagekite - privoxy - quassel - radicale - roundcube - SKIP: samba - searx - SKIP: shaarli - shadowsocks - ssh - tahoe - transmission - FAIL: tt-rss (not installable) - wireguard - Deluge test that configuration changes when app is disabled work - Quassel test that setting the domain works when app is diabled - Transmission test that setting the domain works when app is diabled - Ikiwiki create form works properly - Enable/disable button appears as expected when enabled and when disabled - Enable/disable button works without Javascript - Functional tests work for affected apps, Tor and OpenVPN - AppForm is removed from developer documentation - Forms reference - Customizing tutorial - Test all apps using directory select form - Transmission - Deluge - Visit each template that overrides block configuration and ensure that it is loaded properly and the display is as expected. - All apps that use AppView that are not tested above should not have an enable/disable button. That is JSXC, update, config, firewall, storage, users. Signed-off-by: Alice Kile <buoyantair@protonmail.com> Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
1 parent
bd8aee17d5
commit
0b5b384651
47 files changed
+178
-309
No files matched your search
@@ -571,10 +571,6 @@ a.menu_link_active {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.app-titles .app-toggle-container {
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.app-titles h3 {
|
||||
margin-top: -0.5rem;
|
||||
margin-bottom: 1.6rem;
|
||||
@@ -583,10 +579,8 @@ a.menu_link_active {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.app-toggle-container {
|
||||
display: none;
|
||||
flex-flow: row;
|
||||
justify-content: flex-end;
|
||||
.form-app-enable-disable {
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 767px) {
|
||||
@@ -612,7 +606,7 @@ a.menu_link_active {
|
||||
margin: 0 0 15px 0;
|
||||
}
|
||||
|
||||
.app-titles .app-toggle-container {
|
||||
.app-titles .form-app-enable-disable {
|
||||
margin: 30px auto;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
/**
|
||||
* @licstart The following is the entire license notice for the JavaScript
|
||||
* code in this page.
|
||||
*
|
||||
* This file is part of FreedomBox.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @licend The above is the entire license notice for the JavaScript code
|
||||
* in this page.
|
||||
*/
|
||||
|
||||
var appForm = document.querySelector('#app-form');
|
||||
var appToggleContainer = document.querySelector('#app-toggle-container');
|
||||
var appToggleButton = document.querySelector('#app-toggle-button');
|
||||
var appToggleInput = document.querySelector('#app-toggle-input');
|
||||
|
||||
if (appForm && appToggleButton && appToggleInput && appToggleContainer) {
|
||||
var onSubmit = (e) => {
|
||||
e.preventDefault;
|
||||
appToggleInput.checked = !appToggleInput.checked;
|
||||
appForm.submit();
|
||||
};
|
||||
|
||||
appToggleButton.addEventListener('click', onSubmit);
|
||||
|
||||
/**
|
||||
* if javascript is enabled, this script will run and show the toggle button
|
||||
*/
|
||||
|
||||
appToggleInput.parentElement.style.display = 'none';
|
||||
appToggleContainer.style.display = 'flex';
|
||||
|
||||
/* A basic form has only three elements:
|
||||
* 1. An input tag with CSRF token
|
||||
* 2. A div with form elements
|
||||
* 3. A Submit button
|
||||
*
|
||||
* This kind of form can be completely hidden.
|
||||
*/
|
||||
if (appForm.children.length === 3) {
|
||||
appForm.style.display = 'none';
|
||||
appForm.previousElementSibling.style.display = 'none';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user