Add preview mode support to record finder

This commit is contained in:
Samuel Georges 2015-06-25 06:38:08 +10:00
parent c813318729
commit 87e9996193
4 changed files with 24 additions and 14 deletions

View File

@ -112,8 +112,6 @@ class FileUpload extends FormWidgetBase
*/
protected function prepareVars()
{
$this->previewMode = true;
if ($this->previewMode) {
$this->useCaption = false;
}

View File

@ -1,3 +1,11 @@
<div class="recordfinder-widget" id="<?= $this->getId('container') ?>">
<?= $this->makePartial('recordfinder') ?>
</div>
<?php if ($this->previewMode && !$value): ?>
<span class="form-control"><?= e(trans('backend::lang.form.preview_no_record_message')) ?></span>
<?php else: ?>
<div class="recordfinder-widget" id="<?= $this->getId('container') ?>">
<?= $this->makePartial('recordfinder') ?>
</div>
<?php endif ?>

View File

@ -14,15 +14,18 @@
<span class="text-muted"><?= $prompt ?></span>
<?php endif ?>
</span>
<button
class="btn btn-default"
data-control="popup"
data-size="huge"
data-handler="<?= $this->getEventHandler('onFindRecord') ?>"
data-request-data="recordfinder_flag: 1"
type="button">
<i class="icon-th-list"></i>
</button>
<?php if (!$this->previewMode): ?>
<button
class="btn btn-default"
data-control="popup"
data-size="huge"
data-handler="<?= $this->getEventHandler('onFindRecord') ?>"
data-request-data="recordfinder_flag: 1"
type="button">
<i class="icon-th-list"></i>
</button>
<?php endif ?>
<input
type="hidden"

View File

@ -186,6 +186,7 @@ return [
'confirm_tab_close' => 'Do you really want to close the tab? Unsaved changes will be lost.',
'behavior_not_ready' => 'Form behavior has not been initialized, check that you have called initForm() in your controller.',
'preview_no_files_message' => 'There are no files uploaded.',
'preview_no_record_message' => 'There is no record selected.',
'select' => 'Select',
'select_all' => 'all',
'select_none' => 'none',