Skip to content
Snippets Groups Projects
Commit 41fa04df authored by Camille Simiand's avatar Camille Simiand
Browse files

Add previous video url as placeholder

parent 81f3ad25
No related branches found
No related tags found
1 merge request!67tuleap-182-see-the-initial-video-link
Pipeline #863 passed
......@@ -161,3 +161,7 @@ button[type=submit]{
.remove-link {
font-size: 0.9rem;
}
.video-url {
max-width: 900px;
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ use App\Entity\Capsule;
use App\Exception\ZipArchiveNotOpeningException;
use App\Form\EditVideoUrlFormType;
use App\Repository\CapsuleRepository;
use App\Retriever\ProjectRetriever;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Config\Util\Exception\XmlParsingException;
use Symfony\Component\Filesystem\Exception\FileNotFoundException;
......@@ -199,7 +200,10 @@ class ProjectController extends AbstractController
return $this->redirectToRoute('capsule_list');
}
$form = $this->createForm(EditVideoUrlFormType::class);
$project_retriever = new ProjectRetriever($capsule);
$current_video_url = $project_retriever->getVideoUrl();
$form = $this->createForm(EditVideoUrlFormType::class, ['current_video_url' => $current_video_url]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
......
......@@ -14,6 +14,8 @@ class EditVideoUrlFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$current_video_url = $options['data']['current_video_url'];
$builder
->add(
'new_video_url',
......@@ -21,7 +23,7 @@ class EditVideoUrlFormType extends AbstractType
[
'constraints' => [new NotBlank(['message' => 'capsule.video_url.not_blank'])],
'label' => 'capsule.edit.video_url.text',
'empty_data' => ''
'data' => $current_video_url
]
)
->add(
......
......@@ -16,7 +16,7 @@
</div>
{{ form_start(editVideoUrlForm, {'attr': {novalidate: 'novalidate', 'class': 'd-flex flex-column justify-content-center'}}) }}
{{ form_row(editVideoUrlForm.new_video_url, {'row_attr': {'class' : 'm-auto mb-4 col-6'}}) }}
{{ form_row(editVideoUrlForm.new_video_url, {'row_attr': {'class' : 'video_url m-auto mb-4 col-11 col-sm-10 col-md-9 col-xl-8'}}) }}
{{ form_row(editVideoUrlForm.save, {'row_attr': {'class' : 'm-auto mb-5 col-2'}}) }}
{{ form_end(editVideoUrlForm) }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment