From ea3462284050b6cec8d03426fafe1ec87afa4b9e Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Sat, 6 Dec 2014 15:46:02 +1100 Subject: [PATCH] Clicking a record in readOnly mode will open the manage form in preview mode Use "recordOnClick: null" to retain the original behavior --- .../backend/behaviors/RelationController.php | 17 +++---- .../partials/_manage_form.htm | 44 ++++++++++++------- modules/backend/lang/en/lang.php | 3 ++ 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index 28898504b..c03ff5391 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -695,18 +695,13 @@ class RelationController extends ControllerBehavior $config->showSorting = $this->getConfig('view[showSorting]', true); $config->defaultSort = $this->getConfig('view[defaultSort]'); $config->recordsPerPage = $this->getConfig('view[recordsPerPage]'); - $config->showCheckboxes = $this->getConfig('view[showCheckboxes]', false); + $config->showCheckboxes = $this->getConfig('view[showCheckboxes]', !$this->readOnly); - $defaultOnClick = null; - - if (!$this->readOnly) { - $defaultOnClick = sprintf( - "$.oc.relationBehavior.clickManageListRecord(:id, '%s', '%s')", - $this->field, - $this->relationGetSessionKey() - ); - $config->showCheckboxes = $this->getConfig('view[showCheckboxes]', true); - } + $defaultOnClick = sprintf( + "$.oc.relationBehavior.clickManageListRecord(:id, '%s', '%s')", + $this->field, + $this->relationGetSessionKey() + ); $config->recordOnClick = $this->getConfig('view[recordOnClick]', $defaultOnClick); $config->recordUrl = $this->getConfig('view[recordUrl]', null); diff --git a/modules/backend/behaviors/relationcontroller/partials/_manage_form.htm b/modules/backend/behaviors/relationcontroller/partials/_manage_form.htm index d24017748..952c75c29 100644 --- a/modules/backend/behaviors/relationcontroller/partials/_manage_form.htm +++ b/modules/backend/behaviors/relationcontroller/partials/_manage_form.htm @@ -10,27 +10,41 @@ + + + diff --git a/modules/backend/lang/en/lang.php b/modules/backend/lang/en/lang.php index 62003697e..fc9040a8b 100644 --- a/modules/backend/lang/en/lang.php +++ b/modules/backend/lang/en/lang.php @@ -192,11 +192,14 @@ return [ 'add_selected' => "Add selected", 'add_a_new' => "Add a new :name", 'cancel' => "Cancel", + 'close' => "Close", 'add_name' => "Add :name", 'create' => "Create", 'create_name' => "Create :name", 'update' => "Update", 'update_name' => "Update :name", + 'preview' => "Preview", + 'preview_name' => "Preview :name", 'remove' => "Remove", 'remove_name' => "Remove :name", 'delete' => "Delete",