Add ability to mark all articles from a tag as read

This commit is contained in:
Travis Burtrum 2015-01-12 19:52:41 -05:00
parent 7667694cc8
commit 4b5c8a61f5
4 changed files with 21 additions and 2 deletions

View File

@ -240,8 +240,21 @@ class Poche
}
break;
case 'toggle_archive' :
$this->store->archiveById($id, $this->user->getId());
Tools::logm('archive link #' . $id);
if (isset($_GET['tag_id'])) {
//when we want to archive a whole tag
$tag_id = $_GET['tag_id'];
$allentry_ids = $this->store->retrieveEntriesByTag($tag_id, $this->user->getId());
$entry_ids = array();
foreach ($allentry_ids as $eachentry) {
$entry_ids[] = $eachentry[0];
}
} else { //archive a single article
$entry_ids = array($id);
}
foreach($entry_ids as $id) {
$this->store->archiveById($id, $this->user->getId());
Tools::logm('archive link #' . $id);
}
if ( Tools::isAjaxRequest() ) {
echo 1;
exit;

View File

@ -64,6 +64,8 @@
{% if searchterm is defined %}<a title="{% trans "Delete results matching" %} {{ searchterm }}" href="./?action=delete&search={{ searchterm }}">
{% trans "Delete results matching" %} {{ searchterm }}</a>{% endif %}
{% if tag %}<a title="{% trans "Mark all articles from this tag as read" %}" href="./?action=toggle_archive&amp;tag_id={{ tag.id }}">{% trans "Mark all articles from this tag as read" %}</a>{% endif %}
{% if tag %}<p><a title="{% trans "Download the articles from this tag in an epub" %}" href="./?epub&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download the articles from this tag in an epub" %}</p></a>
{% elseif search_term is defined %}<p><a title="{% trans "Download the articles from this search in an epub" %}" href="./?epub&amp;method=search&amp;value={{ search_term }}">{% trans "Download the articles from this search in an epub" %}</p></a>

View File

@ -57,6 +57,8 @@
{% if searchterm is defined %}<a title="{% trans "Delete results matching" %} {{ searchterm }}" href="./?action=delete&search={{ searchterm }}">{% trans "Delete results matching" %} {{ searchterm }}</a>{% endif %}
{% if tag %}<a title="{% trans "Mark all articles from this tag as read" %}" href="./?action=toggle_archive&amp;tag_id={{ tag.id }}">{% trans "Mark all articles from this tag as read" %}</a>{% endif %}
{% if tag %}<a title="{% trans "Download the articles from this tag in an epub" %}" href="./?epub&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download the articles from this tag in an epub" %}</a>
{% elseif searchterm is defined %}<a title="{% trans "Download the articles from this search in an epub" %}" href="./?epub&amp;method=search&amp;value={{ searchterm }}">{% trans "Download the articles from this search in an epub" %}</a>
{% else %}<a title="{% trans "Download the articles from this category in an epub" %}" href="./?epub&amp;method=category&amp;value={{ view }}">{% trans "Download the articles from this category in an epub" %}</a>{% endif %}

View File

@ -66,6 +66,8 @@
{% if searchterm is defined %}<a title="{% trans "Delete results matching" %} {{ searchterm }}" href="./?action=delete&search={{ searchterm }}">
{% trans "Delete results matching" %} {{ searchterm }}</a>{% endif %}
{% if tag %}<a title="{% trans "Mark all articles from this tag as read" %}" href="./?action=toggle_archive&amp;tag_id={{ tag.id }}">{% trans "Mark all articles from this tag as read" %}</a>{% endif %}
{% if tag %}<a title="{% trans "Download the articles from this tag in an epub" %}" href="./?epub&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download the articles from this tag in an epub" %}</a>
{% elseif searchterm is defined %}<a title="{% trans "Download the articles from this search in an epub" %}" href="./?epub&amp;method=search&amp;value={{ searchterm }}">{% trans "Download the articles from this search in an epub" %}</a>
{% else %}<a title="{% trans "Download the articles from this category in an epub" %}" href="./?epub&amp;method=category&amp;value={{ view }}">{% trans "Download the articles from this category in an epub" %}</a>{% endif %}