├── .github └── FUNDING.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── bin ├── console └── setup ├── lib └── rails │ ├── livestamp.rb │ └── livestamp │ └── version.rb ├── rails-livestamp-1.1.2.gem ├── rails-livestamp-1.1.3.gem ├── rails-livestamp.gemspec └── vendor └── assets └── javascripts └── rails-livestamp.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | patreon: bunlong 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. 4 | 5 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion. 6 | 7 | Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. 8 | 9 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. 10 | 11 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. 12 | 13 | This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/) 14 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in rails-livestamp.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Matt Bradley and Bunlong 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rails-livestamp [![Gem Version](https://badge.fury.io/rb/rails-livestamp.svg)](http://badge.fury.io/rb/rails-livestamp) [![Gem Total Downloads](https://img.shields.io/gem/dt/rails-livestamp.svg)](https://rubygems.org/gems/rails-livestamp) 2 | 3 | The rails-livestamp is a simple jQuery plugin that provides auto-updating timeago text to your timestamped HTML elements, which will update automatically as time goes by. ISO 8601 timestamps are also supported. 4 | 5 | ## Installation 6 | 7 | Add this line to your application's Gemfile: 8 | 9 | ```ruby 10 | gem 'rails-livestamp', '~> 1.1.3' 11 | ``` 12 | And then execute: 13 | 14 | $ bundle 15 | 16 | Or install it yourself as: 17 | 18 | $ gem install rails-livestamp 19 | 20 | To use rails-livestamp add this require statement to your application.js file: 21 | 22 | ```ruby 23 | //= require rails-livestamp 24 | ``` 25 | 26 | ## Usage 27 | 28 | No extra JavaScript required! Just use a `` with the data-livestamp attribute set to the desired Unix timestamp (in seconds), like this: 29 | 30 | If you use ERB: 31 | 32 | ```ruby 33 | You discovered rails-livestamp . 34 | ``` 35 | 36 | If you use HAML: 37 | 38 | ```ruby 39 | You discovered rails-livestamp 40 | %span{"data-livestamp" => "#{Time.now.to_i}"}. 41 | ``` 42 | 43 | And you will see something like this: 44 | 45 | ```ruby 46 | You discovered rails-livestamp a minutes ago. 47 | ``` 48 | 49 | Wait half a minute - the livestamp will update automatically. 50 | 51 | ## More Documentation. 52 | 53 | See the [livestamp documentation](http://mattbradley.github.io/livestampjs/). 54 | 55 | ## License 56 | 57 | [MIT License](https://github.com/Bunlong/rails-livestamp/blob/master/LICENSE) 58 | 59 | Copyright (c) 2015 - Present, [Matt Bradley ( Livestamp.js Maintainer )](https://github.com/mattbradley), [Bunlong VAN](https://github.com/Bunlong) ( Maintainer ) 60 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | 3 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "bundler/setup" 4 | require "rails/livestamp" 5 | 6 | # You can add fixtures and/or initialization code here to make experimenting 7 | # with your gem easier. You can also use a different console, if you like. 8 | 9 | # (If you use this, don't forget to add pry to your Gemfile!) 10 | # require "pry" 11 | # Pry.start 12 | 13 | require "irb" 14 | IRB.start 15 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | bundle install 6 | 7 | # Do any other automated setup that you need to do here 8 | -------------------------------------------------------------------------------- /lib/rails/livestamp.rb: -------------------------------------------------------------------------------- 1 | require "rails/livestamp/version" 2 | 3 | module Rails 4 | module Livestamp 5 | class Engine < ::Rails::Engine 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/rails/livestamp/version.rb: -------------------------------------------------------------------------------- 1 | module Rails 2 | module Livestamp 3 | VERSION = "1.1.3" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /rails-livestamp-1.1.2.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bunlong/rails-livestamp/8018a667db331b8ba8438f278a9430440192a6c4/rails-livestamp-1.1.2.gem -------------------------------------------------------------------------------- /rails-livestamp-1.1.3.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bunlong/rails-livestamp/8018a667db331b8ba8438f278a9430440192a6c4/rails-livestamp-1.1.3.gem -------------------------------------------------------------------------------- /rails-livestamp.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'rails/livestamp/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = "rails-livestamp" 8 | spec.version = Rails::Livestamp::VERSION 9 | spec.authors = ["Bunlong"] 10 | spec.email = ["bunlong.van@gmail.com"] 11 | 12 | spec.summary = %q{The rails-livestamp is a simple jQuery plugin that provides auto-updating timeago text to your timestamped HTML elements, which will update automatically as time goes by. ISO 8601 timestamps are also supported.} 13 | spec.description = %q{The rails-livestamp is a simple jQuery plugin that provides auto-updating timeago text to your timestamped HTML elements, which will update automatically as time goes by. ISO 8601 timestamps are also supported.} 14 | spec.homepage = "https://github.com/Bunlong/rails-livestamp" 15 | spec.license = "MIT" 16 | 17 | spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } 18 | spec.bindir = "exe" 19 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } 20 | spec.require_paths = ["lib"] 21 | 22 | spec.add_development_dependency "bundler", "~> 1.8" 23 | spec.add_development_dependency "rake", "~> 10.0" 24 | end 25 | --------------------------------------------------------------------------------