diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-08-12 08:22:30 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@smile.fr> | 2015-08-12 09:52:36 +0200 |
commit | 053b9568b2e3d032720d405bc1c2b71eccb36714 (patch) | |
tree | 1bd4241ce05c42d924f0baf34a3d1872ef6a7a4f | |
parent | fedaf005377e6d62ff0986f7f54afef3287a6451 (diff) | |
download | wallabag-053b9568b2e3d032720d405bc1c2b71eccb36714.tar.gz wallabag-053b9568b2e3d032720d405bc1c2b71eccb36714.tar.zst wallabag-053b9568b2e3d032720d405bc1c2b71eccb36714.zip |
add new post form in material header
10 files changed, 66 insertions, 52 deletions
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 | |||
15 | /** | 15 | /** |
16 | * @param Request $request | 16 | * @param Request $request |
17 | * | 17 | * |
18 | * @Route("/new", name="new_entry") | 18 | * @Route("/new-entry", name="new_entry") |
19 | * | 19 | * |
20 | * @return \Symfony\Component\HttpFoundation\Response | 20 | * @return \Symfony\Component\HttpFoundation\Response |
21 | */ | 21 | */ |
22 | public function addEntryAction(Request $request) | 22 | public function addEntryFormAction(Request $request) |
23 | { | 23 | { |
24 | $entry = new Entry($this->getUser()); | 24 | $entry = new Entry($this->getUser()); |
25 | 25 | ||
@@ -45,12 +45,24 @@ class EntryController extends Controller | |||
45 | return $this->redirect($this->generateUrl('homepage')); | 45 | return $this->redirect($this->generateUrl('homepage')); |
46 | } | 46 | } |
47 | 47 | ||
48 | return $this->render('WallabagCoreBundle:Entry:new.html.twig', array( | 48 | return $this->render('WallabagCoreBundle:Entry:new_form.html.twig', array( |
49 | 'form' => $form->createView(), | 49 | 'form' => $form->createView(), |
50 | )); | 50 | )); |
51 | } | 51 | } |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * @param Request $request | ||
55 | * | ||
56 | * @Route("/new", name="new") | ||
57 | * | ||
58 | * @return \Symfony\Component\HttpFoundation\Response | ||
59 | */ | ||
60 | public function addEntryAction(Request $request) | ||
61 | { | ||
62 | return $this->render('WallabagCoreBundle:Entry:new.html.twig'); | ||
63 | } | ||
64 | |||
65 | /** | ||
54 | * Edit an entry content. | 66 | * Edit an entry content. |
55 | * | 67 | * |
56 | * @param Request $request | 68 | * @param Request $request |
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 @@ | |||
3 | {% block title %}{% trans %}Save new entry{% endtrans %}{% endblock %} | 3 | {% block title %}{% trans %}Save new entry{% endtrans %}{% endblock %} |
4 | 4 | ||
5 | {% block content %} | 5 | {% block content %} |
6 | {{ form(form) }} | 6 | {{ render(controller( "WallabagCoreBundle:Entry:addEntryForm" )) }} |
7 | {% endblock %} | 7 | {% 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 @@ | |||
1 | <form name="entry" method="post" action="{{ path('new_entry')}}"> | ||
2 | |||
3 | {% if form_errors(form) %} | ||
4 | <span class="black-text">{{ form_errors(form) }}</span> | ||
5 | {% endif %} | ||
6 | |||
7 | {% if form_errors(form.url) %} | ||
8 | <span class="black-text">{{ form_errors(form.url) }}</span> | ||
9 | {% endif %} | ||
10 | |||
11 | {{ form_label(form.url) }} | ||
12 | {{ form_widget(form.url) }} | ||
13 | |||
14 | <div class="hidden">{{ form_rest(form) }}</div> | ||
15 | </form> | ||
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 @@ | |||
7 | 7 | ||
8 | <p>{% trans %}There are several ways to save an article:{% endtrans %}</p> | 8 | <p>{% trans %}There are several ways to save an article:{% endtrans %}</p> |
9 | <ul> | 9 | <ul> |
10 | <li><a href="{{ path('new_entry') }}">{% trans %}Thanks to this form{% endtrans %}</a></li> | 10 | <li><a href="{{ path('new') }}">{% trans %}Thanks to this form{% endtrans %}</a></li> |
11 | </ul> | 11 | </ul> |
12 | <h3>{% trans %}Browser Addons{% endtrans %}</h3> | 12 | <h3>{% trans %}Browser Addons{% endtrans %}</h3> |
13 | <ul> | 13 | <ul> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/base.html.twig b/src/Wallabag/CoreBundle/Resources/views/base.html.twig index 162fb463..c381a08c 100644 --- a/src/Wallabag/CoreBundle/Resources/views/base.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/base.html.twig | |||
@@ -72,7 +72,7 @@ | |||
72 | <li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li> | 72 | <li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li> |
73 | <li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li> | 73 | <li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li> |
74 | <li><a href="{{ path ('tag') }}">{% trans %}tags{% endtrans %}</a></li> | 74 | <li><a href="{{ path ('tag') }}">{% trans %}tags{% endtrans %}</a></li> |
75 | <li><a href="{{ path('new_entry') }}">{% trans %}save a link{% endtrans %}</a></li> | 75 | <li><a href="{{ path('new') }}">{% trans %}save a link{% endtrans %}</a></li> |
76 | <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a> | 76 | <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a> |
77 | <div id="search-form" class="messages info popup-form"> | 77 | <div id="search-form" class="messages info popup-form"> |
78 | <form method="get" action="index.php"> | 78 | <form method="get" action="index.php"> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new.html.twig index cac9a96b..95ed0785 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new.html.twig | |||
@@ -3,38 +3,5 @@ | |||
3 | {% block title %}{% trans %}Save new entry{% endtrans %}{% endblock %} | 3 | {% block title %}{% trans %}Save new entry{% endtrans %}{% endblock %} |
4 | 4 | ||
5 | {% block content %} | 5 | {% block content %} |
6 | <div class="row"> | 6 | {{ render(controller( "WallabagCoreBundle:Entry:addEntryForm" )) }} |
7 | <div class="col s12"> | ||
8 | <div class="card-panel"> | ||
9 | |||
10 | <form name="entry" method="post" action=""> | ||
11 | <div class="card-content"> | ||
12 | |||
13 | {% if form_errors(form) %} | ||
14 | <span class="black-text">{{ form_errors(form) }}</span> | ||
15 | {% endif %} | ||
16 | |||
17 | {% if form_errors(form.url) %} | ||
18 | <span class="black-text">{{ form_errors(form.url) }}</span> | ||
19 | {% endif %} | ||
20 | |||
21 | <div class="input-field s12"> | ||
22 | {{ form_label(form.url) }} | ||
23 | {{ form_widget(form.url) }} | ||
24 | </div> | ||
25 | |||
26 | <button class="btn waves-effect waves-light" type="submit" name="entry[save]"> | ||
27 | {% trans %}Save{% endtrans %} | ||
28 | <i class="mdi-content-send right"></i> | ||
29 | </button> | ||
30 | </div> | ||
31 | <div class="hidden">{{ form_rest(form) }}</div> | ||
32 | </form> | ||
33 | |||
34 | |||
35 | {{ form(form) }} | ||
36 | |||
37 | </div> | ||
38 | </div> | ||
39 | </div> | ||
40 | {% endblock %} | 7 | {% 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 index 00000000..1a3ab86d --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new_form.html.twig | |||
@@ -0,0 +1,14 @@ | |||
1 | <form name="entry" method="post" action="{{ path('new_entry')}}"> | ||
2 | |||
3 | {% if form_errors(form) %} | ||
4 | <span class="black-text">{{ form_errors(form) }}</span> | ||
5 | {% endif %} | ||
6 | |||
7 | {% if form_errors(form.url) %} | ||
8 | <span class="black-text">{{ form_errors(form.url) }}</span> | ||
9 | {% endif %} | ||
10 | |||
11 | {{ form_widget(form.url) }} | ||
12 | |||
13 | <div class="hidden">{{ form_rest(form) }}</div> | ||
14 | </form> | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/howto.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/howto.html.twig index a0a02cc8..6f98ba99 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/howto.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/howto.html.twig | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | 21 | ||
22 | <div id="set1" class="col s12"> | 22 | <div id="set1" class="col s12"> |
23 | <a href="{{ path('new_entry') }}">{% trans %}Thanks to this form{% endtrans %}</a> | 23 | <a href="{{ path('new') }}">{% trans %}Thanks to this form{% endtrans %}</a> |
24 | </div> | 24 | </div> |
25 | 25 | ||
26 | 26 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig index 2b32c2f9..5a1f7001 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig | |||
@@ -58,7 +58,7 @@ | |||
58 | </div> | 58 | </div> |
59 | <div class="input-field nav-panel-buttom"> | 59 | <div class="input-field nav-panel-buttom"> |
60 | <ul> | 60 | <ul> |
61 | <li class="bold"><a class="waves-effect" href="{{ path('new_entry') }}" id="nav-btn-add"><i class="mdi-content-add"></i></a></li> | 61 | <li class="bold"><a class="waves-effect" href="{{ path('new') }}" id="nav-btn-add"><i class="mdi-content-add"></i></a></li> |
62 | <li><a class="waves-effect" href="javascript: void(null);" id="nav-btn-search"><i class="mdi-action-search"></i></a> | 62 | <li><a class="waves-effect" href="javascript: void(null);" id="nav-btn-search"><i class="mdi-action-search"></i></a> |
63 | </ul> | 63 | </ul> |
64 | </div> | 64 | </div> |
@@ -69,6 +69,11 @@ | |||
69 | <i class="mdi-navigation-close"></i> | 69 | <i class="mdi-navigation-close"></i> |
70 | </div> | 70 | </div> |
71 | </form> | 71 | </form> |
72 | <div class="input-field nav-panel-add" style="display: none"> | ||
73 | {{ render(controller( "WallabagCoreBundle:Entry:addEntryForm" )) }} | ||
74 | <label for="add"><i class="mdi-content-add"></i></label> | ||
75 | <i class="mdi-navigation-close"></i> | ||
76 | </div> | ||
72 | <!--<form name="entry" method="post" action="{{ path('new_entry') }}"> | 77 | <!--<form name="entry" method="post" action="{{ path('new_entry') }}"> |
73 | <div class="input-field nav-panel-add" style="display: none"> | 78 | <div class="input-field nav-panel-add" style="display: none"> |
74 | <input id="add entry_url" name="entry[url]" type="search" required placeholder="{% trans %}Enter your link here{% endtrans %}"> | 79 | <input id="add entry_url" name="entry[url]" type="search" required placeholder="{% trans %}Enter your link here{% endtrans %}"> |
@@ -113,4 +118,4 @@ | |||
113 | </div> | 118 | </div> |
114 | </div> | 119 | </div> |
115 | </footer> | 120 | </footer> |
116 | {% endblock %} \ No newline at end of file | 121 | {% endblock %} |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js b/src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js index fdfda380..9341cb5a 100755 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js | |||
@@ -6,15 +6,16 @@ $(document).ready(function(){ | |||
6 | accordion : false | 6 | accordion : false |
7 | }); | 7 | }); |
8 | 8 | ||
9 | //$('#nav-btn-add').click(function(){ | 9 | $('#nav-btn-add').click(function(){ |
10 | // $(".nav-panel-buttom").hide(100); | 10 | $(".nav-panel-buttom").hide(100); |
11 | // $(".nav-panel-add").show(100); | 11 | $(".nav-panel-add").show(100); |
12 | // $(".nav-panel-menu").hide(100); | 12 | $(".nav-panel-menu").hide(100); |
13 | // $(".nav-panels .action").hide(100); | 13 | $(".nav-panels .action").hide(100); |
14 | // $(".nav-panel-menu").addClass('hidden'); | 14 | $(".nav-panel-menu").addClass('hidden'); |
15 | // $(".nav-panels").css('background', 'white'); | 15 | $(".nav-panels").css('background', 'white'); |
16 | // return false; | 16 | $("#entry_url").focus(); |
17 | //}); | 17 | return false; |
18 | }); | ||
18 | $('#nav-btn-search').click(function(){ | 19 | $('#nav-btn-search').click(function(){ |
19 | $(".nav-panel-buttom").hide(100); | 20 | $(".nav-panel-buttom").hide(100); |
20 | $(".nav-panel-search").show(100); | 21 | $(".nav-panel-search").show(100); |