A free, self-hostable news aggregator…
Implémentation des vues lecture et globale (issue #67)
Marien Fressinaud36316a6d7e81
diff --git a/app/models/Category.php b/app/models/Category.phpindex 273559b1e..0c991588d 100755--- a/app/models/Category.php+++ b/app/models/Category.php@@ -35,10 +35,10 @@ class Category extends Model {public function feeds () {if (is_null ($this->feeds)) {$feedDAO = new FeedDAO ();- return $feedDAO->listByCategory ($this->id ());- } else {- return $this->feeds;+ $this->feeds = $feedDAO->listByCategory ($this->id ());}++ return $this->feeds;}public function _id ($value) {diff --git a/app/views/helpers/global_view.phtml b/app/views/helpers/global_view.phtmlindex b666fe620..8e5e363f8 100644--- a/app/views/helpers/global_view.phtml+++ b/app/views/helpers/global_view.phtml@@ -1,5 +1,33 @@+<?php $this->partial ('nav_menu'); ?>++<div id="stream" class="global"><?php-$this->partial ('nav_menu');+ foreach ($this->cat_aside as $cat) {+ $feeds = $cat->feeds ();+ $catNotRead = $cat->nbNotRead ();+ if (!empty ($feeds)) {?>+ <div class="category">+ <div class="cat_header"><a href="<?php echo _url ('index', 'index', 'get', 'c_' . $cat->id ()); ?>"><?php echo $cat->name(); ?><?php echo $catNotRead > 0 ? ' (' . $catNotRead . ')' : ''; ?></a></div>++ <ul class="feeds">+ <?php foreach ($feeds as $feed) { ?>+ <?php $not_read = $feed->nbNotRead (); ?>+ <li class="item">+ <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="" />-Non implémenté\ No newline at end of file+ <a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>">+ <?php echo $not_read > 0 ? '<b>' : ''; ?>+ <?php echo $feed->name(); ?>+ <?php echo $not_read > 0 ? ' (' . $not_read . ')' : ''; ?>+ <?php echo $not_read > 0 ? '</b>' : ''; ?>+ </a>+ </li>+ <?php } ?>+ </ul>+ </div>+<?php+ }+ }+?>+</div>\ No newline at end of filediff --git a/app/views/helpers/normal_view.phtml b/app/views/helpers/normal_view.phtmlindex 515084047..2ca365552 100644--- a/app/views/helpers/normal_view.phtml+++ b/app/views/helpers/normal_view.phtml@@ -7,7 +7,7 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {$items = $this->entryPaginator->items ();?>-<div id="stream">+<div id="stream" class="normal"><?php$display_today = true;$display_yesterday = true;diff --git a/app/views/helpers/reader_view.phtml b/app/views/helpers/reader_view.phtmlindex f702a4b91..cdca393b9 100644--- a/app/views/helpers/reader_view.phtml+++ b/app/views/helpers/reader_view.phtml@@ -1,4 +1,5 @@<?php+$this->partial ('nav_menu');if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {$items = $this->entryPaginator->items ();diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtmlindex 5b325ac8d..e290e02d3 100644--- a/app/views/javascript/main.phtml+++ b/app/views/javascript/main.phtml@@ -9,6 +9,16 @@ var hide_posts = false;$mark = $this->conf->markWhen ();?>+function is_reader_mode() {+ var stream = $("#stream.reader");+ return stream.html() != null;+}++function is_normal_mode() {+ var stream = $("#stream.normal");+ return stream.html() != null;+}+function redirect (url, new_tab) {if (url) {if (new_tab) {@@ -117,7 +127,7 @@ function init_posts () {<?php } ?>if (hide_posts) {- $("#stream:not(.reader) .flux:not(.active) .flux_content").hide ();+ $(".flux:not(.active) .flux_content").hide ();}$(".flux_header .item.title, .flux_header .item.date").click (function () {@@ -153,6 +163,10 @@ function init_posts () {}function init_column_categories () {+ if(!is_normal_mode()) {+ return;+ }+$(".category").addClass ("stick");$(".categories .category .btn:first-child").width ("160px");$(".category").append ("<a class=\"btn dropdown-toggle\" href=\"#\"><i class=\"icon i_down\"></i></a>");@@ -268,6 +282,9 @@ function init_shortcuts () {}$(document).ready (function () {+ if(is_reader_mode()) {+ hide_posts = false;+ }init_posts ();init_column_categories ();init_shortcuts ();diff --git a/public/theme/freshrss.css b/public/theme/freshrss.cssindex 60498ad5b..345bd5252 100644--- a/public/theme/freshrss.css+++ b/public/theme/freshrss.css@@ -298,6 +298,44 @@color: #666;}+#stream.global {+ text-align: center;+}+ #stream.global .category {+ display: inline-block;+ width: 280px;+ margin: 20px 10px;+ vertical-align: top;+ background: #fff;+ border: 1px solid #aaa;+ border-radius: 5px;+ text-align: left;+ box-shadow: 0 0 5px #bbb;+ }+ #stream.global .cat_header {+ height: 35px;+ padding: 0 10px;+ background: #eee;+ border-bottom: 1px solid #aaa;+ border-radius: 5px 5px 0 0;+ line-height: 35px;+ font-size: 120%;+ }+ #stream.global .cat_header a {+ color: #333;+ text-shadow: 0 -1px 0px #aaa;+ }+ #stream.global .category .feeds {+ max-height: 250px;+ margin: 0;+ list-style: none;+ overflow: auto;+ }+ #stream.global .category .feeds .item {+ padding: 0 10px;+ font-size: 90%;+ }+.content {max-width: 550px;margin: 0 auto;