Skip to content

Commit

Permalink
Logout & new core version
Browse files Browse the repository at this point in the history
  • Loading branch information
rdurica committed Aug 10, 2023
1 parent 9bbcb36 commit c948704
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 96 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This interactive platform allows administrators to create and assign fun tasks a
capturing their achievements through various media formats like videos, images, or written responses to quizzes and
queries.

![image](https://github.com/rdurica/b-day-challenge/assets/16089770/c2bd90bb-ab1a-47fc-911f-9a127dbdb700)
## Contributing

If you would like to contribute to this project, please fork the repository and create a pull request. We welcome all
Expand Down
3 changes: 2 additions & 1 deletion src/app/Component/Form/Login/LoginForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Rdurica\Core\Component\Component;
use Rdurica\Core\Component\ComponentRenderer;
use Rdurica\Core\Model\Service\UserService;
use Rdurica\Core\Util\FlashType;

/**
* LoginForm.
Expand Down Expand Up @@ -57,7 +58,7 @@ public function formOnSuccess(Form $form, ArrayHash $values): void
$this->user->login($identity);
$this->getPresenter()->redirect('Home:');
} catch (AuthenticationException $e) {
$this->getPresenter()->flashMessage($e->getMessage(), 'danger');
$this->getPresenter()->flashMessage($e->getMessage(), FlashType::ERROR);
$this->redirect('this');
}
}
Expand Down
9 changes: 7 additions & 2 deletions src/app/Presenter/Error4xxPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
use Nette\Application\BadRequestException;
use Nette\Application\Request;
use Nette\Application\UI\Presenter;
use Rdurica\Core\Presenter\SetMdbTemplateLayout;


final class Error4xxPresenter extends Presenter
{
use SetMdbTemplateLayout;

/**
* @throws BadRequestException
*/
Expand All @@ -26,7 +29,9 @@ public function startup(): void
public function renderDefault(BadRequestException $exception): void
{
// load template 403.latte or 404.latte or ... 4xx.latte
$file = __DIR__ . "/templates/Error/{$exception->getCode()}.latte";
$this->template->setFile(is_file($file) ? $file : __DIR__ . '/templates/Error/4xx.latte');
$file = __DIR__ . "/../../vendor/rdurica/core/src/Templates/Error/{$exception->getCode()}.latte";
$this->template->setFile(
is_file($file) ? $file : __DIR__ . '/../../vendor/rdurica/core/src/Templates/Error/4xx.latte'
);
}
}
3 changes: 1 addition & 2 deletions src/app/Presenter/ErrorPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace App\Presenter;

use Nette;
use Nette\Application\BadRequestException;
use Nette\Application\Helpers;
use Nette\Application\IPresenter;
Expand Down Expand Up @@ -41,7 +40,7 @@ public function run(Request $request): Response
return new CallbackResponse(
function (IRequest $httpRequest, IResponse $httpResponse): void {
if (preg_match('#^text/html(?:;|$)#', (string)$httpResponse->getHeader('Content-Type'))) {
require __DIR__ . '/templates/Error/500.phtml';
require __DIR__ . '/../../vendor/rdurica/core/src/Templates/Error/500.phtml';
}
}
);
Expand Down
7 changes: 0 additions & 7 deletions src/app/Presenter/templates/Error/403.latte

This file was deleted.

8 changes: 0 additions & 8 deletions src/app/Presenter/templates/Error/404.latte

This file was deleted.

6 changes: 0 additions & 6 deletions src/app/Presenter/templates/Error/405.latte

This file was deleted.

6 changes: 0 additions & 6 deletions src/app/Presenter/templates/Error/410.latte

This file was deleted.

4 changes: 0 additions & 4 deletions src/app/Presenter/templates/Error/4xx.latte

This file was deleted.

27 changes: 0 additions & 27 deletions src/app/Presenter/templates/Error/500.phtml

This file was deleted.

24 changes: 0 additions & 24 deletions src/app/Presenter/templates/Error/503.phtml

This file was deleted.

12 changes: 11 additions & 1 deletion src/app/Presenter/templates/Home/default.latte
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
{block content}
{block navbar}{include './../navbar.latte'}{/block}
{block content}
<div class="align-items-center text-white bg-primary border-0" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body">
Hello, world! This is a toast message.
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
{/block}
63 changes: 63 additions & 0 deletions src/app/Presenter/templates/navbar.latte
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<!-- Container wrapper -->
<div class="container-fluid">
<!-- Toggle button -->
<button
class="navbar-toggler"
type="button"
data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<!-- Collapsible wrapper -->
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<!-- Navbar brand -->
<a class="navbar-brand mt-2 mt-lg-0" n:href="Home:">
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-login-form/lotus.webp"
height="35"
alt="B-day"
loading="lazy"
/> B-day challenge
</a>
<!-- Left links -->
{* <ul class="navbar-nav me-auto mb-2 mb-lg-0">*}
{* <li class="nav-item">*}
{* <a class="nav-link" href="#">Pridat ukol</a>*}
{* </li>*}
{* </ul>*}
</div>
<!-- Right elements -->
<div class="d-flex align-items-center">
<!-- Avatar -->
<div class="dropdown">
<a class="dropdown-toggle d-flex align-items-center hidden-arrow"
href="#"
id="navbarDropdownMenuAvatar"
role="button"
data-mdb-toggle="dropdown"
aria-expanded="false">

<img src="https://mdbcdn.b-cdn.net/img/new/avatars/2.webp"
class="rounded-circle"
height="25"
alt="Black and White Portrait of a Man"
loading="lazy"/>
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuAvatar">
<li>
<a class="dropdown-item" href="#">My profile</a>
</li>
<li>
<a class="dropdown-item" n:href="signOut!">Logout</a>
</li>
</ul>
</div>
</div>
<!-- Right elements -->
</div>
<!-- Container wrapper -->
</nav>
2 changes: 1 addition & 1 deletion src/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": ["MIT"],
"require": {
"php": ">= 8.0",
"rdurica/core": "^0.1.0",
"rdurica/core": "~0.2.0",
"tracy/tracy": "^2.9"
},
"require-dev": {
Expand Down
14 changes: 7 additions & 7 deletions src/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c948704

Please sign in to comment.