From b203377994ff51231a632f5b940c14482b9c3206 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 4 Sep 2012 09:41:45 +0200 Subject: [PATCH] [IMP] in list views: hide drag-n-drop handle and trash can with css classes bzr revid: rco@openerp.com-20120904074145-5mefinpkz0pl0qyb --- addons/web/static/src/css/base.css | 9 +++++++-- addons/web/static/src/css/base.sass | 7 +++++++ addons/web/static/src/js/view_list.js | 12 ++++++++++++ addons/web/static/src/xml/base.xml | 6 +++--- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 06a37a54727..d32b0a9f42a 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -69,7 +69,6 @@ display: none !important; } } - .openerp.openerp_webclient_container { height: 100%; position: relative; @@ -85,7 +84,7 @@ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); /* http://www.quirksmode.org/dom/inputfile.html * http://stackoverflow.com/questions/2855589/replace-input-type-file-by-an-image - */ */ + */ } .openerp :-moz-placeholder { color: #afafb6 !important; @@ -2638,6 +2637,12 @@ content: "ö"; color: #404040; } +.openerp .oe_list_cannot_edit .oe_list_header_handle, .openerp .oe_list_cannot_edit .oe_list_field_handle { + display: none !important; +} +.openerp .oe_list_cannot_delete .oe_list_header_delete, .openerp .oe_list_cannot_delete .oe_list_record_delete { + display: none !important; +} .openerp .tree_header { background-color: #f0f0f0; border-bottom: 1px solid #cacaca; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index c238ef6ee07..8ddf9b56b9f 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2050,6 +2050,13 @@ $sheet-max-width: 860px .oe_list_handle @include text-to-icon("ö") + .oe_list_cannot_edit + .oe_list_header_handle, .oe_list_field_handle + display: none !important + .oe_list_cannot_delete + .oe_list_header_delete, .oe_list_record_delete + display: none !important + // }}} // Tree view {{{ .tree_header diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index e3006a31757..06d2548339c 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -250,6 +250,18 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi this.$el.html(QWeb.render(this._template, this)); this.$el.addClass(this.fields_view.arch.attrs['class']); + + // add css classes that reflect the (absence of) access rights + if (!this._is_action_enabled('create')) { + this.$el.addClass('oe_list_cannot_create'); + } + if (!this._is_action_enabled('edit')) { + this.$el.addClass('oe_list_cannot_edit'); + } + if (!this._is_action_enabled('delete')) { + this.$el.addClass('oe_list_cannot_delete'); + } + // Head hook // Selecting records this.$el.find('.oe_list_record_selector').click(function(){ diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 3bee6eebcc5..7c135ad047c 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -635,7 +635,7 @@ - + @@ -644,7 +644,7 @@ - + @@ -691,7 +691,7 @@ t-att-data-field="column.id" > - +