Skip to content

Commit

Permalink
Merge pull request #499 from humhub/add-autofocus-to-first-field-in-m…
Browse files Browse the repository at this point in the history
…odal-box

Fix: Add autofocus on event edit and event type edit
  • Loading branch information
luke- authored Jul 24, 2024
2 parents 107e159 + 5642e68 commit a3c46be
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 32 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changelog
---------------------
- Fix #477: Hide the settings button when module is not available for a container
- Enh #466: Fix period selector on default reminder settings
- Fix: Add autofocus on event edit and event type edit (for HumHub 1.17 - see https://github.com/humhub/humhub/issues/7136)

1.6.2 (July 16, 2024)
---------------------
Expand Down
34 changes: 17 additions & 17 deletions views/common/editTypeModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/* @var $model CalendarEntryType|CalendarTypeSetting */

if($model instanceof CalendarTypeSetting) {
if ($model instanceof CalendarTypeSetting) {
$title = Yii::t('CalendarModule.views_container-config_typesConfig', '<strong>Edit</strong> calendar');
$titleAttribute = 'title';
$titleDisabled = true;
Expand All @@ -30,11 +30,11 @@
?>

<?php ModalDialog::begin(['header' => Yii::t('CalendarModule.views_container-config_typesConfig', $title)]); ?>
<?php $form = ActiveForm::begin()?>
<div class="modal-body">
<div id="event-type-color-field" class="form-group space-color-chooser-edit" style="margin-top: 5px;">
<?= ColorPicker::widget(['model' => $model, 'container' => 'event-type-color-field']); ?>
<?= $form->field($model, $titleAttribute, ['template' => '
<?php $form = ActiveForm::begin() ?>
<div class="modal-body">
<div id="event-type-color-field" class="form-group space-color-chooser-edit" style="margin-top: 5px;">
<?= ColorPicker::widget(['model' => $model, 'container' => 'event-type-color-field']); ?>
<?= $form->field($model, $titleAttribute, ['template' => '
{label}
<div class="input-group">
<span class="input-group-addon">
Expand All @@ -43,15 +43,15 @@
{input}
</div>
{error}{hint}'
])->textInput(['disabled' => $titleDisabled, 'placeholder' => Yii::t('CalendarModule.config', 'Name'), 'maxlength' => 100])->label(false) ?>
</div>
<?php if($model instanceof CalendarTypeSetting && $model->canBeDisabled()) : ?>
<?= $form->field($model, 'enabled')->checkbox() ?>
<?php endif; ?>
</div>
<div class="modal-footer">
<?= ModalButton::submitModal(); ?>
<?= ModalButton::cancel(); ?>
</div>
<?php ActiveForm::end()?>
])->textInput(['disabled' => $titleDisabled, 'placeholder' => Yii::t('CalendarModule.config', 'Name'), 'maxlength' => 100, 'autofocus' => ''])->label(false) ?>
</div>
<?php if ($model instanceof CalendarTypeSetting && $model->canBeDisabled()) : ?>
<?= $form->field($model, 'enabled')->checkbox() ?>
<?php endif; ?>
</div>
<div class="modal-footer">
<?= ModalButton::submitModal(); ?>
<?= ModalButton::cancel(); ?>
</div>
<?php ActiveForm::end() ?>
<?php ModalDialog::end() ?>
30 changes: 15 additions & 15 deletions views/entry/edit-basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
use humhub\modules\calendar\models\forms\CalendarEntryForm;
use humhub\modules\calendar\Module;
use humhub\modules\content\components\ContentContainerActiveRecord;
use humhub\modules\content\widgets\ContentTagDropDown;
use humhub\modules\content\widgets\richtext\RichTextField;
use humhub\modules\topic\widgets\TopicPicker;
use humhub\modules\ui\form\widgets\ColorPicker;
use humhub\modules\content\widgets\ContentTagDropDown;
use humhub\modules\ui\form\widgets\ContentHiddenCheckbox;
use humhub\modules\ui\form\widgets\ContentVisibilitySelect;
use humhub\modules\ui\form\widgets\TimePicker;
Expand All @@ -34,7 +34,7 @@
{input}
</div>
{error}{hint}'
])->textInput(['placeholder' => Yii::t('CalendarModule.views_entry_edit', 'Title')])->label(false) ?>
])->textInput(['placeholder' => Yii::t('CalendarModule.views_entry_edit', 'Title'), 'autofocus' => ''])->label(false) ?>
</div>

<?php Yii::$app->formatter->timeZone = $calendarEntryForm->timeZone ?>
Expand All @@ -58,18 +58,18 @@
</div>

<div class="row">
<div class="col-xs-6" style="padding: 0">
<div class="col-xs-6" style="padding: 0">
<div class="col-sm-6">
<?= $form->field($calendarEntryForm->entry, 'all_day')->checkbox(['data-action-change' => 'toggleDateTime']) ?>
</div>
<?php if (Module::isRecurrenceActive()) : ?>
<div class="col-sm-6">
<?= $form->field($calendarEntryForm, 'recurring')->checkbox(['data-action-change' => 'toggleRecurring']) ?>
</div>
<div class="col-sm-6">
<?= $form->field($calendarEntryForm, 'recurring')->checkbox(['data-action-change' => 'toggleRecurring']) ?>
</div>
<?php endif; ?>
</div>
<div class="col-xs-6 timeZoneField"<?= $calendarEntryForm->entry->all_day ? ' hidden' : '' ?>>
<?= TimeZoneDropdownAddition::widget(['model' => $calendarEntryForm])?>
<?= TimeZoneDropdownAddition::widget(['model' => $calendarEntryForm]) ?>
</div>
</div>

Expand All @@ -80,20 +80,20 @@
<?= $form->field($calendarEntryForm->entry, 'location')->textInput() ?>
</div>
</div>

<div class="row">
<?php if ($calendarEntryForm->recurring || $calendarEntryForm->isFutureEvent()) : ?>
<div class="col-sm-3">
<?= $form->field($calendarEntryForm, 'reminder')->checkbox(['data-action-change' => 'toggleReminder']) ?>
</div>
<div class="col-sm-3">
<?= $form->field($calendarEntryForm, 'reminder')->checkbox(['data-action-change' => 'toggleReminder']) ?>
</div>
<?php endif; ?>
<div class="col-sm-3">
<?= $form->field($calendarEntryForm, 'hidden')->widget(ContentHiddenCheckbox::class) ?>
</div>
<?php if ($calendarEntryForm->canCreatePublicEntry()) :?>
<div class="col-sm-6">
<?= $form->field($calendarEntryForm, 'is_public')->widget(ContentVisibilitySelect::class, ['contentOwner' => 'entry']) ?>
</div>
<?php if ($calendarEntryForm->canCreatePublicEntry()) : ?>
<div class="col-sm-6">
<?= $form->field($calendarEntryForm, 'is_public')->widget(ContentVisibilitySelect::class, ['contentOwner' => 'entry']) ?>
</div>
<?php endif; ?>
</div>

Expand Down

0 comments on commit a3c46be

Please sign in to comment.