back to home

jgraichen / rails-timeago

A Rails helper for time tags that can be used with the jQuery Timeago plugin.

View on GitHub
213 stars
36 forks
3 issues
RubyJavaScript

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing jgraichen/rails-timeago in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/jgraichen/rails-timeago)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

rails-timeago **rails-timeago** provides a timeago_tag helper to create time tags usable for jQuery Timeago plugin. Installation Add this line to your : And then execute: $ bundle Or install it yourself as: $ gem install rails-timeago Use bundled JavaScript with Sprockets *Note:* The bundled JavaScript can only be used with sprockets. Rails-webpacker cannot load scripts bundled with the gem. If you use rails-webpacker you need to install, load, and setup jquery-timeago on your own. To use bundled jQuery Timeago plugin add this require statement to your file: //= require rails-timeago This will also convert all matching time tags on page load. Use the following to also include all available locale files: //= require rails-timeago-all If using a recent Rails with , jQuery might not be present anymore. You need to add to your and load it, e.g.: //= require jquery //= require rails-timeago //= require rails-timeago-all Usage Use the timeago_tag helper like any other regular tag helper: Available options: **date_only** Only print date as tag content instead of full time. (default: ) **format** A time format for localize method used to format static time. (default: ) **limit** Set a limit for time ago tags. All dates before given limit will not be converted. (default: ) **force** Force time ago tag ignoring limit option. (default: ) **default** String that will be returned if time is . (default: ) **title** A string or block that will be used to create a title attribute for timeago tags. It set to nil or false no title attribute will be set. (default: ) All other options will be given as options to the time tag helper. The above options can be assigned globally as defaults using A global limit should always be given as a block that will be evaluated each time the rails helper is called. That avoids the limit becoming smaller the longer the application runs. I18n **rails-timeago 2** ships with a modified version of jQuery timeago that allows to include all locale files at once and set the locale via an option or per element via the attribute: The following snippet will print a script tag that set the jQuery timeago locale according to your : Arguments are passed to Rails' helper, e.g. to assign a CSP nonce: . Just insert it in your application layout's html head. If you use another I18n framework for JavaScript you can also directly set . For example: rails-timeago-all application.js jQuery.timeago.settings.strings["en"] jQuery.timeago.settings.strings` you need to define them like this: License MIT License Copyright (c) 2014, Jan Graichen