summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controllers/controller.php3
-rw-r--r--controllers/news.controller.php12
-rw-r--r--templates/main.php4
3 files changed, 11 insertions, 8 deletions
diff --git a/controllers/controller.php b/controllers/controller.php
index 89037b263..06234e8f4 100644
--- a/controllers/controller.php
+++ b/controllers/controller.php
@@ -65,7 +65,7 @@ class Controller {
/**
* Binds variables to the template and prints it
- * The following values are always assigned: userId
+ * The following values are always assigned: userId, trans
* @param $arguments an array with arguments in $templateVar => $content
* @param $template the name of the template
* @param $fullPage if true, it will render a full page, otherwise only a part
@@ -84,6 +84,7 @@ class Controller {
}
$template->assign('userId', $this->userId);
+ $template->assign('trans', $this->trans);
$template->printPage();
}
diff --git a/controllers/news.controller.php b/controllers/news.controller.php
index f01022104..30b409f54 100644
--- a/controllers/news.controller.php
+++ b/controllers/news.controller.php
@@ -62,18 +62,19 @@ class NewsController extends Controller {
// always show the last viewed feed on reload
$lastViewedId = $this->getUserValue('lastViewedFeed');
$lastViewedType = $this->getUserValue('lastViewedFeedType');
+ $showAll = $this->getUserValue('showAll');
if( $lastViewedId === null || $lastViewedType === null) {
$lastViewedId = $feedMapper->mostRecent();
} else {
// check if the last selected feed or folder exists
if( (
- $feedMapper->findById($lastViewedId) === null &&
- $lastViewedType === FeedType::FEED
+ $lastViewedType === FeedType::FEED &&
+ $feedMapper->findById($lastViewedId) === null
) ||
(
- $folderMapper->findById($lastViewedId) === null &&
- $lastViewedType === FeedType::FOLDER
+ $lastViewedType === FeedType::FOLDER &&
+ $folderMapper->findById($lastViewedId) === null
) ){
$lastViewedId = $feedMapper->mostRecent();
}
@@ -85,9 +86,10 @@ class NewsController extends Controller {
$params = array(
'allfeeds' => $feeds,
'folderforest' => $folderForest,
+ 'showAll' => $showAll,
'lastViewedId' => $lastViewedType,
'lastViewedType' => $lastViewedType,
- // for compability, remove this after refactoring
+ // FIXME: for compability, remove this after refactoring
'feedid' => $lastViewedId,
'feedtype' => $lastViewedType,
);
diff --git a/templates/main.php b/templates/main.php
index ce753d317..8a618d34d 100644
--- a/templates/main.php
+++ b/templates/main.php
@@ -4,9 +4,9 @@
<?php
-$showAll = OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'showAll');
+$l = $_['trans'];
-if($showAll) {
+if($_['showAll']) {
$viewButtonImg = 'eye_all.svg';
$viewButtonTitle = $l->t('Show everything');
$viewButtonClass = 'show_all';