]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Add warning message when there is no entry in current view 191/head
authorNumEricR <eric.github@gmail.com>
Tue, 27 Aug 2013 14:02:25 +0000 (16:02 +0200)
committerNumEricR <eric.github@gmail.com>
Tue, 27 Aug 2013 14:03:50 +0000 (16:03 +0200)
inc/poche/Poche.class.php
tpl/home.twig

index 57e8b7b3576acc4d8d7373c246e3c93fc882df5e..a8f64151d59aecaa67922fdd6dc00ff6776ca9d6 100644 (file)
@@ -259,13 +259,17 @@ class Poche
                 break;
             default: # home, favorites and archive views
                 $entries = $this->store->getEntriesByView($view, $this->user->getId());
-                $this->pagination->set_total(count($entries));
-                $page_links = $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&');
-                $datas = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit());
                 $tpl_vars = array(
-                    'entries' => $datas,
-                    'page_links' => $page_links,
+                    'entries' => '',
+                    'page_links' => '',
                 );
+                if (count($entries) > 0) {
+                    $this->pagination->set_total(count($entries));
+                    $page_links = $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&');
+                    $datas = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit());
+                    $tpl_vars['entries'] = $datas;
+                    $tpl_vars['page_links'] = $page_links;
+                }
                 Tools::logm('display ' . $view . ' view');
                 break;
         }
index 6b80c6ede2d9f4d2803d902ed519b49fdc576737..f51c34f235d5ab91e80f250d2b44fc899e8fe3d1 100644 (file)
 {% endblock %}
 {% block content %}
             {{ page_links | raw }}
-            {% for entry in entries %}
+            {% if entries is empty %}
+            <div class="messages warning"><p>{% trans "No link available here!" %}</p></div>
+            {% else %}
+                {% for entry in entries %}
             <div id="entry-{{ entry.id|e }}" class="entrie">
                 <h2><a href="index.php?view=view&amp;id={{ entry.id|e }}">{{ entry.title|raw }}</a></h2>
                 <ul class="tools">
@@ -31,6 +34,7 @@
                 <p>{{ entry.content|striptags|slice(0, 300) }}...</p>
                 <p class="vieworiginal txtright small"><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}">{{ entry.url | e | getDomain }}</a></p>
             </div>
-            {% endfor %}
+                {% endfor %}
+            {% endif %}
             {{ page_links | raw }}
 {% endblock %}
\ No newline at end of file