chore: sync module from working instance and add install guide
This commit is contained in:
52
views/profile/_rescue-info.php
Normal file
52
views/profile/_rescue-info.php
Normal 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>
|
||||
@@ -4,7 +4,6 @@ use yii\helpers\Html;
|
||||
|
||||
/* @var \humhub\modules\space\models\Space $space */
|
||||
/* @var \humhub\modules\space_profiles\models\SpaceProfile $profile */
|
||||
/* @var string $searchBlockWidget */
|
||||
?>
|
||||
|
||||
<div class="media" style="margin-bottom:20px;">
|
||||
@@ -30,16 +29,6 @@ use yii\helpers\Html;
|
||||
<section style="margin-bottom:20px;"><?= $profile->body_html ?></section>
|
||||
<?php endif; ?>
|
||||
|
||||
<section style="margin-bottom:20px;">
|
||||
<?php if (class_exists($searchBlockWidget)): ?>
|
||||
<?= $searchBlockWidget::widget(['contentContainer' => $space]) ?>
|
||||
<?php else: ?>
|
||||
<div class="well well-sm" style="margin-bottom:0;">
|
||||
<?= Yii::t('SpaceProfilesModule.base', 'Animal Management plugin integration point is ready. The block will appear here when that plugin is installed.') ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<?php if (!empty($profile->footer_html)): ?>
|
||||
<section><?= $profile->footer_html ?></section>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<?php
|
||||
|
||||
use humhub\modules\space\models\Space;
|
||||
use humhub\modules\space\widgets\Sidebar as SpaceSidebar;
|
||||
use humhub\modules\space_profiles\components\TemplateRegistry;
|
||||
use humhub\modules\space_profiles\models\SpaceProfile;
|
||||
use humhub\modules\space_profiles\widgets\RescueInfoSidebar;
|
||||
use yii\web\View;
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var Space $space */
|
||||
@@ -16,14 +19,6 @@ if ($profile && !empty($profile->background_image_path)) {
|
||||
|
||||
$searchBlockWidget = '\\humhub\\modules\\animal_management\\widgets\\SearchAnimalProfilesBlock';
|
||||
$templateView = TemplateRegistry::resolveView($profile ? $profile->template_key : null);
|
||||
$spaceDescription = trim((string)$space->about);
|
||||
if ($spaceDescription === '') {
|
||||
$spaceDescription = trim((string)$space->description);
|
||||
}
|
||||
|
||||
if ($spaceDescription === '') {
|
||||
$spaceDescription = trim((string)($profile?->description ?? ''));
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="panel panel-default rescue-profile-scope" style="<?= $backgroundStyle ?>">
|
||||
@@ -42,52 +37,58 @@ if ($spaceDescription === '') {
|
||||
<?= $this->render($templateView, [
|
||||
'space' => $space,
|
||||
'profile' => $profile,
|
||||
'searchBlockWidget' => $searchBlockWidget,
|
||||
]) ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->beginBlock('sidebar'); ?>
|
||||
<div class="panel panel-default">
|
||||
<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
|
||||
$sidebarWidgets = [];
|
||||
|
||||
<?php if ($spaceDescription !== '' || trim((string)$profile->mission_statement) !== '' || trim((string)$profile->animals_we_accept) !== ''): ?>
|
||||
<hr style="margin:12px 0;">
|
||||
<?php endif; ?>
|
||||
if ($profile && class_exists($searchBlockWidget)) {
|
||||
$sidebarWidgets[] = [$searchBlockWidget, ['contentContainer' => $space], ['sortOrder' => 20]];
|
||||
}
|
||||
|
||||
<?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>
|
||||
echo SpaceSidebar::widget([
|
||||
'space' => $space,
|
||||
'widgets' => $sidebarWidgets,
|
||||
]);
|
||||
?>
|
||||
<?php $this->endBlock(); ?>
|
||||
|
||||
<?php if ($profile): ?>
|
||||
<div id="space-profile-left-rescue-info" style="display:none;">
|
||||
<?= RescueInfoSidebar::widget(['space' => $space]) ?>
|
||||
</div>
|
||||
<?php
|
||||
$this->registerJs(<<<JS
|
||||
(function() {
|
||||
var panel = document.getElementById('space-profile-left-rescue-info');
|
||||
if (!panel) {
|
||||
return;
|
||||
}
|
||||
|
||||
var navContainer = document.querySelector('.layout-nav-container');
|
||||
if (!navContainer) {
|
||||
return;
|
||||
}
|
||||
|
||||
var menu = navContainer.querySelector('#space-main-menu');
|
||||
panel.style.display = 'block';
|
||||
panel.style.marginTop = '12px';
|
||||
|
||||
if (menu && menu.parentNode === navContainer) {
|
||||
if (menu.nextSibling) {
|
||||
navContainer.insertBefore(panel, menu.nextSibling);
|
||||
} else {
|
||||
navContainer.appendChild(panel);
|
||||
}
|
||||
} else {
|
||||
navContainer.appendChild(panel);
|
||||
}
|
||||
})();
|
||||
JS
|
||||
, View::POS_END);
|
||||
?>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -20,6 +20,25 @@ $profile = $model->getProfile();
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="well well-sm" style="margin-bottom:14px;">
|
||||
<div style="font-weight:700;margin-bottom:6px;"><?= Yii::t('SpaceProfilesModule.base', 'Module Setup') ?></div>
|
||||
<div style="margin-bottom:8px;">
|
||||
<?= Yii::t('SpaceProfilesModule.base', 'Space Profiles publishes a branded rescue profile page for this space and can set it as the default space home page.') ?>
|
||||
</div>
|
||||
<div style="margin-bottom:10px;">
|
||||
<?= Yii::t('SpaceProfilesModule.base', 'Run setup to apply any pending Space Profiles migrations and configure this space home route automatically.') ?>
|
||||
</div>
|
||||
<?= Html::a(
|
||||
Yii::t('SpaceProfilesModule.base', 'Run Space Profiles Setup'),
|
||||
$model->contentContainer->createUrl('/space_profiles/settings/setup'),
|
||||
[
|
||||
'class' => 'btn btn-primary btn-sm',
|
||||
'data-method' => 'post',
|
||||
'data-confirm' => Yii::t('SpaceProfilesModule.base', 'Run Space Profiles setup now for this space?'),
|
||||
]
|
||||
) ?>
|
||||
</div>
|
||||
|
||||
<div class="help-block">
|
||||
<?= Yii::t('SpaceProfilesModule.base', 'Configure your rescue profile content, optional HTML regions, and branding assets.') ?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user