-
Notifications
You must be signed in to change notification settings - Fork 32
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
Follow button #963
Follow button #963
Conversation
Codecov Report
@@ Coverage Diff @@
## master #963 +/- ##
==========================================
+ Coverage 83.06% 83.14% +0.08%
==========================================
Files 411 411
Lines 10033 10053 +20
==========================================
+ Hits 8334 8359 +25
+ Misses 1699 1694 -5
Continue to review full report at Codecov.
|
@Crashillo I have a problem with Follow button, for example in, http:https://participacion.gobify.net/participacion/p/pacto-social-mujer Can you help me with the magic of CSS? 😄 |
I'll check what happens in staging by following a process, which shows another alert. For example: http:https://participacion.gobify.net/participacion/p/jjnlvcebnogn-npp0vusbnoirsvon-vlgdlsjbn |
There you have your CSS. @Crashillo no need to worry. |
I have tried the following tests:
GobiertoPeople
@furilo, I have a design detail pending. In "Agendas Module" (Ex. http:https://participacion.gobify.net/personas/alcalde-de-madrid) the follow button is not prepared for this module with the styles that it has, I pass you a capture. When you follow a person or an event, you don't see the text. |
@apradillap the CSS issue is fixed. Btw, the idea was that this button was Ajax (in the sandbox you even had the interaction), but now the whole page is reloading. Any special reason? |
Thanks @furilo for the CSS! I reused another part of the application concerning subscriptions. So I change it to AJAX? |
yes, it its quick |
I think the new styles broke the button About this process: See in staging: http:https://participacion.gobify.net/participacion/p/presupuestos-participativos-alcobendas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I miss tests to follow a Process. Those tests will have shown you the error 500 I caught in the acceptance.
@@ -38,15 +38,16 @@ def create | |||
) | |||
end | |||
|
|||
redirect_to request.referrer | |||
redirect_to request.referrer if @user_subscription_form.subscribable.class.name == "Site" || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This piece of code is not working well when I follow a Process, because is raising a 500 error:
NoMethodError (undefined method `name' for #<GobiertoParticipation::Process:0x007fd7f6ec9ed0>):
app/controllers/user/subscriptions_controller.rb:42:in `create'
If you are dealing with HTML and JS requests you should implement a respond_to
, and probably redirect to the referer in all HTML requests, and in the JS requests render a create.js.erb partial. In this partial you should render the button in the new state.
So, when a user follows something the button will say "Proceso seguido!"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the mistake I was telling you yesterday that I had pending, I was aware, I correct it and add the test.
Alvaro commented that we have to redefine the page of subscriptions, which made no sense because it was going to grow a lot. |
@@ -27,6 +28,14 @@ class ProcessForm | |||
|
|||
validates :site, :title_translations, :process_type, presence: true | |||
validates :process_type, inclusion: { in: ::GobiertoParticipation::Process.process_types } | |||
validates_presence_of :starts, :ends, if: :process? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, those validations should be removed
@@ -27,6 +28,14 @@ class ProcessForm | |||
|
|||
validates :site, :title_translations, :process_type, presence: true | |||
validates :process_type, inclusion: { in: ::GobiertoParticipation::Process.process_types } | |||
validates_presence_of :starts, :ends, if: :process? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, those validations should be removed
<a href="#" class="button outline rounded desktop_only follow_process"><i class="fa fa-rss"></i> <span><%= t('.follow_process') %></span></a> | ||
<% end %> | ||
<!-- ./ --> | ||
<span id="subscribable_button"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 🆒
Ready to merge |
Connects to #842
What does this PR do?
Depending on the context, the button should allow the user to follow:
Pending