Hello,

This looks to be a very exciting module that I would like to follow closely!

I wanted to share something I noticed while testing:
The view is not refreshing when the flag uses "JavaScript toggle" (but it does work with "Normal link")
Is this a known limitation?

Thank you!

Comments

YK85’s picture

Actually, after taking a closer look, when the flag is set to "Normal link" the page refreshes anyway so the view is also refreshed so there is no need for the Views Flag Refresh module (I believe).

I use "Javascript toggle" on my views as it looks better. It would be great to be able to have the view refresh after x seconds once a content is unflagged for the content to be removed from the view via AJAX.

Thanks!

cpliakas’s picture

Category: feature » bug
Status: Active » Postponed (maintainer needs more info)

Hi yaz085.

You are right in that this module isn't necessary when you use the "Normal link" widget to display the flag link. This module is specifically designed to bridge the Views and Flag projects when both of their their internal AJAX settings are enabled. With that being said, you have to make sure the view is configured to refresh when certain flags are selected. See the configuration section along with the image on this module's project page explaining how to configure the view to work with this module.

Can you confirm that the View is configured correctly? If so, let's continue this thread as a bug report and try to find out what the issue is.

Thanks for posting,
Chris

tomdisher’s picture

StatusFileSize
new74.55 KB

I can confirm the same problem. I'm using 6.x-2.11 and Views Flag Refresh 6.x-1.0-beta2

It seems that Views Flag Refresh does nothing.

Attached is a shot of my configuration.

cpliakas’s picture

Hi tomdisher.

Thanks for posting. Your configuration looks correct, and things should be working. Unfortunately I cannot replicate the issue, so it would be great if someone could help with the debugging. Couple of things I am interested in knowing...

  • Does the module work with a default Drupal theme?
  • Is there any custom theming that might be stripping out the default IDs and CSS classes set by the Views module?
  • Are there any other modules, custom or contrib, that could be clashing with this module's JavaScript?
  • Using Firebug or some other diagnostic tool, are there any JavaScript errors being thrown?
  • Which browser(s) are you testing on?
  • What version of the Flag module is being used?

Any information would be helpful in tracking this down.

Thanks,
Chris

tomdisher’s picture

Thanks for the quick reply, Chris.

It does look like it is working with the Garland theme. Any suggestions?

Further info:

-No JS errors

-I can't think of anything stripping the views classes and IDs

-Testing on Firefox 3.6.8

-Flag 6.x-1.3

cpliakas’s picture

Hi tomdisher.

Great information. I feel like we are getting closer. From what you said, it seems to be something isolated to the theme. Is this a custom theme or contributed theme? If custom, are you using a base theme? Also, are there any views / block templates in the theme?

Random thought, does your page.tpl.php have a <?php print $closure; ?>? Sometimes omitting that messes up javascript functionality.

Thanks again for the information,
Chris

cpliakas’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Active

Changing to a support request since the module works with a default Drupal theme. Will continue to help debug and will change back to a bug report if other information is uncovered.

tomdisher’s picture

Category: support » bug
Status: Active » Postponed (maintainer needs more info)

Hi Chris

Thanks for your support- What actually happened:

I changed the default view settings which did not carry over to the block view for some reason. On one page I inserted the default - on another I inserted the block. The block was not working. When I checked with the garland theme I actually looked at the one calling the default values.

In short, it was an ID-10-T error.

I'm not sure why the default values were not overwritten in the block view. The block was set to use default values. That might be worth looking into.

Thanks again!

Tom

cpliakas’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Fixed

Haha! Thanks for posting back. I have been known to do that from time to time as well :-). Marking this thread as "fixed", and this will remain as a good debug tutorial for others who can't get the module to work.

Thanks for the posts,
Chris

YK85’s picture

Status: Fixed » Active
StatusFileSize
new32.18 KB

Hi Chris,

I'm sorry to reopen but I am still experiencing this problem with a specific display type (panel pane) and also I think I found a bug with settings not transferring to all displays when Default is updated. Please let me know if I should open this somewhere else.

