From 7f9f5281e5fe6dd92c810f7945c7761ca17fd2e6 Mon Sep 17 00:00:00 2001 From: NumEricR Date: Wed, 28 Aug 2013 19:12:11 +0200 Subject: [PATCH 1/4] Add number of results next to pager --- inc/poche/Poche.class.php | 2 ++ tpl/css/style.css | 21 ++++++++++++++++++--- tpl/home.twig | 11 +++++++++-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index a8f6415..89e94a3 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -262,6 +262,7 @@ class Poche $tpl_vars = array( 'entries' => '', 'page_links' => '', + 'nb_results' => '', ); if (count($entries) > 0) { $this->pagination->set_total(count($entries)); @@ -269,6 +270,7 @@ class Poche $datas = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit()); $tpl_vars['entries'] = $datas; $tpl_vars['page_links'] = $page_links; + $tpl_vars['nb_results'] = count($entries); } Tools::logm('display ' . $view . ' view'); break; diff --git a/tpl/css/style.css b/tpl/css/style.css index 7633534..f07072a 100644 --- a/tpl/css/style.css +++ b/tpl/css/style.css @@ -98,6 +98,10 @@ a, a:hover, a:visited { #main #content .entrie { border-bottom: 1px dashed #222; } +/* First entry */ +#main #content .results + .entrie { + clear: both; +} #main .entrie .tools { list-style-type: none; @@ -189,11 +193,22 @@ a, a:hover, a:visited { } -/* Pagination */ -.pagination { - clear: both; +.results { + overflow: hidden; padding-bottom: 20px; padding-top: 10px; +} + +.nb-results { + float: left; + font-size: 0.9em; + line-height: 24px; + vertical-align: middle; +} + +/* Pagination */ +.pagination { + float: right; text-align: right; } .pagination a { diff --git a/tpl/home.twig b/tpl/home.twig index f51c34f..db4e088 100644 --- a/tpl/home.twig +++ b/tpl/home.twig @@ -18,10 +18,17 @@ {% endblock %} {% block content %} - {{ page_links | raw }} {% if entries is empty %}

{% trans "No link available here!" %}

{% else %} + {% block pager %} + {% if nb_results > 1 %} +
+
{{ nb_results }} {% trans "results" %}
+ {{ page_links | raw }} +
+ {% endif %} + {% endblock %} {% for entry in entries %}

{{ entry.title|raw }}

@@ -36,5 +43,5 @@
{% endfor %} {% endif %} - {{ page_links | raw }} + {{ block('pager') }} {% endblock %} \ No newline at end of file From 876bb3af42b1628e162492bcd95939e32ce1a661 Mon Sep 17 00:00:00 2001 From: NumEricR Date: Fri, 30 Aug 2013 15:31:33 +0200 Subject: [PATCH 2/4] Remove on login and home views useless link "back to home" --- tpl/_top.twig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tpl/_top.twig b/tpl/_top.twig index ae01cc3..dc20081 100644 --- a/tpl/_top.twig +++ b/tpl/_top.twig @@ -1,3 +1,7 @@
-

logo poche

+

+ {% if view == 'home' %}{% block logo %}logo poche{% endblock %} + {% else %}{{ block('logo') }} + {% endif %} +

\ No newline at end of file From 08a12b6dbbbdff54ffd93c6c8ed3608f0c99e34e Mon Sep 17 00:00:00 2001 From: NumEricR Date: Thu, 5 Sep 2013 22:01:15 +0200 Subject: [PATCH 3/4] Hide disabled pagination links --- tpl/css/style.css | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tpl/css/style.css b/tpl/css/style.css index 7633534..5aca9ae 100644 --- a/tpl/css/style.css +++ b/tpl/css/style.css @@ -221,12 +221,7 @@ a, a:hover, a:visited { margin: 2px; } .pagination .disabled { - border: 1px solid #eee; - color: #ddd; - margin: 2px; - padding: 4px 8px; - font-size: 11px; - font-weight: bold; + display: none; } #bookmarklet { From 2edde7fe337a8502ee5d37ae0b76f76295864b7c Mon Sep 17 00:00:00 2001 From: NumEricR Date: Thu, 5 Sep 2013 22:16:36 +0200 Subject: [PATCH 4/4] Display sort links only if there is at least 2 articles in current list --- tpl/home.twig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tpl/home.twig b/tpl/home.twig index f51c34f..f44e040 100644 --- a/tpl/home.twig +++ b/tpl/home.twig @@ -12,10 +12,12 @@ {% include '_menu.twig' %} {% endblock %} {% block precontent %} + {% if entries|length > 1 %}
  • {% trans {% trans "by date" %} {% trans
  • {% trans {% trans "by title" %} {% trans
+ {% endif %} {% endblock %} {% block content %} {{ page_links | raw }}