Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
610d238
Missing file doc comment
Gormartsen Aug 16, 2015
14ae0d4
Doc comment is empty
Gormartsen Aug 16, 2015
41e8a3e
Update views_plugin_pager_altpager.inc
Gormartsen Aug 16, 2015
5525bc3
Just to trigger errors
Gormartsen Aug 16, 2015
5598ec9
Generate another test
Gormartsen Aug 16, 2015
b45cf3e
We need more test here!
Gormartsen Aug 16, 2015
b5b9942
See what happen now
Gormartsen Aug 16, 2015
7e1aa63
one more test
Gormartsen Aug 16, 2015
05f278a
See the test!
Gormartsen Aug 16, 2015
0eaf951
Some problems for pr-report
Gormartsen Aug 16, 2015
b367df4
This one pr-report is failed for sure
Gormartsen Aug 16, 2015
8d46c29
Update altpager.css
Gormartsen Aug 16, 2015
39c2bb4
Let's see what happen now
Gormartsen Aug 16, 2015
1137fd3
Some error here!
Gormartsen Aug 16, 2015
49d490b
Update altpager.css
Gormartsen Aug 16, 2015
9060c69
Update altpager.css
Gormartsen Aug 16, 2015
d0e0b34
One more test
Gormartsen Aug 16, 2015
ebbdef8
This one should be fine
Gormartsen Aug 16, 2015
54de81e
Testing PR
Gormartsen Aug 16, 2015
f162a7d
Testing again
Gormartsen Aug 16, 2015
55dda6b
Another test
Gormartsen Aug 16, 2015
8cba8a0
Another test
Gormartsen Aug 17, 2015
9e34245
How many tests more?
Gormartsen Aug 17, 2015
7c16db5
Another test
Gormartsen Aug 17, 2015
cd5e6d5
Last fix
Gormartsen Aug 17, 2015
3fa658e
Update .gitlc.yml file. For git.lc service integration.
GitlcBot Aug 20, 2015
811d9a7
Update .gitlc.yml file. For git.lc service integration.
GitlcBot Aug 20, 2015
3096140
Update .gitlc.yml file. For git.lc service integration.
GitlcBot Aug 20, 2015
26ba5c9
Update .gitlc.yml file. For git.lc service integration.
GitlcBot Aug 20, 2015
e9fb142
Update .gitlc.yml file. For git.lc service integration.
GitlcBot Aug 20, 2015
4df0314
Update .gitlc.yml file. For git.lc service integration.
GitlcBot Aug 20, 2015
abe36f5
Update .gitlc.yml file. For git.lc service integration.
GitlcBot Aug 20, 2015
7c42fe4
Update .gitlc.yml file. For git.lc service integration.
GitlcBot Aug 20, 2015
cd30c98
Update .gitlc.yml file. For git.lc service integration.
GitlcBot Aug 20, 2015
285191c
Prepare alt pager for backdrop
Gormartsen May 27, 2016
9e5dd5c
Let's try it out
Gormartsen May 27, 2016
3ede213
Reorganize module for Backdrop
Gormartsen May 27, 2016
b6f81d6
Code cleaning
Gormartsen May 27, 2016
edb53ae
Fix autoload AltPager
Gormartsen May 27, 2016
32c65de
Fix issue Only variables should be passed by reference
Gormartsen May 27, 2016
5a96ea0
Update view plugin to configure quantity, step and pages
Gormartsen May 27, 2016
8f37011
Fix tyoi
Gormartsen May 27, 2016
96c48c1
Fix another typo
Gormartsen May 27, 2016
1998aed
Add option form
Gormartsen May 27, 2016
6ed4696
Basic test for tests
Gormartsen May 27, 2016
857bd77
Fix admin page
Gormartsen May 27, 2016
d9a1e25
Clean code style
Gormartsen May 27, 2016
9b6d9bd
Fix typo with settings
Gormartsen May 27, 2016
23ec625
One more typo fix
Gormartsen May 27, 2016
70c4792
Remove ZenCI deploy
Gormartsen May 27, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitlc.yml

This file was deleted.

4 changes: 2 additions & 2 deletions altpager.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ div.altpager ul li.active {
border-bottom: 1px solid #ccc;
}

