Merge pull request #2295 from gabsource/fix-relation-manage-readonly

Propagate the RelationController readOnly option to the viewClickList AJAX action
This commit is contained in:
Samuel Georges 2016-08-13 15:30:58 +10:00 committed by GitHub
commit 5c53b10c20
2 changed files with 6 additions and 4 deletions

View File

@ -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) {

View File

@ -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 = $('<a />')
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
}
})
}