Add links to mark as read/unread and change some functions names

This commit is contained in:
Frederic Guillot 2013-04-03 21:21:24 -04:00
parent 078c13da2b
commit 038e58dfd6
4 changed files with 42 additions and 25 deletions

View File

@ -23,7 +23,7 @@
}
}
request.open("POST", "?action=status&id=" + item_id, true);
request.open("POST", "?action=change-item-status&id=" + item_id, true);
request.send();
}
@ -37,7 +37,7 @@
remove_item(item_id);
};
request.open("POST", "?action=read&id=" + item_id, true);
request.open("POST", "?action=mark-item-read&id=" + item_id, true);
request.send();
}
@ -46,7 +46,7 @@
{
var request = new XMLHttpRequest();
request.open("POST", "?action=unread&id=" + item_id, true);
request.open("POST", "?action=mark-item-unread&id=" + item_id, true);
request.send();
}
@ -87,7 +87,9 @@
var request = new XMLHttpRequest();
request.onload = function() {
request.onreadystatechange = function() {
if (request.readyState === 4) {
hide_refresh_icon(feed_id);
@ -106,9 +108,10 @@
}
}
catch (e) {}
}
};
request.open("GET", "?action=ajax-refresh-feed&feed_id=" + feed_id, true);
request.open("POST", "?action=refresh-feed&feed_id=" + feed_id, true);
request.send();
return true;

View File

@ -98,27 +98,39 @@ Router\get_action('read', function() {
});
Router\post_action('read', function() {
Router\get_action('mark-item-read', function() {
$id = Request\param('id');
Model\set_item_read($id);
Response\json(array('Ok'));
Response\Redirect('?action=default');
});
Router\post_action('unread', function() {
Router\get_action('mark-item-unread', function() {
$id = Request\param('id');
Model\set_item_unread($id);
Response\Redirect('?action=history');
});
Router\post_action('mark-item-read', function() {
$id = Request\param('id');
Model\set_item_read($id);
Response\json(array('Ok'));
});
Router\post_action('status', function() {
Router\post_action('mark-item-unread', function() {
$id = Request\param('id');
Model\set_item_unread($id);
Response\json(array('Ok'));
});
Router\post_action('change-item-status', function() {
$id = Request\param('id');
@ -179,7 +191,7 @@ Router\get_action('refresh-feed', function() {
});
Router\get_action('ajax-refresh-feed', function() {
Router\post_action('refresh-feed', function() {
$id = Request\int_param('feed_id');
@ -243,7 +255,7 @@ Router\post_action('add', function() {
}
else {
Session\flash_error('Unable to find a subscription.');
Session\flash_error('Unable to find a subscription or parsing error.');
}
Response\html(Template\layout('add', array(

View File

@ -25,6 +25,7 @@
<p>
<?= Helper\get_host_from_url($item['url']) ?> |
<?= date('l, j F Y H:i', $item['updated']) ?> |
<a href="?action=mark-item-unread&amp;id=<?= urlencode($item['id']) ?>">mark as unread</a> |
<a
href="<?= $item['url'] ?>"
id="original-<?= urlencode($item['id']) ?>"

View File

@ -27,6 +27,7 @@
</p>
<p>
<?= Helper\get_host_from_url($item['url']) ?> |
<a href="?action=mark-item-read&amp;id=<?= urlencode($item['id']) ?>">mark as read</a> |
<a
href="<?= $item['url'] ?>"
id="original-<?= urlencode($item['id']) ?>"