Make devtools project list sortable
authorMatthias Schmidt <gravatronics@live.com>
Sun, 3 Feb 2019 14:22:58 +0000 (15:22 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 3 Feb 2019 14:22:58 +0000 (15:22 +0100)
Close #2842

wcfsetup/install/files/acp/templates/devtoolsProjectList.tpl
wcfsetup/install/files/lib/acp/page/DevtoolsProjectListPage.class.php

index d50f541b77c7b8842503c58eaaa9bdfcc0fc6906..a8fa0ec2779cf33c3f0ab575577481d57adf2247 100644 (file)
@@ -34,9 +34,9 @@
                <table class="table">
                        <thead>
                                <tr>
-                                       <th class="columnID" colspan="3">{lang}wcf.global.objectID{/lang}</th>
-                                       <th class="columnText">{lang}wcf.acp.devtools.project.name{/lang}</th>
-                                       <th class="columnText">{lang}wcf.acp.devtools.project.path{/lang}</th>
+                                       <th class="columnID{if $sortField === 'projectID'} active {@$sortOrder}{/if}" colspan="3"><a href="{link controller='DevtoolsProjectList'}sortField=projectID&sortOrder={if $sortField === 'projectID' && $sortOrder === 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
+                                       <th class="columnText{if $sortField === 'name'} active {@$sortOrder}{/if}"><a href="{link controller='DevtoolsProjectList'}sortField=name&sortOrder={if $sortField === 'name' && $sortOrder === 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.devtools.project.name{/lang}</a></th>
+                                       <th class="columnText{if $sortField === 'path'} active {@$sortOrder}{/if}"><a href="{link controller='DevtoolsProjectList'}sortField=path&sortOrder={if $sortField === 'path' && $sortOrder === 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.devtools.project.path{/lang}</a></th>
                                        
                                        {event name='columnHeads'}
                                </tr>
index bf6af93a8375abde024185024cdf3d7c6c1b5371..efae7d3ca5a3abcc2f11afa5c310ef124bd771e6 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 namespace wcf\acp\page;
 use wcf\data\devtools\project\DevtoolsProjectList;
-use wcf\page\MultipleLinkPage;
+use wcf\page\SortablePage;
 
 /**
  * Shows a list of devtools projects.
@@ -11,13 +11,20 @@ use wcf\page\MultipleLinkPage;
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    WoltLabSuite\Core\Acp\Page
  * @since      3.1
+ * 
+ * @property   DevtoolsProjectList     $objectList
  */
-class DevtoolsProjectListPage extends MultipleLinkPage {
+class DevtoolsProjectListPage extends SortablePage {
        /**
         * @inheritDoc
         */
        public $activeMenuItem = 'wcf.acp.menu.link.devtools.project.list';
        
+       /**
+        * @inheritDoc
+        */
+       public $defaultSortField = 'name';
+       
        /**
         * @inheritDoc
         */
@@ -39,7 +46,7 @@ class DevtoolsProjectListPage extends MultipleLinkPage {
        public $neededPermissions = ['admin.configuration.package.canInstallPackage'];
        
        /**
-        * @var DevtoolsProjectList
+        * @inheritDoc
         */
-       public $objectList;
+       public $validSortFields = ['projectID', 'name', 'path'];
 }