Skip to content

Commit 6b6041f

Browse files
author
Zane
committed
ArticleEdit split
1 parent fc779cf commit 6b6041f

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
namespace App\Controller\Editor;
3+
4+
use Symfony\Component\HttpFoundation\JsonResponse;
5+
use Symfony\Component\HttpFoundation\Response;
6+
use Symfony\Component\Routing\Attribute\Route;
7+
8+
9+
class ArticleUploadImages extends ArticleEditBaseController
10+
{
11+
#[Route('/ajax/editor/article/{articleId<[1-9]+[0-9]*>}/images/upload', name: 'app_article_edit_images-upload', methods: ['POST'])]
12+
public function upload(int $articleId) : JsonResponse|Response
13+
{
14+
try {
15+
dd("TODO");
16+
$arrIdsAndTags = $this->request->get('tags') ?? [];
17+
$this->loadArticleEditor($articleId)->setTagsFromIdsAndTags($arrIdsAndTags);
18+
$this->factory->getEntityManager()->flush();
19+
return $this->jsonOKResponse("Tag salvati");
20+
21+
} catch(Exception|Error $ex) { return $this->textErrorResponse($ex); }
22+
}
23+
}

‎templates/article/editor/images.html.twig

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!-- ARTICLE side column editor images gallery START -->
2-
<div id="tli-article-editor-image-gallery" class="col-lg-4 sticky-top overflow-auto mt-15">
2+
<div id="tli-article-editor-image-gallery" class="col-lg-4 sticky-top overflow-auto mt-15"
3+
data-save-url="{{ path('app_article_edit_images-upload', {'articleId': Article.id}) }}">
34

45
{% embed 'parts/alert-chalkboard.html.twig' %}
56
{% block alertStyle %}{% if Article.Images is empty %}collapse{% endif%} tli-images-guide{% endblock %}
@@ -24,14 +25,20 @@
2425
{% endfor %}
2526
</div>
2627

28+
2729
<div class="sticky-bottom text-center mt-2">
30+
2831
<button type="button" class="btn btn-primary tli-image-upload">
2932
<i class="fa-solid fa-upload"></i> Carica immagini
3033
</button>
3134

3235
<input type="file" multiple accept="image/*" class="d-none">
3336

34-
<div class="tli-image-upload-progress"></div>
37+
<div id="tli-image-upload-progress" class="progress d-none" role="progressbar"
38+
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
39+
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width: 0%"></div>
40+
</div>
41+
3542
</div>
3643

3744
</div>

0 commit comments

Comments
 (0)