Commit c64de3f5 authored by Thiago Alvarenga Salvadori's avatar Thiago Alvarenga Salvadori
Browse files

le-search: fix missing pages in search of educational content


Signed-off-by: default avatarThiago Alvarenga Salvadori <thiagoalvarenga3@gmail.com>
parent dd5235a0
......@@ -41,6 +41,7 @@ let tabIndex;
const Me = imports.misc.extensionUtils.getCurrentExtension();
const DocInfo = Me.imports.docInfo;
const MAX_PAGES = 20;
const MAX_SEARCH_RESULTS_ROWS = 10;
const MAX_RESULTS_PER_PAGE = 24;
const ITEM_LIMIT = 24;
......@@ -794,11 +795,11 @@ SubEduc.prototype = {
this._pageButtons[i].connect('clicked', Lang.bind(this, this._pageAction, i));
this._header.add(this._pageButtons[i], {x_align: St.Align.START, y_align: St.Align.START, expand: false, x_fill: true, y_fill: true });
pageStyle = 'journal-heading';
if(i > 19)
if(i > MAX_PAGES-1)
{
this._pageButtons[i].hide();
this._next.show();
this._pageShowing = [0, 19];
this._pageShowing = [0, MAX_PAGES-1];
}
}
this._header.add(this._next, {x_align: St.Align.START, y_align: St.Align.START, expand: false, x_fill: true, y_fill: true });
......@@ -809,14 +810,14 @@ SubEduc.prototype = {
_nextAction: function()
{
if( this._pageShowing[1] + MAX_RESULTS_PER_PAGE+1 <= this._pageButtons.length)
this._pageShowing[1] += MAX_RESULTS_PER_PAGE;
if( this._pageShowing[1] + MAX_PAGES+1 <= this._pageButtons.length)
this._pageShowing[1] += MAX_PAGES;
else
{
this._pageShowing[1] = this._pageButtons.length;
this._next.hide();
}
this._pageShowing[0] = this._pageShowing[1] - (MAX_RESULTS_PER_PAGE - 1);
this._pageShowing[0] = this._pageShowing[1] - (MAX_PAGES - 1);
if(this._pageShowing[0] == 0)
this._before.hide();
else
......@@ -824,7 +825,7 @@ SubEduc.prototype = {
for(var i=0 ; i < this._pageButtons.length ; i++)
{
if(i >= this._pageShowing[0] && i < this._pageShowing[1])
if(i >= this._pageShowing[0] && i <= this._pageShowing[1])
this._pageButtons[i].show();
else
this._pageButtons[i].hide();
......@@ -833,14 +834,14 @@ SubEduc.prototype = {
_beforeAction: function()
{
if( this._pageShowing[0] - MAX_RESULTS_PER_PAGE > 0)
this._pageShowing[0] -= MAX_RESULTS_PER_PAGE;
if( this._pageShowing[0] - MAX_PAGES > 0)
this._pageShowing[0] -= MAX_PAGES;
else
{
this._pageShowing[0] = 0;
this._before.hide();
}
this._pageShowing[1] = this._pageShowing[0] + (MAX_RESULTS_PER_PAGE-1);
this._pageShowing[1] = this._pageShowing[0] + (MAX_PAGES-1);
if(this._pageShowing[1]+1 < this._pageButtons.length)
this._next.show();
else
......@@ -848,7 +849,7 @@ SubEduc.prototype = {
for(var i=0 ; i < this._pageButtons.length ; i++)
{
if(i >= this._pageShowing[0] && i < this._pageShowing[1])
if(i >= this._pageShowing[0] && i <= this._pageShowing[1])
this._pageButtons[i].show();
else
this._pageButtons[i].hide();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment