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

Add Views "Page by date" pager plugin #2766

Closed
Al-Rozhkov opened this issue Jul 12, 2017 · 38 comments
Closed

Add Views "Page by date" pager plugin #2766

Al-Rozhkov opened this issue Jul 12, 2017 · 38 comments

Comments

@Al-Rozhkov
Copy link
Member

Al-Rozhkov commented Jul 12, 2017

Date module was merged to Backdrop core in version 1.2.0

For some reason one views pager plugin wasn't ported (date_views\includes\date_views_plugin_pager.inc). I wonder was it intentional or wasn't. @Graham-72 and me going to finish port of much needed Calendar module which is depend on that pager plugin. So we need to decide how to recover pager plugin.

If removal wasn't intentional, we can restore pager in Backdrop core 1.8.0. Until then we can include pager in Calendar module beta release. At the time of release 1.8.0 we can make stable version of Calendar which will depend on 1.8.0 core.

Respective issue in Calendar queue.


PR by @Al-Rozhkov: backdrop/backdrop#1928
PR rebased by @indigoxela: backdrop/backdrop#3163

@Al-Rozhkov
Copy link
Member Author

I have read Add date (field) module to core carefully and looks like it wasn't intentional to exclude something from date_views module. Not only pager plugin is missing. Argument handler for date fields which is responsible for views contextual filters doesn't work, although date_views_argument_handler.inc file is there.

Quote from @quicksketch comment:

Disadvantages: This is a bit rushed and we probably have some bugs that we have introduced.

The port is looks incomplete. I'm going to provide PR to fix this.

@Al-Rozhkov
Copy link
Member Author

I have set up an example view on sandbox site with pager by date: http://1928.backdrop.backdrop.qa.backdropcms.org/page-by-date

Check out "Prev/Next" links on the top of the view.

@klonos
Copy link
Member

klonos commented Jul 15, 2017

Thank you for taking initiative on this @Al-Rozhkov 👍

@Al-Rozhkov
Copy link
Member Author

Is it ok to add 1.8.0 milestone for this one?

@serundeputy serundeputy added this to the 1.8.0 milestone Jul 15, 2017
@jenlampton
Copy link
Member

jenlampton commented Aug 17, 2017

Yes, thank you @Al-Rozhkov for catching the oversight. I'd love to see this get into 1.8! I know this was "missing" from the port of Date module, but it is still adding a feature to core. Going to tag it as a feature request (as well as a bug).

@jenlampton
Copy link
Member

I gave the PR a quick code review and left some feedback. Overall, it looks great! There are a few things in the old Drupal code that were not up to snuff with Backdrop standards, a few minor cleanups needed, and I had a few questions. Otherwise, this looks super close!

@quicksketch
Copy link
Member

PR needs some adjustments, mostly small though. Moving this to needs work.

@Al-Rozhkov
Copy link
Member Author

Thank you for review. I pushed changes based on your comments.
I'm not sure about deleted variables in date_views_argument_handler_simple class. Everything works without them.

@quicksketch
Copy link
Member

I'm not sure about deleted variables in date_views_argument_handler_simple class. Everything works without them.

Yeah, PHP doesn't require you to define properties used within an object, but including them provides you a way to document what is expected within the object. IDE's like PHPStorm also will use the property documentation to provide code-hints, and will hightlight unexpected properties as a possible bug, this can help you catch typos in your property names. We should leave them in place.

I'm not quite sure how to test these changes. For new features like this that is somewhat on the fringe of functionality, we should add new test coverage.

@jenlampton
Copy link
Member

Looks like this still needs some work, and with code-freeze in just a few hours I'm going to bump the milestone.

@jenlampton jenlampton modified the milestones: 1.9.0, 1.8.0 Sep 5, 2017
@Al-Rozhkov Al-Rozhkov removed their assignment Dec 23, 2017
@jenlampton
Copy link
Member

Looks like this still needs some work, and with no attention since the last release, I'm going to remove the milestone. Should we get a PR ready we can always add one back.

@jenlampton jenlampton removed this from the 1.9.0 milestone Jan 15, 2018
@olafgrabienski
Copy link

Re testing: There is a use case mentioned in the forum which according to one of the replies should be solved by this PR.

Looking at the screenshots there, I'm not sure if that case really needs this sort of pager

Indeed, it doesn't. At least, I was able to build a view for the use case without this PR.

@olafgrabienski
Copy link

