Explorar o código

Correction design (issue #6), début correction bug #16 (à voir où ça en est)

Marien Fressinaud %!s(int64=13) %!d(string=hai) anos
pai
achega
250c75de2a

+ 2 - 0
app/controllers/configureController.php

@@ -9,6 +9,8 @@ class configureController extends ActionController {
 			);
 		}
 	}
+	
+	public function indexAction () { }
 
 	public function categorizeAction () {
 		$catDAO = new CategoryDAO ();

+ 10 - 6
app/views/index/index.phtml

@@ -15,18 +15,21 @@
 	
 	<?php foreach ($items as $item) { ?>
 	<div class="post flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>">
-		<?php $author = $item->author (); ?>
+		<h1 class="title"><a target="_blank" href="<?php echo $item->link (); ?>"> <?php echo $item->title (); ?></a></h1>
+		
 		<div class="before">
-			<?php $feed = $item->feed (true); ?>
-			<?php echo $author != '' ? $author . ' a écrit' : ''; ?>
-			le <?php echo $item->date (); ?>
-			sur <a target="_blank" href="<?php echo $feed->website (); ?>"><?php echo $feed->name (); ?> <img src="http://www.google.com/s2/favicons?domain=<?php echo get_domain ($feed->website ()); ?>" alt="" /></a>,
 		</div>
 		
-		<h1 class="title"><a target="_blank" href="<?php echo $item->link (); ?>"> <?php echo $item->title (); ?></a></h1>
 		<div class="content"><?php echo $item->content (); ?></div>
 		
 		<div class="after">
+			<?php $author = $item->author (); ?>
+			<?php $feed = $item->feed (true); ?>
+			Le <?php echo $item->date (); ?>
+			<?php echo $author != '' ? ' par ' . $author : ''; ?>
+			sur <a target="_blank" href="<?php echo $feed->website (); ?>"><?php echo $feed->name (); ?> <img src="http://www.google.com/s2/favicons?domain=<?php echo get_domain ($feed->website ()); ?>" alt="" /></a>,
+			
+			<div class="options">
 			<?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
 			<?php if (!$item->isRead ()) { ?>
 			<a class="read" href="<?php echo Url::display (array ('c' => 'entry', 'a' => 'read', 'params' => array ('id' => $item->id (), 'is_read' => 1))); ?>">J'ai fini de lire l'article</a><!--
@@ -40,6 +43,7 @@
 			--><a class="bookmark" href="<?php echo Url::display (array ('c' => 'entry', 'a' => 'bookmark', 'params' => array ('id' => $item->id (), 'is_favorite' => 0))); ?>">Retirer l'article de mes favoris</a>
 			<?php } ?>
 			<?php } ?>
+			</div>
 		</div>
 	</div>
 	<?php } ?>

+ 1 - 6
app/views/javascript/main.phtml

@@ -24,7 +24,7 @@ function slide (new_active, old_active) {
 		old_active.children (".content").slideUp (200);
 		new_active.children (".content").slideDown (200, function () {
 			$.smoothScroll({
-				offset: new_active.position ().top + 25
+				offset: new_active.position ().top
 			});
 		});
 	} else {
@@ -32,11 +32,6 @@ function slide (new_active, old_active) {
 			offset: new_active.position ().top + 25
 		});
 	}
