aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNumEricR <eric.github@gmail.com>2013-08-27 16:02:25 +0200
committerNumEricR <eric.github@gmail.com>2013-08-27 16:03:50 +0200
commit3eb049036e601c1978cf5f7f0d5be8c577933b72 (patch)
tree9a8504d70de6b69d18f4d44de88ad4a304a089e6
parent093f1efb213ce43e76ad7416eef347c80d8b0e17 (diff)
downloadwallabag-3eb049036e601c1978cf5f7f0d5be8c577933b72.tar.gz
wallabag-3eb049036e601c1978cf5f7f0d5be8c577933b72.tar.zst
wallabag-3eb049036e601c1978cf5f7f0d5be8c577933b72.zip
Add warning message when there is no entry in current view
-rw-r--r--inc/poche/Poche.class.php14
-rw-r--r--tpl/home.twig8
2 files changed, 15 insertions, 7 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 57e8b7b3..a8f64151 100644
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -259,13 +259,17 @@ class Poche
259 break; 259 break;
260 default: # home, favorites and archive views 260 default: # home, favorites and archive views
261 $entries = $this->store->getEntriesByView($view, $this->user->getId()); 261 $entries = $this->store->getEntriesByView($view, $this->user->getId());
262 $this->pagination->set_total(count($entries));
263 $page_links = $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&');
264 $datas = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit());
265 $tpl_vars = array( 262 $tpl_vars = array(
266 'entries' => $datas, 263 'entries' => '',
267 'page_links' => $page_links, 264 'page_links' => '',
268 ); 265 );
266 if (count($entries) > 0) {
267 $this->pagination->set_total(count($entries));
268 $page_links = $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&');
269 $datas = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit());
270 $tpl_vars['entries'] = $datas;
271 $tpl_vars['page_links'] = $page_links;
272 }
269 Tools::logm('display ' . $view . ' view'); 273 Tools::logm('display ' . $view . ' view');
270 break; 274 break;
271 } 275 }
diff --git a/tpl/home.twig b/tpl/home.twig
index 6b80c6ed..f51c34f2 100644
--- a/tpl/home.twig
+++ b/tpl/home.twig
@@ -19,7 +19,10 @@
19{% endblock %} 19{% endblock %}
20{% block content %} 20{% block content %}
21 {{ page_links | raw }} 21 {{ page_links | raw }}
22 {% for entry in entries %} 22 {% if entries is empty %}
23 <div class="messages warning"><p>{% trans "No link available here!" %}</p></div>
24 {% else %}
25 {% for entry in entries %}
23 <div id="entry-{{ entry.id|e }}" class="entrie"> 26 <div id="entry-{{ entry.id|e }}" class="entrie">
24 <h2><a href="index.php?view=view&amp;id={{ entry.id|e }}">{{ entry.title|raw }}</a></h2> 27 <h2><a href="index.php?view=view&amp;id={{ entry.id|e }}">{{ entry.title|raw }}</a></h2>
25 <ul class="tools"> 28 <ul class="tools">
@@ -31,6 +34,7 @@
31 <p>{{ entry.content|striptags|slice(0, 300) }}...</p> 34 <p>{{ entry.content|striptags|slice(0, 300) }}...</p>
32 <p class="vieworiginal txtright small"><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}">{{ entry.url | e | getDomain }}</a></p> 35 <p class="vieworiginal txtright small"><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}">{{ entry.url | e | getDomain }}</a></p>
33 </div> 36 </div>
34 {% endfor %} 37 {% endfor %}
38 {% endif %}
35 {{ page_links | raw }} 39 {{ page_links | raw }}
36{% endblock %} \ No newline at end of file 40{% endblock %} \ No newline at end of file