Przeglądaj źródła

Load feed configuration on the same page

Need improvements

See https://github.com/marienfressinaud/FreshRSS/issues/646
Marien Fressinaud 11 lat temu
rodzic
commit
7481887db7

+ 4 - 0
app/Controllers/configureController.php

@@ -90,6 +90,10 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 	 * Default values are empty strings unless specified.
 	 */
 	public function feedAction() {
+		if (Minz_Request::param('ajax')) {
+			$this->view->_useLayout(false);
+		}
+
 		$catDAO = new FreshRSS_CategoryDAO();
 		$this->view->categories = $catDAO->listCategories(false);
 

+ 4 - 1
app/views/configure/categorize.phtml

@@ -73,7 +73,7 @@
 						$empty = $feed->nbEntries() == 0 ? ' empty' : '';
 			?>
 			<li class="item<?php echo $error, $empty; ?>">
-				<a class="configure" href="<?php echo _url('configure', 'feed', 'id', $feed->id()); ?>"><?php echo _i('configure'); ?></a>
+				<a class="configure open-slider" href="<?php echo _url('configure', 'feed', 'id', $feed->id()); ?>"><?php echo _i('configure'); ?></a>
 				<img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" /> <?php echo $feed->name(); ?>
 			</li>
 			<?php 	}
@@ -85,3 +85,6 @@
 	</div>
 	<?php } ?>
 </div>
+
+<div id="slider">
+</div>

+ 6 - 2
app/views/configure/feed.phtml

@@ -1,8 +1,12 @@
-<?php $this->partial ('aside_feed'); ?>
+<?php
+	if (!Minz_Request::param('ajax')) {
+		$this->partial('aside_feed');
+	}
+?>
 
 <?php if ($this->flux) { ?>
 <div class="post">
-	<a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> <?php echo Minz_Translate::t ('or'); ?> <a href="<?php echo _url ('index', 'index', 'get', 'f_' . $this->flux->id ()); ?>"><?php echo Minz_Translate::t ('filter'); ?></a>
+	<!-- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> <?php echo Minz_Translate::t ('or'); ?> <a href="<?php echo _url ('index', 'index', 'get', 'f_' . $this->flux->id ()); ?>"><?php echo Minz_Translate::t ('filter'); ?></a> -->
 
 	<h1><?php echo $this->flux->name (); ?></h1>
 	<?php echo $this->flux->description (); ?>

+ 30 - 0
p/scripts/main.js

@@ -1240,6 +1240,35 @@ function faviconNbUnread(n) {
 	}
 }
 
+function init_slider_observers() {
+	var slider = $('#slider');
+	if (slider.length < 1) {
+		return;
+	}
+
+	$('.open-slider').on('click', function() {
+		if (ajax_loading) {
+			return false;
+		}
+
+		ajax_loading = true;
+
+		var url_slide = $(this).attr('href');
+
+		$.ajax({
+			type: 'GET',
+			url: url_slide,
+			data : { ajax: true }
+		}).done(function (data) {
+			slider.html(data);
+			slider.show();
+			ajax_loading = false;
+		});
+
+		return false;
+	})
+}
+
 function init_all() {
 	if (!(window.$ && window.url_freshrss)) {
 		if (window.console) {
@@ -1275,6 +1304,7 @@ function init_all() {
 		init_feed_observers();
 		init_password_observers();
 		init_stats_observers();
+		init_slider_observers();
 	}
 
 	if (window.console) {

+ 5 - 0
p/themes/base-theme/template.css

@@ -645,6 +645,11 @@ br + br + br {
 	display: none;
 }
 
+/*=== Slider */
+#slider {
+	min-height: 50px;
+}
+
 /*=== DIVERS */
 /*===========*/
 .nav-login,