Skip to content

Commit

Permalink
Fix: Add autofocus on file or folder edit (for HumHub 1.17 - see humh…
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-farre committed Jul 28, 2024
1 parent 5c90e7b commit d17d387
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 34 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog
- Fix #216: Fix image space rending on wall entry
- Enh #224: Unifying positions of button on modals for consistency and better UX
- Enh #227: Use PHP CS Fixer
- Fix: Add autofocus on file or folder edit (for HumHub 1.17 - see https://github.com/humhub/humhub/issues/7136)

0.16.6 - March 14, 2024
-------------------------
Expand Down
32 changes: 16 additions & 16 deletions views/edit/modal_edit_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@
?>

<?php ModalDialog::begin([
'header' => Yii::t('CfilesModule.base', '<strong>Edit</strong> file'),
'header' => Yii::t('CfilesModule.base', '<strong>Edit</strong> file'),
'animation' => 'fadeIn',
'size' => 'small']) ?>

<?php $form = ActiveForm::begin(); ?>
<?php $form = ActiveForm::begin() ?>

<div class="modal-body">
<?= $form->field($file->baseFile, 'file_name'); ?>
<?= $form->field($file, 'description')->widget(RichTextField::class); ?>
<?= $form->field($file, 'topics')->widget(TopicPicker::class, ['contentContainer' => $file->content->container])->label(false); ?>
<?= $form->field($file, 'visibility')->widget(ContentVisibilitySelect::class, ['readonly' => $file->parentFolder->content->isPrivate()]); ?>
<?= $form->field($file, 'hidden')->widget(ContentHiddenCheckbox::class, []); ?>
<?= $form->field($file, 'download_count')->staticControl(['style' => 'display:inline']); ?>
</div>
<div class="modal-body">
<?= $form->field($file->baseFile, 'file_name')->textInput(['autofocus' => '']) ?>
<?= $form->field($file, 'description')->widget(RichTextField::class) ?>
<?= $form->field($file, 'topics')->widget(TopicPicker::class, ['contentContainer' => $file->content->container])->label(false) ?>
<?= $form->field($file, 'visibility')->widget(ContentVisibilitySelect::class, ['readonly' => $file->parentFolder->content->isPrivate()]) ?>
<?= $form->field($file, 'hidden')->widget(ContentHiddenCheckbox::class, []) ?>
<?= $form->field($file, 'download_count')->staticControl(['style' => 'display:inline']) ?>
</div>

<div class="modal-footer">
<?= ModalButton::cancel() ?>
<?= ModalButton::submitModal($submitUrl) ?>
</div>
<?php ActiveForm::end() ?>
<div class="modal-footer">
<?= ModalButton::cancel() ?>
<?= ModalButton::submitModal($submitUrl) ?>
</div>
<?php ActiveForm::end() ?>

<?php ModalDialog::end() ?>
<?php ModalDialog::end() ?>
36 changes: 18 additions & 18 deletions views/edit/modal_edit_folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@
/* @var $folder \humhub\modules\cfiles\models\Folder */
/* @var $submitUrl string */

$header = ($folder->isNewRecord)
? Yii::t('CfilesModule.base', '<strong>Create</strong> folder')
: Yii::t('CfilesModule.base', '<strong>Edit</strong> folder');
$header = ($folder->isNewRecord)
? Yii::t('CfilesModule.base', '<strong>Create</strong> folder')
: Yii::t('CfilesModule.base', '<strong>Edit</strong> folder');

?>

<?php ModalDialog::begin([
'header' => $header,
'header' => $header,
'animation' => 'fadeIn',
'size' => 'small']) ?>

<?php $form = ActiveForm::begin(); ?>
<div class="modal-body">
<br />
<?= $form->field($folder, 'title'); ?>
<?= $form->field($folder, 'description'); ?>
<?= $form->field($folder, 'visibility')->widget(ContentVisibilitySelect::class, ['readonly' => !$folder->isRoot() && $folder->parentFolder->content->isPrivate()]) ?>
<?= $form->field($folder, 'hidden')->widget(ContentHiddenCheckbox::class) ?>
</div>

<div class="modal-footer">
<?= ModalButton::cancel() ?>
<?= ModalButton::submitModal($submitUrl)?>
</div>
<?php ActiveForm::end() ?>
<?php $form = ActiveForm::begin() ?>
<div class="modal-body">
<br/>
<?= $form->field($folder, 'title')->textInput(['autofocus' => '']) ?>
<?= $form->field($folder, 'description') ?>
<?= $form->field($folder, 'visibility')->widget(ContentVisibilitySelect::class, ['readonly' => !$folder->isRoot() && $folder->parentFolder->content->isPrivate()]) ?>
<?= $form->field($folder, 'hidden')->widget(ContentHiddenCheckbox::class) ?>
</div>

<div class="modal-footer">
<?= ModalButton::cancel() ?>
<?= ModalButton::submitModal($submitUrl) ?>
</div>
<?php ActiveForm::end() ?>

<?php ModalDialog::end() ?>

0 comments on commit d17d387

Please sign in to comment.