Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Do not link when there are no endorsements. #3531

Conversation

tramuntanal
Copy link
Contributor

@tramuntanal tramuntanal commented May 29, 2018

🎩 What? Why?

There is a strange behaviour when clicking on icon next to endorse button.

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry

@ghost ghost assigned tramuntanal May 29, 2018
@ghost ghost added the status: WIP label May 29, 2018
@@ -1,4 +1,4 @@
<%= link_to "#list-of-endorsements", id: "proposal-#{proposal.id}-endorsements-count", class: "button small compact light button--sc button--shadow #{fully_endorsed ? 'success' : 'secondary'}" do %>
<%= link_to "#{proposal.proposal_endorsements_count.positive? ? "#list-of-endorsements" : "javascript:;"}", id: "proposal-#{proposal.id}-endorsements-count", class: "button small compact light button--sc button--shadow #{fully_endorsed ? 'success' : 'secondary'}" do %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should use link_to_if here or not render the link at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can use a variable if you don't like this inliner:

<% link_href= proposal.proposal_endorsements_count.positive? ? "#list-of-endorsements" : "javascript:;" %>
 +<%= link_to link_href, id: "proposal-#{proposal.id}-endorsements-count", class: "button small compact light button--sc button--shadow #{fully_endorsed ? 'success' : 'secondary'}" do %> 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is not the inline ternary operator, but the link to javascript:;, which looks weird to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, but it is solution to the problem that avoids having to hack the CSSs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tramuntanal You don't need to hack the CSS here. You can apply those classes to a div and it will look exactly the same 😄

@tramuntanal tramuntanal force-pushed the fix/3322-endorsements_num_icon_scrolls_down_to_endorsements_list_when_no_endorsements_exist branch from 3c44b67 to 6a62957 Compare June 1, 2018 11:24
oriolgual
oriolgual previously approved these changes Jun 6, 2018
@tramuntanal
Copy link
Contributor Author

It seems that coverage checks are stalled @decidim/lot-core

@tramuntanal
Copy link
Contributor Author

This PR is ready to be merged @decidim/lot-core :)

@mrcasals mrcasals force-pushed the fix/3322-endorsements_num_icon_scrolls_down_to_endorsements_list_when_no_endorsements_exist branch from b46003f to 7b8a672 Compare June 7, 2018 09:30
@ghost ghost assigned mrcasals Jun 7, 2018
@ghost ghost added the status: WIP label Jun 7, 2018
@mrcasals mrcasals merged commit 32f5f26 into master Jun 7, 2018
@ghost ghost removed the status: WIP label Jun 7, 2018
@mrcasals mrcasals deleted the fix/3322-endorsements_num_icon_scrolls_down_to_endorsements_list_when_no_endorsements_exist branch June 7, 2018 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants