Comments

dawehner’s picture

Assigned: dawehner » Unassigned
StatusFileSize
new4.08 KB

Here is a patch.

merlinofchaos’s picture

+      '#title' => t('Number of pages(query)'),

How about "Maximum number of pages"

+    $form['quantity'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Number of shown pages'),
+      '#description' => t('The total number of pages which are displayed. Leave empty to show all pages.'),
+      '#default_value' => $this->options['quantity'],
+    );
+

I think, hm. "Number of pager links visible" and "Specify the maximum number of links to pages to display in the pager."

Hey while we're at it, are the 'next' and 'prev' text configurable too? If they are we should make those options as well.

dawehner’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Assigned: Unassigned » dawehner

Both tags and quantity is part of theme_pager in d6, already

merlinofchaos’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Category: task » bug

Ok, let's fix the bug and provide the option separately. The bug is more important.

dawehner’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
dawehner’s picture

Title: Provide quantity in the pager settings. » Provide quantity/tags in the pager settings.
StatusFileSize
new4.21 KB
new8.69 KB

So this is a patch which adds tags and quantity.

The title/description in #2 is so much better!

merlinofchaos’s picture

Status: Needs review » Needs work
+    dsm($pager_theme);
+    dsm($tags);

Can I get one without these? :)

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new4.17 KB

Sure.

sgabe’s picture

I were just looking for this option and I couldn't find it. The patch applies fine and seems to work, however the default tags look like this:

    $options['tags'] = array(
      'contains' => array(
        'first' => array('default' => '« first', 'translatable' => TRUE),
        'previous' => array('default' => '‹ previous', 'translatable' => TRUE),
        'next' => array('default' => 'next ›', 'translatable' => TRUE),
        'last' => array('default' => 'last »', 'translatable' => TRUE),
      ),
    );
dawehner’s picture

@sgabe
Mh the patch itself looks fine.

Do you have some kind of translation support on your site enabled?

agileware’s picture

Status: Needs review » Needs work
StatusFileSize
new3.76 KB

Re the patch in #8:

1.

