From 9601a0f607b71e8725dafff90288ee8486dbfcf1 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 30 Aug 2016 20:06:03 -0400 Subject: [PATCH] Revise thumbnail view --- .../visualizations/charts/static/app.css | 1 + .../charts/static/views/types.js | 32 +++++-------------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/config/plugins/visualizations/charts/static/app.css b/config/plugins/visualizations/charts/static/app.css index 7ae42ef608a..b1f6d42f58e 100644 --- a/config/plugins/visualizations/charts/static/app.css +++ b/config/plugins/visualizations/charts/static/app.css @@ -58,6 +58,7 @@ } .charts-grid .item-float { float: left; + height: 140px; } .charts-grid .title { diff --git a/config/plugins/visualizations/charts/static/views/types.js b/config/plugins/visualizations/charts/static/views/types.js index 497f2ea1eab..a6ad065c0fe 100644 --- a/config/plugins/visualizations/charts/static/views/types.js +++ b/config/plugins/visualizations/charts/static/views/types.js @@ -23,37 +23,21 @@ define( [ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/ui/ui-tabs' ], function( Utils, _renderDefault: function() { var self = this; - var index = {}; + var index = []; this.first = null; + var $el = $( '
' ).addClass( 'charts-grid' ); _.each( this.app.types, function( type, type_id ) { if ( !type.datatypes || type.datatypes.indexOf( self.app.dataset.file_ext ) != -1 ) { if ( type.keywords.indexOf( 'default' ) !== -1 ) { - index[ type.category ] = index[ type.category ] || {}; - index[ type.category ][ type_id ] = type; - } - } - }); - if ( _.size( index ) > 0 ) { - var filtered = []; - _.each( index, function( category, category_header ) { - var subset = { title: category_header, list:[] }; - _.each( category, function( type, type_id ) { - subset.list.push({ + $el.append( self._templateThumbnailItem( { id : type_id, title : ( type.zoomable ? '' : '' ) + type.title + ' (' + type.library + ')', url : remote_root + 'src/visualizations/' + self.app.split( type_id ) + '/logo.png' - }); - }); - filtered.push( subset ); - }); - var $el = $( '
' ).addClass( 'charts-grid' ); - _.each( filtered, function( category ) { - $el.append( $( '
' ).addClass( 'header ui-margin-top' ).html( '• ' + category.title ) ); - _.each( category.list, function( type ) { - self.first = self.first || type.id; - $el.append( self._templateThumbnailItem( type ) ); - }); - }); + })); + } + } + }); + if ( $el.children().length > 0 ) { this.tabs.add( { id: Utils.uid(), title: 'Suggested visualizations', $el: $el } ); } },