summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/libs/jquery.js3
-rw-r--r--addons/web/static/src/js/views/basic/basic_renderer.js16
-rw-r--r--addons/web/static/src/js/views/list/list_editable_renderer.js4
3 files changed, 14 insertions, 9 deletions
diff --git a/addons/web/static/src/js/libs/jquery.js b/addons/web/static/src/js/libs/jquery.js
index 0b12b4fed0d..4bcab8eb866 100644
--- a/addons/web/static/src/js/libs/jquery.js
+++ b/addons/web/static/src/js/libs/jquery.js
@@ -11,6 +11,9 @@ $.extend($.expr[':'], {
containsLike: function (element, index, matches){
return element.innerHTML.toUpperCase().indexOf(matches[3].toUpperCase()) >= 0;
},
+ containsTextLike: function (element, index, matches){
+ return element.innerText.toUpperCase().indexOf(matches[3].toUpperCase()) >= 0;
+ },
containsExact: function (element, index, matches){
return $.trim(element.innerHTML) === matches[3];
},
diff --git a/addons/web/static/src/js/views/basic/basic_renderer.js b/addons/web/static/src/js/views/basic/basic_renderer.js
index 977674c022a..e8367e79c26 100644
--- a/addons/web/static/src/js/views/basic/basic_renderer.js
+++ b/addons/web/static/src/js/views/basic/basic_renderer.js
@@ -256,7 +256,7 @@ var BasicRenderer = AbstractRenderer.extend({
// If the view is in edit mode and that a widget have to switch
// its "readonly" state, we have to re-render it completely
if ('readonly' in modifiers && element.widget) {
- var mode = modifiers.readonly ? 'readonly' : modifiersData.baseMode;
+ var mode = modifiers.readonly ? 'readonly' : modifiersData.baseModeByRecord[record.id];
if (mode !== element.widget.mode) {
self._rerenderFieldWidget(element.widget, record, {
keepBaseMode: true,
@@ -416,16 +416,17 @@ var BasicRenderer = AbstractRenderer.extend({
* @param {Object} [options.callback] the callback to call on registration
* and on modifiers updates
* @param {boolean} [options.keepBaseMode=false] this function registers the
- * 'baseMode' of the node; this is a field widget specific settings which
+ * 'baseMode' of the node on a per record basis;
+ * this is a field widget specific settings which
* represents the generic mode of the widget, regardless of its modifiers
* (the interesting case is the list view: all widgets are supposed to be
* in the baseMode 'readonly', except the ones that are in the line that
* is currently being edited).
- * With option 'keepBaseMode' set to true, the current baseMode of the
+ * With option 'keepBaseMode' set to true, the baseMode of the record's
* node isn't overridden (this is particularily useful when a field widget
* is re-rendered because its readonly modifier changed, as in this case,
* we don't want to change its base mode).
- * @param {string} [options.mode] the 'baseMode' of the node is set to this
+ * @param {string} [options.mode] the 'baseMode' of the record's node is set to this
* value (if not given, it is set to this.mode, the mode of the renderer)
* @returns {Object} for code efficiency, returns the last evaluated
* modifiers for the given node and record.
@@ -443,15 +444,16 @@ var BasicRenderer = AbstractRenderer.extend({
modifiers: modifiers,
evaluatedModifiers: {},
elementsByRecord: {},
+ baseModeByRecord : {},
};
if (!_.isEmpty(modifiers)) { // Register only if modifiers might change (TODO condition might be improved here)
this.allModifiersData.push(modifiersData);
}
}
- // Compute node's base mode if necessary
- if (!options.keepBaseMode) {
- modifiersData.baseMode = options.mode || this.mode;
+ // Compute the record's base mode
+ if (!modifiersData.baseModeByRecord[record.id] || !options.keepBaseMode) {
+ modifiersData.baseModeByRecord[record.id] = options.mode || this.mode;
}
// Evaluate if necessary
diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/js/views/list/list_editable_renderer.js
index 8155862dbb4..2d9c02b8ebc 100644
--- a/addons/web/static/src/js/views/list/list_editable_renderer.js
+++ b/addons/web/static/src/js/views/list/list_editable_renderer.js
@@ -504,8 +504,8 @@ ListRenderer.include({
var $row = this._super.apply(this, arguments);
if (this.addTrashIcon) {
var $icon = this.isMany2Many ?
- $('<i>', {class: 'fa fa-times', name: 'unlink'}) :
- $('<i>', {class: 'fa fa-trash-o', name: 'delete'});
+ $('<button>', {class: 'fa fa-times o_list_record_remove', name: 'unlink', 'aria-label': _t('Unlink row ') + (index+1)}) :
+ $('<button>', {class: 'fa fa-trash-o o_list_record_remove', name: 'delete', 'aria-label': _t('Delete row ') + (index+1)});
var $td = $('<td>', {class: 'o_list_record_remove'}).append($icon);
$row.append($td);
}