-	
-	// si le dernier post est actif, on charge les suivants
-	if (new_active.attr ("id") == $(".post.flux:last").attr ("id")) {
-		load_more_posts ();
-	}
 }
 
 function add_not_read (nb) {

+ 1 - 1
public/data/Configuration.array.php

@@ -1,6 +1,6 @@
 <?php
 return array (
-	'posts_per_page' => 10,
+	'posts_per_page' => 50,
 	'default_view' => 'all',
 	'display_posts' => 'no',
 	'sort_order' => 'low_to_high',

+ 19 - 9
public/scripts/endless_mode.js

@@ -1,24 +1,34 @@
-var url = "";
+var url_next_page = "";
+var load = false;
+
+function load_more_refresh () {
+	if (url_next_page === undefined) {
+		$("#load_more").html ("Il n'y a rien à charger");
+		$("#load_more").addClass ("disable");
+	} else {
+		$("#load_more").html ("Charger plus d'articles");
+	}
+}
 
 function load_more_posts () {
-	$.get (url, function (data) {
+	load = true;
+	$.get (url_next_page, function (data) {
 		$("#load_more").before ($("#stream .post", data));
 		
-		url = $(".pagination:last li.pager-next a", data).attr ("href");
-		if (url === undefined) {
-			$("#load_more").html ("Il n'y a plus rien à charger");
-			$("#load_more").addClass ("disable");
-		}
+		url_next_page = $(".pagination:last li.pager-next a", data).attr ("href");
 		
 		init_posts ();
+		load_more_refresh ();
+		load = false;
 	});
 }
 
 $(document).ready (function () {
-	url = $(".pagination:last li.pager-next a").attr ("href");
+	url_next_page = $(".pagination:last li.pager-next a").attr ("href");
 	$(".pagination:last").remove ();
 	
-	$("#stream").append ("<a id=\"load_more\" href=\"#\">Charger plus d'articles</a>");
+	$("#stream").append ("<a id=\"load_more\" href=\"#\"></a>");
+	load_more_refresh ();
 	
 	$("#load_more").click (function () {
 		load_more_posts ();

+ 41 - 28
public/theme/base.css

@@ -216,7 +216,7 @@ form {
 					text-decoration: none;
 				}
 		#stream {
-			padding: 20px 0;
+			padding: 0;
 		}
 		#main .table {
 			display: table;
@@ -232,29 +232,38 @@ form {
 		}
 
 .post {
-	width: 90%;
-	margin: 0 auto;
 }
 	.post.flux {
-		margin: 40px auto;
 		font-family: Palatino, "Times New Roman", serif;
 		line-height: 170%;
-		border-left: 5px solid #aaa;
-		background: #eee;
-		border-radius: 5px;
-		box-shadow: 0 1px 3px #aaa;
+		border-left: 10px solid #aaa;
+		background: #fafafa;
 	}
-		.post.flux .before {
-			padding: 20px;
-			color: #666;
-			font-size: 80%;
-			text-align: center;
+		.post.flux:hover {
+			background: #fff;
 		}
 		.post.flux .after {
-			margin: 50px 0 0;
+			padding: 10px 20px;
+			color: #aaa;
+			font-size: 80%;
+			font-style: italic;
+		}
+			.post.flux .after a {
+				color: #96BDE2;
+			}
+			.post.flux .after .options {
+				float: right;
+			}
+				.post.flux .after .options a {
+					padding: 0 20px;
+				}
+		/*.post.flux .after {
+			margin: 20px 0 0;
+			background: #fff;
 			font-size: 80%;
 			text-align: center;
 			border-top: 1px solid #aaa;
+			border-bottom: 1px solid #aaa;
 		}
 			.post.flux .after a {
 				display: inline-block;
@@ -262,17 +271,18 @@ form {
 				line-height: 50px;
 				width: 50%;
 			}
-				.post.flux .after  a:hover {
-					background: #fff;
+				.post.flux .after a:hover {
+					background: #f6f6f6;
 					text-decoration: none;
-					border-radius: 0 0 5px 5px;
-					box-shadow: 0 1px 3px #aaa;
-				}
+				}*/
 		.post.flux > h1 {
+			min-height: 0;
 			padding: 10px 20px;
+			font-size: 130%;
+			line-height: 150%;
 		}
 		.post.flux .content {
-			padding: 10px 20px;
+			padding: 10px 100px;
 		}
 			.post.flux .content h1, .post.flux .content h2, .post.flux .content h3 {
 				margin: 20px 0;
@@ -303,15 +313,16 @@ form {
 				color: #666;
 			}
 		.post.flux.not_read {
-			border-left: 5px solid #FF5300;
+			border-left: 10px solid #FF5300;
 			background: #FFF3ED;
 		}
 		.post.flux.favorite {
-			border-left: 5px solid #FFC300;
+			border-left: 10px solid #FFC300;
 			background: #FFF6DA;
 		}
 		.post.flux.active {
-			border-left: 5px solid #0062BE;
+			border-left: 10px solid #0062BE;
+			background: #fff;
 		}
 
 /*** PAGINATION ***/
@@ -338,18 +349,20 @@ form {
 			}
 a#load_more {
 	display: block;
-	width: 90%;
 	height: 50px;
-	margin: 0 auto;
 	background: #eee;
-	border-radius: 5px;
-	box-shadow: 0 0 3px #aaa;
 	line-height: 50px;
 	text-align: center;
 	font-weight: bold;
+	border-top: 1px solid #aaa;
 }
+	a#load_more:hover {
+		background: #fff;
+		text-decoration: none;
+	}
 	a#load_more.disable {
-		text-decoration: none !important;
+		cursor: default;
+		background: #eee;
 		color: #666;
 	}