-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from MaxandreOgeret/mog-dev
jsGrid + trans improvments
- Loading branch information
Showing
13 changed files
with
133 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# config/routes/api.yaml | ||
|
||
api_validate_link: | ||
path: /validate | ||
controller: App\Controller\ApiController:validateLink | ||
condition: "request.isXmlHttpRequest()" | ||
options: | ||
expose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"base_url":"","routes":{"api_validate_link":{"tokens":[["text","\/api\/validate"]],"defaults":[],"requirements":[],"hosttokens":[],"methods":[],"schemes":[]}},"prefix":"","host":"localhost","port":"","scheme":"http"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: m.ogeret | ||
* Date: 09/04/2018 | ||
* Time: 13:07 | ||
*/ | ||
|
||
namespace App\Controller; | ||
|
||
use App\Entity\Link; | ||
use App\Service\UriManager; | ||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\Validator\Validator\ValidatorInterface; | ||
|
||
class ApiController extends AbstractController | ||
{ | ||
private $uriManager; | ||
|
||
public function __construct(UriManager $uriManager) | ||
{ | ||
$this->uriManager = $uriManager; | ||
} | ||
|
||
public function validateLink(Request $request, ValidatorInterface $validator) | ||
{ | ||
$link = new Link($request); | ||
$link->setUuid($request->query->get('uuid')) | ||
->setUrl($this->uriManager->format($request->query->get('url'))); | ||
|
||
$violationList = $validator->validate($link); | ||
|
||
if (count($violationList) === 0) { | ||
return new JsonResponse(['status' => 'ok']); | ||
} | ||
$messages = []; | ||
foreach ($violationList as $violation) { | ||
$messages[$violation->getPropertyPath()][] = $violation->getMessage(); | ||
} | ||
|
||
return new JsonResponse(['status' => 'ko', 'messages' => $messages]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters