diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2015-08-12 10:14:44 +0200 |
---|---|---|
committer | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2015-08-12 10:14:44 +0200 |
commit | 496f21e6faed1d06623221dabb35d1f3ce8fc8c2 (patch) | |
tree | 8920beb5cfac2ffbfe11e1852a9d814338646b33 /src/Wallabag | |
parent | 930334cd6d486843b536412391a549815efd038e (diff) | |
parent | 053b9568b2e3d032720d405bc1c2b71eccb36714 (diff) | |
download | wallabag-496f21e6faed1d06623221dabb35d1f3ce8fc8c2.tar.gz wallabag-496f21e6faed1d06623221dabb35d1f3ce8fc8c2.tar.zst wallabag-496f21e6faed1d06623221dabb35d1f3ce8fc8c2.zip |
Merge pull request #1319 from wallabag/v2-form-header
add new post form in material header
Diffstat (limited to 'src/Wallabag')
10 files changed, 66 insertions, 52 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 8894690c..6944a686 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -18,11 +18,11 @@ class EntryController extends Controller | |||
18 | /** | 18 | /** |
19 | * @param Request $request | 19 | * @param Request $request |
20 | * | 20 | * |
21 | * @Route("/new", name="new_entry") | 21 | * @Route("/new-entry", name="new_entry") |
22 | * | 22 | * |
23 | * @return \Symfony\Component\HttpFoundation\Response | 23 | * @return \Symfony\Component\HttpFoundation\Response |
24 | */ | 24 | */ |
25 | public function addEntryAction(Request $request) | 25 | public function addEntryFormAction(Request $request) |
26 | { | 26 | { |
27 | $entry = new Entry($this->getUser()); | 27 | $entry = new Entry($this->getUser()); |
28 | 28 | ||
@@ -48,12 +48,24 @@ class EntryController extends Controller | |||
48 | return $this->redirect($this->generateUrl('homepage')); | 48 | return $this->redirect($this->generateUrl('homepage')); |
49 | } | 49 | } |
50 | 50 | ||
51 | return $this->render('WallabagCoreBundle:Entry:new.html.twig', array( | 51 | return $this->render('WallabagCoreBundle:Entry:new_form.html.twig', array( |
52 | 'form' => $form->createView(), | 52 | 'form' => $form->createView(), |
53 | )); | 53 | )); |
54 | } | 54 | } |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * @param Request $request | ||
58 | * | ||
59 | * @Route("/new", name="new") | ||
60 | * | ||
61 | * @return \Symfony\Component\HttpFoundation\Response | ||
62 | */ | ||
63 | public function addEntryAction(Request $request) | ||
64 | { | ||
65 | return $this->render('WallabagCoreBundle:Entry:new.html.twig'); | ||
66 | } | ||
67 | |||
68 | /** | ||
57 | * Edit an entry content. | 69 | * Edit an entry content. |
58 | * | 70 | * |
59 | * @param Request $request | 71 | * @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); |