Problem with settings not transferring:
After enabling the module I go to the view which has displays Default, page_1, panel_pane_1. In the Default display I go to AJAX and change settings to (o) YES, check [x] Favorites (the flag name used in this view), (o) No widget, then UPDATE and then SAVE view. I go back to Default display and the settings are as I entered. I go to page_1 and panel_pane_1 and the checkbox for the Favorites flag is not checked. Should the Default display carry over this setting? I think this is usually what happens unless the other displays are set to Override.

I re-update with [x] Favorites checked for all other displays, SAVE, go back several times to make sure all the settings stick for all displays.

Problem with panel pane display type:
I go to the url that has the page display which lists nodes and each has a flag link. I flag one node, and the page refreshes. perfect!
Then I go to the url where the panel pane display is used. I flag one node but nothing refreshes.

The panel is embedded into another views page template file using the code <?php print views_embed_view('myfavorites', 'panel_pane_1'); ?>

views-6.x-3.x-dev (2010-Aug-18)
views_flag_refresh-6.x-1.0-beta3 (2010-Sep-08)
flag-6.x-2.0-beta3 (2010-May-09)
panels-6.x-3.7 (2010-Jul-27)

I hope this is enough info to troubleshoot.
Please let me know if I can clarify anything above or provide more details.

Thanks!

YK85’s picture

I changed the panel pane to a block and found that it also does not work.

Is there something else I need to include/print if I embed the view into a template file (.tpl.php)?
<?php print views_embed_view('myfavorites', 'block_1'); ?>

More specifically, I have another view called 'home' where I embed this view 'myfavorites' as well as other views into the template file (views-view-fields--home--page-1.tpl.php).

I really appreciate your work on this very useful module.

Thanks again

cpliakas’s picture

Version: 6.x-1.0-beta1 » 6.x-1.0-beta3
Category: support » bug

Hi yaz085.

Thanks for all the info, very helpful. I actually haven't done anything with either Panels or with Views 3, so I will need to test integration with both of those modules. My guess is there is some API change in Views 3 that prevents this module from working, but I will also test any quirks with Panels. Changing back to a bug report.

Thanks,
Chris

cpliakas’s picture

yaz085,

Just to report back, I tested with both Panels and Views 3 and they work using standard templates. Taking another look at your post, views_embed_view() should work fine, but the fact that they are injected into the template of another view may be causing an issue. Would you feel comfortable either sharing the template file referenced in #11 or pointing me to a public facing site where these views are being rendered?

Thanks,
Chris

YK85’s picture

StatusFileSize
new5.33 KB

Hi Chris,

Please find attached in the zip file:

1) home views export
2) myfavorites views export
3) views-view-fields--home--page-1.tpl.php
4) views-view-fields--myfavorites--panel-pane-1.tpl.php

<?php print views_embed_view('myfavorites', 'panel_pane_1'); ?> is used in the home template

Please let me know if I can provide any further information.
I really appreciate your support!

Bilmar’s picture

Hello,

I'm trying out this cool module and experiencing this same issue.
I'm also using views_embed_view.

I checked out the attachment in #14 and my setup is the same.

Regards

cpliakas’s picture

Title: view is not refreshing when the flag uses "JavaScript toggle" » View does not refresh when it is embedded inside another view
Priority: Normal » Minor

Thanks for the input yaz085 and trupal218.

yaz085, I was able to rebuild your setup and I confirmed what you are seeing. First, views_embed_view() works fine by itself. The issue is when it is used inside another view. This is definitely an edge case, but I will investigate if it can be resolved. I am also changing the title to reflect the diagnosis of the bug.

Also if I could weigh in from a best practices standpoint, generally setups like this use the Views "Attachment" display to chain multiple views together instead of putting this logic in a template. I tested the setup using attachment displays instead of placing views_embed_view() directly inside the template, and the refresh worked for all views as expected. As a side note, calling the function in the template also breaks the flag JavaScript widget if an exposed filter is submitted. The Flag bug does not appear when using Attachments.

My feeling is that we are really wrestling with Views at this point, and Views Flag Refresh appears to work when the normal channels available to the module are used. The addition of the Flag bug also makes me think this setup may cause other problems beyond the one reported in this issue, so I am bumping the priority to "minor". I would be curious to get your feedback on this.

