Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing limit from navigation search? #46

Open
murwiz opened this issue Dec 11, 2014 · 10 comments
Open

Removing limit from navigation search? #46

murwiz opened this issue Dec 11, 2014 · 10 comments

Comments

@murwiz
Copy link

murwiz commented Dec 11, 2014

There doesn't seem to be a way to remove the limit from the navigation search, other than to set the configuration navigation.records to an absurdly large number.

@racke
Copy link
Member

racke commented Dec 11, 2014

What's wrong with that limit? Also, I suppose if wouldn't use a limit if you don't set it at all

@SysPete
Copy link
Member

SysPete commented Jun 2, 2015

This needs to be changed so that if navigation.records is set to ZERO then we don't use pager since if this is set to undef then default of zero applies instead.

@SysPete SysPete reopened this Jun 2, 2015
@murwiz
Copy link
Author

murwiz commented Jun 5, 2015

On 2015-06-02 12:00, Peter Mottram wrote:

This needs to be changed so that if navigation.records is set to ZERO
then we don't use pager since if this is set to undef then default of
zero applies instead.

Peter, is this something I could do? I have some free time now.

@SysPete
Copy link
Member

SysPete commented Jun 5, 2015

@murwiz please go ahead. Can you also update pod to explain how this setting works plus add tests?

@murwiz
Copy link
Author

murwiz commented Jun 29, 2015

I started working on this earlier this month, then got distracted and only now I'm returning to it. My obstacle here is in testing: there doesn't seem to be a programmatic way to change up the {navigation}{records} value inside the D::P::IC6::Routes tables. I've decided to add one, but for now (since it's not in the scope of this change), it'll be a local change only.

@SysPete
Copy link
Member

SysPete commented Jun 30, 2015

Should be possible like this:

setting('plugins')->{"Interchange6::Routes"}->{navigation}->{records} = 20

On 29/06/15 21:14, Jeff Boes wrote:

I started working on this earlier this month, then got distracted and
only now I'm returning to it. My obstacle here is in testing: there
doesn't seem to be a programmatic way to change up the
{navigation}{records} value inside the D::P::IC6::Routes tables. I've
decided to add one, but for now (since it's not in the scope of this
change), it'll be a local change only.


Reply to this email directly or view it on GitHub
#46 (comment).

@murwiz
Copy link
Author

murwiz commented Jun 30, 2015

On 2015-06-30 04:01, Peter Mottram wrote:

Should be possible like this:

setting('plugins')->{"Interchange6::Routes"}->{navigation}->{records}
= 20

Thanks, I'll give that a try. I suspect you can't localize this to a
block, though.

@SysPete
Copy link
Member

SysPete commented Jun 30, 2015

You're right: you'll have to reset at end of block to original setting.

On 30/06/15 14:47, Jeff Boes wrote:

On 2015-06-30 04:01, Peter Mottram wrote:

Should be possible like this:

setting('plugins')->{"Interchange6::Routes"}->{navigation}->{records}
= 20

Thanks, I'll give that a try. I suspect you can't localize this to a
block, though.


Reply to this email directly or view it on GitHub
#46 (comment).

@murwiz
Copy link
Author

murwiz commented Jun 30, 2015

On 2015-06-30 04:01, Peter Mottram wrote:

Should be possible like this:

setting('plugins')->{"Interchange6::Routes"}->{navigation}->{records}
= 20

Sadly, this does not work: I had identified why in my earlier try, but I
gave yours a shot just in case I was wrong.

The route configuration is set up in _setup_routes, around line 222:

 my $routes_config = _config_routes($plugin_config, 

%route_defaults);

This hash is then referenced in the routes, e.g. line 351:

 $products =
     $products->rows( $routes_config->{navigation}->{records} )
     ->page( $tokens->{page} );

Normally, this is no big deal, but if you want to change this value at
run time, it needs to be stored in some kind of way that's accessible
from the outside, or re-calculated from scratch within each route
handler based on $plugin_config.

@murwiz
Copy link
Author

murwiz commented Jun 30, 2015

On 2015-06-30 04:01, Peter Mottram wrote:

Should be possible like this:

setting('plugins')->{"Interchange6::Routes"}->{navigation}->{records}
= 20

After studying the code some more, I don't think this is easily solved.
All of the work in D::P::IC6::Routes::_setup_routes() would have to be
done again after the above assignment, and then again after you change
it back to the original setting. Each route uses "$routes_config", which
is set at the start of _setup_routes.

I figured out a way to do it, basically replacing $routes_config with a
function that re-calculates the configuration if necessary, but I'm
really reluctant to introduce that kind of change just to support a
testing operation. If there's a need for the configuration to be changed
on the fly (I think so, but I'm not the expert on that), then we should
probably start a different issue to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants