[IMP] Make 'oe_list_cannot_*' css classes generic

bzr revid: fme@openerp.com-20121023095559-63exp0dyf5zsd3qw
This commit is contained in:
Fabien Meghazi 2012-10-23 11:55:59 +02:00
parent 9bf9ca7a67
commit 957c187bb1
4 changed files with 2888 additions and 2351 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1547,7 +1547,9 @@ $sheet-max-width: 860px
padding: 100px 0 0 137px
min-height: 327px
margin-left: -15px
.oe_view.oe_cannot_create
.oe_view_nocontent_create
display: none
// }}}
// FormView.base and dynamic tags {{{
.oe_formview
@ -2081,6 +2083,14 @@ $sheet-max-width: 860px
visibility: visible
.oe_list
&.oe_cannot_edit
.oe_list_header_handle, .oe_list_field_handle
display: none !important
padding: 0 !important
&.oe_cannot_delete
.oe_list_record_delete
display: none !important
.oe_form
.oe_form_nosheet
margin: 0 // FIXME: either class or border should not be by default
@ -2178,16 +2188,6 @@ $sheet-max-width: 860px
.oe_list_handle
@include text-to-entypo-icon("}",#E0E0E0,18px)
margin-right: 7px
.oe_list_cannot_create
.oe_view_nocontent_create
display: none
.oe_list_cannot_edit
.oe_list_header_handle, .oe_list_field_handle
display: none !important
padding: 0 !important
.oe_list_cannot_delete
.oe_list_record_delete
display: none !important
// }}}
// Tree view {{{
.tree_header

View File

@ -252,11 +252,6 @@ 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
this.$el.toggleClass('oe_list_cannot_create', !this.is_action_enabled('create'))
.toggleClass('oe_list_cannot_edit', !this.is_action_enabled('edit'))
.toggleClass('oe_list_cannot_delete', !this.is_action_enabled('delete'));
// Head hook
// Selecting records
this.$el.find('.oe_list_record_selector').click(function(){

View File

@ -1161,6 +1161,11 @@ instance.web.View = instance.web.Widget.extend({
}
return view_loaded.pipe(function(r) {
self.trigger('view_loaded', r);
// add css classes that reflect the (absence of) access rights
self.$el.addClass('oe_view')
.toggleClass('oe_cannot_create', !self.is_action_enabled('create'))
.toggleClass('oe_cannot_edit', !self.is_action_enabled('edit'))
.toggleClass('oe_cannot_delete', !self.is_action_enabled('delete'));
});
},
set_default_options: function(options) {