Add warning message when there is no entry in current view

This commit is contained in:
NumEricR 2013-08-27 16:02:25 +02:00
parent 093f1efb21
commit 3eb049036e
2 changed files with 15 additions and 7 deletions

View file

@ -259,13 +259,17 @@ class Poche
break;
default: # home, favorites and archive views
$entries = $this->store->getEntriesByView($view, $this->user->getId());
$tpl_vars = array(
'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 = array(
'entries' => $datas,
'page_links' => $page_links,
);
$tpl_vars['entries'] = $datas;
$tpl_vars['page_links'] = $page_links;
}
Tools::logm('display ' . $view . ' view');
break;
}

View file

@ -19,6 +19,9 @@
{% endblock %}
{% block content %}
{{ page_links | raw }}
{% 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>
@ -32,5 +35,6 @@
<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 %}
{% endif %}
{{ page_links | raw }}
{% endblock %}