-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Twig Component triggers now an deprecated notice message closes #1076.
Rework form block #1124.
- Loading branch information
Showing
14 changed files
with
139 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
/** | ||
* @var $this \luya\cms\base\PhpBlockView | ||
*/ | ||
$hideForm = false; | ||
?> | ||
<?php if ($this->varValue('emailAddress')): ?> | ||
<?= $this->varValue('headline', null, '<h3>{{headline}}</h3>'); ?> | ||
<?php if ($this->extraValue('name') && $this->extraValue('email') && $this->extraValue('message')): ?> | ||
<?php if ($this->extraValue('mailerResponse') == 'success'): $hideForm = true;?> | ||
<div class="alert alert-success"><?= $this->extraValue('sendSuccess'); ?></div> | ||
<?php else: ?> | ||
<div class="alert alert-danger"><?= $this->extraValue('sendError'); ?></div> | ||
<?php endif; ?> | ||
<?php endif; ?> | ||
<?php if (!$hideForm): ?> | ||
<form class="form-horizontal" role="form" method="post"> | ||
<input type="hidden" name="_csrf" value="<?= $this->extraValue('csrf'); ?>" /> | ||
<div class="form-group"> | ||
<label for="name" class="col-sm-2 control-label"><?= $this->extraValue('nameLabel'); ?></label> | ||
<div class="col-sm-10"> | ||
<input type="text" class="form-control" id="name" name="name" placeholder="<?= $this->extraValue('namePlaceholder'); ?>" value="<?= $this->extraValue('name'); ?>"> | ||
<?php if (!$this->extraValue('nameErrorFlag')): ?> | ||
<p class="text-danger"><?= $this->extraValue('nameError'); ?></p> | ||
<?php endif; ?> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label for="email" class="col-sm-2 control-label"><?= $this->extraValue('emailLabel'); ?></label> | ||
<div class="col-sm-10"> | ||
<input type="email" class="form-control" id="email" name="email" placeholder="<?= $this->extraValue('emailPlaceholder'); ?>" value="<?= $this->extraValue('email'); ?>"> | ||
<?php if (!$this->extraValue('emailErrorFlag')): ?> | ||
<p class="text-danger"><?= $this->extraValue('emailError'); ?></p> | ||
<?php endif; ?> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label for="message" class="col-sm-2 control-label"><?= $this->extraValue('messageLabel'); ?></label> | ||
<div class="col-sm-10"> | ||
<textarea class="form-control" rows="4" name="message"><?= $this->extraValue('message'); ?></textarea> | ||
<?php if (!$this->extraValue('messageErrorFlag')): ?> | ||
<p class="text-danger"><?= $this->extraValue('messageError'); ?></p> | ||
<?php endif; ?> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<div class="col-sm-10 col-sm-offset-2"> | ||
<input id="submit" name="submit" type="submit" value="<?= $this->extraValue('sendLabel'); ?>" class="btn btn-primary"> | ||
</div> | ||
</div> | ||
</form> | ||
<?php endif; ?> | ||
<?php endif; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace cmstests\src\frontend\blocks; | ||
|
||
use cmstests\BlockTestCase; | ||
|
||
class FormBlockTest extends BlockTestCase | ||
{ | ||
public $blockClass = 'luya\cms\frontend\blocks\FormBlock'; | ||
|
||
public function testEmptyRenderFrontend() | ||
{ | ||
$this->assertEmpty($this->renderFrontend()); | ||
} | ||
|
||
public function testBasicInput() | ||
{ | ||
$this->block->setVarValues([ | ||
'headline' => 'My Form', | ||
'emailAddress' => 'hello@luya.io', | ||
]); | ||
|
||
$this->assertContains('<h3>My Form</h3><form class="form-horizontal" role="form" method="post"><input type="hidden" name="_csrf" value="', $this->renderFrontendNoSpace()); | ||
$this->assertContains('" /><div class="form-group"><label for="name" class="col-sm-2 control-label">Name</label><div class="col-sm-10"><input type="text" class="form-control" id="name" name="name" placeholder="Vor- und Nachname" value=""></div></div><div class="form-group"><label for="email" class="col-sm-2 control-label">Email</label><div class="col-sm-10"><input type="email" class="form-control" id="email" name="email" placeholder="beispiel@beispiel.ch" value=""></div></div><div class="form-group"><label for="message" class="col-sm-2 control-label">Nachricht</label><div class="col-sm-10"><textarea class="form-control" rows="4" name="message"></textarea></div></div><div class="form-group"><div class="col-sm-10 col-sm-offset-2"><input id="submit" name="submit" type="submit" value="Absenden" class="btn btn-primary"></div></div></form>', $this->renderFrontendNoSpace()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
modules/gallery/src/frontend/views/blocks/GalleryAlbum.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
use luya\admin\filters\MediumThumbnail; | ||
|
||
/** | ||
* @var $this \luya\cms\base\PhpBlockView | ||
*/ | ||
?> | ||
<?php if ($album = $this->extraValue('album')): ?> | ||
<h1><?= $album->title; ?></h1> | ||
<p><?= $album->description; ?></p> | ||
<?php if ($album->cover_image_id): ?> | ||
<p> | ||
<a href="<?= $album->getDetailUrl($this->cfgValue('nav_item_id')); ?>"> | ||
<img class="img-responsive img-rounded" src="<?= Yii::$app->storage->getImage($album->cover_image_id)->applyFilter(MediumThumbnail::identifier())->source; ?>" border="0" /> | ||
</a> | ||
<?php endif; ?> | ||
<?php endif; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
/** | ||
* @var $this \luya\cms\base\PhpBlockView | ||
*/ | ||
?> | ||
<ul> | ||
<?php foreach ($this->extraValue('items', []) as $item): ?> | ||
<li><a href="<?= $item->getDetailUrl($this->cfgValue('nav_item_id')); ?>"><?= $item->title; ?></a></li> | ||
<?php endforeach; ?> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters