]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
add new post form in material header 1319/head
authorNicolas Lœuillet <nicolas@loeuillet.org>
Wed, 12 Aug 2015 06:22:30 +0000 (08:22 +0200)
committerNicolas Lœuillet <nicolas.loeuillet@smile.fr>
Wed, 12 Aug 2015 07:52:36 +0000 (09:52 +0200)
src/Wallabag/CoreBundle/Controller/EntryController.php
src/Wallabag/CoreBundle/Resources/views/Entry/new.html.twig
src/Wallabag/CoreBundle/Resources/views/Entry/new_form.html.twig [new file with mode: 0644]
src/Wallabag/CoreBundle/Resources/views/Static/howto.html.twig
src/Wallabag/CoreBundle/Resources/views/base.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new_form.html.twig [new file with mode: 0644]
src/Wallabag/CoreBundle/Resources/views/themes/material/Static/howto.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js

index 29e0ffb0d9e37c1882ad8f5873c047434d8914e2..ef686ff1b7977a787486d6926ef1c4807c14b22b 100644 (file)
@@ -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.
      *
index b11512a4032639302da69a22d40c5f2fde853fcb..95ed0785231afa2a384e0281b3b2ff2253e2ed16 100644 (file)
@@ -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 (file)
index 0000000..d182d55
--- /dev/null
@@ -0,0 +1,15 @@
+<form name="entry" method="post" action="{{ path('new_entry')}}">
+
+        {% if form_errors(form) %}
+            <span class="black-text">{{ form_errors(form) }}</span>
+        {% endif %}
+
+        {% if form_errors(form.url) %}
+            <span class="black-text">{{ form_errors(form.url) }}</span>
+        {% endif %}
+
+        {{ form_label(form.url) }}
+        {{ form_widget(form.url) }}
+
+    <div class="hidden">{{ form_rest(form) }}</div>
+</form>
index c69c03c32e8b3defe6d28e1450f9487567c85e0a..58cb316b16958ec5eef2ac592050c6ac4c331627 100644 (file)
@@ -7,7 +7,7 @@
 
     <p>{% trans %}There are several ways to save an article:{% endtrans %}</p>
     <ul>
-        <li><a href="{{ path('new_entry') }}">{% trans %}Thanks to this form{% endtrans %}</a></li>
+        <li><a href="{{ path('new') }}">{% trans %}Thanks to this form{% endtrans %}</a></li>
     </ul>
     <h3>{% trans %}Browser Addons{% endtrans %}</h3>
     <ul>
index 162fb463dbb5e3560d25537a14604cfdcd04885c..c381a08c6d91fd3c9c05ab9a872756e99ba6fae2 100644 (file)
@@ -72,7 +72,7 @@
                     <li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li>
                     <li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li>
                     <li><a href="{{ path ('tag') }}">{% trans %}tags{% endtrans %}</a></li>
-                    <li><a href="{{ path('new_entry') }}">{% trans %}save a link{% endtrans %}</a></li>
+                    <li><a href="{{ path('new') }}">{% trans %}save a link{% endtrans %}</a></li>
                     <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a>
                         <div id="search-form" class="messages info popup-form">
                             <form method="get" action="index.php">
index cac9a96b1d825143ce4388412154efdba74d7032..95ed0785231afa2a384e0281b3b2ff2253e2ed16 100644 (file)
@@ -3,38 +3,5 @@
 {% block title %}{% trans %}Save new entry{% endtrans %}{% endblock %}
 
 {% block content %}
