Will it be possible to provide support for mulitiple instances of the widgets on a single node view page?
Requirements:
1) Multiple instances of vud on the same page for the same node
2) Ability to render different widget for different instances
3) When one gets voted the other instances shoud also reflect the latest state of the widget and the votes (through ajax)
Comments
Comment #1
marvil07 commentedNo more features to 3.x I think.
About 1)
I really never tried it, but theoretically you can do that using manual rendering of the widget, see #544354: How to display voting widget by API for nodes?, also take a look to #793048: Per content configuration and #557260: Per node type configuration.
But as a feature I would mark that as a by design unless you are talking about multiple vote tags per node, but that is too related to #793048: Per content configuration so please make a note there to avoid forgetting about this.
About 2) and 3)
I do not understand what you propose, what is an "instance", but I guess you are talking about the same feature. Please elaborate about it.
Comment #2
chandrabhan commentedThanks for the reply.
Actually, 2) and 3) are related to 1). Let me elaborate the requirement.
As per 1), I want to show vote/up down widgets twice for every node (its same the up/down widget just that it is shown twice). Either both of them are shown within the node body (say, at the top and the bottom of the content) or one in node body and another in a sidebar block.
I have tried the code piece in http://drupal.org/node/544354 and it is alllowing me to print the same widget twice anywhere in the node content. (But I am not too sure about showing it in a block though, i need to check).
Now as for 2) and 3), to enhance on 1), what I was requesting was, at the top of the page I want to show a small widget with up and down arrow and at the bottom it would be thumbs up and down with some text and stuff (essentially, different widget.tpl.php). And I might choose to show votes.tpl.php only in the botton widget.
Also, since they both represent the same vote, when I vote using the up arrow at the top of the page, the bottom widget's thumbs up should also reflect the same vote at the same time.
I hope the requirement is relatively clear now.
Comment #3
marvil07 commentedYep, I think they are clear now.
Like you mentioned, it's something to change in theme layer, you can do it, just using #544354: How to display voting widget by API for nodes?.
If you want to render it in a block, you just need to get the right nid and then the process is the same.
I am marking this as by design since I do not have intentions to complicate the rendering.
Comment #4
TheInspector commentedIf you have the widget on multiple places on the page(for example if you use tabs) and want all scores to be updated, you can do as follows, for the 2.0 version:
In vud.theme.inc, row 396:
Change
$commands[] = ctools_ajax_command_replace("#widget-$type-$content_id", theme('vud_widget', $content_id, $type, $tag, $widget));To
$commands[] = ctools_ajax_command_replace(".widget-$type-$content_id", theme('vud_widget', $content_id, $type, $tag, $widget));And in your widget template add the class
print $id;to the vud-widget div, like this:<div class="vud-widget vud-widget-slud <?php print $id; ?>" id="<?php print $id; ?>">Comment #5
nugen commentedWonderful, this works perfect!