Thanks again for posting the code. Extremely helpful in determining the root cause of this bug.
~Chris

YK85’s picture

I tried many other ways but only able to achieve what I need for the page with the method I described above =(

The view 'home' has a page_1 (for role A) page_2 (for role B) and page_3 (for anonymous).
Then I use views_embed_view() within the template file that designs the page (complex) to print the other views inside.

I hope there is another way to get this module working.

Thank you!

cpliakas’s picture

Hi yaz085.

Thanks for posting back. Completely understood with complex layouts. I will refocus my efforts to get this module working in the setup you outlined. There has to be a way to do this.

Thanks again,
Chris

chrisschaub’s picture

I think using panels instead of views attachments or embeds is a better approach, if possible. I'm noticing something similar with panels. When I have to flag / draggable enabled views in one panel page, say one on top of each other. When I click a flag, both views refresh the first time, which is good. But then, the page is kind of broken after that. I can tell the css is a bit broken cause the link colors revert back to the base theme. Is there a reason why two views using flag refresh could not be on the same page, responding to the same flag event? It works the first time perfectly, but just can't handle subsequent flag events after that, without a complete page refresh.

The use case is sort of common. Have a queue of nodes that all have a flag set in the middle panel. Then have a list of "potential nodes" in a panel on the right with flag links. You click a flag link, the node gets added to the queue. It works great the first time.

Thanks for any help.

__mark’s picture

I'm actually experiencing the same thing, the view works great the first time I flag (I'm using one view for a node's comments and another small view in a viewfield), but refreshing doesn't work after that.

After that first, successful time something is flagged and refreshed, if I looked at the status bar of the browser it looked like it made an extra request without anything happening on the page after it ended. So I checked the console and this error was shown twice consecutively:

The stylesheet http://site.com/ was not loaded because its MIME type, "text/html", is not "text/css".

Then I checked the net tab, and after the first flag link posts these all return 200:

http://site.com/views/ajax?view_name=the_view_name_1&view_display_id=default&view_args=43&view_path=node%2F43&view_base_path=node%2F43&view_dom_id=1&pager_element=0

http://site.com/views/ajax?view_name=the_view_name_1&view_display_id=default&view_args=43&view_path=node%2F43&view_base_path=node%2F43&view_dom_id=2&pager_element=0

http://site.com/views/ajax?view_name=the_view_name_2&view_display_id=default&view_args=43%2F&view_path=node%2F43&view_base_path=null&view_dom_id=3&pager_element=1

Then there's two GET requests to two zen theme stylesheets (style and zen.css) that get returned 301. This, I am sure, is because I am using a custom sub theme through zen, and did a poor job of commenting out all of the parent theme stylesheet calls. But it explains what the previous poster described. Then two consecutive GET requests to http://site.com that returned 200.

Then after the second flag is clicked (and after that link's POST request) this returned 200:

http://site.com/views/ajax?view_name=view_name_1&view_display_id=default&view_args=43&view_path=node%2F43&view_base_path=null&view_dom_id=2&pager_element=0
__mark’s picture

Problem is identical in Garland theme too (so just disregard the part in my previous post about the the two stylesheets that returned a 301).

Also, I noticed a something interesting about the bug:

• When 1st flagging in "view_1" -> "view_1" & "view_2" are refreshed.
• When 2nd flagging in "view_1" -> "view_2" is refreshed.
• When 3rd flagging in "view_1" -> "view_2" is refreshed and so on...
(it's the same deal vice-versa too.)

I plan on staring at the code for a while and hoping I find a clue on where to start trying to fix it, so if anyone has a tip on what part of the code this should involve, please post.

chuckbar77’s picture

I'm having the same problem. Has anyone had any further progress?

cpliakas’s picture

Unfortunately I cannot replicate the issue, and due to #D7CX commitments I don't have much free time to spend this at the current moment. Would love to see some patches from developers who are experience this issue, and would be willing to take on a co-maintainer once someone submits a few patches.

Sorry for the delays,
Chris