Fix new session links in comments votes component

When there isn't a current user, the links can't be clicked, so there's
no real point in them being links.

When there's a current user and they cannot vote (for example, an
organization), having a link/button to an action they can't perform
isn't that useful IMHO. They get a message saying they aren't allowed to
vote but the message doesn't say why. However, in this case, many people
might try to click/touch the link/button and will wonder why nothing
happens, so we'll revisit this issue when we change the way we display
the "participation not allowed" messages.

Now the behavior is more similar to the one we get when voting
proposals/debates.
This commit is contained in:
Javi Martín
2021-09-30 22:39:56 +02:00
parent 7912d857b4
commit 053ec31df6
2 changed files with 16 additions and 18 deletions

View File

@@ -2004,7 +2004,9 @@ table {
.comment-votes { .comment-votes {
a { a,
.icon-like,
.icon-unlike {
color: $text-light; color: $text-light;
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;

View File

@@ -12,11 +12,9 @@
</span> </span>
<% end %> <% end %>
<% else %> <% else %>
<%= link_to new_user_session_path do %> <span class="icon-like">
<span class="icon-like"> <span class="show-for-sr"><%= t("votes.agree") %></span>
<span class="show-for-sr"><%= t("votes.agree") %></span> </span>
</span>
<% end %>
<% end %> <% end %>
<%= comment.total_likes %> <%= comment.total_likes %>
</span> </span>
@@ -50,11 +48,9 @@
</span> </span>
<% end %> <% end %>
<% else %> <% else %>
<%= link_to new_user_session_path do %> <span class="icon-like">
<span class="icon-like"> <span class="show-for-sr"><%= t("votes.agree") %></span>
<span class="show-for-sr"><%= t("votes.agree") %></span> </span>
</span>
<% end %>
<% end %> <% end %>
<%= comment.total_likes %> <%= comment.total_likes %>
</span> </span>
@@ -68,18 +64,18 @@
</span> </span>
<% end %> <% end %>
<% else %> <% else %>
<%= link_to new_user_session_path do %> <span class="icon-unlike">
<span class="icon-unlike"> <span class="show-for-sr"><%= t("votes.disagree") %></span>
<span class="show-for-sr"><%= t("votes.disagree") %></span> </span>
</span>
<% end %>
<% end %> <% end %>
<%= comment.total_dislikes %> <%= comment.total_dislikes %>
</span> </span>
</div> </div>
<div class="participation-not-allowed" style="display:none" aria-hidden="false"> <div tabindex="0">
<%= sanitize(t("votes.comment_unauthenticated", signin: link_to_signin, signup: link_to_signup)) %> <div class="participation-not-allowed" style="display:none" aria-hidden="false">
<%= sanitize(t("votes.comment_unauthenticated", signin: link_to_signin, signup: link_to_signup)) %>
</div>
</div> </div>
<% end %> <% end %>
</div> </div>