Skip to content

Commit

Permalink
Added about page.
Browse files Browse the repository at this point in the history
  • Loading branch information
zerai committed Sep 5, 2023
1 parent 9ac7e0e commit 51e94e2
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/di/service.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use Http\Discovery\HttpClientDiscovery;


use OpenEMR\Modules\Marketplace\Adapter\Http\Web\AboutController;
use OpenEMR\Modules\Marketplace\Adapter\Http\Web\DefaultController;
use OpenEMR\Modules\Marketplace\Adapter\Http\Web\NotFoundController;
use OpenEMR\Modules\Marketplace\Finder\ModuleFinder;
Expand Down
2 changes: 2 additions & 0 deletions config/di/twig.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
'source_code' => Module::MODULE_SOURCE_CODE,
'vendor_name' => Module::VENDOR_NAME,
'vendor_url' => Module::VENDOR_URL,
'license' => Module::LICENSE,
'license_url' => Module::LICENSE_URL,
'isStandAlone' => Module::isStandAlone(),
]);

Expand Down
6 changes: 6 additions & 0 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Nyholm\Psr7Server\ServerRequestCreator;


use OpenEMR\Modules\Marketplace\Adapter\Http\Web\AboutController;
use OpenEMR\Modules\Marketplace\Adapter\Http\Web\DefaultController;
use OpenEMR\Modules\Marketplace\Adapter\Http\Web\NotFoundController;
use OpenEMR\Modules\Marketplace\Finder\PackagistModuleFinder;
Expand Down Expand Up @@ -70,5 +71,10 @@ function routerMatch(ServerRequestInterface $request, ContainerInterface $contai
//return ($container->get(DefaultController::class))($request);
}

if ($request->getUri()->getPath() === '/interface/modules/custom_modules/oe-module-marketplace/public/about') {

return ($container->get(AboutController::class))();
}

return ($container->get(NotFoundController::class))();
}
32 changes: 32 additions & 0 deletions src/Adapter/Http/Web/AboutController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php declare(strict_types=1);

namespace OpenEMR\Modules\Marketplace\Adapter\Http\Web;

use Nyholm\Psr7\Factory\Psr17Factory;
use Psr\Http\Message\ResponseInterface;
use Twig\Environment;

class AboutController
{
/**
* @var Environment
*/
private $twigEnvironment;

public function __construct(Environment $twigEnvironment)
{
$this->twigEnvironment = $twigEnvironment;
}

public function __invoke(): ResponseInterface
{
$content = $this->twigEnvironment->render('about/index.html.twig');

$psr17Factory = new Psr17Factory();
$responseBody = $psr17Factory->createStream($content);

return $psr17Factory->createResponse(200)->withBody($responseBody);
}


}
81 changes: 81 additions & 0 deletions src/Adapter/Http/Web/Templates/about/index.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{% extends 'layout-base-tbs5.html.twig' %}



{% block body %}
<div class="container mt-3">
<div class="row justify-content-center">
<div class="col-8">
<h3 class="text-center m-3">About {{ module.name }}</h3>

<div class="row my-3">
<div class="col-3 text-start">Module Version:</div><div class="col text-end">{{ module.version }}</div>
</div>
<div class="row my-3">
<div class="col-3 text-start">License:</div>
<div class="col text-end">
<a href="{{ module.license_url }}" class="text-decoration-none" target="_blank">{{ module.license }}</a>
</div>
</div>
<div class="row my-3">
<div class="col-3 text-start">Vendor:</div>
<div class="col text-end">
<a href="{{ module.vendor_url }}" class="text-decoration-none" target="_blank">{{ module.vendor_name }}</a>
</div>
</div>
<div class="row my-3">
<div class="col-3 text-start">Online support:</div>
<div class="col text-end">
<a href="{{ module.source_code }}/issues" target="_blank">{{ module.source_code }}/issues</a>
</div>
</div>
<div class="row mt-5">
<a href="https://github.com/MedicalMundi/oe-module-marketplace/discussions/categories/ideas" target="_blank" class="btn btn-outline-primary btn-md d-block m-1 text-start" role="button">
<i class="bi bi-lightbulb-fill"></i> Suggest a new feature
</a>
</div>

<p class="d-block-flex">
<a target="_blank" class="btn btn-outline-success btn-lg d-block m-0 text-start" data-bs-toggle="collapse" href="#collapseSupportUsOptions" role="button" aria-expanded="false" aria-controls="collapseSupportUsOptions">
<i class="bi bi-heart-fill"></i> Support Us
</a>

</p>
<div class="collapse" id="collapseSupportUsOptions">
<div class="card card-body">
<p class="text-center">Thanks!! <i class="bi bi-hearts text-danger"></i></p>
<div class="btn-group btn-group-lg" role="group" aria-label="Large button group">
<button type="button" class="btn btn-outline-success">
<a class="text-decoration-none" href="https://github.com/sponsors/pMononoke?frequency=one-time" target="_blank">One-time</a>
</button>
<button type="button" class="btn btn-outline-success">
<a class="text-decoration-none" href="https://github.com/sponsors/pMononoke?frequency=recurring" target="_blank">Monthly</a>
</button>
</div>

</div>
</div>





<div class="row mt-5 justify-content-center">
<div class="col-3">
<a href="/interface/modules/custom_modules/oe-module-marketplace/public/" class="btn btn-outline-secondary btn-md d-block m-1 text-start" role="button">
<i class="bi bi-arrow-left-circle-fill"></i> Back to module
</a>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

{# OVERRIDE DEFAULT HEADER #}
{% block header %}
{% endblock %}

{# OVERRIDE DEFAULT FOOTER #}
{% block footer %}
{% endblock %}
5 changes: 5 additions & 0 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class Module

public const VENDOR_URL = 'https://github.com/medicalmundi';

public const LICENSE = 'MIT';

public const LICENSE_URL = 'https://github.com/medicalmundi/oe-module-marketplace/blob/main/LICENSE';


/**
* @var null|ContainerInterface
*/
Expand Down

0 comments on commit 51e94e2

Please sign in to comment.