I have created two flags using the Flag module and they are placed on my custom content type, 'Challenge'. Both the flags can only be flagged but not unflagged. The first flag is "Accept". The second flag is "Complete". These two flags i have created normally through the UI. However to display them in panels, i have used the following code in a custom text area in panel as flags are not displayed automatically there.
<div id="accept-flag">
<?php
print flag_create_link('flag1', %node:nid);
?>
</div>
<div id ="complete-flag">
<?php
print flag_create_link('flag2',%node:nid);
?>
</div>
This displays both the flag on my Panel Page. However, my use case is something different. At first only, the "Accept" flag should be visible. Then, when the user clicks on "Accept", then only the other flag, "Complete" should appear. Any hints on how to achieve this. I have also tried using Rules, giving the event: A node has been flagged and then the action for a new flag. It does not work. Then i tried using flag actions as well, i.e., on flagging of first flag, display another flag.It does not work. Any ideas, suggestions are appreciated.
Thanks
Edit
i thought of a way to do this using JavaScript and css. When the first flag is visible, the second wont show. The code i am using is :
if($("#accept-flag").is(":visible")){
$("#complete-flag").css('display','none');
This i have placed inside js/script.js in my theme folder.
(function ($, Drupal, window, document, undefined) {
if($("#accept-flag").is(":visible")){
$("#complete-flag").css('display','none');
}
})(jQuery, Drupal, this, this.document);
When i view the page source, the script is loading however both the flags are still showing.
Please advice
Thanks again