From 1af22ec14b1a2ae2352aca8c610ecd0f4a44adbb Mon Sep 17 00:00:00 2001 From: MuK IT GmbH Date: Tue, 16 Apr 2019 09:45:03 +0000 Subject: [PATCH] publish muk_web_searchpanel - 12.0 --- muk_web_searchpanel/__manifest__.py | 2 +- muk_web_searchpanel/doc/changelog.rst | 5 ++ .../static/src/js/kanban_searchpanel.js | 61 +++++++++++++++++++ .../static/src/js/kanban_view.js | 7 ++- .../static/src/scss/kanban_view.scss | 43 +++++++++++++ muk_web_searchpanel/static/src/xml/kanban.xml | 18 ++++++ 6 files changed, 132 insertions(+), 4 deletions(-) diff --git a/muk_web_searchpanel/__manifest__.py b/muk_web_searchpanel/__manifest__.py index 66e825d..c0e78d4 100644 --- a/muk_web_searchpanel/__manifest__.py +++ b/muk_web_searchpanel/__manifest__.py @@ -20,7 +20,7 @@ { 'name': 'MuK Search Panel', 'summary': 'Kanban Search Panel', - 'version': '12.0.1.1.1', + 'version': '12.0.1.2.0', 'category': 'Extra Tools', 'license': 'AGPL-3', 'author': 'MuK IT', diff --git a/muk_web_searchpanel/doc/changelog.rst b/muk_web_searchpanel/doc/changelog.rst index 54c9a20..4c6a0d2 100644 --- a/muk_web_searchpanel/doc/changelog.rst +++ b/muk_web_searchpanel/doc/changelog.rst @@ -1,3 +1,8 @@ +`1.2.0` +------- + +- Mobile Support + `1.1.0` ------- diff --git a/muk_web_searchpanel/static/src/js/kanban_searchpanel.js b/muk_web_searchpanel/static/src/js/kanban_searchpanel.js index ddcb319..ebad731 100644 --- a/muk_web_searchpanel/static/src/js/kanban_searchpanel.js +++ b/muk_web_searchpanel/static/src/js/kanban_searchpanel.js @@ -21,6 +21,7 @@ odoo.define('web.SearchPanel', function (require) { "use strict"; var core = require('web.core'); +var config = require('web.config'); var Domain = require('web.Domain'); var Widget = require('web.Widget'); @@ -581,6 +582,66 @@ var SearchPanel = Widget.extend({ }, }); +if (config.device.isMobile) { + SearchPanel.include({ + tagName: 'details', + + _getCategorySelection: function () { + var self = this; + return Object.keys(this.categories).reduce(function (selection, categoryId) { + var category = self.categories[categoryId]; + console.log('category', category); + if (category.activeValueId) { + var ancestorIds = [category.activeValueId].concat(self._getAncestorValueIds(category, category.activeValueId)); + var breadcrumb = ancestorIds.map(function (valueId) { + return category.values[valueId].display_name; + }); + selection.push({ breadcrumb: breadcrumb, icon: category.icon, color: category.color}); + } + console.log('selection', selection); + return selection; + }, []); + }, + + _getFilterSelection: function () { + var self = this; + return Object.keys(this.filters).reduce(function (selection, filterId) { + var filter = self.filters[filterId]; + console.log('filter', filter); + if (filter.groups) { + Object.keys(filter.groups).forEach(function (groupId) { + var group = filter.groups[groupId]; + Object.keys(group.values).forEach(function (valueId) { + var value = group.values[valueId]; + if (value.checked) { + selection.push({name: value.name, icon: filter.icon, color: filter.color}); + } + }); + }); + } else if (filter.values) { + Object.keys(filter.values).forEach(function (valueId) { + var value = filter.values[valueId]; + if (value.checked) { + selection.push({name: value.name, icon: filter.icon, color: filter.color}); + } + }); + } + console.log('selection', selection); + return selection; + }, []); + }, + + _render: function () { + this._super.apply(this, arguments); + this.$el.prepend(qweb.render('SearchPanel.MobileSummary', { + categories: this._getCategorySelection(), + filterValues: this._getFilterSelection(), + separator: ' / ', + })); + }, + }); +} + return SearchPanel; }); \ No newline at end of file diff --git a/muk_web_searchpanel/static/src/js/kanban_view.js b/muk_web_searchpanel/static/src/js/kanban_view.js index b7bd31a..694f10d 100644 --- a/muk_web_searchpanel/static/src/js/kanban_view.js +++ b/muk_web_searchpanel/static/src/js/kanban_view.js @@ -83,9 +83,10 @@ KanbanView.include({ }, _processNode: function (node, fv) { if (node.tag === 'searchpanel') { - if (!config.device.isMobile) { - this._processSearchPanelNode(node, fv); - } +// if (!config.device.isMobile) { +// this._processSearchPanelNode(node, fv); +// } + this._processSearchPanelNode(node, fv); return false; } return this._super.apply(this, arguments); diff --git a/muk_web_searchpanel/static/src/scss/kanban_view.scss b/muk_web_searchpanel/static/src/scss/kanban_view.scss index a614226..44d3146 100644 --- a/muk_web_searchpanel/static/src/scss/kanban_view.scss +++ b/muk_web_searchpanel/static/src/scss/kanban_view.scss @@ -120,4 +120,47 @@ } } } +} + +@include media-breakpoint-down(sm) { + .o_kanban_with_searchpanel { + flex-direction: column; + + details.o_search_panel { + flex-basis: auto; + height: auto; + width: 100%; + padding: 0; + + > summary { + padding: $o-searchpanel-p-small; + // Hide the caret. For details see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary + list-style-type: none; + &::-webkit-details-marker { + display: none + } + + .badge { + font-size: 100%; + background-color: white; + } + } + + > .o_search_panel_section { + margin: 0 $o-searchpanel-p-small 0 $o-searchpanel-p; + } + + &[open] { + z-index: $zindex-dropdown; + + > summary { + background-color: $list-group-action-active-bg; + } + + .fa-chevron-left:before { + content: "\f078"; + } + } + } + } } \ No newline at end of file diff --git a/muk_web_searchpanel/static/src/xml/kanban.xml b/muk_web_searchpanel/static/src/xml/kanban.xml index 510a340..460060d 100644 --- a/muk_web_searchpanel/static/src/xml/kanban.xml +++ b/muk_web_searchpanel/static/src/xml/kanban.xml @@ -123,4 +123,22 @@ + + + +
+ Filters... + + + + + + + + +
+ +
+
+ \ No newline at end of file