|
3 | 3 | namespace Dontdrinkandroot\GitkiBundle\Controller; |
4 | 4 |
|
5 | 5 | use Dontdrinkandroot\GitkiBundle\Exception\FileLockedException; |
| 6 | +use Dontdrinkandroot\GitkiBundle\Form\Type\MarkdownEditType; |
6 | 7 | use Dontdrinkandroot\GitkiBundle\Service\Markdown\MarkdownServiceInterface; |
7 | 8 | use Dontdrinkandroot\Path\FilePath; |
8 | 9 | use GitWrapper\GitException; |
9 | | -use Symfony\Component\Form\SubmitButton; |
10 | 10 | use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; |
11 | 11 | use Symfony\Component\HttpFoundation\Request; |
12 | 12 | use Symfony\Component\HttpFoundation\Response; |
@@ -96,37 +96,10 @@ public function editAction(Request $request, $path) |
96 | 96 | return new Response($renderedView, Response::HTTP_LOCKED); |
97 | 97 | } |
98 | 98 |
|
99 | | - $form = $this->createFormBuilder() |
100 | | - ->add('content', 'textarea', ['attr' => ['rows' => 15], 'label' => false]) |
101 | | - ->add('commitMessage', 'text', ['label' => 'Commit Message', 'required' => true]) |
102 | | - ->add( |
103 | | - 'actions', |
104 | | - 'form_actions', |
105 | | - [ |
106 | | - 'buttons' => [ |
107 | | - 'save' => [ |
108 | | - 'type' => 'submit', |
109 | | - 'options' => ['label' => 'Save'] |
110 | | - ], |
111 | | - 'cancel' => [ |
112 | | - 'type' => 'submit', |
113 | | - 'options' => ['label' => 'Cancel', 'button_class' => 'default'] |
114 | | - ], |
115 | | - ] |
116 | | - ] |
117 | | - ) |
118 | | - ->getForm(); |
| 99 | + $form = $this->createForm(MarkdownEditType::class); |
119 | 100 |
|
120 | 101 | $form->handleRequest($request); |
121 | 102 |
|
122 | | - /** @var SubmitButton $cancelButton */ |
123 | | - $cancelButton = $form->get('actions')->get('cancel'); |
124 | | - if ($cancelButton->isClicked()) { |
125 | | - $this->getWikiService()->removeLock($user, $filePath); |
126 | | - |
127 | | - return $this->redirect($this->generateUrl('ddr_gitki_file', ['path' => $filePath])); |
128 | | - } |
129 | | - |
130 | 103 | if ($form->isValid()) { |
131 | 104 | $content = $form->get('content')->getData(); |
132 | 105 | $commitMessage = $form->get('commitMessage')->getData(); |
|
0 commit comments