Initial import of space_profiles module
This commit is contained in:
45
views/profile/templates/rescue-center.php
Normal file
45
views/profile/templates/rescue-center.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
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;">
|
||||
<div class="media-left" style="padding-right:15px;">
|
||||
<?php if (!empty($profile->icon_path)): ?>
|
||||
<?= Html::img($profile->icon_path, ['style' => 'width:96px;height:96px;object-fit:cover;border-radius:10px;']) ?>
|
||||
<?php else: ?>
|
||||
<div style="width:96px;height:96px;border-radius:10px;background:#f3f5f7;display:flex;align-items:center;justify-content:center;">
|
||||
<i class="fa fa-paw fa-2x text-muted"></i>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<h2 style="margin-top:0;margin-bottom:8px;"><?= Html::encode($space->name) ?></h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($profile->header_html)): ?>
|
||||
<section style="margin-bottom:20px;"><?= $profile->header_html ?></section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($profile->body_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; ?>
|
||||
93
views/profile/view.php
Normal file
93
views/profile/view.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
use humhub\modules\space\models\Space;
|
||||
use humhub\modules\space_profiles\components\TemplateRegistry;
|
||||
use humhub\modules\space_profiles\models\SpaceProfile;
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var Space $space */
|
||||
/* @var SpaceProfile|null $profile */
|
||||
/* @var bool $isPublicRoute */
|
||||
|
||||
$backgroundStyle = '';
|
||||
if ($profile && !empty($profile->background_image_path)) {
|
||||
$backgroundStyle = 'background-image:url(' . Html::encode($profile->background_image_path) . ');background-size:cover;background-position:center;';
|
||||
}
|
||||
|
||||
$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 ?>">
|
||||
<div class="panel-body" style="background:rgba(255,255,255,0.93);border-radius:8px;">
|
||||
<?php if (!empty($isPublicRoute) && $space->visibility !== Space::VISIBILITY_ALL): ?>
|
||||
<div class="alert alert-warning">
|
||||
<?= Yii::t('SpaceProfilesModule.base', 'This profile is visible to signed-in users based on the space privacy setting.') ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!$profile): ?>
|
||||
<div class="alert alert-info">
|
||||
<?= Yii::t('SpaceProfilesModule.base', 'This rescue has not published its profile yet.') ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?= $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 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>
|
||||
<?php $this->endBlock(); ?>
|
||||
10
views/public/view.php
Normal file
10
views/public/view.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/* @var \humhub\modules\space\models\Space $space */
|
||||
/* @var \humhub\modules\space_profiles\models\SpaceProfile|null $profile */
|
||||
|
||||
echo $this->render('@space_profiles/views/profile/view', [
|
||||
'space' => $space,
|
||||
'profile' => $profile,
|
||||
'isPublicRoute' => true,
|
||||
]);
|
||||
95
views/settings/index.php
Normal file
95
views/settings/index.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
use humhub\modules\rescue_foundation\components\UploadStandards;
|
||||
use humhub\modules\space_profiles\models\forms\SpaceProfileForm;
|
||||
use humhub\widgets\Button;
|
||||
use yii\bootstrap\ActiveForm;
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var SpaceProfileForm $model */
|
||||
/* @var string|null $subNav */
|
||||
|
||||
$profile = $model->getProfile();
|
||||
?>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><?= Yii::t('SpaceProfilesModule.base', '<strong>Space Profile</strong> Settings') ?></div>
|
||||
|
||||
<?php if (!empty($subNav)): ?>
|
||||
<?= $subNav ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="help-block">
|
||||
<?= Yii::t('SpaceProfilesModule.base', 'Configure your rescue profile content, optional HTML regions, and branding assets.') ?>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<?= Yii::t('SpaceProfilesModule.base', 'Rescue name and description are inherited from this Space\'s name and about/description settings.') ?>
|
||||
</div>
|
||||
|
||||
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>
|
||||
|
||||
<?= $form->errorSummary($model, ['class' => 'alert alert-danger']) ?>
|
||||
|
||||
<?= $form->field($model, 'template_key')->dropDownList($model->getTemplateOptions()) ?>
|
||||
<?= $form->field($model, 'address') ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4"><?= $form->field($model, 'city') ?></div>
|
||||
<div class="col-md-4"><?= $form->field($model, 'state') ?></div>
|
||||
<div class="col-md-4"><?= $form->field($model, 'zip') ?></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6"><?= $form->field($model, 'email') ?></div>
|
||||
<div class="col-md-6"><?= $form->field($model, 'phone') ?></div>
|
||||
</div>
|
||||
|
||||
<?= $form->field($model, 'animals_we_accept')->textarea(['rows' => 3]) ?>
|
||||
<?= $form->field($model, 'mission_statement')->textarea(['rows' => 4]) ?>
|
||||
|
||||
<hr>
|
||||
|
||||
<?= $form->field($model, 'header_html')->textarea(['rows' => 4]) ?>
|
||||
<?= $form->field($model, 'body_html')->textarea(['rows' => 6]) ?>
|
||||
<?= $form->field($model, 'footer_html')->textarea(['rows' => 4]) ?>
|
||||
|
||||
<div class="alert alert-warning">
|
||||
<?= Yii::t('SpaceProfilesModule.base', 'Only HTML/CSS for profile regions is allowed. JavaScript and script-like content are removed automatically.') ?>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="help-block">
|
||||
<?= Yii::t('SpaceProfilesModule.base', 'Allowed image formats: {formats}. Maximum file size: {size} MB.', [
|
||||
'formats' => implode(', ', UploadStandards::imageExtensions()),
|
||||
'size' => number_format(UploadStandards::IMAGE_MAX_BYTES / 1024 / 1024, 1),
|
||||
]) ?>
|
||||
</div>
|
||||
|
||||
<?php if ($profile && !empty($profile->icon_path)): ?>
|
||||
<div class="form-group">
|
||||
<label class="control-label"><?= Yii::t('SpaceProfilesModule.base', 'Current icon') ?></label>
|
||||
<div><?= Html::img($profile->icon_path, ['style' => 'max-width:96px;max-height:96px;border-radius:8px;']) ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $form->field($model, 'iconFile')->fileInput(['accept' => '.jpg,.jpeg,.png,.webp']) ?>
|
||||
<?= $form->field($model, 'removeIcon')->checkbox() ?>
|
||||
|
||||
<?php if ($profile && !empty($profile->background_image_path)): ?>
|
||||
<div class="form-group">
|
||||
<label class="control-label"><?= Yii::t('SpaceProfilesModule.base', 'Current background image') ?></label>
|
||||
<div><?= Html::img($profile->background_image_path, ['style' => 'max-width:320px;border-radius:8px;']) ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $form->field($model, 'backgroundImageFile')->fileInput(['accept' => '.jpg,.jpeg,.png,.webp']) ?>
|
||||
<?= $form->field($model, 'removeBackgroundImage')->checkbox() ?>
|
||||
|
||||
<?= Button::save()->submit() ?>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user