-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add answer poll counts #6641
Add answer poll counts #6641
Conversation
one: "1 vote so far" | ||
other: "<%=count%> votes so far" | ||
answer_count: | ||
zero: "0 vote" |
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.
zero
doesn't work. How to do that?
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.
The english pluralization rule doesn't make use of zero
. And 0 votes
is in fact the correct English.
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.
But it will still be presented to translators in webtranslateit automatically right?
Good then, I'll revert that.
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.
Nice 👍 |
4a6b91c
to
0e8a293
Compare
👍 |
I need a little help with the failing Jasmine test. The line |
0e8a293
to
7334686
Compare
Add the rendered element to the spec content and test the visibility there: diff --git a/spec/javascripts/app/views/poll_view_spec.js b/spec/javascripts/app/views/poll_view_spec.js
index 0b9b7d5..bbd4551 100644
--- a/spec/javascripts/app/views/poll_view_spec.js
+++ b/spec/javascripts/app/views/poll_view_spec.js
@@ -2,7 +2,7 @@ describe("app.views.Poll", function(){
beforeEach(function() {
loginAs({name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}});
this.view = new app.views.Poll({ model: factory.postWithPoll()});
- this.view.render();
+ spec.content().html(this.view.render().el);
});
describe("setProgressBar", function(){
@@ -15,9 +15,9 @@ describe("app.views.Poll", function(){
describe("toggleResult", function(){
it("toggles the progress bar and result", function(){
- expect(this.view.$('.poll_progress_bar_wrapper:first').css('display')).toBe("none");
- this.view.toggleResult(null);
- expect(this.view.$('.poll_progress_bar_wrapper:first').css('display')).toBe("block");
+ expect($(".poll_progress_bar_wrapper:first")).toBeHidden();
+ this.view.toggleResult();
+ expect($(".poll_progress_bar_wrapper:first")).toBeVisible();
});
}); You can run the jasmine tests locally with bin/rake jasmine:ci instead of running them in the browser. Travis is doing the same thing. |
7334686
to
79f4594
Compare
@@ -89,7 +89,7 @@ app.views.Poll = app.views.Base.extend({ | |||
}, | |||
|
|||
toggleElements: function() { | |||
this.$('.percentage').toggle(); | |||
this.$('.poll-result').toggle(); |
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.
Strings must use doublequote.
79f4594
to
044d433
Compare
|
||
input[type=radio], | ||
label { | ||
vertical-align: middle; |
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.
Properties should be ordered font-weight, margin-bottom, vertical-align
044d433
to
16cee70
Compare
@@ -300,5 +300,8 @@ en: | |||
count: | |||
one: "1 vote so far" | |||
other: "<%=count%> votes so far" | |||
answer_count: | |||
one: "1 vote" |
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 still have a bug here, looks like the "0" case is using the "one" translation. Any idea what's going on?
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.
Other translations in that file look like this:
reshares:
zero: "<%= count %> Reshares"
one: "<%= count %> Reshare"
other: "<%= count %> Reshares"
I'm not familiar with our translation code but I'd try to do the same here.
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.
@jhass told me a few days ago that zero
was not needed for english and the "count" translation just above doesn't have it and works well, so really no idea where the problem is.
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.
My bad, the bug was there because the local was set to french, which needs a zero
key. So, no bug.
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.
maybe you should add zero to the english translation, even if english doesn't need it, but other languages use this key as fallback.
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.
@SuperTux88 I did that first but then removed it following @jhass advice. Jonne what should we do here? (even if this doesn't block this PR so is maybe a out of topic discussion).
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.
Add zero
.
16cee70
to
1e27b50
Compare
Ok, should be ready to merge ;) |
Seems legit. Thank you! |
'cause my head doesn't want to calculate it anymore.