-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
203 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; | ||
use Fisharebest\Webtrees\Http\RequestHandlers\ModulesAllPage; | ||
use Fisharebest\Webtrees\I18N; | ||
use MagicSunday\Webtrees\PedigreeChart\Configuration; | ||
|
||
/** | ||
* @var Configuration $configuration | ||
* @var string $moduleName | ||
* @var string $title | ||
*/ | ||
|
||
?> | ||
|
||
<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(ModulesAllPage::class) => I18N::translate('Modules'), $title]]) ?> | ||
|
||
<h1><?= $title ?></h1> | ||
|
||
<form method="post"> | ||
<?= view($moduleName.'::modules/pedigree-chart/form/generations', ['configuration' => $configuration]) ?> | ||
|
||
<?= view($moduleName.'::modules/pedigree-chart/form/orientation', ['configuration' => $configuration]) ?> | ||
|
||
<button type="submit" class="btn btn-primary"> | ||
<?= I18N::translate('save') ?> | ||
</button> | ||
|
||
<a href="<?= route(ControlPanel::class) ?>" class="btn btn-secondary"> | ||
<?= view('icons/cancel') ?> | ||
<?= I18N::translate('cancel') ?> | ||
</a> | ||
|
||
<?= csrf_field() ?> | ||
</form> |
29 changes: 29 additions & 0 deletions
29
resources/views/modules/pedigree-chart/form/generations.phtml
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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Fisharebest\Webtrees\I18N; | ||
use MagicSunday\Webtrees\PedigreeChart\Configuration; | ||
|
||
/** | ||
* @var Configuration $configuration | ||
*/ | ||
|
||
?> | ||
|
||
<div class="form-group row"> | ||
<label class="col-sm-3 col-form-label wt-page-options-label" for="generations"> | ||
<?= I18N::translate('Generations') ?> | ||
</label> | ||
<div class="col-sm-9 wt-page-options-value"> | ||
<?= | ||
view('components/select', [ | ||
'id' => 'generations', | ||
'name' => 'generations', | ||
'selected' => $configuration->getGenerations(), | ||
'options' => $configuration->getGenerationsList(), | ||
'class' => 'form-control-sm', | ||
]) | ||
?> | ||
</div> | ||
</div> |
32 changes: 32 additions & 0 deletions
32
resources/views/modules/pedigree-chart/form/orientation.phtml
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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Fisharebest\Webtrees\I18N; | ||
use MagicSunday\Webtrees\PedigreeChart\Configuration; | ||
|
||
/** | ||
* @var Configuration $configuration | ||
*/ | ||
|
||
?> | ||
|
||
<div class="form-group row"> | ||
<label class="col-form-label col-sm-3 wt-page-options-label"> | ||
<?= I18N::translate('Orientation') ?> | ||
</label> | ||
<div class="col-sm-9 wt-page-options-value" id="layout"> | ||
<?= | ||
view('components/radios-inline', [ | ||
'name' => 'layout', | ||
'options' => [ | ||
Configuration::LAYOUT_RIGHTLEFT => view('icons/pedigree-left') . I18N::translate('left'), | ||
Configuration::LAYOUT_LEFTRIGHT => view('icons/pedigree-right') . I18N::translate('right'), | ||
Configuration::LAYOUT_BOTTOMTOP => view('icons/pedigree-up') . I18N::translate('up'), | ||
Configuration::LAYOUT_TOPBOTTOM => view('icons/pedigree-down') . I18N::translate('down'), | ||
], | ||
'selected' => $configuration->getLayout(), | ||
]) | ||
?> | ||
</div> | ||
</div> |
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,66 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the package magicsunday/webtrees-pedigree-chart. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MagicSunday\Webtrees\PedigreeChart\Traits; | ||
|
||
use Fisharebest\Webtrees\FlashMessages; | ||
use Fisharebest\Webtrees\I18N; | ||
use Fisharebest\Webtrees\Validator; | ||
use MagicSunday\Webtrees\PedigreeChart\Configuration; | ||
use Psr\Http\Message\ResponseInterface; | ||
use Psr\Http\Message\ServerRequestInterface; | ||
|
||
/** | ||
* Trait ModuleConfigTrait. | ||
* | ||
* @author Rico Sonntag <mail@ricosonntag.de> | ||
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License v3.0 | ||
* @link https://github.com/magicsunday/webtrees-pedigree-chart/ | ||
*/ | ||
trait ModuleConfigTrait | ||
{ | ||
use \Fisharebest\Webtrees\Module\ModuleConfigTrait; | ||
|
||
/** | ||
* @return ResponseInterface | ||
*/ | ||
public function getAdminAction(ServerRequestInterface $request): ResponseInterface | ||
{ | ||
$this->layout = 'layouts/administration'; | ||
|
||
return $this->viewResponse( | ||
$this->name() . '::modules/pedigree-chart/config', | ||
[ | ||
'configuration' => new Configuration($request, $this), | ||
'moduleName' => $this->name(), | ||
'title' => self::title(), | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* @param ServerRequestInterface $request | ||
* | ||
* @return ResponseInterface | ||
*/ | ||
public function postAdminAction(ServerRequestInterface $request): ResponseInterface | ||
{ | ||
$configuration = new Configuration($request, $this); | ||
|
||
$this->setPreference('default_generations', (string) $configuration->getGenerations()); | ||
$this->setPreference('default_tree_layout', $configuration->getLayout()); | ||
|
||
FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', | ||
$this->title()), 'success'); | ||
|
||
return redirect($this->getConfigLink()); | ||
} | ||
} |