From 36316a6d7e81c3e73cad1362194e73a9006b0c72 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 16 Jun 2013 20:28:57 +0200 Subject: Implémentation des vues lecture et globale (issue #67) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/Category.php | 6 +++--- app/views/helpers/global_view.phtml | 32 +++++++++++++++++++++++++++++-- app/views/helpers/normal_view.phtml | 2 +- app/views/helpers/reader_view.phtml | 1 + app/views/javascript/main.phtml | 19 ++++++++++++++++++- public/theme/freshrss.css | 38 +++++++++++++++++++++++++++++++++++++ 6 files changed, 91 insertions(+), 7 deletions(-) diff --git a/app/models/Category.php b/app/models/Category.php index 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.phtml index b666fe620..8e5e363f8 100644 --- a/app/views/helpers/global_view.phtml +++ b/app/views/helpers/global_view.phtml @@ -1,5 +1,33 @@ +partial ('nav_menu'); ?> + +
partial ('nav_menu'); + foreach ($this->cat_aside as $cat) { + $feeds = $cat->feeds (); + $catNotRead = $cat->nbNotRead (); + if (!empty ($feeds)) { ?> + + +
\ No newline at end of file diff --git a/app/views/helpers/normal_view.phtml b/app/views/helpers/normal_view.phtml index 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 (); ?> -
+
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.phtml index 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 () { 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 (""); @@ -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.css index 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; -- cgit v1.2.3