From ffbfb188c84b416b9ea8aeb78b68d82399fa69fb Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Wed, 27 Sep 2017 11:10:22 +0200 Subject: [PATCH] improve features list order --- .../admin/views/scripts/feature/index.phtml | 36 +++++++++---------- library/Class/Feature.php | 15 +++----- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/application/modules/admin/views/scripts/feature/index.phtml b/application/modules/admin/views/scripts/feature/index.phtml index 748a54af926..9162964d6bd 100644 --- a/application/modules/admin/views/scripts/feature/index.phtml +++ b/application/modules/admin/views/scripts/feature/index.phtml @@ -20,24 +20,6 @@ $description = (new Class_TableDescription('features')) return $feature->getCategory(); }) - ->addRowAction(function($feature) - { - return $this->tagAnchor($feature->getWiki(), - $this->tagImg(Class_Admin_Skin::current() - ->getIconUrl('actions', - 'help')), - ['target' => '_blank', - 'title' => $this->_('Documentation')]); - }) - - ->addRowAction(function($feature) - { - if(!$feature->getTest()) - return ''; - return $this->tagPreview(Class_Url::relative($feature->getTest()), - $this->_('Essayer')); - }) - ->addRowAction(function($feature) { $hide = $this->tagAnchor(['module' => 'admin', @@ -62,6 +44,24 @@ $description = (new Class_TableDescription('features')) ? $hide : $show; }) + + ->addRowAction(function($feature) + { + return $this->tagAnchor($feature->getWiki(), + $this->tagImg(Class_Admin_Skin::current() + ->getIconUrl('actions', + 'help')), + ['target' => '_blank', + 'title' => $this->_('Documentation')]); + }) + + ->addRowAction(function($feature) + { + if(!$feature->getTest()) + return ''; + return $this->tagPreview(Class_Url::relative($feature->getTest()), + $this->_('Essayer')); + }) ; $html = diff --git a/library/Class/Feature.php b/library/Class/Feature.php index bfadd212c88..52275e54812 100644 --- a/library/Class/Feature.php +++ b/library/Class/Feature.php @@ -39,7 +39,11 @@ class Class_Feature { public function findAll() { - return $this->_getFeatures(); + if(static::$_features) + return static::$_features; + + $features = (new Class_Feature_List)->getFeatures(); + return static::$_features = array_reverse(array_map([$this, '_createInstances'], array_keys($features), $features)); } @@ -99,15 +103,6 @@ class Class_Feature { } - protected function _getFeatures() { - if(static::$_features) - return static::$_features; - - $features = (new Class_Feature_List)->getFeatures(); - return static::$_features = array_map([$this, '_createInstances'], array_keys($features), $features); - } - - protected function _createInstances($id, $feature) { return (new Class_Feature_Description) ->setId($id) -- GitLab