div.altpager ul li a {
div.altpager ul li a {
text-decoration: none;
}

div.altpager ul li a:hover {
div.altpager ul li a:hover {
color: green;
}
5 changes: 2 additions & 3 deletions altpager.extender.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class AltPager extends SelectQueryExtender {

/**
*
* Constructor. AddTag for Altpager Extension.
*/
public function __construct(SelectQueryInterface $query, DatabaseConnection $connection) {
parent::__construct($query, $connection);
Expand All @@ -26,8 +26,7 @@ class AltPager extends SelectQueryExtender {
* to it.
*/
public function execute() {
$max_count = $this
->query
$max_count = $this->query
->countQuery()
->execute()
->fetchField();
Expand Down
9 changes: 2 additions & 7 deletions altpager.info
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
name = Alternative Pager
description = API for alternative pager. It is alternative view point on Pager functionality.
core = 7.x
files[] = altpager.extender.inc
files[] = altpager.test

# Views.
files[] = includes/views/altpager.views.inc
files[] = includes/views/views_plugin_pager_altpager.inc
backdrop = 1.x
type = module
15 changes: 13 additions & 2 deletions altpager.module
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,24 @@
* Pager functionality.
*/

/**
* Implements hook_autoload_info().
*/
function altpager_autoload_info() {
return array(
'AltPager' => 'altpager.extender.inc',
'views_plugin_pager_altpager' => 'views/views_plugin_pager_altpager.inc',
);
}


/**
* Implementation of hook_views_api().
*/
function altpager_views_api() {
return array(
'api' => '3',
'path' => drupal_get_path('module', 'altpager') . '/includes/views',
'api' => '3.0',
'path' => backdrop_get_path('module', 'altpager') . '/views',
);
}

Expand Down
2 changes: 1 addition & 1 deletion altpager.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Test the module functions.
*/
class AltpagerTestCase extends DrupalWebTestCase {
class AltpagerTestCase extends BackdropWebTestCase {

public static function getInfo() {
return array(
Expand Down
7 changes: 3 additions & 4 deletions altpager_example/altpager_example.info
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name = Alternative Pager ( Example )
description = Example work module.
dependencies[] = altpager
configure = altpager_example
core = 7.x
backdrop = 1.x
type = module

files[] = views/altpager_example.views_default.inc
dependencies[] = altpager
7 changes: 4 additions & 3 deletions altpager_example/altpager_example.module
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function altpager_example_menu() {
*/
function altpager_example_views_api() {
return array(
'api' => 3,
'path' => drupal_get_path('module', 'altpager_example') . '/views',
'api' => 3.0,
'path' => backdrop_get_path('module', 'altpager_example') . '/views',
);
}

Expand All @@ -53,7 +53,8 @@ function altpager_example_page() {

foreach ($nids as $row) {
$node = node_load($row->nid);
$result .= render(node_view($node));
$node_view = node_view($node);
$result .= render($node_view);
}

$result .= theme('altpager');
Expand Down
1 change: 0 additions & 1 deletion altpager_example/views/altpager_example.view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ $view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Altpager example';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

Expand Down
4 changes: 4 additions & 0 deletions altpager_example/views/altpager_example.views_default.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php
/**
* @file
* Example module.
*/

/**
* Implements hook_views_default_views().
Expand Down
80 changes: 0 additions & 80 deletions includes/views/views_plugin_pager_altpager.inc

This file was deleted.

File renamed without changes.
147 changes: 147 additions & 0 deletions views/views_plugin_pager_altpager.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?php

/**
* @file
* The plugin to handle Altpager.
*
* @ingroup views_pager_plugins
*/
class views_plugin_pager_altpager extends views_plugin_pager_mini {

/**
* Summary title overwrite.
*/
function summary_title() {

$quantity = 10;
if(isset($this->options['quantity'])) {
$quantity = $this->options['quantity'];
}

$step = 10;
if(isset($this->options['step'])) {
$step = $this->options['step'];
}

$pages = 10;
if(isset($this->options['pages'])) {
$pages = $this->options['pages'];
}

return t('Altpage, Start with !quantity, step !step and !pages pages max', array ('!quantity' => $quantity, '!step' => $step, '!pages' => $pages));
}

/**
* Query overwrite.
*/
function query() {
// Override query.
}

/**
* Pre execute overwrite.
*/
function pre_execute(&$query) {

// Count all entries.
$max_count = $query
->countQuery()
->execute()
->fetchField();

$quantity = 10;
if(isset($this->options['quantity'])) {
$quantity = $this->options['quantity'];
}

$step = 10;
if(isset($this->options['step'])) {
$step = $this->options['step'];
}

$pages = 10;
if(isset($this->options['pages'])) {
$pages = $this->options['pages'];
}

if($max_count > $quantity) {
$pager_steps = array();
$pager_steps[$quantity] = $quantity;

$page_count = $quantity;
while($pages > 0) {
$pages--;
if( $page_count + $step > $max_count) {
break;
}
$page_count = $page_count + $step;
$pager_steps[$page_count] = $page_count;
}
altpager_items_elements($pager_steps);
}

// Save data count all entries.
altpager_count_all_items($max_count);


// Count viewed.
$count_items = altpager_count_items_viewed();

// Apply limit.
$query->range(0, $count_items);
}

/**
* Options definition overwrite.
*/
function option_definition() {
return array(
'quantity' => 10,
'step' => 10,
'pages' => 5,
);
}

/**
* Options form overwrite.
*/
function options_form(&$form, &$form_state) {
$form['quantity'] = array(
'#type' => 'textfield',
'#title' => t('Items on first page'),
'#description' => t('How many items display on first page.'),
'#default_value' => $this->options['quantity'],
);
$form['step'] = array(
'#type' => 'textfield',
'#title' => t('Page step'),
'#description' => t('How many items display on each step.'),
'#default_value' => $this->options['step'],
);
$form['pages'] = array(
'#type' => 'textfield',
'#title' => t('Pages'),
'#description' => t('How many pages to generate.'),
'#default_value' => $this->options['pages'],
);
}

/**
* Options form validate overwrite.
*/
function options_validate(&$form, &$form_state) {
// Disable validate.
}

/**
* Render overwrite.
*/
function render($input) {
$pager_theme = views_theme_functions('altpager', $this->view, $this->display);

return theme($pager_theme, array(
'element' => $this->options,
));
}

}