Auto-update signature count on petition page. - #482
Conversation
188601b to
3ac2ddd
Compare
|
|
||
| def open_petition_page? | ||
| # XXX What should go here? Same as petition_page? plus petition.open? Is that allowed here? | ||
| true |
There was a problem hiding this comment.
The method petition_page? is just a check for the controller and action name but we know that if it's true then the @petition instance variable is set so just use the Petition#open? method to achieve what you need, e.g:
petition_page? && @petition.open?
Hopefully that's clearer?
There was a problem hiding this comment.
Ah, great, thanks, I still don't get my head around where variables are magically available in ruby :)
|
The reason that |
This also updates the progress bar.
3ac2ddd to
106f77f
Compare
|
Ah, of course, makes sense, thanks. Think only thing I don't understand now is the |
That's just a simple decorator around the template context so that we can return the values in the way that we need. Mostly it's simple delegations but some are slightly more complicated. It then creates the cache key for each item in the list of dependencies. |
|
@dracos one more thing - I think creating a signature count API would be useful - there's no need to pull all of the JSON data just to get the signature count. |
This fetches the JSON of the petition every 10 seconds and updates the count, and progress bar, accordingly, with a pretty counting animation.