letter_avatar 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a9c80066e2882fbe010bf95f0abd9d050a5f093
4
- data.tar.gz: 1aa4b8946c1e553b0ea7cb15e13387ec6cef6b99
3
+ metadata.gz: f648e3d3e303081858371e1bbe2e164b76b68085
4
+ data.tar.gz: 5b55acfe7f9f5df46eea21b8d0b3867485950102
5
5
  SHA512:
6
- metadata.gz: 453e68d3381212f3e9ad20144d31ad8e0d1095547b66f703afaa33b9dba4c7cc9bb38add0c2f3737634100992cfd2da25097e5a2f402fb8eb376d95b4572eeb2
7
- data.tar.gz: 49a2e7af21d60ec7b24960948d71f803023116f0049f8e3072548778d60188b9bca367163398822c9c90861035d87e9c8c33a59474fa2dec0f650ab0d5aba90b
6
+ metadata.gz: c3d835fedd766bda7395275f8e936703ffa323f2a6f0dc3c5050e1a6c24304cdd718c827df43af2ef0afdfbfa6d45d49bf0ba61d9e963d12ea173fcccf8bfaba
7
+ data.tar.gz: 4db45918f3221758b818cecc57e008c299d1de98ce0ea766c1a67341e0f265baab4f1950d462c9dc4c4db9b7bdf04d129c45767f68a2624f5fbb1a7044ead5a9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ 0.3.5
2
+ -----
3
+
4
+ - `LetterAvatar::HasAvatar` helper module cleanup
5
+ - `LetterAvatar.path_to_url` helper method
6
+
1
7
  0.3.4
2
8
  -----
3
9
 
data/README.md CHANGED
@@ -102,6 +102,10 @@ Say, you have a model `User` (which must have attribute or method `name`)
102
102
  class User
103
103
  include LetterAvatar::HasAvatar
104
104
  ...
105
+
106
+ def name
107
+ 'ksz2k'
108
+ end
105
109
  end
106
110
  ```
107
111
 
@@ -113,9 +117,6 @@ Then, in your views you can use:
113
117
  # or
114
118
  @user.avatar_url(200)
115
119
  => "/system/letter_avatars/2/K/87_178_230/200.png"
116
- # or even
117
- @user.avatar_tag(200, class: 'av')
118
- => "<img class=\"av\" alt=\"ksz2k\" src=\"/system/letter_avatars/2/K/87_178_230/200.png\" />"
119
120
  ```
120
121
 
121
122
  ### Way to support non [a-z0-9] charsets
@@ -5,7 +5,7 @@ module LetterAvatar
5
5
  end
6
6
 
7
7
  def letter_avatar_url_for(avatar_path)
8
- avatar_path.to_s.sub('public/', '/')
8
+ LetterAvatar.path_to_url(avatar_path)
9
9
  end
10
10
 
11
11
  def letter_avatar_url(name, size = 64)
@@ -3,9 +3,6 @@ module LetterAvatar
3
3
  def self.included(base)
4
4
  base.send :include, InstanceMethods
5
5
  base.extend ClassMethods
6
- base.class_eval do
7
- include LetterAvatar::AvatarHelper
8
- end
9
6
  end
10
7
 
11
8
  module ClassMethods
@@ -17,17 +14,13 @@ module LetterAvatar
17
14
  end
18
15
 
19
16
  def avatar_path(size = 64)
20
- letter_avatar_for(name, size)
17
+ LetterAvatar.generate(name, size)
21
18
  end
22
19
 
23
20
  def avatar_url(size = 64)
24
- letter_avatar_url(name, size)
21
+ LetterAvatar.path_to_url(avatar_path(size))
25
22
  end
26
23
 
27
- def avatar_tag(size = 64, options = {})
28
- letter_avatar_tag(name, size, options)
29
- end
30
-
31
24
  end
32
25
  end
33
26
  end
@@ -1,3 +1,3 @@
1
1
  module LetterAvatar
2
- VERSION = '0.3.4'
2
+ VERSION = '0.3.5'
3
3
  end
data/lib/letter_avatar.rb CHANGED
@@ -52,4 +52,8 @@ module LetterAvatar
52
52
 
53
53
  true
54
54
  end
55
+
56
+ def self.path_to_url(path)
57
+ path.to_s.sub('public/', '/')
58
+ end
55
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letter_avatar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Discourse Developers