diff --git a/frappe/public/js/frappe/list/list_sidebar.html b/frappe/public/js/frappe/list/list_sidebar.html
index c9686a7e05..e5c180e316 100644
--- a/frappe/public/js/frappe/list/list_sidebar.html
+++ b/frappe/public/js/frappe/list/list_sidebar.html
@@ -19,6 +19,9 @@
{%= __("Assigned To Me") %}
+
+ {%= __("Image View") %}
+
{% if(frappe.help.has_help(doctype)) { %}
{{ __("Help") }}
{% } %}
diff --git a/frappe/public/js/frappe/list/list_sidebar.js b/frappe/public/js/frappe/list/list_sidebar.js
index aa353fedef..042091b8bc 100644
--- a/frappe/public/js/frappe/list/list_sidebar.js
+++ b/frappe/public/js/frappe/list/list_sidebar.js
@@ -27,6 +27,7 @@ frappe.views.ListSidebar = Class.extend({
this.setup_reports();
this.setup_assigned_to_me();
+ this.setup_list_view_switching();
if(frappe.views.calendar[this.doctype]) {
this.sidebar.find(".calendar-link, .gantt-link").removeClass("hide");
@@ -84,6 +85,32 @@ frappe.views.ListSidebar = Class.extend({
me.doclistview.assigned_to_me();
});
},
+ setup_list_view_switching: function() {
+ var me = this;
+ if(this.doclistview.meta.image_field) {
+ this.page.sidebar.find(".switch-list-view").removeClass("hide");
+
+ var label = this.doclistview.meta.image_view ? "List View": "Image View";
+ this.page.sidebar.find(".switch-list-view a").html(label)
+
+ var switch_list_view = function(view) {
+ var image_view = 0
+ if(view == "Image View")
+ image_view = 1
+
+ me.doclistview.meta.image_view = image_view;
+ me.doclistview.refresh(true);
+ };
+
+ this.page.sidebar.find(".switch-list-view a").on("click", function() {
+ switch_list_view(label)
+ });
+
+ this.offcanvas_list_sidebar.find(".switch-list-view a").on("click", function() {
+ switch_list_view(label)
+ });
+ }
+ },
get_stats: function() {
var me = this
return frappe.call({