+++ plugins/views_plugin_pager_full.inc
@@ -67,6 +76,13 @@ class views_plugin_pager_full extends views_plugin_pager {
+    $form['quantity'] = array(
+      '#type' => 'textfield',
+      '#title' => t('"Number of pager links visible'),
+      '#description' => t('Specify the maximum number of links to pages to display in the pager."'),
+      '#default_value' => $this->options['quantity'],
+    );

There are extra double quotes in the title and description.

2.

+++ plugins/views_plugin_pager_full.inc
@@ -145,6 +161,40 @@ class views_plugin_pager_full extends views_plugin_pager {
+    $form['tags'] = array (
+      '#type' => 'fieldset',
+      '#collapsible' => FALSE,
+      '#collapsed' => FALSE,
+      '#tree' => TRUE,
+      '#title' => t('Tags'),
+      '#input' => TRUE,
+      '#description' => t('TODO: Description'),
+    );
+    $form['tags']['first'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Text for "first"-link'),
+      '#description' => t('Text for "first"-link'),
+      '#default_value' => $this->options['tags']['first'],
+    );
+    $form['tags']['previous'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Text for "previous"-link'),
+      '#description' => t('Text for "previous"-link'),
+      '#default_value' => $this->options['tags']['previous'],
+    );
+    $form['tags']['next'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Text for "next"-link'),
+      '#description' => t('Text for "next"-link'),
+      '#default_value' => $this->options['tags']['next'],
+    );
+    $form['tags']['last'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Text for "last"-link'),
+      '#description' => t('Text for "last"-link'),
+      '#default_value' => $this->options['tags']['last'],
+    );

* Lots of TODOs and descriptions that duplicate titles.
* "Text for "first"-link" etc. - Why the dash between "first" and link instead of a space? Looks a bit messy.

3.

+++ plugins/views_plugin_pager_full.inc
@@ -200,7 +250,13 @@ class views_plugin_pager_full extends views_plugin_pager {
diff --git plugins/views_plugin_query_default.inc plugins/views_plugin_query_default.inc
index ee1877a..6b51d48 100644
--- plugins/views_plugin_query_default.inc
+++ plugins/views_plugin_query_default.inc
@@ -9,7 +9,7 @@
 /**
  * Object used to create a SELECT query.
  */
-class views_plugin_query_default extends views_plugin_query{
+class views_plugin_query_default extends views_plugin_query {
 
   /**
    * A list of tables in the order they should be added, keyed by alias.

This part is irrelevant.

Also, for those who want a D7 version here it is (with points 1 & 3 from above fixed).

Powered by Dreditor.

marcvangend’s picture

+1, will try to test the patch soon.

ericduran’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Needs work » Needs review

:-( I hate when I write a patch and then I think to look this up after I write it.

Anyways this looks good to me. I'm going to try and apply see what happens.

Switching to needs review to see if it still applies against the latest.

Status: Needs review » Needs work

The last submitted patch, views-pager_quantity_tags-1000480-11-d7.patch, failed testing.

ericduran’s picture

Assigned: dawehner » ericduran

Fixing the test and uploading patch in a sec.

ericduran’s picture

Status: Needs work » Needs review
StatusFileSize
new6.5 KB

And now here's the patch.

I fixed some of the formatting and also changed the text around because it had some todos. I based my text arounds Drupal cores wording for theme_pager.

Also the test should be fixed with this patch.

ericduran’s picture

StatusFileSize
new6.45 KB

Here's the same exact patch but without the simple-test verbose I put in there for debugging.

Either way both patches should pass :)

ericduran’s picture

StatusFileSize
new6.15 KB

Ok last one I promise. This fixed a small mistake I had on the simple test.

tim.plunkett’s picture

Status: Needs review » Needs work
+++ b/plugins/views_plugin_pager_full.incundefined
@@ -24,6 +24,7 @@ class views_plugin_pager_full extends views_plugin_pager {
+    $options['quantity'] = array('default' => 9);

What's with 9? This could use a comment.

+++ b/plugins/views_plugin_pager_full.incundefined
@@ -212,8 +266,18 @@ class views_plugin_pager_full extends views_plugin_pager {
+      0 => $this->options['tags']['first'],
+      1 => $this->options['tags']['previous'],
+      3 => $this->options['tags']['next'],
+      4 => $this->options['tags']['last'],

Where is index 2?

ericduran’s picture

Status: Needs work » Needs review
StatusFileSize
new6.15 KB

What's with 9? This could use a comment

This is the default that's used now. This default is from the default 'quantity' variable for theme_pager in core.

Where is index 2?

Missed it good catch.

tim.plunkett’s picture

In that case, why hardcore the indices at all? Just leaving them out will accomplish the same thing.

dawehner’s picture

Status: Needs review » Needs work
+++ b/tests/views_translatable.testundefined
@@ -116,12 +116,15 @@ class ViewsTranslatableTest extends ViewsSqlTest {
+        'Tag first1' => array('pager', 'tags', 'first'),
+        'Tag prev1' => array('pager', 'tags', 'previous'),
+        'Tag next1' => array('pager', 'tags', 'next'),

Awesome!!!

A short quote from theme_pager:


  $li_first = theme('pager_first', array('text' => (isset($tags[0]) ? $tags[0] : t('« first')), 'element' => $element, 'parameters' => $parameters));
  $li_previous = theme('pager_previous', array('text' => (isset($tags[1]) ? $tags[1] : t('‹ previous')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters));
  $li_next = theme('pager_next', array('text' => (isset($tags[3]) ? $tags[3] : t('next ›')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters));
  $li_last = theme('pager_last', array('text' => (isset($tags[4]) ? $tags[4] : t('last »')), 'element' => $element, 'parameters' => $parameters));

So i think 2 was the right number here :)

ericduran’s picture

Hmm I guess that's where I got the 3 from. These seems like a bug in core regarding theme_pager.

ericduran’s picture

Status: Needs work » Needs review
StatusFileSize
new6.28 KB

Ok so this one has comments for the default the and weird theme_pager tags keys.

@tim.plunkett I didn't leave the default as blank because we're not checking what we pass to theme_pager, we're always passing it. So if we make our default nothing it would overwrite the standard 9 items per pager list.

dawehner’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Status: Needs review » Patch (to be ported)

Reviewed the patch and it look perfect. Let's get it in. Thanks for taking over the patch and push it forward.

Committed to 7.x-3.x

This patch should be worth for 6.x-3.x.

chris matthews’s picture

Issue summary: View changes
Status: Patch (to be ported) » Closed (outdated)

The Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed, please see issue #3030347: Plan to clean process issue queue