Skip to content

Commit

Permalink
Showing thumbsnails when switching viz (#313)
Browse files Browse the repository at this point in the history
* Showing thumbsnails when switching viz

* Adding missing images

* linting
  • Loading branch information
mistercrunch committed Apr 11, 2016
1 parent 5b82249 commit 807d686
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 4 deletions.
Binary file added caravel/assets/images/noimg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified caravel/assets/images/viz_thumbnails/bar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added caravel/assets/images/viz_thumbnails/dist_bar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added caravel/assets/images/viz_thumbnails/heatmap.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added caravel/assets/images/viz_thumbnails/markup.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added caravel/assets/images/viz_thumbnails/para.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions caravel/assets/javascripts/explore.js
Expand Up @@ -206,13 +206,26 @@ function initExploreView() {
for (var i = 0; i < collapsed_fieldsets.length; i++) {
toggle_fieldset($('legend:contains("' + collapsed_fieldsets[i] + '")'), false);
}
function formatViz(viz) {
var url = '/static/assets/images/viz_thumbnails/' + viz.id + '.png';
var no_img = '/static/assets/images/noimg.png';
return $(
'<img class="viz-thumb-option" src="' + url + '" onerror="this.src=\'' + no_img + '\';">' +
'<span>' + viz.text + '</span>'
);
}

$(".select2").select2({
dropdownAutoWidth: true
});
$(".select2Sortable").select2({
dropdownAutoWidth: true
});
$(".select2-with-images").select2({
dropdownAutoWidth: true,
dropdownCssClass: "bigdrop",
formatResult: formatViz
});
$(".select2Sortable").select2Sortable({
bindOrder: 'sortableStop'
});
Expand Down
10 changes: 10 additions & 0 deletions caravel/assets/stylesheets/caravel.css
Expand Up @@ -173,6 +173,16 @@ img.loading {
width: 20px;
margin: 5px;
}
img.viz-thumb-option {
width: 100px;
border: 1px solid gray;
margin-right: 5px;
border-radius: 5px;
}
.select2-drop.bigdrop .select2-results {
max-height: 700px;
}

.dashboard .title {
text-align: center;
}
Expand Down
2 changes: 1 addition & 1 deletion caravel/templates/caravel/explore.html
Expand Up @@ -40,7 +40,7 @@
<i class="fa fa-edit"></i>&nbsp;
</a>
<span title="Visualization Type" data-toggle="tooltip">
{{ form.get_field("viz_type")(class_="select2") }}
{{ form.get_field("viz_type")(class_="select2-with-images") }}
</span>
{% if slice %}
<span class="btn btn-default notbtn" title="Slice" data-toggle="tooltip" data-placement="bottom">
Expand Down
27 changes: 24 additions & 3 deletions docs/gallery.rst
Expand Up @@ -22,7 +22,7 @@ Gallery
.. image:: _static/img/viz_thumbnails/word_cloud.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/filter.png
.. image:: _static/img/viz_thumbnails/filter_box.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/pivot_table.png
Expand All @@ -31,15 +31,36 @@ Gallery
.. image:: _static/img/viz_thumbnails/force_directed.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/percent_change.png
.. image:: _static/img/viz_thumbnails/compare.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/sunburst.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/stacked.png
.. image:: _static/img/viz_thumbnails/area.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/big_number.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/area.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/big_number_total.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/dist_bar.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/heatmap.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/markup.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/para.png
:scale: 25 %

.. image:: _static/img/viz_thumbnails/world_map.png
:scale: 25 %

0 comments on commit 807d686

Please sign in to comment.