Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dgilperez/initialjs-rails
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: shah743/initialjs-rails
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 4 commits
  • 2 files changed
  • 2 contributors

Commits on Feb 1, 2016

  1. Update README.md

    Shah Zaib committed Feb 1, 2016
    Copy the full SHA
    839d6d9 View commit details
  2. Merge pull request #2 from shah743/updated_readme

    Update README.md
    Shah Zaib committed Feb 1, 2016
    Copy the full SHA
    93e4211 View commit details
  3. Merge pull request #3 from shah743/char_count

    Char count
    Shah Zaib committed Feb 1, 2016
    Copy the full SHA
    e5a22fa View commit details

Commits on Oct 1, 2018

  1. Copy the full SHA
    76c0744 View commit details
Showing with 10 additions and 8 deletions.
  1. +9 −7 README.md
  2. +1 −1 initialjs-rails.gemspec
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# initialjs-rails

[initial.js](https://github.com/mozilla/metrics-graphics) is a simple jQuery plugin to make Gmail-like text avatars for profile pictures using SVG.
[initial.js](https://github.com/judesfernando/initial.js) is a simple jQuery plugin to make Gmail-like text avatars for profile pictures using SVG.

**initialjs-rails** is a wrapper to easily include it in your Rails projects using the assets pipeline.

@@ -28,18 +28,20 @@ Add this to your application.js after page is ready:

$('.initialjs-avatar').initial();

And finally, in your views, tag your *<img/>* class with `initialjs-avatar` class. You can use *data-attributes* as described in [initial.js](https://github.com/mozilla/metrics-graphics). Or you can use the helper below.
And finally, in your views, tag your *<img/>* class with `initialjs-avatar` class. You can use *data-attributes* as described in [initial.js](https://github.com/judesfernando/initial.js). Or you can use the helper below.

Enjoy.

## ActionView Helper

For extra simplicity, you can use this helper in your view to generate your avatar image from your model. In the following examples we'll use User, but any model responding to `:name` will do. You can learn the options available and their defaults directly from the examples:
For extra simplicity, you can use this helper in your view to generate your avatar image from your model. In the following examples we'll use User, any model responding to `:name` or passing String will do. You can learn the options available and their defaults directly from the examples:

avatar_image(user) # => 100x100 image with round corners
avatar_image(user, size: 32) # => 32x32 image with round corners
avatar_image(user, class: 'extra_class') # => add an extra CSS class to <img/> tag
avatar_image(user, round_corners: false) # => disable round corners
avatar_image(@user) or avatar_image(@user.full_name) # => 100x100 image with round corners
avatar_image(@user, size: 32) # => 32x32 image with round corners
avatar_image(@user, count: 2) # => Number of characherts to be shown in the picture
avatar_image(@user, color: black or #000) # => Color of the text
avatar_image(@user, class: 'extra_class') # => add an extra CSS class to <img/> tag
avatar_image(@user, round_corners: false) # => disable round corners

## Development

2 changes: 1 addition & 1 deletion initialjs-rails.gemspec
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency 'railties', [">= 3.1", "< 5.0"]
spec.add_dependency 'railties', [">= 3.1", "< 6.0"]

spec.add_development_dependency "bundler", "~> 1.9"
spec.add_development_dependency "rake", "~> 10.0"