From f8fa26d59c0f31d20c53cf637bbed5eb37a33f98 Mon Sep 17 00:00:00 2001 From: mutec Date: Mon, 14 Oct 2019 16:31:26 +0200 Subject: [PATCH] Add toggle button for reaction types in ACP This gives administrators a quick overview which reaction types are enabled and which are not. Closes #3094 --- .../files/acp/templates/reactionTypeList.tpl | 2 ++ .../reaction/type/ReactionTypeAction.class.php | 17 ++++++++++++++++- wcfsetup/install/lang/de.xml | 3 ++- wcfsetup/install/lang/en.xml | 3 ++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/reactionTypeList.tpl b/wcfsetup/install/files/acp/templates/reactionTypeList.tpl index 0ae6214c16..b125202ef0 100644 --- a/wcfsetup/install/files/acp/templates/reactionTypeList.tpl +++ b/wcfsetup/install/files/acp/templates/reactionTypeList.tpl @@ -12,6 +12,7 @@ $(function() { new WCF.Action.Delete('wcf\\data\\reaction\\type\\ReactionTypeAction', '.reactionTypeRow'); + new WCF.Action.Toggle('wcf\\data\\reaction\\type\\ReactionTypeAction', '.reactionTypeRow'); }); {/if} @@ -46,6 +47,7 @@ + diff --git a/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php index 3bdae6773c..2317ee042a 100644 --- a/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php +++ b/wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php @@ -2,6 +2,8 @@ namespace wcf\data\reaction\type; use wcf\data\AbstractDatabaseObjectAction; use wcf\data\ISortableAction; +use wcf\data\IToggleAction; +use wcf\data\TDatabaseObjectToggle; use wcf\system\exception\PermissionDeniedException; use wcf\system\exception\UserInputException; use wcf\system\file\upload\UploadFile; @@ -20,7 +22,9 @@ use wcf\system\WCF; * @method ReactionTypeEditor[] getObjects() * @method ReactionTypeEditor getSingleObject() */ -class ReactionTypeAction extends AbstractDatabaseObjectAction implements ISortableAction { +class ReactionTypeAction extends AbstractDatabaseObjectAction implements ISortableAction, IToggleAction { + use TDatabaseObjectToggle; + /** * @inheritDoc */ @@ -222,4 +226,15 @@ class ReactionTypeAction extends AbstractDatabaseObjectAction implements ISortab return $returnValues; } + + /** + * @inheritDoc + */ + public function toggle() { + foreach ($this->getObjects() as $object) { + $object->update([ + 'isAssignable' => $object->isAssignable ? 0 : 1 + ]); + } + } } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 8f9ba28f84..f637a0d7a9 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -2599,8 +2599,9 @@ Kein Abschnitt darf leer sein und alle Abschnitten dürfen nur folgende Zeichen - + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index b2fca935ed..0424c19cdc 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -2527,8 +2527,9 @@ If you have already bought the licenses for the listed apps, th - + + -- 2.20.1