Clicking a record in readOnly mode will open the manage form in preview mode
Use "recordOnClick: null" to retain the original behavior
This commit is contained in:
parent
906d97dce4
commit
ea34622840
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -10,27 +10,41 @@
|
|||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="popup">×</button>
|
||||
<h4 class="modal-title">
|
||||
<?= e(trans('backend::lang.relation.update_name', ['name'=>$relationLabel])) ?>
|
||||
<?php if ($this->readOnly): ?>
|
||||
<?= e(trans('backend::lang.relation.preview_name', ['name'=>$relationLabel])) ?>
|
||||
<?php else: ?>
|
||||
<?= e(trans('backend::lang.relation.update_name', ['name'=>$relationLabel])) ?>
|
||||
<?php endif ?>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
<?= $relationManageWidget->render() ?>
|
||||
|
||||
<?= $relationManageWidget->render(['preview' => $this->readOnly]) ?>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary">
|
||||
<?= e(trans('backend::lang.relation.update')) ?>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default"
|
||||
data-dismiss="popup">
|
||||
<?= e(trans('backend::lang.relation.cancel')) ?>
|
||||
</button>
|
||||
<?php if ($this->readOnly): ?>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default"
|
||||
data-dismiss="popup">
|
||||
<?= e(trans('backend::lang.relation.close')) ?>
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary">
|
||||
<?= e(trans('backend::lang.relation.update')) ?>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default"
|
||||
data-dismiss="popup">
|
||||
<?= e(trans('backend::lang.relation.cancel')) ?>
|
||||
</button>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<?= Form::close() ?>
|
||||
|
||||
<?php else: ?>
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in New Issue