-    <div class="row">
-        <div class="col s12">
-            <div class="card-panel">
-
-                <form name="entry" method="post" action="">
-                    <div class="card-content">
-
-                        {% if form_errors(form) %}
-                            <span class="black-text">{{ form_errors(form) }}</span>
-                        {% endif %}
-
-                        {% if form_errors(form.url) %}
-                            <span class="black-text">{{ form_errors(form.url) }}</span>
-                        {% endif %}
-
-                        <div class="input-field s12">
-                            {{ form_label(form.url) }}
-                            {{ form_widget(form.url) }}
-                        </div>
-
-                        <button class="btn waves-effect waves-light" type="submit" name="entry[save]">
-                            {% trans %}Save{% endtrans %}
-                            <i class="mdi-content-send right"></i>
-                        </button>
-                    </div>
-                    <div class="hidden">{{ form_rest(form) }}</div>
-                </form>
-
-
-                {{ form(form) }}
-
-            </div>
-        </div>
-    </div>
+    {{ render(controller( "WallabagCoreBundle:Entry:addEntryForm" )) }}
 {% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new_form.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new_form.html.twig
new file mode 100644 (file)
index 0000000..1a3ab86
--- /dev/null
@@ -0,0 +1,14 @@
+<form name="entry" method="post" action="{{ path('new_entry')}}">
+
+        {% if form_errors(form) %}
+            <span class="black-text">{{ form_errors(form) }}</span>
+        {% endif %}
+
+        {% if form_errors(form.url) %}
+            <span class="black-text">{{ form_errors(form.url) }}</span>
+        {% endif %}
+
+        {{ form_widget(form.url) }}
+
+    <div class="hidden">{{ form_rest(form) }}</div>
+</form>
index a0a02cc8de7aa990b3824d2fc90327c28fe04cfc..6f98ba993e41bea0a0df2ee2fcc0b1df99b2ee41 100644 (file)
@@ -20,7 +20,7 @@
 
 
                     <div id="set1" class="col s12">
-                        <a href="{{ path('new_entry') }}">{% trans %}Thanks to this form{% endtrans %}</a>
+                        <a href="{{ path('new') }}">{% trans %}Thanks to this form{% endtrans %}</a>
                     </div>
 
 
index 2b32c2f9d92796a72fc6edff7bf7ac67e2e371ec..5a1f7001336700093b2369d0977e1cfe2bb449dc 100644 (file)
@@ -58,7 +58,7 @@
             </div>
             <div class="input-field nav-panel-buttom">
                 <ul>
-                    <li class="bold"><a class="waves-effect" href="{{ path('new_entry') }}" id="nav-btn-add"><i class="mdi-content-add"></i></a></li>
+                    <li class="bold"><a class="waves-effect" href="{{ path('new') }}" id="nav-btn-add"><i class="mdi-content-add"></i></a></li>
                     <li><a class="waves-effect" href="javascript: void(null);" id="nav-btn-search"><i class="mdi-action-search"></i></a>
                 </ul>
             </div>
                     <i class="mdi-navigation-close"></i>
                 </div>
             </form>
+            <div class="input-field nav-panel-add" style="display: none">
+                {{ render(controller( "WallabagCoreBundle:Entry:addEntryForm" )) }}
+                <label for="add"><i class="mdi-content-add"></i></label>
+                <i class="mdi-navigation-close"></i>
+            </div>
             <!--<form name="entry" method="post" action="{{ path('new_entry') }}">
                 <div class="input-field nav-panel-add" style="display: none">
                     <input id="add entry_url" name="entry[url]" type="search" required placeholder="{% trans %}Enter your link here{% endtrans %}">
             </div>
         </div>
     </footer>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
index fdfda3806a8d50e24ca9e4368fa8c0ac58faaaf3..9341cb5aa8bdd53b9e527ba180d38f1de5cb3270 100755 (executable)
@@ -6,15 +6,16 @@ $(document).ready(function(){
         accordion : false
     });
 
-    //$('#nav-btn-add').click(function(){
-    //    $(".nav-panel-buttom").hide(100);
-    //    $(".nav-panel-add").show(100);
-    //    $(".nav-panel-menu").hide(100);
-    //    $(".nav-panels .action").hide(100);
-    //    $(".nav-panel-menu").addClass('hidden');
-    //    $(".nav-panels").css('background', 'white');
-    //    return false;
-    //});
+    $('#nav-btn-add').click(function(){
+       $(".nav-panel-buttom").hide(100);
+       $(".nav-panel-add").show(100);
+       $(".nav-panel-menu").hide(100);
+       $(".nav-panels .action").hide(100);
+       $(".nav-panel-menu").addClass('hidden');
+       $(".nav-panels").css('background', 'white');
+       $("#entry_url").focus();
+       return false;
+    });
     $('#nav-btn-search').click(function(){
         $(".nav-panel-buttom").hide(100);
         $(".nav-panel-search").show(100);