Skip to content

Commit

Permalink
Merge pull request #95 from H2-invent/feature/publicRoomsOnJoinpage
Browse files Browse the repository at this point in the history
Feature/public rooms on joinpage
  • Loading branch information
holema authored Mar 21, 2021
2 parents c50b418 + 5b23355 commit 708aaf9
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/css/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
@import "./layout/main";
@import "./layout/header";
@import "./layout/navbar";

@import "./layout/join";
5 changes: 5 additions & 0 deletions assets/css/layout/_join.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.max-vh60{
max-height: 60vh;
overflow: hidden;
overflow-y: auto;
}
1 change: 1 addition & 0 deletions assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -543,3 +543,4 @@ label.required:after {
#modalAdressbook a[aria-expanded="true"] {
background: white;
}

5 changes: 4 additions & 1 deletion assets/js/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ $(document).ready(function () {
$('#snackbar').removeClass('show');
}, 3000);
}, 500);
});
});
$(window).on('load', function () {
$('[data-toggle="popover"]').popover({html: true});
});
54 changes: 54 additions & 0 deletions src/Twig/RoomsInFuture.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
// src/Twig/AppExtension.php
namespace App\Twig;

use App\Entity\Checklist;
use App\Entity\MyUser;
use App\Entity\Rooms;
use App\Entity\Server;
use App\Service\LicenseService;
use App\Service\MessageService;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;
use function GuzzleHttp\Psr7\str;

class RoomsInFuture extends AbstractExtension
{


private $licenseService;
private $em;
public function __construct(EntityManagerInterface $entityManager, LicenseService $licenseService, TokenStorageInterface $tokenStorage, EntityManagerInterface $em)
{
$this->licenseService = $licenseService;
$this->em = $entityManager;
}

public function getFilters()
{
return [
new TwigFilter('roomsinFuture', [$this, 'roomsinFuture']),
];
}

public function roomsinFuture(Server $server)
{
$now = new \DateTime();
$qb = $this->em->getRepository(Rooms::class)->createQueryBuilder('rooms');
$qb->andWhere('rooms.server = :server')
->andWhere('rooms.showRoomOnJoinpage = true')
->andWhere('rooms.start > :now')
->setParameter('server', $server)
->setParameter('now',$now)
->orderBy('rooms.start', 'ASC');
$rooms = $qb->getQuery()->getResult();

return $rooms;

}

}
35 changes: 33 additions & 2 deletions templates/join/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,46 @@
Image by {{ image['photographer'] }} </a>
<a href="https://www.pexels.com" target="_blank" referrerpolicy="no-referrer"
rel="noreferrer noopener"> provided by <img height="30px"
src="{{ asset('images/pexels.png') }}" />
src="{{ asset('images/pexels.png') }}"/>
</a>

{% endif %}
</div>
</div>

</div>
{% if server and server|roomsinFuture|length > 0 %}
<div class="col-lg-10 mt-3">
<div class="card frozenGlas">
<div class="glossy"></div>
<div class="card-body">
<h3 class="h3-responsive text-center">{{ 'Öffentliche Konferenzen'|trans }}</h3>
<div class="max-vh60">
<ul class="list-group">

{% for r in server|roomsinFuture %}
<li class="list-group-item d-flex align-items-center justify-content-between">
<b>{{ r.start|date('d.m.Y | H:i') }}</b>
<h5>{{ r.name }} <a tabindex="0" data-toggle="popover" data-trigger="focus"
title="{{ 'Agenda'|trans }}"
data-content="{% if r.agenda is not null %}{{ r.agenda|markdown_to_html|escape }}{% else %}{{ 'Keine Angabe'|trans }}{% endif %}"><i
class="fa fa-info-circle"></i></a></h5>

{% if r.public %}
<a href="{{ path('public_subscribe_participant',{'uid':r.uidParticipant}) }}"
class="btn btn-sm btn-outline-primary">{{ 'Anmelden'|trans }}</a>
{% endif %}
</li>

{% endfor %}

</ul>
</div>
</div>
</div>
</div>
{% endif %}
</div>


{{ include('base/__snack.html.twig') }}
{% endblock %}

0 comments on commit 708aaf9

Please sign in to comment.