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

Feature/2728 endorsement to proposals apply new design #2733

Merged

Conversation

tramuntanal
Copy link
Contributor

@tramuntanal tramuntanal commented Feb 14, 2018

🎩 What? Why?

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • Apply new designs.

@ghost ghost assigned tramuntanal Feb 14, 2018
@ghost ghost added the in-progress label Feb 14, 2018
@codecov
Copy link

codecov bot commented Feb 14, 2018

Codecov Report

Merging #2733 into master will decrease coverage by 0.02%.
The diff coverage is 73.07%.

@@            Coverage Diff             @@
##           master    #2733      +/-   ##
==========================================
- Coverage   98.85%   98.83%   -0.03%     
==========================================
  Files        1581     1581              
  Lines       37412    37407       -5     
==========================================
- Hits        36985    36972      -13     
- Misses        427      435       +8

@ghost ghost assigned Crashillo Feb 14, 2018
@Crashillo Crashillo removed their assignment Feb 14, 2018
@Crashillo
Copy link
Contributor

Done, design app updated. :)

@tramuntanal
Copy link
Contributor Author

Thanks @Crashillo, but it seems you broke the build of ci/circleci: admin 😢

@Crashillo
Copy link
Contributor

O_o, holy s***. How come? If you check the commit out, you'll see I edited just one view! It seems that a test is broken, somehow related to admin/users? Sorry, but I've no idea how to solve it. Let's see if @decidim/lot-core could help us here.

@mrcasals
Copy link
Contributor

It looks like you found a random failing test, #2738 fixes it. I'll reschedule yours to make things work 😄

@mrcasals
Copy link
Contributor

@Crashillo @tramuntanal tests are green!

@tramuntanal
Copy link
Contributor Author

@mrcasals Thanks!! 👍

@Crashillo I've just added the login required part. Waiting for the identities popup implemented. Thanks a lot!

@tramuntanal
Copy link
Contributor Author

@mrcasals I've executed the specs locally and all passed, is it possible that this "ci/circleci: comments" failure is another random failure?

@oriolgual
Copy link
Contributor

I've re-enqueued the job @tramuntanal

@tramuntanal
Copy link
Contributor Author

tramuntanal commented Feb 20, 2018

@decidim/lot-core @decidim/product I think it is ready to be merged.

@arnaumonty
Copy link
Member

arnaumonty commented Feb 21, 2018

Hi @tramuntanal I've been checking on staging and it works well. I have just a few comments:

  • When you click on endorse and the window to select your identity is opened, after to select the identity and click "ok" the window should close it and it remains open.
  • In the list of endorsements when you have more than 4 endorsements you can see "see all" endorsements, but if you click "see all" you keep seeing "see all" link but I was expecting to see something to "See all" and "See less" or something similar.
  • And when you click on "see all" it displays a list and not a continuous text separated by comma, and the behaviour expected is to have a continuous text.

@xabier
Copy link

xabier commented Feb 21, 2018

Also (I commented this via Telegram)

  • The behaviour of the "endorse" button should mimick the behaviour of the suport/vote button: it displays as actuable for anyone it asks login or registration when clicking if participant is not.

@xabier
Copy link

xabier commented Feb 21, 2018

@tramuntanal if any of these improvements (except for @arnaumonty 's first suggestion which I think is critical) involves long complication, I see better to merge and then iterate.

@xabier
Copy link

xabier commented Feb 21, 2018

@tramuntanal @Crashillo ... BTW: it looks fantastic!!! Congrats!

@tramuntanal
Copy link
Contributor Author

@decidim/lot-core After applying fixes required by @decidim/product this PR is ready to be merged 🥁

@@ -68,6 +75,36 @@ def endorsement_button(proposal, from_proposals_list, btn_label = nil, user_grou
current_endorsement_url: current_endorsement_url,
endorse_label: endorse_label, unendorse_label: unendorse_label }
end

def fully_endorsed?(proposal, current_user)
if current_user
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rewrite this like:

return false unless current_user

user_group_endorsements = current_user.user_groups.verified.all? { |user_group| proposal.endorsed_by?(current_user, user_group) }

user_group_endorsements & proposal.endorsed_by?(current_user)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, done!

@@ -68,6 +75,36 @@ def endorsement_button(proposal, from_proposals_list, btn_label = nil, user_grou
current_endorsement_url: current_endorsement_url,
endorse_label: endorse_label, unendorse_label: unendorse_label }
end

def fully_endorsed?(proposal, current_user)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add some docs please

@@ -6,6 +6,7 @@ module Proposals
class ProposalEndorsementsController < Decidim::Proposals::ApplicationController
helper_method :proposal

protect_from_forgery except: [:destroy, :create]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really necessary? It seems that with this another site could trigger a creation or deletion of an endorsement (maybe I'm wrong)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been added when applying new designs because the CTA is no longer a button with a form, but a whole div that on click executes a jquery method using vanilla $.ajax. This ajax call does not have any authentication_token to be used when invoking :destroy or :create.

I'll try to rework this.

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've managed to supply the auth token through the url so now protection from forgery has been re-enabled.

<%= render partial: "endorsements_count", locals: { proposal: @proposal, fully_endorsed: fully_endorsed } %>
<% if current_settings.endorsements_blocked? %>
<%= content_tag :span, t('.endorse'), class: "card__button button #{endorsement_button_classes(false)} disabled", disabled: true, title: t('.endorse') %>
<% elsif not current_user %>
Copy link
Contributor

Choose a reason for hiding this comment

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

elsif not current_user it's kinds complicated, maybe we can use elsif current_user and swap the block with the next one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, done.

@tramuntanal tramuntanal dismissed oriolgual’s stale review February 26, 2018 09:29

All requested changes applied.

@tramuntanal
Copy link
Contributor Author

All tests passing, automatic merging ready, @decidim/lot-core @decidim/product ready to be merged.

@tramuntanal
Copy link
Contributor Author

@decidim/lot-core Should I click the "Squash and merge" button? normally it's you that do it. I fear that if we don't do it soon new conflicts will arise 😨

@mrcasals mrcasals merged commit e08dc58 into master Feb 27, 2018
@mrcasals mrcasals deleted the feature/2728-endorsement_to_proposals_apply_new_design branch February 27, 2018 10:07
@ghost ghost removed the in-progress label Feb 27, 2018
@mrcasals
Copy link
Contributor

@tramuntanal done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants