[TASK] Use JS Icon API in Recordlist module 71/44071/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Wed, 14 Oct 2015 22:32:57 +0000 (00:32 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Fri, 16 Oct 2015 09:44:05 +0000 (11:44 +0200)
Resolves: #70731
Releases: master
Change-Id: I6114f35ce37099a567b2fb5af34a8a99494c5056
Reviewed-on: http://review.typo3.org/44071
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/recordlist/Resources/Public/JavaScript/Recordlist.js

index 4aea58e..c169ebe 100644 (file)
 /**
  * Usability improvements for the record list
  */
-define(['jquery', 'TYPO3/CMS/Backend/Storage'], function($, Storage) {
+define(['jquery', 'TYPO3/CMS/Backend/Storage', 'TYPO3/CMS/Backend/Icons'], function($, Storage, Icons) {
        'use strict';
 
        var Recordlist = {
                identifier: {
-                       toggle: '.t3js-toggle-recordlist'
-               },
-               classes: {
-                       toggleIconState: {
-                               collapsed: 'fa-chevron-down',
-                               expanded: 'fa-chevron-up'
+                       toggle: '.t3js-toggle-recordlist',
+                       icons: {
+                               collapse: 'actions-view-list-collapse',
+                               expand: 'actions-view-list-expand'
                        }
                }
        };
@@ -35,9 +33,16 @@ define(['jquery', 'TYPO3/CMS/Backend/Storage'], function($, Storage) {
                var $me = $(this),
                        table = $me.data('table'),
                        $target = $($me.data('target')),
-                       isExpanded = $target.data('state') === 'expanded';
+                       isExpanded = $target.data('state') === 'expanded',
+                       $collapseIcon = $me.find('.collapseIcon'),
+                       toggleIcon = isExpanded ? Recordlist.identifier.icons.expand : Recordlist.identifier.icons.collapse;
 
-               $me.find('.collapseIcon .icon-unify .fa').toggleClass(Recordlist.classes.toggleIconState.collapsed).toggleClass(Recordlist.classes.toggleIconState.expanded);
+               Icons.getIcons([
+                       [Recordlist.identifier.icons.expand, Icons.sizes.small],
+                       [Recordlist.identifier.icons.collapse, Icons.sizes.small]
+               ]).done(function(icons) {
+                       $collapseIcon.html(icons[toggleIcon]);
+               });
 
                // Store collapse state in UC
                var storedModuleDataList = {};