Sometimes you want your date navigation view to work with ajax, such as when you are running a calendar block on a page. #339279: [calandar] AJAX navigation in month view is a two-year attempt to get this to work. In comment #105 of that issue, hefox mentions that the only reason views 2 doesn't automatically take care of the ajax part (if you've enabled ajax for the view) is because the particular selectors views searches for are missing from the tpl.php file. I wonder if there's any reason why it wouldn't make sense to add them? That way ajax views would work out of the box for date views and all their dependencies, like calendar -- at least for people with views 2. I'm not very familiar with the date/views integration, so forgive me if this is a complete dead end, but the attached patch makes everything work for me, and all the simpletests still pass. Made from date 6.x-2.x-dev 2010-Dec-21 version, and tested in Firefox, Chrome and IE8.

Also, if you're looking at this, it seems odd that line 38 reads <span class="next... - like the class should maybe be prev or something.

Date field and view definition objects are attached as well.

Comments

andyf’s picture

Thanks! Works for me, with my own views and event content type. I was using it for the mini calendar block, and I did notice that the navigation arrows (« and ») would have a couple of empty spaces appended to them on clicking, which looked bad on the right arrow.

izmeez’s picture

subscribing

seancorrales’s picture

Great patch. I was using this on a calendar display in a mini-panel and it still worked flawless.

Excellent timing on this patch, too! Saved me a lot of heartache.

dddave’s picture

http://drupal.org/node/339279#comment-3932306

I suspect this is back to needs work.

geek-merlin’s picture

ssub

jcmarco’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.08 KB

This patch is linked to the same issue in the calendar module #339279: [calandar] AJAX navigation in month view,
and both patches are required to improve the views compatibility allowing the use of the views ajax feature with date and calendar modules.
I just rerolled @dnotes patch with last dev release

nlambert’s picture

Seems to work well with the mini calendar (block display), but not with the page display.

If the patch isn't intended for the page view, it seems to break the page's navigation functionality => the throbber appears, but the month doesn't switch.

To regain the navigation on the views page I must override the views ajax setting for the page display => Use Ajax : No

I've tried with date 6.2.7 AND date 6.2.x dev

nlambert’s picture

Sorry, I take that back.

It was working on one of my installations, so I investigated further. There's a problem on multilingual sites => settings.view_base_path doesn't include the language path prefix.

Great job!

nlambert’s picture

We could also add on line 42

  <div class="date-heading">
    <span class="next views-summary"><h3><?php print $nav_title ?></h3></span>
  </div>

On the year display, the "date heading" renders a link to the month display of the given month.

What do you think?

Cheers

klonos’s picture

...subscribing. What about 7.x?

dgastudio’s picture

same here, how to make it work in d7?

manos_ws’s picture

Its almost a year! I have applied the patch from #4 and it is working for 4 months now.

Please could you commit the patch.

Thanks allot in advance.

Manos

jiakomo’s picture

Modesia, how did you make it work? On a similar setup of mine (multilingual site), the block display works, but the page does not (the month doesn't switch).

nlambert’s picture

@jiakomo
wow, long time ago...

look at views theme.inc lines 154&155
then look at views ajax_view.js lines 121&126

should get you in the right direction

arlinsandbulte’s picture

Assigned: Unassigned » arlinsandbulte

Assigning to myself to commit #6 above.
It is only adding a few classes to the output, so the risk is low.

arlinsandbulte’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

klonos’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Status: Closed (fixed) » Active

...sorry to reopen this one. Did this change also make it into 7.x?

arlinsandbulte’s picture

Status: Active » Closed (fixed)

The D7 Code in this area is COMPLETELY different than the D6 code.
So, I am going to close this issue.

If you need support or have found a bug, please file a new issue.
And follow the directions here: http://drupal.org/node/755312

gbernier’s picture

@klonos

Did you find out if this was somewhere in D7 because I need the exact same functionality working on a D7 site.

Cheers,
Gene Bernier