Skip to content

added simple variable for S for plural/singular units #54

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

Merged
merged 3 commits into from
Mar 18, 2014

Conversation

itslenny
Copy link
Contributor

Added scope variables for: daysS, hoursS, minutesS, and secondsS.

The variables are set to 's' or '' (blank string) depending on if each of the values should be plural. I thought of a bunch of different ways to implement this, but this seemed like the simplest. I thought about adding configurable unit words or a template variable you could provide, but it just seemed like overkill.

Here is an example of how it would be used:

<timer class="countdown" end-time="campaign.start">{{days}} day{{daysS}}, {{hours}} hour{{hoursS}}, {{minutes}} minute{{minutesS}}, {{seconds}} second{{secondsS}}.</timer>

Which would result in (for example:

22 days, 3 hours, 2 minutes, 4 seconds.
22 days, 3 hours, 2 minutes, 3 seconds.
22 days, 3 hours, 2 minutes, 2 seconds.
22 days, 3 hours, 2 minutes, 1 second.
22 days, 3 hours, 2 minutes, 0 seconds.
22 days, 3 hours, 1 minute, 59 seconds.
...etc

Sorry that my description is longer than the code I submitted.

@siddii
Copy link
Owner

siddii commented Mar 18, 2014

@itslenny - Thanks for the PR 👍 Could you please add an E2E test for this?

@itslenny
Copy link
Contributor Author

Added the test. Also, caught an error with my code and fixed it (that's why tests are good).

Do I need to do another pull including it or are you able to just grab the changes?

@siddii
Copy link
Owner

siddii commented Mar 18, 2014

Thx! Can you merge stuff from the master into this branch?

@itslenny
Copy link
Contributor Author

Should be all set. I ran the tests and everything passed (including the singluar / plural thing and the leading zeros thing which were conflicting and had to be manually merged).

@siddii
Copy link
Owner

siddii commented Mar 18, 2014

Awesome.. 👍

siddii added a commit that referenced this pull request Mar 18, 2014
added simple variable for S for plural/singular units
@siddii siddii merged commit 0711c00 into siddii:master Mar 18, 2014
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.

2 participants