summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2012-09-03 03:00:36 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2012-09-03 03:00:36 +0200
commit74693ed2db27dbe732af1f44929a8976b0017050 (patch)
treed2be725ba95bb04327a9b50642e8db962546a84d
parent8f574db911ebd7748f2462f423e92b275ce99b56 (diff)
add padding to the bottom to be able to scroll even with one element
-rw-r--r--ajax/usersettings.php10
-rw-r--r--index.php6
-rw-r--r--js/items.js16
3 files changed, 27 insertions, 5 deletions
diff --git a/ajax/usersettings.php b/ajax/usersettings.php
index 27fc11cb1..c11bb346e 100644
--- a/ajax/usersettings.php
+++ b/ajax/usersettings.php
@@ -16,7 +16,13 @@ OCP\JSON::checkAppEnabled('news');
OCP\JSON::callCheck();
if(isset($_POST['showAll'])){
- OCP\Config::setUserValue(OCP\USER::getUser(), 'news', 'showAll', $_POST['showAll']);
+ if($_POST['showAll'] === 'false'){
+ $showAll = false;
+ } else {
+ $showAll = true;
+ }
+ OCP\Config::setUserValue(OCP\USER::getUser(), 'news', 'showAll', $showAll);
}
-OCP\JSON::success(); \ No newline at end of file
+OCP\JSON::success();
+
diff --git a/index.php b/index.php
index b7e688ba2..60163153c 100644
--- a/index.php
+++ b/index.php
@@ -36,6 +36,9 @@ $foldermapper = new OCA\News\FolderMapper($userid);
$allfeeds = $foldermapper->childrenOfWithFeeds(0); //$foldermapper->populate($folder);
$folderforest = $foldermapper->childrenOf(0); //retrieve all the folders
+$feedid = 0;
+$feedtype = 0;
+
if ($allfeeds) {
$feedid = isset( $_GET['feedid'] ) ? $_GET['feedid'] : null;
if ($feedid == null) {
@@ -53,9 +56,6 @@ if ($allfeeds) {
}
}
}
-} else {
- $feedid = 0;
- $feedtype = 0;
}
$tmpl = new OCP\Template( 'news', 'main', 'user' );
diff --git a/js/items.js b/js/items.js
index ad4f5513d..323d7b346 100644
--- a/js/items.js
+++ b/js/items.js
@@ -32,6 +32,11 @@ var t = t || function(app, string){ return string; }; // mock translation for lo
this._$articleList.scrollTop(0);
this._itemCache = new ItemCache();
this._$articleList.children('ul').children('.feed_item:eq(0)').addClass('viewed');
+
+ this._setScrollBottom();
+ $(window).resize(function(){
+ self._setScrollBottom();
+ });
// mark items whose title was hid under the top edge as read
// when the bottom is reached, mark all items as read
@@ -105,6 +110,7 @@ var t = t || function(app, string){ return string; }; // mock translation for lo
self._$articleList.children('ul').show();
}
self._$articleList.removeClass('loading');
+ self._setScrollBottom();
});
};
@@ -167,6 +173,16 @@ var t = t || function(app, string){ return string; }; // mock translation for lo
this._markCurrentlyViewed();
};
+ /**
+ * Adds padding to the bottom to be able to scroll the last element beyond
+ * the top area
+ */
+ Items.prototype._setScrollBottom = function() {
+ var padding = this._$articleList.height();
+ console.log(padding);
+ this._$articleList.children('ul').css('padding-bottom', padding + 'px');
+ };
+
/**
* Empties the item cache
*/