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

Display schedule time relative to now. #394

Merged
merged 1 commit into from
Oct 2, 2021
Merged

Display schedule time relative to now. #394

merged 1 commit into from
Oct 2, 2021

Conversation

morgoth
Copy link
Collaborator

@morgoth morgoth commented Oct 1, 2021

@bensheldon bensheldon temporarily deployed to goodjob-relative-time-ict2t7bs October 1, 2021 19:27 Inactive
Copy link
Owner

@bensheldon bensheldon left a comment

Choose a reason for hiding this comment

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

Big improvement. I'm a fan of relative time with timestamp title.

You might know better than me about the future compatibility of content_tag.

@@ -1,5 +1,9 @@
# frozen_string_literal: true
module GoodJob
module ApplicationHelper
def relative_time(timestamp)
text = timestamp.future? ? "in #{time_ago_in_words(timestamp)}" : "#{time_ago_in_words(timestamp)} ago"
content_tag(:time, text, datetime: timestamp, title: timestamp)
Copy link
Owner

Choose a reason for hiding this comment

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

I think content_tag is deprecated in favor of tag.time.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed it. I wasn't sure in which version of Rails tag was introduced, but we're already using it in engine, so it is fine.

@bensheldon bensheldon temporarily deployed to goodjob-relative-time-ict2t7bs October 1, 2021 20:34 Inactive
@bensheldon
Copy link
Owner

😍

Screen Shot 2021-10-01 at 5 47 41 PM

@bensheldon bensheldon merged commit 8a264ac into main Oct 2, 2021
@bensheldon bensheldon deleted the relative-time branch October 2, 2021 00:48
@bensheldon bensheldon added the enhancement New feature or request label Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants