chore: sync module from working instance and add install guide

This commit is contained in:
Kelin Rescue Hub
2026-04-09 14:16:53 -04:00
parent 87a59e5a0a
commit 69c348ce27
9 changed files with 360 additions and 59 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace humhub\modules\space_profiles\widgets;
use humhub\components\Widget;
use humhub\modules\space\models\Space;
use humhub\modules\space_profiles\models\SpaceProfile;
class RescueInfoSidebar extends Widget
{
public Space $space;
public function run()
{
$profile = SpaceProfile::findOne(['contentcontainer_id' => $this->space->contentcontainer_id]);
$spaceDescription = trim((string)$this->space->about);
if ($spaceDescription === '') {
$spaceDescription = trim((string)$this->space->description);
}
if ($spaceDescription === '') {
$spaceDescription = trim((string)($profile?->description ?? ''));
}
return $this->render('rescueInfoSidebar', [
'space' => $this->space,
'profile' => $profile,
'spaceDescription' => $spaceDescription,
]);
}
}

View File

@@ -0,0 +1,52 @@
<?php
use humhub\modules\space\models\Space;
use humhub\modules\space_profiles\models\SpaceProfile;
use yii\helpers\Html;
/* @var Space $space */
/* @var SpaceProfile|null $profile */
/* @var string $spaceDescription */
?>
<div class="panel panel-default" style="margin-bottom:16px;">
<div class="panel-body">
<?php if (!$profile): ?>
<div class="text-muted">
<?= Yii::t('SpaceProfilesModule.base', 'Contact details will appear after the profile is published.') ?>
</div>
<?php else: ?>
<div style="font-weight:700;font-size:18px;text-align:center;margin-bottom:12px;">
<?= Html::encode($space->name) ?>
</div>
<div><?= Html::encode($profile->address) ?></div>
<div style="margin-bottom:10px;"><?= Html::encode($profile->city) ?>, <?= Html::encode($profile->state) ?> <?= Html::encode($profile->zip) ?></div>
<div style="margin-bottom:6px;">
<strong><?= Yii::t('SpaceProfilesModule.base', 'Email') ?>:</strong>
<a href="mailto:<?= Html::encode($profile->email) ?>"><?= Html::encode($profile->email) ?></a>
</div>
<div>
<strong><?= Yii::t('SpaceProfilesModule.base', 'Phone') ?>:</strong>
<a href="tel:<?= Html::encode(preg_replace('/[^0-9+]/', '', (string)$profile->phone) ?? '') ?>"><?= Html::encode($profile->phone) ?></a>
</div>
<?php if ($spaceDescription !== '' || trim((string)$profile->mission_statement) !== '' || trim((string)$profile->animals_we_accept) !== ''): ?>
<hr style="margin:12px 0;">
<?php endif; ?>
<?php if ($spaceDescription !== ''): ?>
<div style="margin-bottom:10px;"><?= nl2br(Html::encode($spaceDescription)) ?></div>
<?php endif; ?>
<?php if (trim((string)$profile->mission_statement) !== ''): ?>
<div style="margin-bottom:4px;"><strong><?= Yii::t('SpaceProfilesModule.base', 'Mission Statement') ?>:</strong></div>
<div style="margin-bottom:10px;"><?= nl2br(Html::encode($profile->mission_statement)) ?></div>
<?php endif; ?>
<?php if (trim((string)$profile->animals_we_accept) !== ''): ?>
<div style="margin-bottom:4px;"><strong><?= Yii::t('SpaceProfilesModule.base', 'Animals We Accept') ?>:</strong></div>
<div><?= nl2br(Html::encode($profile->animals_we_accept)) ?></div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>