summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-01-25 14:06:34 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-01-25 14:06:34 +0100
commit2a6443a0f0f52272e1e3269d0c32f56322a9a3ec (patch)
treeeefeb8a1a3c6ab32426945b7edbb5e220979a02f
parenta7aa82b461ec2b35883ce4fb34e29e2b77717145 (diff)
Demande rafraîchissement page quand nvx articles
Ajout d'une indication pour rafraîchir la page si de nouveaux articles ont été détectés via le serveur Voir #379
-rw-r--r--app/i18n/en.php1
-rw-r--r--app/i18n/fr.php1
-rw-r--r--app/views/helpers/view/normal_view.phtml7
-rw-r--r--p/scripts/main.js9
-rw-r--r--p/themes/Dark/freshrss.css19
-rw-r--r--p/themes/Flat/freshrss.css19
-rw-r--r--p/themes/Origine/freshrss.css19
7 files changed, 75 insertions, 0 deletions
diff --git a/app/i18n/en.php b/app/i18n/en.php
index 683d7ca22..5d9b01f0b 100644
--- a/app/i18n/en.php
+++ b/app/i18n/en.php
@@ -241,6 +241,7 @@ return array (
'today' => 'Today',
'yesterday' => 'Yesterday',
'before_yesterday' => 'Before yesterday',
+ 'new_article' => 'There are new available articles, click to refresh the page.',
'by_author' => 'By <em>%s</em>',
'related_tags' => 'Related tags',
'no_feed_to_display' => 'There is no article to show.',
diff --git a/app/i18n/fr.php b/app/i18n/fr.php
index c20bf98e7..fd2257c70 100644
--- a/app/i18n/fr.php
+++ b/app/i18n/fr.php
@@ -241,6 +241,7 @@ return array (
'today' => 'Aujourd’hui',
'yesterday' => 'Hier',
'before_yesterday' => 'À partir d’avant-hier',
+ 'new_article' => 'Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.',
'by_author' => 'Par <em>%s</em>',
'related_tags' => 'Tags associés',
'no_feed_to_display' => 'Il n’y a aucun article à afficher.',
diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml
index a1df87579..af5ff03fe 100644
--- a/app/views/helpers/view/normal_view.phtml
+++ b/app/views/helpers/view/normal_view.phtml
@@ -63,6 +63,13 @@ if (!empty($this->entries)) {
$display_others = false;
}
+ if ($this->entries[0]->id () === $item->id ()) {
+ ?><div id="new-article">
+ <a href="<?php echo _url(); ?>"><?php
+ echo Minz_Translate::t ('new_article');
+ ?></a></div><?php
+ }
+
?><div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>">
<ul class="horizontal-list flux_header"><?php
if ($this->loginOk) {
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 3f6352baf..0c3a5fa3d 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -519,12 +519,21 @@ function init_notifications() {
function refreshUnreads() {
$.getJSON('./?c=javascript&a=nbUnreadsPerFeed').done(function (data) {
+ var new_article = false;
$.each(data, function(feed_id, nbUnreads) {
feed_id = 'f_' + feed_id;
var elem = $('#' + feed_id + '>.feed').get(0),
feed_unreads = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0;
incUnreadsFeed(null, feed_id, nbUnreads - feed_unreads);
+
+ if (nbUnreads - feed_unreads > 0) {
+ new_article = true;
+ }
});
+
+ if (new_article) {
+ $('#new-article').show();
+ }
});
}
diff --git a/p/themes/Dark/freshrss.css b/p/themes/Dark/freshrss.css
index c394ad98b..2ad30fab2 100644
--- a/p/themes/Dark/freshrss.css
+++ b/p/themes/Dark/freshrss.css
@@ -224,6 +224,25 @@
text-align: right;
}
+#new-article {
+ display: none;
+ min-height: 40px;
+ background: #26303F;
+ text-align: center;
+}
+ #new-article:hover {
+ background: #4A5D7A;
+ }
+ #new-article a {
+ display: block;
+ line-height: 40px;
+ color: #fff;
+ font-weight: bold;
+ }
+ #new-article a:hover {
+ text-decoration: none;
+ }
+
.flux {
border-left: 3px solid #aaa;
background: #1c1c1c;
diff --git a/p/themes/Flat/freshrss.css b/p/themes/Flat/freshrss.css
index b2d92f86b..80e0da330 100644
--- a/p/themes/Flat/freshrss.css
+++ b/p/themes/Flat/freshrss.css
@@ -217,6 +217,25 @@ body {
z-index: -10;
}
+#new-article {
+ display: none;
+ min-height: 40px;
+ background: #3498db;
+ text-align: center;
+}
+ #new-article:hover {
+ background: #2980b9;
+ }
+ #new-article a {
+ display: block;
+ line-height: 40px;
+ color: #fff;
+ font-weight: bold;
+ }
+ #new-article a:hover {
+ text-decoration: none;
+ }
+
.flux {
border-left: 3px solid #ecf0f1;
}
diff --git a/p/themes/Origine/freshrss.css b/p/themes/Origine/freshrss.css
index 86745af1a..bedeff695 100644
--- a/p/themes/Origine/freshrss.css
+++ b/p/themes/Origine/freshrss.css
@@ -230,6 +230,25 @@
text-align: right;
}
+#new-article {
+ display: none;
+ min-height: 40px;
+ background: #0084CC;
+ text-align: center;
+}
+ #new-article:hover {
+ background: #0066CC;
+ }
+ #new-article a {
+ display: block;
+ line-height: 40px;
+ color: #fff;
+ font-weight: bold;
+ }
+ #new-article a:hover {
+ text-decoration: none;
+ }
+
.flux {
border-left: 3px solid #aaa;
background: #fafafa;