Pārlūkot izejas kodu

Corrections vue globale

Contribue à https://github.com/marienfressinaud/FreshRSS/issues/353
Alexandre Alapetite 12 gadi atpakaļ
vecāks
revīzija
fdd179d344

+ 1 - 1
app/Controllers/entryController.php

@@ -11,7 +11,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController {
 
 		$this->params = array ();
 		$output = Minz_Request::param('output', '');
-		if (($output != '') && ($this->conf->view_mode !== $output)) {
+		if (($output != '') && ($this->view->conf->view_mode !== $output)) {
 			$this->params['output'] = $output;
 		}
 

+ 2 - 4
app/Controllers/indexController.php

@@ -46,10 +46,8 @@ class FreshRSS_index_Controller extends Minz_ActionController {
 			// no layout for RSS output
 			$this->view->_useLayout (false);
 			header('Content-Type: application/rss+xml; charset=utf-8');
-		} else {
-			if ($output === 'global') {
-				Minz_View::appendScript (Minz_Url::display ('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js')));
-			}
+		} elseif ($output === 'global') {
+			Minz_View::appendScript (Minz_Url::display ('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js')));
 		}
 
 		$this->view->cat_aside = $this->catDAO->listCategories ();

+ 10 - 6
app/views/helpers/view/global_view.phtml

@@ -2,18 +2,22 @@
 
 <div id="stream" class="global categories">
 <?php
-	$params = Minz_Request::params ();
-	$state = 'not_read';
-	if (array_key_exists('state', $params)) {
-		$state = $params['state'];
+	$arUrl = array('c' => 'index', 'a' => 'index', 'params' => array());
+	if ($this->conf->view_mode !== 'normal') {
+		$arUrl['params']['output'] = 'normal';
 	}
+	$p = Minz_Request::param('state', '');
+	if (($p != '') && ($this->conf->default_view !== $p)) {
+		$arUrl['params']['state'] = $p;
+	}
+
 	foreach ($this->cat_aside as $cat) {
 		$feeds = $cat->feeds ();
 		if (!empty ($feeds)) {
 ?>
 	<div class="box-category">
 		<div class="category">
-			<a data-unread="<?php echo $cat->nbNotRead (); ?>" class="btn" href="<?php echo _url ('index', 'index', 'get', 'c_' . $cat->id (), 'output', 'normal'); ?>">
+			<a data-unread="<?php echo $cat->nbNotRead (); ?>" class="btn" href="<?php $arUrl['params']['get'] = 'c_' . $cat->id (); echo Minz_Url::display($arUrl); ?>">
 			<?php echo $cat->name(); ?>
 			</a>
 		</div>
@@ -22,7 +26,7 @@
 			<?php $not_read = $feed->nbNotRead (); ?>
 			<li id="f_<?php echo $feed->id (); ?>" class="item<?php echo $feed->inError () ? ' error' : ''; ?><?php echo $feed->nbEntries () == 0 ? ' empty' : ''; ?>">
 				<img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" />
-				<a class="feed" data-unread="<?php echo $feed->nbNotRead (); ?>" data-priority="<?php echo $feed->priority (); ?>" href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id (), 'output', 'normal', 'state', $state); ?>">
+				<a class="feed" data-unread="<?php echo $feed->nbNotRead (); ?>" data-priority="<?php echo $feed->priority (); ?>" href="<?php $arUrl['params']['get'] = 'f_' . $feed->id(); echo Minz_Url::display($arUrl); ?>">
 				<?php echo $feed->name(); ?>
 				</a>
 			</li>

+ 3 - 3
lib/Minz/View.php

@@ -63,7 +63,7 @@ class Minz_View {
 	 * Affiche la Vue en elle-même
 	 */
 	public function render () {
-		if ((@include($this->view_filename)) === false) {
+		if ((include($this->view_filename)) === false) {
 			Minz_Log::record ('File not found: `'
 			            . $this->view_filename . '`',
 			            Minz_Log::NOTICE);
@@ -79,7 +79,7 @@ class Minz_View {
 		             . self::LAYOUT_PATH_NAME . '/'
 		             . $part . '.phtml';
 
-		if ((@include($fic_partial)) === false) {
+		if ((include($fic_partial)) === false) {
 			Minz_Log::record ('File not found: `'
 			            . $fic_partial . '`',
 			            Minz_Log::WARNING);
@@ -95,7 +95,7 @@ class Minz_View {
 		            . '/views/helpers/'
 		            . $helper . '.phtml';
 
-		if ((@include($fic_helper)) === false) {;
+		if ((include($fic_helper)) === false) {;
 			Minz_Log::record ('File not found: `'
 			            . $fic_helper . '`',
 			            Minz_Log::WARNING);

+ 10 - 0
p/scripts/global_view.js

@@ -24,6 +24,16 @@ function load_panel(link) {
 		// en en ouvrant une autre ensuite, on se retrouve au même point de scroll
 		$("#panel").scrollTop(0);
 
+		$('#nav_menu_read_all a, #bigMarkAsRead').click(function () {
+			$.ajax({
+				url: $(this).attr("href"),
+				async: false
+			});
+			//$("#panel .close").first().click();
+			window.location.reload(false);
+			return false;
+		});
+
 		panel_loading = false;
 	});
 }

+ 5 - 3
p/scripts/main.js

@@ -137,7 +137,9 @@ function mark_favorite(active) {
 		if (active.closest('div').hasClass('not_read')) {
 			var elem = $('#aside_flux .favorites').children(':first').get(0),
 				feed_unreads = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0;
-			elem.setAttribute('data-unread', Math.max(0, feed_unreads + inc));
+			if (elem) {
+				elem.setAttribute('data-unread', Math.max(0, feed_unreads + inc));
+			}
 		}
 	});
 }
@@ -559,6 +561,8 @@ function load_more_posts() {
 }
 
 function init_load_more(box) {
+	box_load_more = box;
+
 	var $next_link = $("#load_more");
 	if (!$next_link.length) {
 		// no more article to load
@@ -566,8 +570,6 @@ function init_load_more(box) {
 		return;
 	}
 
-	box_load_more = box;
-
 	url_load_more = $next_link.attr("href");
 	var $prefetch = $('#prefetch');
 	if ($prefetch.attr('href') !== url_load_more) {