So I guess, this is ready for testing. (...) But before implementing them, we might want to discuss if the changes are sufficient now for the calendar module port.

@docwilmot Are you maybe up to test the calendar module with this PR?

@docwilmot
Copy link
Contributor

Are you maybe up to test the calendar module with this PR?

Calendar module works almost completely with this PR. Theres a watchdog error, but no obvious loss of function.

It might be possible to move the pager plugin definition to the calendar module (as far as I know the only module that actually uses that pager), but then still at least one core change is needed: backdrop/backdrop@a2c78bc

I would agree with this as well. Havent tried.

@docwilmot
Copy link
Contributor

I'm going to try and see if we can just commit backdrop/backdrop@a2c78bc let Calendar module own all the rest of this code instead

@ghost
Copy link

ghost commented Aug 15, 2020

From Zulip chat:

@BWPanda
Was 'page by date' in Calendar or Date in D7?

@docwilmot
Date. We merged Date, but left that out somehow.

@BWPanda
Then I'd say it should be in core. People might have had D7 sites using that functionality from Date without having Calendar installed. It should stay the same.

@klonos
Copy link
Member

klonos commented Aug 15, 2020

Then I'd say it should be in core. People might have had D7 sites using that functionality from Date without having Calendar installed. It should stay the same.

I fully agree 👍

@docwilmot
Copy link
Contributor

To give context to the last two comments above, I was able to move all the Page by Date code into Calendar module with backdrop/backdrop@a2c78bc as the only core change (plus renaming date_views.views.inc to date.views.inc which should be done anyway, as this is an error).

So the question was: is there any other project using the Page by Date plugin apart from Calendar? If not then we should move all that code to Calendar and let it be maintained there.

@BWPanda feels since that code was in Date and that Date was merged to core " it should be in core. People might have had D7 sites using that functionality from Date without having Calendar installed. It should stay the same."

I will not pursue moving this code around any further, so as not to waste time. If the consensus is this should be put back into core then this issue deserves at least a "works for me" tag. Wont code review yet, in case the pendulum swings again to putting it in Calendar.

@jenlampton would be good for a tiebreak

@quicksketch
Copy link
Member

I think the rationalization that D7 Date owned it previously and it should be in Backdrop's Date port is a fairly good reasoning. It's also entirely possible to set up listings of dates that don't need a "calendar" at all, that are just paged lists of events by month like the one @indigoxela posted a screenshot of.

However, in the current PR, there is a swath of code related to setting config values such as:

    "date_views_month_format_with_year": "F Y",
    "date_views_month_format_without_year": "F",
    "date_views_day_format_with_year": "l, F j, Y",
    "date_views_day_format_without_year": "l, F j",
    "date_views_week_format_with_year": "F j, Y",
    "date_views_week_format_without_year": "F j"

These do not appear to be used anywhere in the PR. If they're necessary only for Calendar, then those perhaps should be moved to Calendar module. But as far as I can see, they might not be used anywhere at all.

@jenlampton
Copy link
Member

I also think it should be in core, since it was in Date in Drupal 7. Even if calendar was the only contrib module that used the functionality, that doesn't mean that people building views with dates aren't also using it.

@indigoxela
Copy link
Member

indigoxela commented Aug 21, 2020

However, in the current PR, there is a swath of code related to setting config values such as ... These do not appear to be used anywhere

It appears to - but these variables are used. Here's the D7 commit that brought that setting in.
It's used in function theme_date_nav_title().

Regarding renaming of date_views.views.inc to date.views.inc - that maybe makes sense, but I didn't dare because of possible glitches. Are there any? (Apart of the fact that the old file won't get removed on updates.)

@indigoxela
Copy link
Member

Phew, we have functional tests now. 🎉

@herbdool
Copy link

I think the code looks good. Since it's a major chunk of code I propose moving it to 1.17.0. An added benefit is that it's one more new feature for the blog post 😉

@herbdool
Copy link

I've also tested now and it works well.

@ghost
Copy link

ghost commented Aug 31, 2020

Thanks for everyone's work on this! Especially @indigoxela, @Al-Rozhkov, @jenlampton, @quicksketch, @olafgrabienski, @docwilmot & @herbdool.. I've merged backdrop/backdrop#3163 into 1.x.

@ghost ghost closed this as completed Aug 31, 2020
@jenlampton jenlampton changed the title Restore missing "Page by date" Views pager plugin Add Views "Page by date" pager plugin Sep 15, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants