aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-06-16 20:28:57 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-06-16 20:28:57 +0200
commit36316a6d7e81c3e73cad1362194e73a9006b0c72 (patch)
tree3b68e5a223cd67e98c5a2d948d4da93b30198e74 /app
parente3b3fa39d8b51bb571d2d15dafcfc94d4ab28787 (diff)
Implémentation des vues lecture et globale (issue #67)
Diffstat (limited to 'app')
-rwxr-xr-xapp/models/Category.php6
-rw-r--r--app/views/helpers/global_view.phtml32
-rw-r--r--app/views/helpers/normal_view.phtml2
-rw-r--r--app/views/helpers/reader_view.phtml1
-rw-r--r--app/views/javascript/main.phtml19
5 files changed, 53 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 @@
+<?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 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 ();
?>
-<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.phtml
index 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.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 () {
<?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 ();