Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
792 views
in Q2A Core by
When voting up/down a question or answer the voting down/up button disappears, how to keep it there. i think it's more intuitive if it stays in it's place instead of making disapear style it to look inactive.  How can we acheive that please ( prevent the other button from disappearing)

Thank you

1 Answer

+2 votes
by
selected by
 
Best answer

It is possible by adding the buttons You need again. See an example here. The function needs to be modified and copied to YOur qa-theme.php.

After that You need to change the upper margin of the class .qa-vote-one-button in the css file to 0: margin:0;

That should work for You. You just would have to change the language file as well, as the newly visible but disabled button says something that does not fit Your needs...

It will not allow You to use the newly visible second button I think. Please play around a bit..this coulld be a starting point.

Modify the following function as follows:

 

function vote_buttons($post)
{
$this->output('<div class="qa-vote-buttons '.(($post['vote_view']=='updown') ? 'qa-vote-buttons-updown' : 'qa-vote-buttons-net').'">');
 
switch (@$post['vote_state'])
{
case 'voted_up':
$this->post_hover_button($post, 'vote_up_tags', '+', 'qa-vote-one-button qa-voted-up');
$this->post_disabled_button($post, 'vote_down_tags', '&ndash;', 'qa-vote-second-button qa-vote-down');    // A D D E D
break;
 
case 'voted_up_disabled':
$this->post_disabled_button($post, 'vote_up_tags', '+', 'qa-vote-one-button qa-vote-up');
break;
 
case 'voted_down':
$this->post_disabled_button($post, 'vote_up_tags', '+', 'qa-vote-first-button qa-vote-up');     // A D D E D
$this->post_hover_button($post, 'vote_down_tags', '&ndash;', 'qa-vote-one-button qa-voted-down');
break;
 
case 'voted_down_disabled':
$this->post_disabled_button($post, 'vote_down_tags', '&ndash;', 'qa-vote-one-button qa-vote-down');
break;
 
case 'up_only':
$this->post_hover_button($post, 'vote_up_tags', '+', 'qa-vote-first-button qa-vote-up');
$this->post_disabled_button($post, 'vote_down_tags', '', 'qa-vote-second-button qa-vote-down');
break;
 
case 'enabled':
$this->post_hover_button($post, 'vote_up_tags', '+', 'qa-vote-first-button qa-vote-up');
$this->post_hover_button($post, 'vote_down_tags', '&ndash;', 'qa-vote-second-button qa-vote-down');
break;
 
default:
$this->post_disabled_button($post, 'vote_up_tags', '', 'qa-vote-first-button qa-vote-up');
$this->post_disabled_button($post, 'vote_down_tags', '', 'qa-vote-second-button qa-vote-down');
break;
}
 
$this->output('</div>');
}
 
 
EDIT ------------------>>>
 
Ichanged the code a bit as the two added lines didnt have values !!!!
 
 
$this->post_disabled_button($post, 'vote_down_tags', '&ndash;', 'qa-vote-second-button qa-vote-down');    // A D D E D
$this->post_disabled_button($post, 'vote_up_tags', '+', 'qa-vote-first-button qa-vote-up');     // A D D E D

 

by
Thousand thanks ! it works great. i changed  the 'qa-vote-one-button' selector on case 'voted down'  to 'qa-vote-minusone-button' for he adjuste vote down button position
Thank you very much !
...