Merge branch '327_pinned_comment' into issue321_layout_improvements_actionForm

This commit is contained in:
2021-12-16 21:41:22 +01:00
57 changed files with 1115 additions and 512 deletions

View File

@@ -21,11 +21,14 @@ class LocationApiController extends ApiController
{
public function customizeQuery(string $action, Request $request, $query): void
{
$query->andWhere(
$query->expr()->andX(
$query
->leftJoin('e.locationType', 'lt')
->andWhere(
$query->expr()->andX(
$query->expr()->eq('e.availableForUsers', "'TRUE'"),
$query->expr()->eq('lt.availableForUsers', "'TRUE'"),
$query->expr()->eq('e.active', "'TRUE'"),
)
);
);
}
}

View File

@@ -17,6 +17,27 @@ use Symfony\Component\Routing\Annotation\Route;
class UserApiController extends ApiController
{
/**
* @Route(
* "/api/1.0/main/user-current-location.{_format}",
* name="chill_main_user_current_location",
* requirements={
* "_format": "json"
* }
* )
*
* @param mixed $_format
*/
public function currentLocation($_format): JsonResponse
{
return $this->json(
$this->getUser()->getCurrentLocation(),
JsonResponse::HTTP_OK,
[],
['groups' => ['read']]
);
}
/**
* @Route(
* "/api/1.0/main/whoami.{_format}",

View File

@@ -33,6 +33,13 @@ ul.record_actions {
margin-right: auto;
}
}
ul.dropdown-menu {
li {
display: block;
margin-right: 0;
}
}
}
.sticky-form-buttons {
margin-top: 4em;

View File

@@ -55,6 +55,15 @@ final class UserApiControllerTest extends WebTestCase
return $data['results'][0];
}
public function testUserCurrentLocation()
{
$client = $this->getClientAuthenticated();
$client->request(Request::METHOD_GET, '/api/1.0/main/user-current-location.json');
$this->assertResponseIsSuccessful();
}
public function testWhoami()
{
$client = $this->getClientAuthenticated();

View File

@@ -546,6 +546,14 @@ paths:
responses:
200:
description: "ok"
/1.0/main/user-current-location.json:
get:
tags:
- user
summary: Return the current location of the currently authenticated user
responses:
200:
description: "ok"
/1.0/main/user/{id}.json:
get:
tags:

View File

@@ -56,6 +56,7 @@ centers: centres
Centers: Centres
comment: commentaire
Comment: Commentaire
Pinned comment: Commentaire épinglé
Any comment: Aucun commentaire
# comment embeddable