From 7f22ba62dca21ffbbd1c4774dd511993689da446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Gaulin?= Date: Mon, 8 Aug 2016 08:35:57 +0200 Subject: [PATCH] Propagate the readOnly option to the viewClickList AJAX action --- modules/backend/behaviors/RelationController.php | 5 +++-- .../relationcontroller/assets/js/october.relation.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index 63a275995..ce78b16ab 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -599,10 +599,11 @@ class RelationController extends ControllerBehavior $config->recordUrl = $this->getConfig('view[recordUrl]', null); $defaultOnClick = sprintf( - "$.oc.relationBehavior.clickViewListRecord(':%s', '%s', '%s')", + "$.oc.relationBehavior.clickViewListRecord(':%s', '%s', '%s', %s)", $this->relationModel->getKeyName(), $this->field, - $this->relationGetSessionKey() + $this->relationGetSessionKey(), + $this->readOnly ? 1 : 0 ); if ($config->recordUrl) { diff --git a/modules/backend/behaviors/relationcontroller/assets/js/october.relation.js b/modules/backend/behaviors/relationcontroller/assets/js/october.relation.js index 5e13a2810..85c052814 100644 --- a/modules/backend/behaviors/relationcontroller/assets/js/october.relation.js +++ b/modules/backend/behaviors/relationcontroller/assets/js/october.relation.js @@ -9,7 +9,7 @@ $(el).closest('.control-list').listWidget('toggleChecked', [el]) } - this.clickViewListRecord = function(recordId, relationField, sessionKey) { + this.clickViewListRecord = function(recordId, relationField, sessionKey, readOnly) { var newPopup = $('') newPopup.popup({ @@ -18,7 +18,8 @@ extraData: { 'manage_id': recordId, '_relation_field': relationField, - '_session_key': sessionKey + '_session_key': sessionKey, + '_relation_read_only': readOnly ? 1 : 0 } }) }