Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default parameters for guests in a config panel #58

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .codeclimate.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-22.04]
php-version: ['7.4', '8.0', '8.1', '8.2']
php-version: ['8.1', '8.2']

name: Testing PHP ${{ matrix.php-version }} on ${{ matrix.operating-system }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-22.04]
php-version: ['7.4', '8.0', '8.1', '8.2']
php-version: ['8.1', '8.2']

name: Testing PHP ${{ matrix.php-version }} on ${{ matrix.operating-system }}

Expand All @@ -24,4 +24,4 @@ jobs:

- run: composer validate
- run: composer install --no-progress
- run: vendor/bin/phpstan analyse -c phpstan.neon
- run: vendor/bin/phpstan analyse --xdebug -c phpstan.neon
29 changes: 0 additions & 29 deletions .github/workflows/phpunit.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
composer.lock
package-lock.json
.idea/
vendor/
node_modules/
composer.lock
package-lock.json
resources/js/pedigree-chart.js
resources/js/pedigree-chart-storage.js
.phpunit.result.cache
webtrees-pedigree-chart.zip
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
![Latest version](https://img.shields.io/github/v/release/magicsunday/webtrees-pedigree-chart?sort=semver)
![License](https://img.shields.io/github/license/magicsunday/webtrees-pedigree-chart)
![PHPStan](https://github.com/magicsunday/webtrees-pedigree-chart/actions/workflows/phpstan.yml/badge.svg)
![PHPUnit](https://github.com/magicsunday/webtrees-pedigree-chart/actions/workflows/phpunit.yml/badge.svg)
![PHPCodeSniffer](https://github.com/magicsunday/webtrees-pedigree-chart/actions/workflows/phpcs.yml/badge.svg)
![CodeQL](https://github.com/magicsunday/webtrees-pedigree-chart/actions/workflows/codeql-analysis.yml/badge.svg)

Expand All @@ -19,7 +18,7 @@ is capable to display up to 25 ancestor generations of an individual.
**Caution: If you are rendering a lot of generations it may take a while and even slow down your system.**

## Installation
Requires webtrees 2.1.
Requires webtrees 2.2.

### Using Composer
To install using [composer](https://getcomposer.org/), just run the following command from the command line
Expand Down Expand Up @@ -71,13 +70,14 @@ to adjust the layout of the charts according to your needs.
To build/update the javascript, run the following commands:

```
nvm install node
npm install --unsafe-perm --save-dev
npm run prepare
```

### Run tests
```
composer update
vendor/bin/phpstan analyse -c phpstan.neon
vendor/bin/phpstan analyse --xdebug --memory-limit=-1 -c phpstan.neon
vendor/bin/phpcs src/ --standard=PSR12
```
65 changes: 59 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,78 @@
"magicsunday/webtrees-module-installer-plugin": true
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"ext-json": "*",
"ext-dom": "*",
"fisharebest/webtrees": "~2.1.0",
"fisharebest/webtrees": "~2.2.0 || dev-main",
"magicsunday/webtrees-module-base": "^1.0",
"magicsunday/webtrees-module-installer-plugin": "^1.3"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.9",
"phpstan/phpstan-strict-rules": "^1.4",
"phpstan/phpstan-deprecation-rules": "^1.1",
"squizlabs/php_codesniffer": "^3.7"
},
"autoload": {
"psr-4": {
"MagicSunday\\Webtrees\\PedigreeChart\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"MagicSunday\\Webtrees\\PedigreeChart\\Test\\": "test/"
}
"scripts": {
"module:build": [
"### Remove any left over files",
"rm -Rf webtrees-pedigree-chart/",
"### Checkout latest version of repository",
"git archive --prefix=webtrees-pedigree-chart/ HEAD --format=tar | tar -x",
"### Install required components",
"@composer require magicsunday/webtrees-module-base:^1.0",
"### Copy base module to vendor directory",
"mkdir -p webtrees-pedigree-chart/vendor/magicsunday",
"cp -r vendor/magicsunday/webtrees-module-base webtrees-pedigree-chart/vendor/magicsunday/webtrees-module-base",
"### Remove all not required files from archive",
"rm -rf webtrees-pedigree-chart/.github",
"rm -rf webtrees-pedigree-chart/resources/js/modules",
"rm -f webtrees-pedigree-chart/.gitattributes",
"rm -f webtrees-pedigree-chart/.gitignore",
"rm -f webtrees-pedigree-chart/composer.json",
"rm -f webtrees-pedigree-chart/package.json",
"rm -f webtrees-pedigree-chart/rollup.config.js",
"rm -f webtrees-pedigree-chart/phpstan.neon",
"### Clean vendor",
"rm -rf webtrees-pedigree-chart/vendor/magicsunday/webtrees-module-base/.github",
"rm -rf webtrees-pedigree-chart/vendor/magicsunday/webtrees-module-base/test",
"rm -f webtrees-pedigree-chart/vendor/magicsunday/webtrees-module-base/.gitignore",
"rm -f webtrees-pedigree-chart/vendor/magicsunday/webtrees-module-base/composer.json",
"rm -f webtrees-pedigree-chart/vendor/magicsunday/webtrees-module-base/phpstan.neon",
"rm -f webtrees-pedigree-chart/vendor/magicsunday/webtrees-module-base/phpunit.xml",
"### Create archive",
"zip --quiet --recurse-paths --move -9 webtrees-pedigree-chart.zip webtrees-pedigree-chart"
],
"module:check": [
"### PHP CodeSniffer",
"@composer module:phpcs",
"### PHPStan",
"@composer module:phpstan"
],
"module:phpcs": [
"@composer global require squizlabs/php_codesniffer=* --quiet",
"~/.composer/vendor/bin/phpcs src/ --standard=PSR12"
],
"module:phpstan": [
"@composer global require --quiet phpstan/phpstan=*",
"@composer global require --quiet phpstan/extension-installer=*",
"@composer global require --quiet phpstan/phpstan-deprecation-rules=*",
"@composer global require --quiet phpstan/phpstan-strict-rules=*",
"@composer install --quiet",
"~/.composer/vendor/bin/phpstan analyse --memory-limit=-1 --xdebug -c phpstan.neon",
"@composer install --no-dev --quiet"
]
},
"scripts-descriptions": {
"module:build": "Create a distribution file (webtrees-pedigree-chart.zip)",
"module:check": "Run various static analysis tools"
}
}
3 changes: 2 additions & 1 deletion module.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
use Composer\Autoload\ClassLoader;
use MagicSunday\Webtrees\PedigreeChart\Module;

// Register our namespace
// Register our required namespaces
$loader = new ClassLoader();
$loader->addPsr4('MagicSunday\\Webtrees\\ModuleBase\\', __DIR__ . '/vendor/magicsunday/webtrees-module-base/src');
$loader->addPsr4('MagicSunday\\Webtrees\\PedigreeChart\\', __DIR__ . '/src');
$loader->register();

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"watch": "rollup --watch --config rollup.config.js"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^13.0",
"@rollup/plugin-node-resolve": "^15.0",
"d3-fetch": "^3.0",
"d3-hierarchy": "^3.0",
"d3-scale": "^4.0",
Expand All @@ -21,7 +21,7 @@
"d3-timer": "^3.0",
"d3-transition": "^3.0",
"d3-zoom": "^3.0",
"rollup": "^2.56",
"rollup": "^2.79",
"rollup-plugin-terser": "^7.0"
}
}
16 changes: 8 additions & 8 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon

parameters:
# You can currently choose from 10 levels (0 is the loosest and 9 is the strictest).
level: 8
level: max

paths:
- src
# If you have tests and want to analyze this folder, uncomment the line below
# - test

fileExtensions:
- php
- src/

checkMissingIterableValueType: false
excludePaths:
- vendor/
37 changes: 37 additions & 0 deletions resources/views/modules/pedigree-chart/config.phtml
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 resources/views/modules/pedigree-chart/form/generations.phtml
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 resources/views/modules/pedigree-chart/form/orientation.phtml
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>
37 changes: 2 additions & 35 deletions resources/views/modules/pedigree-chart/page.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -52,42 +52,9 @@ use MagicSunday\Webtrees\PedigreeChart\Configuration;
</div>
</div>

<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>
<?= view($moduleName.'::modules/pedigree-chart/form/generations', ['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>
<?= view($moduleName.'::modules/pedigree-chart/form/orientation', ['configuration' => $configuration]) ?>

<div class="collapse" id="showMoreOptions">
<div class="form-group row">
Expand Down
Loading