From 053b9568b2e3d032720d405bc1c2b71eccb36714 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 12 Aug 2015 08:22:30 +0200 Subject: [PATCH] add new post form in material header --- .../CoreBundle/Controller/EntryController.php | 18 ++++++++-- .../Resources/views/Entry/new.html.twig | 2 +- .../Resources/views/Entry/new_form.html.twig | 15 ++++++++ .../Resources/views/Static/howto.html.twig | 2 +- .../CoreBundle/Resources/views/base.html.twig | 2 +- .../views/themes/material/Entry/new.html.twig | 35 +------------------ .../themes/material/Entry/new_form.html.twig | 14 ++++++++ .../themes/material/Static/howto.html.twig | 2 +- .../views/themes/material/layout.html.twig | 9 +++-- .../views/themes/material/public/js/init.js | 19 +++++----- 10 files changed, 66 insertions(+), 52 deletions(-) create mode 100644 src/Wallabag/CoreBundle/Resources/views/Entry/new_form.html.twig create mode 100644 src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new_form.html.twig diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 29e0ffb0..ef686ff1 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -15,11 +15,11 @@ class EntryController extends Controller /** * @param Request $request * - * @Route("/new", name="new_entry") + * @Route("/new-entry", name="new_entry") * * @return \Symfony\Component\HttpFoundation\Response */ - public function addEntryAction(Request $request) + public function addEntryFormAction(Request $request) { $entry = new Entry($this->getUser()); @@ -45,11 +45,23 @@ class EntryController extends Controller return $this->redirect($this->generateUrl('homepage')); } - return $this->render('WallabagCoreBundle:Entry:new.html.twig', array( + return $this->render('WallabagCoreBundle:Entry:new_form.html.twig', array( 'form' => $form->createView(), )); } + /** + * @param Request $request + * + * @Route("/new", name="new") + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function addEntryAction(Request $request) + { + return $this->render('WallabagCoreBundle:Entry:new.html.twig'); + } + /** * Edit an entry content. * diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/new.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/new.html.twig index b11512a4..95ed0785 100644 --- a/src/Wallabag/CoreBundle/Resources/views/Entry/new.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/Entry/new.html.twig @@ -3,5 +3,5 @@ {% block title %}{% trans %}Save new entry{% endtrans %}{% endblock %} {% block content %} - {{ form(form) }} + {{ render(controller( "WallabagCoreBundle:Entry:addEntryForm" )) }} {% endblock %} diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/new_form.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/new_form.html.twig new file mode 100644 index 00000000..d182d552 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/Entry/new_form.html.twig @@ -0,0 +1,15 @@ +
+ + {% if form_errors(form) %} + {{ form_errors(form) }} + {% endif %} + + {% if form_errors(form.url) %} + {{ form_errors(form.url) }} + {% endif %} + + {{ form_label(form.url) }} + {{ form_widget(form.url) }} + + +
diff --git a/src/Wallabag/CoreBundle/Resources/views/Static/howto.html.twig b/src/Wallabag/CoreBundle/Resources/views/Static/howto.html.twig index c69c03c3..58cb316b 100644 --- a/src/Wallabag/CoreBundle/Resources/views/Static/howto.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/Static/howto.html.twig @@ -7,7 +7,7 @@

{% trans %}There are several ways to save an article:{% endtrans %}

{% trans %}Browser Addons{% endtrans %}